diff --git a/nonlinearbaseline.tex b/nonlinearbaseline.tex index cb172e8..6af5e2c 100644 --- a/nonlinearbaseline.tex +++ b/nonlinearbaseline.tex @@ -501,7 +501,7 @@ When stimulating with both foreign signals simultaneously, additional peaks appe \begin{figure*}[p] \includegraphics[width=\columnwidth]{regimes} - \caption{\label{fig:regimes} Linear and nonlinear responses of a model P-unit in a three-fish setting in dependence on stimulus amplitudes. The model P-unit (identifier ``2018-05-08-ad'') was stimulated with two sine waves of equal amplitude (contrast) at difference frequencies $\Delta f_1=40$\,Hz and $\Delta f_2=228$\,Hz relative the receiver's EOD frequency. $\Delta f_2$ was set to match the baseline firing rate $r$ of the P-unit. \figitem{A--D} Top: the stimulus, an amplitude modulation of the receiver's EOD resulting from the stimulation with the two sine waves. The contrasts of both beats increase from \panel{A} to \panel{D} as indicated. Middle: Spike raster of the model P-unit response. Bottom: power spectrum of the firing rate estimated from the spike raster. \figitem{A} At low stimulus contrasts the response is linear. The only peaks in the response spectrum are at the two stimulating beat frequencies (green and purple marker), the latter enhancing the peak at baseline firig rate (blue). The largest peak, however, is always the one atthe EOD frequency of the receiver (black). Here also flanked by harmonics of $\Delta f_1$ (small black markers). \figitem{B} At moderately higher stimulus contrast, the peaks in the response spectrum at the two beat frequencies become larger. In addition, a peak at $f_{EOD} - \Delta f_2 $ appears. \figitem{C} At intermediate stimulus contrasts, nonlinear responses start to appear at the sum and the difference of the stimulus frequencies (orange and red). Additional peaks appear at harmonics of $\Delta f_1$ (small green markers) and at $f_{EOD} \Delta f_2 \pm \Delta f_1$ (small purple marker). \figitem{D} At higher stimulus contrasts further peaks appear in the power spectrum. \figitem{E} Amplitude of the linear (at $\Delta f_1$ and $\Delta f_2$) and nonlinear (at $\Delta f_2 - \Delta f_1$ and $\Delta f_1 + \Delta f_2$) responses of the model P-unit as a function of beat contrast (thick lines). Thin lines indicate the initial linear and quadratic dependence on stimulus amplitude for the linear and nonlinear responses, respectively. In the linear regime, below a stimulus contrast of about 1.2\,\% (left vertical line), the only peaks in the response spectrum are at the stimulus frequencies. In the weakly nonlinear regime up to a contrast of about 3.5\,\% peaks arise at the sum and the difference of the two stimulus frequencies. At stronger stimulation the amplitudes of these nonlinear responses deviate from the quadratic dependency on stimulus contrast.} + \caption{\label{fig:regimes} Linear and nonlinear responses of a model P-unit in a three-fish setting in dependence on stimulus amplitudes. The model P-unit (identifier ``2018-05-08-ad'') was stimulated with two sine waves of equal amplitude (contrast) at difference frequencies $\Delta f_1=40$\,Hz and $\Delta f_2=228$\,Hz relative the receiver's EOD frequency. $\Delta f_2$ was set to match the baseline firing rate $r$ of the P-unit. \figitem{A--D} Top: the stimulus, an amplitude modulation of the receiver's EOD resulting from the stimulation with the two sine waves. The contrasts of both beats increase from \panel{A} to \panel{D} as indicated. Middle: Spike raster of the model P-unit response. Bottom: power spectrum of the firing rate estimated from the spike raster. \figitem{A} At low stimulus contrasts the response is linear. The only peaks in the response spectrum are at the two stimulating beat frequencies (green and purple marker), the latter enhancing the peak at baseline firig rate (blue). The largest peak, however, is always the one atthe EOD frequency of the receiver (black), reflecting the locking of P-unit spikes to the own EOD. The peak at $f_{EOD}$ is also flanked by harmonics of $\Delta f_1$ (small black markers). \figitem{B} At moderately higher stimulus contrast, the peaks in the response spectrum at the two beat frequencies become larger. In addition, a peak at $f_{EOD} - \Delta f_2 $ appears. \figitem{C} At intermediate stimulus contrasts, nonlinear responses start to appear at the sum and the difference of the stimulus frequencies (orange and red). Additional peaks appear at harmonics of $\Delta f_1$ (small green markers) and at $f_{EOD} \Delta f_2 \pm \Delta f_1$ (small purple marker). \figitem{D} At higher stimulus contrasts further peaks appear in the power spectrum. \figitem{E} Amplitude of the linear (at $\Delta f_1$ and $\Delta f_2$) and nonlinear (at $\Delta f_2 - \Delta f_1$ and $\Delta f_1 + \Delta f_2$) responses of the model P-unit as a function of beat contrast (thick lines). Thin lines indicate the initial linear and quadratic dependence on stimulus amplitude for the linear and nonlinear responses, respectively. In the linear regime, below a stimulus contrast of about 1.2\,\% (left vertical line), the only peaks in the response spectrum are at the stimulus frequencies. In the weakly nonlinear regime up to a contrast of about 3.5\,\% peaks arise at the sum and the difference of the two stimulus frequencies. At stronger stimulation the amplitudes of these nonlinear responses deviate from the quadratic dependency on stimulus contrast.} \end{figure*} The stimuli used in \figref{fig:motivation} had the same not-small amplitude. Whether this stimulus condition falls into the weakly nonlinear regime as in \citet{Voronenko2017} is not clear. In order to illustrate how the responses to two beat frequencies develop over a range of amplitudes we use a stochastic leaky-integrate-and-fire (LIF) based P-unit model fitted to a specific electrophysiologically measured cell \citep{Barayeu2023}. diff --git a/plotstyle.py b/plotstyle.py index 94f0c7e..905c408 100644 --- a/plotstyle.py +++ b/plotstyle.py @@ -154,11 +154,11 @@ def plot_style(): ns.psF02 = dict(color=palette['purple'], marker='o', linestyle='none', markersize=4, mec='none', mew=0) ns.psF012 = dict(color=palette['orange'], marker='o', linestyle='none', markersize=4, mec='none', mew=0) ns.psF01_2 = dict(color=palette['red'], marker='o', linestyle='none', markersize=4, mec='none', mew=0) - ns.psFEODm = dict(color=palette['black'], marker='o', linestyle='none', markersize=3, mec='none', mew=0) - ns.psF0m = dict(color=palette['blue'], marker='o', linestyle='none', markersize=3, mec='none', mew=0) - ns.psF01m = dict(color=palette['green'], marker='o', linestyle='none', markersize=3, mec='none', mew=0) - ns.psF02m = dict(color=palette['purple'], marker='o', linestyle='none', markersize=3, mec='none', mew=0) - ns.psF012m = dict(color=palette['orange'], marker='o', linestyle='none', markersize=3, mec='none', mew=0) + ns.psFEODm = dict(color=lighter(palette['black'], 0.5), marker='^', linestyle='none', markersize=3, mec='none', mew=0) + ns.psF0m = dict(color=lighter(palette['blue'], 0.6), marker='D', linestyle='none', markersize=2.5, mec='none', mew=0) + ns.psF01m = dict(color=lighter(palette['green'], 0.6), marker='o', linestyle='none', markersize=3, mec='none', mew=0) + ns.psF02m = dict(color=lighter(palette['purple'], 0.6), marker='s', linestyle='none', markersize=2.4, mec='none', mew=0) + ns.psF012m = dict(color=lighter(palette['orange'], 0.6), marker='p', linestyle='none', markersize=3, mec='none', mew=0) ns.psF01_2m = dict(color=palette['red'], marker='o', linestyle='none', markersize=3, mec='none', mew=0) ns.model_color1 = palette['purple'] diff --git a/regimes.py b/regimes.py index dde1e1f..0ffd068 100644 --- a/regimes.py +++ b/regimes.py @@ -189,6 +189,9 @@ def plot_psd(ax, s, path, contrast, spikes, nfft, dt, beatf1, beatf2, eodf): freqs, psd = compute_power(path, contrast, spikes, nfft, dt) psd /= freqs[1] ax.plot(freqs, decibel(psd), **s.lsPower) + # mark frequencies: + ax.plot(eodf, decibel(peak_ampl(freqs, psd, eodf)) + offs, + label=r'$f_{EOD}$', clip_on=False, **s.psFEOD) ax.plot(beatf2, decibel(peak_ampl(freqs, psd, beatf2)) + offs, label=r'$r$', clip_on=False, **s.psF0) ax.plot(beatf1, decibel(peak_ampl(freqs, psd, beatf1)) + offs, @@ -199,22 +202,32 @@ def plot_psd(ax, s, path, contrast, spikes, nfft, dt, beatf1, beatf2, eodf): label=r'$\Delta f_2 - \Delta f_1$', clip_on=False, **s.psF01_2) ax.plot(beatf1 + beatf2, decibel(peak_ampl(freqs, psd, beatf1 + beatf2)) + offs, label=r'$\Delta f_1 + \Delta f_2$', clip_on=False, **s.psF012) - ax.plot(eodf, decibel(peak_ampl(freqs, psd, eodf)) + offs, - label=r'$f_{EOD}$', clip_on=False, **s.psFEOD) - ax.plot(eodf + beatf1, decibel(peak_ampl(freqs, psd, eodf + beatf1)) + offsm, label=r'$f_{EOD} \pm k \Delta f_1$', **s.psFEODm) + ax.plot(eodf + beatf1, decibel(peak_ampl(freqs, psd, eodf + beatf1)) + offsm, + label=r'$f_{EOD} \pm k \Delta f_1$', **s.psFEODm) ax.plot(eodf - beatf1, decibel(peak_ampl(freqs, psd, eodf - beatf1)) + offsm, **s.psFEODm) - if contrast > 0.02: - ax.plot(2*beatf1, decibel(peak_ampl(freqs, psd, 2*beatf1)) + offsm, label=r'$k\Delta f_1$', **s.psF01m) - ax.plot(eodf + 2*beatf1, decibel(peak_ampl(freqs, psd, eodf + 2*beatf1)) + offsm, **s.psFEODm) if contrast > 0.008: - ax.plot(eodf - beatf2, decibel(peak_ampl(freqs, psd, eodf - beatf2)) + offsm, label=r'$f_{EOD} - \Delta f_2$', **s.psF0m) + ax.plot(eodf - beatf2, decibel(peak_ampl(freqs, psd, eodf - beatf2)) + offsm, + label=r'$f_{EOD} - k \Delta f_2$', **s.psF0m) if contrast > 0.02: - ax.plot(eodf - beatf2 + beatf1, decibel(peak_ampl(freqs, psd, eodf - beatf2 + beatf1)) + offsm, label=r'$f_{EOD} - \Delta f_2 \pm \Delta f_1$', **s.psF02m) + ax.plot(2*beatf1, decibel(peak_ampl(freqs, psd, 2*beatf1)) + offsm, + label=r'$k\Delta f_1$', **s.psF01m) + ax.plot(eodf + 2*beatf1, decibel(peak_ampl(freqs, psd, eodf + 2*beatf1)) + offsm, **s.psFEODm) + ax.plot(eodf - beatf2 + beatf1, decibel(peak_ampl(freqs, psd, eodf - beatf2 + beatf1)) + offsm, + label=r'$f_{EOD} - \Delta f_2 \pm k\Delta f_1$', **s.psF02m) ax.plot(eodf - beatf2 - beatf1, decibel(peak_ampl(freqs, psd, eodf - beatf2 - beatf1)) + offsm, **s.psF02m) if contrast > 0.05: + ax.plot(beatf2 + 2*beatf1, decibel(peak_ampl(freqs, psd, beatf2 + 2*beatf1)) + offsm, + label=r'$\Delta f_2 + k\Delta f_1$', **s.psF012m) + ax.plot(beatf2 + 3*beatf1, decibel(peak_ampl(freqs, psd, beatf2 + 3*beatf1)) + offsm, **s.psF012m) ax.plot(3*beatf1, decibel(peak_ampl(freqs, psd, 3*beatf1)) + offsm, **s.psF01m) ax.plot(4*beatf1, decibel(peak_ampl(freqs, psd, 4*beatf1)) + offsm, **s.psF01m) ax.plot(eodf - 2*beatf1, decibel(peak_ampl(freqs, psd, eodf - 2*beatf1)) + offsm, **s.psFEODm) + ax.plot(eodf - 3*beatf1, decibel(peak_ampl(freqs, psd, eodf - 3*beatf1)) + offsm, **s.psFEODm) + ax.plot(eodf - 2*beatf2, decibel(peak_ampl(freqs, psd, eodf - 2*beatf2)) + offsm, **s.psF0m) + ax.plot(eodf - beatf2 + 2*beatf1, decibel(peak_ampl(freqs, psd, eodf - beatf2 + 2*beatf1)) + offsm, + **s.psF02m) + ax.plot(eodf - beatf2 + 3*beatf1, decibel(peak_ampl(freqs, psd, eodf - beatf2 + 2*beatf1)) + offsm, + **s.psF02m) ax.set_xlim(0, 750) ax.set_ylim(-60, 0) ax.set_xticks_delta(200) @@ -335,8 +348,8 @@ if __name__ == '__main__': plot_example(axe[0, c], axe[1, c], axe[2, c], s, path, cell, alpha, beatf1, beatf2, eodf, nfft, 100) axe[1, 0].xscalebar(1, -0.1, 20, 'ms', ha='right') - axe[2, 3].legend(loc='center right', bbox_to_anchor=(1, -0.8), - ncol=10, columnspacing=1, handletextpad=0.1) + axe[2, 3].legend(loc='center right', bbox_to_anchor=(1.05, -0.8), + ncol=11, columnspacing=0.6, handletextpad=0) fig.common_yspines(axe[0, :]) fig.common_yticks(axe[2, :]) fig.tag(axe[0, :], xoffs=-3, yoffs=1.6)