% Template for PLoS
% Version 3.6 Aug 2022
%
% % % % % % % % % % % % % % % % % % % % % %
%
% -- IMPORTANT NOTE
%
% This template contains comments intended 
% to minimize problems and delays during our production 
% process. Please follow the template instructions
% whenever possible.
%
% % % % % % % % % % % % % % % % % % % % % % % 
%
% Once your paper is accepted for publication, 
% PLEASE REMOVE ALL TRACKED CHANGES in this file 
% and leave only the final text of your manuscript. 
% PLOS recommends the use of latexdiff to track changes during review, as this will help to maintain a clean tex file.
% Visit https://www.ctan.org/pkg/latexdiff?lang=en for info or contact us at latex@plos.org.
%
%
% There are no restrictions on package use within the LaTeX files except that no packages listed in the template may be deleted.
%
% Please do not include colors or graphics in the text.
%
% The manuscript LaTeX source should be contained within a single file (do not use \input, \externaldocument, or similar commands).
%
% % % % % % % % % % % % % % % % % % % % % % %
%
% -- FIGURES AND TABLES
%
% Please include tables/figure captions directly after the paragraph where they are first cited in the text.
%
% DO NOT INCLUDE GRAPHICS IN YOUR MANUSCRIPT
% - Figures should be uploaded separately from your manuscript file. 
% - Figures generated using LaTeX should be extracted and removed from the PDF before submission. 
% - Figures containing multiple panels/subfigures must be combined into one image file before submission.
% For figure citations, please use "Fig" instead of "Figure".
% See http://journals.plos.org/plosone/s/figures for PLOS figure guidelines.
%
% Tables should be cell-based and may not contain:
% - spacing/line breaks within cells to alter layout or alignment
% - do not nest tabular environments (no tabular environments within tabular environments)
% - no graphics or colored text (cell background color/shading OK)
% See http://journals.plos.org/plosone/s/tables for table guidelines.
%
% For tables that exceed the width of the text column, use the adjustwidth environment as illustrated in the example table in text below.
%
% % % % % % % % % % % % % % % % % % % % % % % %
%
% -- EQUATIONS, MATH SYMBOLS, SUBSCRIPTS, AND SUPERSCRIPTS
%
% IMPORTANT
% Below are a few tips to help format your equations and other special characters according to our specifications. For more tips to help reduce the possibility of formatting errors during conversion, please see our LaTeX guidelines at http://journals.plos.org/plosone/s/latex
%
% For inline equations, please be sure to include all portions of an equation in the math environment.  For example, x$^2$ is incorrect; this should be formatted as $x^2$ (or $\mathrm{x}^2$ if the romanized font is desired).
%
% Do not include text that is not math in the math environment. For example, CO2 should be written as CO\textsubscript{2} instead of CO$_2$.
%
% Please add line breaks to long display equations when possible in order to fit size of the column. 
%
% For inline equations, please do not include punctuation (commas, etc) within the math environment unless this is part of the equation.
%
% When adding superscript or subscripts outside of brackets/braces, please group using {}.  For example, change "[U(D,E,\gamma)]^2" to "{[U(D,E,\gamma)]}^2". 
%
% Do not use \cal for caligraphic font.  Instead, use \mathcal{}
%
% % % % % % % % % % % % % % % % % % % % % % % % 
%
% Please contact latex@plos.org with any questions.
%
% % % % % % % % % % % % % % % % % % % % % % % %
\documentclass[10pt,letterpaper]{article}
\usepackage[top=0.85in,left=2.75in,footskip=0.75in]{geometry}

% amsmath and amssymb packages, useful for mathematical formulas and symbols
\usepackage{amsmath,amssymb}

% Use adjustwidth environment to exceed column width (see example table in text)
\usepackage{changepage}

% textcomp package and marvosym package for additional characters
\usepackage{textcomp,marvosym}

% cite package, to clean up citations in the main text. Do not remove.
\usepackage{cite}

% Use nameref to cite supporting information files (see Supporting Information section for more info)
\usepackage{nameref}%,hyperref
\usepackage[breaklinks=true,colorlinks=true,citecolor=blue!30!black,urlcolor=blue!30!black,linkcolor=blue!30!black]{hyperref}

% \usepackage{natbib}%sort,comma,,round
% \setcitestyle{super,comma,sort&compress}%authoryear,

% line numbers
\usepackage[right]{lineno}

% ligatures disabled
\usepackage[nopatch=eqnum]{microtype}
\DisableLigatures[f]{encoding = *, family = * }

% color can be used to apply background shading to table cells only
\usepackage[table]{xcolor}


% array package and thick rules for tables
\usepackage{array}

% create "+" rule type for thick vertical lines
\newcolumntype{+}{!{\vrule width 2pt}}

% create \thickcline for thick horizontal lines of variable length
\newlength\savedwidth
\newcommand\thickcline[1]{%
  \noalign{\global\savedwidth\arrayrulewidth\global\arrayrulewidth 2pt}%
  \cline{#1}%
  \noalign{\vskip\arrayrulewidth}%
  \noalign{\global\arrayrulewidth\savedwidth}%
}

% \thickhline command for thick horizontal lines that span the table
\newcommand\thickhline{\noalign{\global\savedwidth\arrayrulewidth\global\arrayrulewidth 2pt}%
\hline
\noalign{\global\arrayrulewidth\savedwidth}}



% Remove comment for double spacing
%\usepackage{setspace} 
%\doublespacing

% Text layout
\raggedright
\setlength{\parindent}{0.5cm}
\textwidth 5.25in 
\textheight 8.75in

% Bold the 'Figure #' in the caption and separate it from the title/caption with a period
% Captions will be left justified
\usepackage[aboveskip=1pt,labelfont=bf,labelsep=period,justification=raggedright,singlelinecheck=off]{caption}
\renewcommand{\figurename}{Fig}

% Use the PLoS provided BiBTeX style
%\bibliographystyle{plos2015}
\bibliographystyle{apalike}%alpha}%}%alpha}%apalike}
% Remove brackets from numbering in List of References
\makeatletter
\renewcommand{\@biblabel}[1]{\quad#1.}
\makeatother

% Header and Footer with logo
\usepackage{lastpage,fancyhdr,graphicx}
\usepackage{epstopdf}
%\pagestyle{myheadings}
\pagestyle{fancy}
\fancyhf{}
%\setlength{\headheight}{27.023pt}
%\lhead{\includegraphics[width=2.0in]{PLOS-submission.eps}}
\rfoot{\thepage/\pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrule}{\hrule height 2pt \vspace{2mm}}
\fancyheadoffset[L]{2.25in}
\fancyfootoffset[L]{2.25in}
\lfoot{\today}

\usepackage{lipsum}
\usepackage[mediumspace,mediumqspace,Gray,amssymb]{SIunits}
\usepackage{ifthen}
%% BEGIN MACROS SECTION

%%%%% species names %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\Lepto}{\emph{Apteronotus leptorhynchus}}
\newcommand{\lepto}{\emph{A. leptorhynchus}}
\newcommand{\Eigen}{\emph{Eigenmannia virescens}}
\newcommand{\eigen}{\emph{E. virescens}}

%%%%% notes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\note}[2][]{\textbf{[#1: #2]}}
\newcommand{\noteab}[1]{\note[AB]{#1}}
\newcommand{\notejb}[1]{\note[JB]{#1}}
\newcommand{\notejg}[1]{\note[JG]{#1}}
\newcommand{\notems}[1]{\note[MS]{#1}}
\newcommand{\notebl}[1]{\note[BL]{#1}}

%%%%% equation references %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\eqref}[1]{(\ref{#1})}
\newcommand{\eref}[1]{\ref{#1}}
\newcommand{\eqn}{Eq}
\newcommand{\Eqn}{Eq}
\newcommand{\eqns}{Eqs}
\newcommand{\Eqns}{Eqs}
\newcommand{\Eqnref}[1]{\Eqn~\eqref{#1}}
\newcommand{\Eqnsref}[1]{\Eqns~\eqref{#1}}

%%%%% figures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% references to panels of a figure within the caption:
\newcommand{\figitem}[2][]{\ifthenelse{\equal{#1}{}}{\textsf{\bfseries #2}}{\textsf{\bfseries #2}}$_{\sf #1}$}
% references to panels of a figure within the text:
%\newcommand{\panel}[2][]{\textsf{#2}}
\newcommand{\panel}[2][]{\ifthenelse{\equal{#1}{}}{\textsf{#2}}{\textsf{#2}$_{\sf #1}$}}%\ifthenelse{\equal{#1}{}}{\textsf{#2}}{\textsf{#2}$_{\sf #1}$}
% references to figures:
\newcommand{\fref}[1]{\textup{\ref{#1}}}
\newcommand{\subfref}[2]{\textup{\ref{#1}}\,\panel{#2}}
% references to figures in normal text:
\newcommand{\fig}{Fig}
\newcommand{\Fig}{Figure}
\newcommand{\figs}{Figs}
\newcommand{\Figs}{Figures}
\newcommand{\figref}[1]{\fig~\fref{#1}}
\newcommand{\Figref}[1]{\Fig~\fref{#1}}
\newcommand{\figsref}[1]{\figs~\fref{#1}}
\newcommand{\Figsref}[1]{\Figs~\fref{#1}}
\newcommand{\subfigref}[2]{\fig~\subfref{#1}{#2}}
\newcommand{\Subfigref}[2]{\Fig~\subfref{#1}{#2}}
\newcommand{\subfigsref}[2]{\figs~\subfref{#1}{#2}}
\newcommand{\Subfigsref}[2]{\Figs~\subfref{#1}{#2}}
% references to figures within brackets:
\newcommand{\figb}{Fig}
\newcommand{\figsb}{Figs}
\newcommand{\figrefb}[1]{\figb~\fref{#1}}
\newcommand{\figsrefb}[1]{\figsb~\fref{#1}}
\newcommand{\subfigrefb}[2]{\figb~\subfref{#1}{#2}}
\newcommand{\subfigsrefb}[2]{\figsb~\subfref{#1}{#2}}

%%%%% changes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\remove}[2][]{%
  \protect\ifthenelse{\value{showtrackchanges}<2}%
    {\protect\ifthenelse{\value{showtrackchanges}=0}%
      {}% 0
      {\ifthenelse{\equal{#1}{}}{}{\textit{\textbf{[#1:]}} }\st{#2}}}% 1
    {\protect\ifthenelse{\value{showtrackchanges}=2}%
      {\protect\marginpar{\protect\rule[-0.3ex]{0.5mm}{2ex}}\ifthenelse{\equal{#1}{}}{}{\textit{\textbf{[#1:]}} }\st{#2}}% 2
      {\protect\marginpar{\small\textbf{deleted\ifthenelse{\equal{#1}{}}{}{ [#1]}:} #2}}}}% 3

\newcommand{\add}[2][]{%
  \protect\ifthenelse{\value{showtrackchanges}<2}%
    {\protect\ifthenelse{\value{showtrackchanges}=0}%
      {#2}% 0
      {\textcolor{red}{\ifthenelse{\equal{#1}{}}{}{\textit{[#1:]} }#2}}}% 1
    {\protect\ifthenelse{\value{showtrackchanges}=2}%
      {{\protect\marginpar{\protect\rule[-0.3ex]{0.5mm}{2ex}}\bfseries \ifthenelse{\equal{#1}{}}{}{\textit{[#1:]} }#2}}% 2
      {\protect\marginpar{\small\textbf{inserted\ifthenelse{\equal{#1}{}}{}{ [#1]}}}{\bfseries #2}}}}% 3

\newcommand{\change}[2][]{%
  \protect\ifthenelse{\value{showtrackchanges}<2}%
     {\protect\ifthenelse{\value{showtrackchanges}=0}%
      {#2}% 0
      {\textcolor{red}{\ifthenelse{\equal{#1}{}}{}{\textit{[#1:]} }#2}}}% 1
     {\protect\ifthenelse{\value{showtrackchanges}=2}%
      {\protect\marginpar{\protect\rule[-0.3ex]{0.5mm}{2ex}}{\bfseries \ifthenelse{\equal{#1}{}}{}{\textit{[#1:]} }#2}}% 2
      {\protect\marginpar{\small\textbf{changed\ifthenelse{\equal{#1}{}}{}{ [#1]}}}{\bfseries #2}}}}% 3

%%%%% new commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\fstim}{\ensuremath{f_{\rm{stim}}}}
\newcommand{\feod}{\ensuremath{f_{\rm{EOD}}}}
\newcommand{\feodsolid}{\ensuremath{f_{\rm{EOD}}}}
\newcommand{\feodhalf}{\ensuremath{f_{\rm{EOD}}/2}}
\newcommand{\fbase}{\ensuremath{f_{\rm{base}}}}
\newcommand{\fbasesolid}{\ensuremath{f_{\rm{base}}}}
\newcommand{\fstimintro}{\ensuremath{\rm{EOD}_{2}}}
\newcommand{\feodintro}{\ensuremath{\rm{EOD}_{1}}}
\newcommand{\ffstimintro}{\ensuremath{f_{2}}}
\newcommand{\ffeodintro}{\ensuremath{f_{1}}}

\newcommand{\carrierinput}{\ensuremath{y(t)}}


\newcommand{\baseval}{134}
\newcommand{\bone}{$\Delta f_{1}$}
\newcommand{\btwo}{$\Delta f_{2}$}
\newcommand{\fone}{$f_{1}$}
\newcommand{\ftwo}{$f_{2}$}
\newcommand{\ff}{$f_{1}$--$f_{2}$}
\newcommand{\auc}{\rm{AUC}}

\newcommand{\n}{\ensuremath{N}}
\newcommand{\bvary}{\ensuremath{\Delta f_{1}}}
\newcommand{\avary}{\ensuremath{A(\Delta f_{1})}}
\newcommand{\afvary}{\ensuremath{A(f_{1})}}
\newcommand{\avaryc}{\ensuremath{A(c_{1})}}
\newcommand{\cvary}{\ensuremath{c_{1}}}
\newcommand{\fvary}{\ensuremath{f_{1}}}

\newcommand{\bstable}{\ensuremath{\Delta f_{2}}}
\newcommand{\astable}{\ensuremath{A(\Delta f_{2})}}
\newcommand{\astablec}{\ensuremath{A(c_{2})}}
\newcommand{\cstable}{\ensuremath{c_{2}}}
\newcommand{\fstable}{\ensuremath{f_{2}}}

\newcommand{\aeod}{\ensuremath{A(f_{\rm{EOD}})}}
\newcommand{\fbasecorrsolid}{\ensuremath{f_{\rm{BaseCorrected}}}}
\newcommand{\fbasecorr}{\ensuremath{f_{\rm{BaseCorrected}}}}
\newcommand{\ffall}{$f_{\rm{EOD}}$\&$f_{1}$\&$f_{2}$}
\newcommand{\ffvary}{$f_{\rm{EOD}}$\&$f_{1}$}%sum 
\newcommand{\ffstable}{$f_{\rm{EOD}}$\&$f_{2}$}%sum 
\newcommand{\colstableone}{blue}%sum 
\newcommand{\colstabletwo}{cyan}%sum 
\newcommand{\colvaryone}{brown}%sum 
\newcommand{\colvarytwo}{red}%sum 
\newcommand{\colstableoneb}{Blue}%sum 
\newcommand{\colstabletwob}{Cyan}%sum 
\newcommand{\colvaryoneb}{Brown}%sum Brown 
\newcommand{\colvarytwob}{Red}%sum 
\newcommand{\resp}{$A(f)$}%sum %\Delta 
\newcommand{\respb}{$A(\Delta f)$}%sum %\Delta 

\newcommand{\rocf}{98}%sum %\Delta 
\newcommand{\roci}{36}%sum %\Delta 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Beat combinations
\newcommand{\boneabs}{\ensuremath{|\Delta f_{1}|}}%sum 
\newcommand{\btwoabs}{\ensuremath{|\Delta f_{2}|}}%sum 
\newcommand{\bsum}{\ensuremath{|\boneabs{} + \btwoabs{}|}}%sum 
\newcommand{\bdiff}{\ensuremath{|\boneabs{} - \btwoabs{}|}}%diff of both beat frequencies


\newcommand{\signalnoise}{$s_\xi(t)$}%su\right m 

\newcommand{\bsumb}{$\bsum{}=\fbase{}$}%su\right m 
\newcommand{\btwob}{$\Delta f_{2}=\fbase{}$}%sum 
\newcommand{\boneb}{$\Delta f_{1}=\fbase{}$}%sum 
\newcommand{\bsumbtwo}{$\bsum{}=2 \fbase{}$}%sum 
\newcommand{\bsumbc}{$\bsum{}=\fbasecorr{}$}%sum 
\newcommand{\bsume}{$\bsum{}=\feod{}$}%sum 
\newcommand{\bsumehalf}{$\bsum{}=\feod{}/2$}%sum 
\newcommand{\bdiffb}{$\bdiff{}=\fbase{}$}%diff of both beat frequencies
\newcommand{\bdiffbc}{$\bdiff{}=\fbasecorr{}$}%diff of both beat frequencies
\newcommand{\bdiffe}{$\bdiff{}=\feod{}$}%diff of both 
\newcommand{\bdiffehalf}{$\bdiff{}=\feod{}/2$}%diff of both
%beat frequencies

%%%%% tables %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% references to tables:
\newcommand{\tref}[1]{\textup{\ref{#1}}}
% references to tables in normal text:
\newcommand{\tab}{Tab.}
\newcommand{\Tab}{Table}
\newcommand{\tabs}{Tabs.}
\newcommand{\Tabs}{Tables}
\newcommand{\tabref}[1]{\tab~\tref{#1}}
\newcommand{\Tabref}[1]{\Tab~\tref{#1}}
\newcommand{\tabsref}[1]{\tabs~\tref{#1}}
\newcommand{\Tabsref}[1]{\Tabs~\tref{#1}}
% references to tables within the bracketed text:
\newcommand{\tabb}{Tab.}
\newcommand{\tabsb}{Tab.}
\newcommand{\tabrefb}[1]{\tabb~\tref{#1}}
\newcommand{\tabsrefb}[1]{\tabsb~\tref{#1}}

%%%%%%%%%%%%%%%%%%%%%%% Frequency combinations
\newcommand{\fsum}{\ensuremath{f_{1} + f_{2}}}%sum 
\newcommand{\fdiff}{\ensuremath{|f_{1}-f_{2}|}}%diff of

\newcommand{\fsumb}{$\fsum=\fbase{}$}%su\right m 
\newcommand{\ftwob}{$f_{2}=\fbase{}$}%sum 
\newcommand{\foneb}{$f_{1}=\fbase{}$}%sum 
\newcommand{\ftwobc}{$f_{2}=\fbasecorr{}$}%sum 
\newcommand{\fonebc}{$f_{1}=\fbasecorr{}$}%sum 
\newcommand{\fsumbtwo}{$\fsum{}=2 \fbase{}$}%sum 
\newcommand{\fsumbc}{$\fsum{}=\fbasecorr{}$}%sum 
\newcommand{\fsume}{$\fsum{}=\feod{}$}%sum 
\newcommand{\fsumehalf}{$\fsum{}=\feod{}/2$}%sum 
\newcommand{\fdiffb}{$\fdiff{}=\fbase{}$}%diff of both beat frequencies
\newcommand{\fdiffbc}{$\fdiff{}=\fbasecorr{}$}%diff of both beat frequencies
\newcommand{\fdiffe}{$\fdiff{}=\feod{}$}%diff of both 
\newcommand{\fdiffehalf}{$\fdiff{}=\feod{}/2$}%diff of both

\newcommand{\fctwo}{\ensuremath{f_{\rm{Female}}}}%sum 
\newcommand{\fcone}{\ensuremath{f_{\rm{Intruder}}}}%sum 
\newcommand{\bctwo}{\ensuremath{\Delta \fctwo{}}}%sum 
\newcommand{\bcone}{\ensuremath{\Delta \fcone{}}}%sum 
\newcommand{\bcsum}{\ensuremath{|\bctwo{}| + |\bcone{}|}}%sum 
\newcommand{\abcsumabbr}{\ensuremath{A(\Delta f_{\rm{Sum}})}}%sum 
\newcommand{\abcsum}{\ensuremath{A(\bcsum{})}}%sum 

\newcommand{\abcone}{\ensuremath{A(\bcone{})}}%sum 

\newcommand{\bctwoshort}{\ensuremath{\Delta f_{F}}}%sum 
\newcommand{\bconeshort}{\ensuremath{\Delta f_{I}}}%sum 
\newcommand{\bcsumshort}{\ensuremath{|\bctwoshort{} + \bconeshort{}|}}%sum 
\newcommand{\abcsumshort}{\ensuremath{A(\bcsumshort{})}}%sum 
\newcommand{\abconeshort}{\ensuremath{A(|\bconeshort{}|)}}%sum 

\newcommand{\abcsumb}{\ensuremath{A(\bcsum{})=\fbasesolid{}}}%sum 
\newcommand{\bcdiff}{\ensuremath{||\bctwo{}| - |\bcone{}||}}%diff of both beat frequencies

\newcommand{\bcsumb}{\ensuremath{\bcsum{} =\fbasesolid{}}}%su\right m 
\newcommand{\bcsumbn}{\ensuremath{\bcsum{} \neq \fbasesolid{}}}%su\right m 
\newcommand{\bctwob}{\ensuremath{\bctwo{} =\fbasesolid{}}}%sum 
\newcommand{\bconeb}{\ensuremath{\bcone{} =\fbasesolid{}}}%sum 
\newcommand{\bcsumbtwo}{\ensuremath{\bcsum{}=2 \fbasesolid{}}}%sum 
\newcommand{\bcsumbc}{\ensuremath{\bcsum{}=\fbasecorr{}}}%sum 
\newcommand{\bcsume}{\ensuremath{\bcsum{}=f_{\rm{EOD}}}}%sum 
\newcommand{\bcsumehalf}{\ensuremath{\bcsum{}=f_{\rm{EOD}}/2}}%sum 

\newcommand{\bcdiffb}{\ensuremath{\bcdiff{}=\fbasesolid{}}}%diff of both beat frequencies
\newcommand{\bcdiffbc}{\ensuremath{\bcdiff{}=\fbasecorr{}}}%diff of both beat frequencies
\newcommand{\bcdiffe}{\ensuremath{\bcdif{}f=f_{\rm{EOD}}}}%diff of both 
\newcommand{\bcdiffehalf}{\ensuremath{\bcdiff{}=f_{\rm{EOD}}/2}}%diff of both

\newcommand{\burstcorr}{\ensuremath{{Corrected}}}
\newcommand{\cvbasecorr}{CV\ensuremath{_{BaseCorrected}}}
\newcommand{\cv}{CV\ensuremath{_{Base}}}%\cvbasecorr{}
\newcommand{\nli}{PNL\ensuremath{(\fbase{})}}%Fr$_{Burst}$
\newcommand{\nlicorr}{PNL\ensuremath{(\fbasecorr{}})}%Fr$_{Burst}$
\newcommand{\suscept}{$|\chi_{2}|$}
\newcommand{\frcolor}{pink lines}

\newcommand{\rec}{\ensuremath{\rm{R}}}%{\ensuremath{con_{R}}}
\newcommand{\rif}{\ensuremath{\rm{RIF}}}
\newcommand{\ri}{\ensuremath{\rm{RI}}}%sum 
\newcommand{\rf}{\ensuremath{\rm{RF}}}%sum 
\newcommand{\withfemale}{\rm{ROC}\ensuremath{\rm{_{Female}}}}%sum \textit{
\newcommand{\wofemale}{\rm{ROC}\ensuremath{\rm{_{NoFemale}}}}%sum 
\newcommand{\dwithfemale}{\rm{\ensuremath{\auc_{Female}}}}%sum CV\ensuremath{_{BaseCorrected}}
\newcommand{\dwofemale}{\rm{\ensuremath{\auc_{NoFemale}}}}%sum 
\newcommand{\fp}{\ensuremath{\rm{FP}}}%sum 
\newcommand{\cd}{\ensuremath{\rm{CD}}}%sum 

%% END MACROS SECTION

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\vspace*{0.2in}
% Title must be 250 characters or less.
\begin{flushleft}
  {\Large
  \textbf\newline{Second-order susceptibility in electrosensory primary afferents in a three-fish setting}
  }
  \newline
  % Insert author names, affiliations and corresponding author email (do not include titles, positions, or degrees).
  \\
  Alexandra Barayeu\textsuperscript{1},
  Maria Schlungbaum\textsuperscript{2,3},
  Benjamin Lindner\textsuperscript{2,3},
  Jan Benda\textsuperscript{1, 4}
  Jan Grewe\textsuperscript{1, *}
  \\
  \bigskip
  \textbf{1} Institute for Neurobiology, Eberhard Karls Universit\"at T\"ubingen, 72076 T\"ubingen, Germany\\
  \textbf{2} Bernstein Center for Computational Neuroscience Berlin, Berlin, Germany\\
  \textbf{3} Department of Physics, Humboldt University Berlin, Berlin, Germany\\
  \textbf{4} Bernstein Center for Computational Neuroscience Tübingen, Tübingen, 72076, Germany\\
  \bigskip
  
  % Insert additional author notes using the symbols described below. Insert symbol callouts after author names as necessary.
  % 
  % Remove or comment out the author notes below if they aren't used.
  %
  \paragraph{Short title:} 
  \paragraph{Corresponding author:}Jan Grewe, E-mail: jan.grewe@uni-tuebingen.de
  \paragraph{Conflict of interest:}The authors declare no conflict of interest.
  \paragraph{Author Contributions:} All authors designed the study and discussed the results. AB performed the data analyses and modelling, AB and JG drafted the paper, all authors discussed and revised the manuscript.
  
  \paragraph{Keywords:} population coding $|$ conduction delay $|$ heterogeneity $|$ electric fish $|$ mutual information
  
  % Additional Equal Contribution Note
  % Also use this double-dagger symbol for special authorship notes, such as senior authorship.
  % \ddag These authors also contributed equally to this work.
  
  % Current address notes
  % \textcurrency Current Address: Dept/Program/Center, Institution Name, City, State, Country % change symbol to "\textcurrency a" if more than one current address note
  % \textcurrency b Insert second current address 
  % \textcurrency c Insert third current address
  
  % Deceased author note
  % \dag Deceased
  
  % Group/Consortium Author Note
  % \textpilcrow Membership list can be found in the Acknowledgments section.
  
  % Use the asterisk to denote corresponding authorship and provide email address in note below.
  * jan.grewe@uni-tuebingen.de
  
  \end{flushleft}
  % Please keep the abstract below 300 words
  \section*{Abstract}  
  \lipsum[1-1]
  % Please keep the Author Summary between 150 and 200 words
  % Use first person. PLOS ONE authors please skip this step. 
  % Author Summary not valid for PLOS ONE submissions.   
  \section*{Author summary}
  \lipsum[1-1]
  \linenumbers

%Nonlinearities contribute to the encoding of the full behaviorally relevant signal range in primary electrosensory afferents.

%Nonlinear effects identified as mechanisms that contribute 
%Nonlinearities in primary electrosensory afferents, the P-units, of \textit{Apteronotus leptorhynchus} enables the encoding of a wide dynamic range of behavioral-relevant beat frequencies and amplitudes

%Nonlinearities in primary electrosensory afferents contribute to the representation of a wide range of beat frequencies and amplitudes

%Nonlinearities contribute to the encoding of a wide range of beat frequencies and amplitudes in primary electrosensory afferents

%The role of nonlinearities in the encoding of a wide range of beat frequencies and amplitudes in primary electrosensory afferents

%Nonlinearities facilitate the encoding of a wide range of beat frequencies and amplitudes in primary electrosensory afferents



%\begin{abstract}
%In this work, the influence of nonlinearities on stimulus encoding in the primary sensory afferents of weakly electric fish of the species \lepto{} was investigated. These fish produce an electric organ discharge (EOD) with a fish-specific frequency. When the EOD of one fish interferes with the EOD of another fish, it results in a signal with a periodic amplitude modulation, called beat. The beat provides information about the sex and size of the encountered conspecific and is the basis for communication. The beat frequency is predicted as the difference between the EOD frequencies and the beat amplitude corresponds to the size of the smaller EOD field. Primary sensory afferents, the P-units, phase-lock to the EOD and encode beats with changes in their firing rate. In this work, the nonlinearities of primary electrosensory afferents, the P-units of weakly electric fish of the species \lepto{} and \eigen{} were addressed. Nonlinearities were characterized as the second-order susceptibility of P-units, in a setting where at least three fish were present. The nonlinear responses of P-units were especially strong in regular firing P-units. White noise stimulation was confirmed as a method to retrieve the socond-order suscepitbility in P-units.% with bursting being identified as a factor enhancing nonlinear interactions. 
%\end{abstract}

%\end{frontmatter}



\section*{Introduction}
%with nonlinearities being observed in all sensory modalities

Nonlinear processes are fundamental in neuronal information processing. On the systemic level: deciding to take one or another action is a nonlinear process. On a finer scale, neurons are inherently nonlinear: whether an action potential is elicited depends on the membrane potential to exceed a certain threshold\cite{Brincat2004, Chacron2000, Chacron2001, Nelson1997, Gussin2007, Middleton2007, Longtin2008}. In conjunction with neuronal noise, nonlinear mechanism facilitate the encoding of weak stimuli via stochastic resonance\cite{Wiesenfeld1995, Stocks2000,Neiman2011fish}. We can find nonlinearities in many sensory systems such as rectification in the transduction machinery of inner hair cells \cite{Peterson2019}, signal rectification in electroreceptor cells \cite{Chacron2000, Chacron2001}, or in complex cells of the visual system \cite{Adelson1985}. In the auditory or the active electric sense, for example, nonlinear processes are needed to extract envelopes, i.e. amplitude modulations of a carrier signal\cite{Joris2004, Barayeu2023} called beats. Beats are common stimuli in different sensory modalities enabling rhythm and pitch perception in human hearing \cite{Roeber1834, Plomp1967, Joris2004, Grahn2012} and providing context for electrocommunication in weakly electric fish \cite{Engler2001, Hupe2008, Henninger2018, Benda2020}.%Adelson1985, 

While the sensory periphery can often be well described by linear models, this is not true for many upstream neurons. Rather, nonlinear processes are implemented to extract special stimulus features\cite{Gabbiani1996}. In active electrosensation, the self-generated electric field (electric organ discharge, EOD)\cite{Salazar2013} that is quasi sinusoidal in wavetype electric fish acts as the carrier signal that is amplitude modulated in the context of communication\cite{Benda2013, Fotowat2013, Walz2014, Henninger2018} as well as object detection and navigation\cite{Fotowat2013, Nelson1999}. In social contexts, the interference of the EODs of two interacting animals result in a characteristic periodic amplitude modulation, the so-called beat. The beat amplitude is defined by the smaller EOD amplitude, its frequency is defined as the difference between the two EOD frequencies ($\Delta f = f-\feod{}$, valid for $f < \feod{}/2$)\cite{Barayeu2023}. Cutaneous electroreceptor organs that are distributed over the bodies of these fish \cite{Carr1982} are tuned to the own field\cite{Hopkins1976,Viancour1979}. Probability-type electroreceptor afferents (P-units) innervate these organs via ribbon synapses\cite{Szabo1965, Wachtel1966} and project to the hindbrain where they trifurcate and synapse onto pyramidal cells in the electrosensory lateral line lobe (ELL)\cite{Krahe2014}. The P-units of the gymnotiform electric fish \lepto{} encode such amplitude modulations (AMs) by modulation of their firing rate\cite{Gabbiani1996}. They fire probabilistically but phase-locked to the own EOD and the skipping of cycles leads to their characteristic multimodal interspike-interval distribution. Even though the extraction of the AM itself requires a nonlinearity\cite{Middleton2006,Stamper2012Envelope,Savard2011} encoding the time-course of the AM is linear over a wide range\cite{Xu1996,Benda2005,Gussin2007,Grewe2017,Savard2011}. In the context of social signalling among three fish we observe an AM of the AM, also referred to as second-order envelope or just social envelope\cite{Middleton2006, Savard2011, Stamper2012Envelope}. Encoding this again requires nonlinearities\cite{Middleton2006} and it was shown that a subpopulation of P-units are sensitive to envelopes\cite{Savard2011} and exhibit nonlinearities e.g. when driven by strong stimuli\cite{Nelson1997,Chacron2004}. 

\begin{figure*}[!ht]
  \includegraphics[width=\columnwidth]{motivation}
  \caption{\label{fig:motivation} Nonlinearity in an electrophysiologically recorded P-unit of \lepto{} in a three-fish setting. Receiver with EOD frequency $\feod{} =664$\,Hz encounters fish with EOD frequencies $f_{1}=631$\,Hz and $f_{2}=797$\,Hz. Both encountered fish lead to a beat contrast of 10\,\%. Top: Sheme of a nonlinear system. Second row: Interference of the receiver EOD with the EODs of other fish. Third row: Spike trains of the P-unit. Forth row: Firing rate, retrieved as the convolution of the spike trains with a Gaussian kernel ($\sigma = 1$\,ms). Bottom row: Power spectrum of the firing rate. \figitem{A} Baseline condition: Only the receiver is present. The baseline firing rate \fbase{} dominates the power spectrum of the firing rate. \figitem{B} The receiver and the fish with EOD frequency $f_{1}=631$\,Hz are present. \figitem{C} The receiver and the fish with EOD frequency $f_{2}=797$\,Hz are present. \figitem{D} All three fish with the EOD frequencies \feod{}, $f_{1}$ and $f_{2}$ are present. Nonlinear peaks occur at the sum and difference of the two beat frequencies in the power spectrum of the firing rate.
  }
\end{figure*}

Recent theoretical and modelling work on leaky integrate-and-fire (LIF) model neurons revealed specific pattern of nonlinear interactions when driven with weak sinewaves\cite{Voronenko2017}. This situation is reminiscent of the real fish's situation in which three electric fish interact. The active electrosensory system is then exposed to the two AMs arising from the interactions with either foreign fish's field. Previous recordings in the natural habitat showed interactions of three animals in which two animals interacted closely (strong signals) and were interrupted by an intruding animal (weak signal). The intruder was detected at spatial distances that led to an extremely faint intruder signal while the strong signal of the other animal is present\cite{Henninger2018}. When the receiver fish with EOD frequency \feod{} is alone, the P-unit fire action potentials as a baseline response $r_{0}$ at a spontaneous baseline rate \fbase{}. Accordingly, a peak at \fbase{} is present in the power spectrum of the neuronal response (\subfigrefb{fig:motivation}{A}, bottom). Phase-locking to the own field also leads to a representation of \feod{} in the P-unit firing rate (see \figref{fig:cells_suscept}\panel{B})\cite{Sinz2020}. The beat frequency when two fish interact is also represented in the respective responses and accordingly, there is a peak in power spectrum at $\Delta f_1$ or $\Delta f_2$ (\subfigrefb{fig:motivation}{B, C}, respectively). When three fish encounter, all their waveforms interfere with both beat frequencies being present in the superimposed signal (\subfigrefb{fig:motivation}{D}, second row). The power spectrum of the neuronal activity contains both previously seen beat peaks, but also nonlinear interaction peaks at the sum frequency \bsum{} and the difference frequency \bdiff{} (\subfigrefb{fig:motivation}{D}, bottom), thus the response of the system is not equal to the input (\subfigrefb{fig:motivation}{D}, top). The appearing difference peak is known as the social envelope\cite{Stamper2012Envelope, Savard2011}. The neuron shown here, clearly encodes the envelope. Whether P-units in general encode envelopes has been subject of controversy, some works do not consider P-units as envelope encoders\cite{Middleton2006}, while others identify some P-units as envelope encoders\cite{Savard2011}. 

The P-unit responses can be partially explained by simple linear filters. The linear relation of the cellular response and the stimulus can be captured by the first-order susceptibility (or transfer function). As in Volterra series, higher-order terms describe the nonlinear interactions. We quantify the nonlinearity of P-unit encoding by estimating the second-order susceptibility from white-noise responses\cite{Nikias1993,Neiman2011fish, Voronenko2017,Egerland2020}. We address whether the theory still holds for neurons that do not encode the foreign signals directly but respond to the AM of a carrier. For this study we re-use a large set of recordings of afferents of both the active (P-units) and the passive electrosensory (ampullary cells) to work out which cellular features determine which cells show nonlinear encoding. 



\section*{Results}
Theoretical work \cite{Voronenko2017} shows that stochastic leaky integrate-and-fire (LIF) model neurons may show nonlinear stimulus encoding when the model is driven by two cosine signals with specific frequencies. In the context of weakly electric fish, such a setting is part of the animal's everyday life. The sinusoidal electric-organ discharges (EODs) of neighboring animals interfere and lead to amplitude modulations (AMs) that are called beats (two-fish interaction) and envelopes (multiple-fish interaction) \cite{Middleton2006, Savard2011,Stamper2012Envelope}. The p-type electroreceptor afferents of the tuberous electrosensory system, i.e. the P-units encode such AMs of the underlying EOD carrier in  their time-dependent firing rates \cite{Bastian1981a,Walz2014}. We here explore the nonlinear mechanism in different cells that exhibit distinctly different levels of noise, i.e. differences in the coefficient of variation (CV) of the interspike intervals (ISI). Low-CV P-units have a less noisy firing pattern that is closer to pacemaker firing, whereas high-CV P-units show a more irregular firing pattern that is closer to a Poisson process.
%P-units are heterogeneous in their baseline firing properties \cite{Grewe2017, Hladnik2023} and differ with respect to their baseline firing rates, the sensitivity and their noisiness. 



\subsection*{Nonlinear signal transmission in low-CV P-units} %frequency combinations withappearing when the input frequencies are related to \fbase{} are

Second-order susceptibility is expected to be especially pronounced for low-CV cells \cite{Voronenko2017}. P-units fire action potentials probabilistically phase-locked to the self-generated EOD. Skipping of EOD cycles leads to the characteristic multimodal ISI distribution with maxima at integer multiples of the EOD period (\subfigrefb{fig:cells_suscept}{A}). In this example the ISI distribution has a CV of 0.2 which can be considered low among P-units\cite{Hladnik2023}. Spectral analysis of the baseline activity shows two major peaks, the first is located at the baseline firing rate (\fbase), the second is located at the discharge frequency of the electric organ (\feod{}) and is flanked by two smaller peaks at $\feod \pm \fbase{}$ (\subfigref{fig:cells_suscept}{B}).


\begin{figure*}[!ht]
\includegraphics[width=\columnwidth]{cells_suscept} 
\caption{\label{fig:cells_suscept} Estimation of linear and nonlinear stimulus encoding in a low-CV P-unit. Calculated based on the first frozen noise repeat. \figitem{A} Interspike interval (ISI) distribution of the cell's baseline activity, i.e. the cell is driven only by the unperturbed own field. The CV of the ISIs is a dimensionless measure quantifying the response regularity. Zero CV would indicate perfect regularity. \figitem{B} Power-spectrum of the baseline response. \figitem{C} Random amplitude modulation stimulus (top) and responses (spike raster in the lower traces) of the same P-unit. The stimulus contrast reflects the strength of the AM. \figitem{D} Transfer function (first-order susceptibility, \Eqnref{linearencoding_methods}) of the responses to 10\% (light purple) and 20\% contrast (dark purple) RAM stimulation. \figitem{E, F} Absolute value of the second-order susceptibility, \Eqnref{eq:susceptibility}, for the low, and high stimulus contrasts. Pink angles -- edges of the structure when \fone, \ftwo{} or \fsum{} are equal to \fbase{}. \figitem{G} Projected diagonals, calculated as the mean of the anti-diagonals of the matrices in \panel{E, F}. Gray dots mark \fbase{}. Horizontal dashed lines: medians of the projected diagonals.}
\end{figure*}

Noise stimuli, the random amplitude modulations (RAM, \subfigref{fig:cells_suscept}{C}, top trace, red line) of the EOD, are commonly used to characterize the stimulus driven responses of P-units by means of the transfer function (first-order susceptibility), the spike-triggered average, or the stimulus-response coherence. Here, we additionally estimate the second-order susceptibility to capture nonlinear encoding. Depending on the stimulus intensity which is given as the contrast, i.e. the amplitude of the noise stimulus in relation to the EOD amplitude (see methods), the spikes align more or less clearly to AMs of the stimulus (light and dark purple for low and high contrast stimuli, \subfigrefb{fig:cells_suscept}{C}). The linear encoding (see \Eqnref{linearencoding_methods}) is similar for the two RAM contrasts in this low-CV P-unit (\subfigrefb{fig:cells_suscept}{D}). First-order susceptibility is low for low frequencies, peaks in the range below 100\,Hz and then falls off again.

Theory predicts a pattern of nonlinear susceptibility for the interaction of two cosine stimuli when \fone{}, \ftwo{} or \fsum{} are equal to \fbase{} (pink triangle in \subfigsref{fig:cells_suscept}{E, F}). To estimate the second-order susceptibility from the P-unit responses to RAM stimuli, the noise stimulus was set in relation to the corresponding neuronal response in the Fourier domain, resulting in a matrix in which the nonlinearity at the sum frequency \fsum{} in the firing rate is depicted for two noise frequencies \fone{} and \ftwo{} (\Eqnref{eq:susceptibility}, \subfigrefb{fig:cells_suscept}{E--F}). The decomposition of the RAM stimulus into the frequency components allows us to approximate the beat frequencies $\Delta f$, occurring in case of pure sine-wave stimulation (\subfigrefb{fig:motivation}{D}). Thus, the nonlinearity accessed with the RAM stimulation at \fsum{} (\subfigrefb{fig:cells_suscept}{E}) is similar to the nonlinearity appearing during pure sine-wave stimulation at \bsum{} (orange peak, \subfigrefb{fig:motivation}{D}). A band of elevated nonlinearity appears for the low RAM contrast when \fsumb{} (yellow anti-diagonal between pink edges, \subfigrefb{fig:cells_suscept}{E}) but vanishes for the stronger stimulus (20\% contrast, \subfigref{fig:cells_suscept}{F}). Further, the overall level of nonlinearity changes with the stimulus strength. To compare the structural changes in the matrices we calculated the mean of the anti-diagonals, resulting in the projected diagonal (\subfigrefb{fig:cells_suscept}{G}). For a low RAM contrast the second-order susceptibility at \fbase{} is slightly enhanced (\subfigrefb{fig:cells_suscept}{G}, gray dot on light purple line). For the higher RAM contrast, however, this is not visible and the overall second-order susceptibility is reduced (\subfigrefb{fig:cells_suscept}{G}, compare light and dark purple lines). The reason behind this decrease is that the higher RAM contrast is associated with a simultaneously increase of the stimulus amplitude but also of the total noise in the system. This is important since increased noise is known to linearize signal
transmission \cite{Longtin1993, Chialvo1997,  Roddey2000, Voronenko2017}.

High-CV P-units do not exhibit pronounced nonlinearities even at low stimulus contrasts (for more details see supplementary information: \nameref*{S1:highcvpunit}).


\begin{figure*}[!ht]
\includegraphics[width=\columnwidth]{ampullary}
  \caption{\label{fig:ampullary} Estimation of linear and nonlinear stimulus encoding in an ampullary afferent. Calculated based on the first frozen noise repeat. \figitem{A} Interspike interval (ISI) distribution of the cell's baseline activity. The CV of the ISIs is a dimensionless measure quantifying the response regularity. Zero CV would indicate perfect regularity. \figitem{B} Power-spectrum of the baseline response. \figitem{C} White noise stimulus (top) added to the fish's self-generated electric field and responses (spike raster in the lower traces). The stimulus contrast reflects the strength of the stimulus in relation to the own electric field amplitude. \figitem{D} Transfer function (first-order susceptibility, \Eqnref{linearencoding_methods}) of the responses to 2\% (light green) and 20\% contrast (dark green) stimulation. \figitem{E, F} Absolute value of the second-order susceptibility, \Eqnref{eq:susceptibility}, for the low, and high stimulus contrasts. Pink angles -- edges of the structure when \fone, \ftwo{} or \fsum{} are equal to \fbase{}. \figitem{G} Projected diagonals, calculated as the mean of the anti-diagonals of the matrices in \panel{E, F}. Gray dots mark \fbase{}. Horizontal dashed lines: medians of the projected diagonals.
  }
\end{figure*}


\subsection*{Ampullary afferents exhibit strong nonlinear interactions}
Irrespective of the CV, neither P-unit shows the complete proposed structure of nonlinear interactions. \lepto{} posses an additional electrosensory system, the passive or ampullary electrosensory system that responds to low-frequency exogeneous electric stimuli. The population of ampullary afferents is much less heterogeneous, and known for the much lower CVs of the ISI distributions (0.08--0.22)\cite{Grewe2017}. Ampullary cells do not phase-lock to the EOD and the ISI are unimodally distributed (\subfigrefb{fig:ampullary}{A}). According to the low irregularity of the baseline response, the power spectrum shows a very distinct peak at \fbase{} and harmonics of it. Since the cells do not fire phase locked to the EOD, there is no peak at \feod{} (\subfigrefb{fig:ampullary}{B}). When driven by a noise stimulus with a low contrast (note: this is not an AM but an added stimulus to the self-generated EOD, \subfigref{fig:ampullary}{C}), ampullary cells exhibit very pronounced bands when \fsum{} is equal to \fbase{} or its harmonic in the second-order susceptibility matrix implying that this cell is especially nonlinear at these frequency combinations (yellow diagonals, \subfigrefb{fig:ampullary}{E, G}, light green). With higher stimulus contrasts these bands disappear (\subfigrefb{fig:ampullary}{F}) and the projected diagonal is decreased and lacks the distinct peak at \fsum{} (\subfigrefb{fig:ampullary}{G}, dark green). 



\subsection*{Model-based estimation of the nonlinear structure}
Traces of the expected structure of second-order susceptibility are found in both ampullary and p-type electrosensory afferents. In the recordings shown above (\figrefb{fig:cells_suscept}, \figrefb{fig:ampullary}), the nonlinear response is strong whenever the two frequencies (\fone{}, \ftwo{}) fall onto the antidiagonal \fsumb{}, which is in line with theoretical expectations\cite{Voronenko2017}. However, a pronounced nonlinear response for frequencies with \foneb{} or \ftwob{}, although predicted by theory,  cannot be observed. Here we investigate how these discrepancies can be understood.

\begin{figure*}[!h]
  \includegraphics[width=\columnwidth]{model_and_data}
  \caption{\label{model_and_data} High trial numbers and a reduced internal noise reveal the nonlinear structure in a LIF model with carrier. \figitem{A} \suscept{} surface of the  electrophysiologically recorded low-CV P-unit (cell 2012-07-03-ak) driven with a weak stimulus with 2.5\% contrast. The plot shows that \suscept{} surface for $N=11$. Pink edges mark the expected structure of enhanced nonlinearity. \figitem[i]{B} \textit{Standard condition} of the model simulation. The model is driven by a RAM stimulus (red trace). The signal noise component \signalnoise{} and the intrinsic noise are shown in the center and bottom. \figitem[ii]{B} \suscept{} surface of the cell's LIF model counterpart (cell 2012-07-03-ak, table~\ref{modelparams}) averaged over the same number of stimulus repetitions. \figitem[iii]{B} Same as \panel[ii]{B} but $10^6$ stimulus repetitions. \figitem[i - iii]{C} Same as in \panel[i - iii]{B} but in the \textit{noise split} condition: there is no external RAM signal driving the model. Parts (90\%) of the total intrinsic noise are treated as signal (center trace,  \signalnoise) while the intrinsic noise is reduced (see methods for details). Note that the signal component \signalnoise{} is added as an amplitude modulation and is thus limited with respect to its spectral content by the Nyquist frequency of the carrier, half the EOD frequency. It thus has a reduced high frequency content as compared to the intrinsic noise. Adding this discarded high frequency components to the intrinsic noise does not affect the results here (not shown).
}
\end{figure*}

In the electrophysiological experiments, we only have a limited number of trials and this insufficient averaging may occlude the full nonlinear structure. This limitation can be overcome by using a computational model for the P-unit, a stochastic leaky integrate-and-fire model with adaptation current and dendritic preprocessing, with parameters fitted to the experimentally recorded P-unit (\figrefb{flowchart}) \cite{Barayeu2023}. The model faithfully reproduces the second-order susceptibility of a low-CV cell estimated from the same low number of repetitions ($\n{}=11$, compare \panel{A} and \panel[ii]{B} in \figrefb{model_and_data}).

In the model we can increase the number of repetitions substantially but still do not observe the full nonlinear structure ($\n{}=10^6$, \subfigrefb{model_and_data}\,\panel[iii]{B}). A possible reason for this could be that by applying a broadband stimulus the effective input-noise level is increased and this may linearize the signal 
transmission \cite{Longtin1993, Chialvo1997,  Roddey2000, Voronenko2017}.  Assuming that the intrinsic noise level in this P-unit is small enough, the full nonlinear structure should appear in the limit of weak AMs.  Again, this cannot be done experimentally, because the problem of insufficient averaging becomes even more severe for weak AMs (low contrast). In the model, however, we know the time course of the intrinsic noise and can use this knowledge to determine the susceptibilities by input-output correlations via the Furutsu-Novikov theorem \cite{Furutsu1963, Novikov1965}. This theorem, in its simplest form, states that the cross-spectrum $S_{x\eta}(\omega)$ of a Gaussian noise $\eta(t)$ driving a nonlinear system and the system's output $x(t)$ is proportional to the linear susceptibility according to $S_{x\eta}(\omega)=\chi(\omega)S_{\eta\eta}(\omega)$. Here $\chi(\omega)$ characterizes the linear response to an infinitely weak signal $s(t)$ in the presence of the background noise $\eta(t)$. Likewise, the nonlinear susceptibility can be determined in an analogous fashion from higher-order input-output cross-spectra (see methods, equations \eqref{eq:crosshigh} and \eqref{eq:susceptibility}) \cite{Egerland2020}. In line with an alternative derivation of the Furutsu-Novikov theorem \cite{Lindner2022}, we can split the total noise and consider a fraction of it as stimulus. This allows to calculate the susceptibility from the cross-spectrum between the output and this stimulus fraction of the noise. Adapting this approach to our P-unit model (see methods), we replace the intrinsic noise by an approximately equivalent RAM stimulus $s_\xi(t)$ and a weak remaining intrinsic noise $\sqrt{2D \, c_{\rm{noise}}} \cdot \xi(t)$ with $c_\text{noise} = 0.1$ (see methods, equations \eqref{eq:ram_split}, \eqref{eq:Noise_split_intrinsic}, \eqref{eq:Noise_split_intrinsic_dendrite}, \subfigrefb{model_and_data}\,\panel[i]{C}). We tune the amplitude of the RAM stimulus $s_\xi(t)$ such that the output firing rate and variability (CV) are the same as in the baseline activity (i.e. full intrinsic noise $\sqrt{2D}\xi(t)$ in the voltage equation but no RAM) and compute the second- and third-order cross-spectra between the RAM part of the noise $s_\xi(t)$ and the output spike train. This procedure has two consequences: (i) by means of the cross-spectrum between the output and \signalnoise, which is a large fraction of the noise, the signal-to-noise ratio of the measured susceptibilities is drastically improved; (ii) the total noise in the system has been reduced (by what was before the external RAM stimulus $s(t)$), which makes the system more nonlinear. For both reasons we now see the expected nonlinear features in the second-order susceptibility for a sufficient number of trials (\subfigrefb{model_and_data}\,\panel[iii]{C}), but not for a number of trials comparable to the experiment (\subfigrefb{model_and_data}\,\panel[ii]{C}). In addition to the strong response for \fsumb{}, we now also observe pronounced nonlinear responses at \foneb{} and \ftwob{} (vertical and horizontal lines, \subfigrefb{model_and_data}\,\panel[iii]{C}).

Note, that the increased number of repetitions goes along with a substantial reduction of second-order susceptibility values (\subfigrefb{model_and_data}\,\panel[iii]{C}), that saturate in its peak values for $N>10^5$ (\figrefb{fig:trialnr}). This demonstrates the limited reliability of a statistical estimate that is based on 11 trials only. However, we would like to point out that already the limited number of trials as used in the experiments reveals key features of the nonlinear response.

With high levels of intrinsic noise, we would not expect the nonlinear response features to survive. Indeed, we do not find these features in a high-CV P-unit and its corresponding model (not shown).




\subsection*{Second-order susceptibility can explain nonlinear peaks in pure sinewave stimulation}
We calculated the second-order susceptibility surfaces at \fsum{} by extracting the respective spectral components of the P-unit responses to RAM stimuli. How does this relate to the pure sinewave situation that approximates the interference of real animals? The relevant signals are the beat frequencies \bone{} and \btwo{} that arise from the interference of the receiving fish's own and either of the foreign EODs (\figref{fig:motivation}). The response power spectrum showed peaks from nonlinear interaction at the sum of the two beat frequencies (orange marker, \subfigrefb{fig:motivation}{D}) and at the difference between the two beat frequencies (red marker, \subfigrefb{fig:motivation}{D}). In the example $\Delta f_{2}$ was similar to \fbase{}, corresponding to the horizontal line in the RAM-based second-order susceptibility matrix in \subfigrefb{model_and_data}\,\panel[iii]{C}. In the three-fish example, there was a second nonlinearity at the difference between the two beat frequencies (red circle, \subfigrefb{fig:motivation}{D}), that cannot be explained with the so-far shown second-order susceptibility matrix in \subfigrefb{model_and_data}\,\panel[iii]{C}, in which only the nonlinearity at \fsum{} in the response is addressed. % less prominent,
\begin{figure*}[!ht]
  \includegraphics[width=\columnwidth]{model_full}
  \caption{\label{fig:model_full} \figitem[]{A} Full second-order susceptibility of the model of an electrophysiologically recorded P-unit (see table~\ref{modelparams} for model parameters of 2012-07-03-ak). White lines -- coordinate axis. The nonlinearity at \fsum{} in the firing rate is quantified in the upper right and lower left quadrants (\Eqnref{eq:susceptibility}). The nonlinearity at \fdiff{} in the firing rate is quantified in the upper left and lower right quadrants. Baseline firing rate $\fbase{}=120$\,Hz. Absolute value of the model second-order susceptibility, with $N=10^6$ stimulus realizations and the intrinsic noise split (see methods). The position of the orange letters corresponds to the beat frequencies used for the pure sinewave stimulation in the subsequent panels. The position of the red letters correspond to the difference of those beat frequencies. \figitem{B--E} Power spectral density of model responses under pure sinewave stimulation. \figitem{B} The two beat frequencies are in sum equal to \fbase{}. \figitem{C} The difference of the two beat frequencies is equal to \fbase{}. \figitem{D} Only one beat frequency is equal to \fbase{}. \figitem{C} No beat frequencies is equal to \fbase{}.}
\end{figure*}
%section \ref{intrinsicsplit_methods}).\figitem{A} Absolute value of the second-order susceptibility of an electrophysiologically recorded P-unit. RAM stimulus realizations $N=11$. Diagonal bands appear when the sum of the frequencies \fsum{} or the difference \fdiff{} is equal to \fbase{}. \figitem{B}  The diagonals, that were present in \panel{A}, are complemented by vertical and horizontal lines when \fone{} or \ftwo{} are equal to \fbase{}. Note that the different scale of the second-order susceptibility is associated with the higher signal-to-ratio in case of 1 million repeats in \panel{B}.

However, the second-order susceptibility can also be calculated for the full matrix including negative frequency components of the respective spectra in \Eqnsref{eq:crosshigh} and (\ref{eq:susceptibility}). The resulting \suscept{} matrix is symmetric with respect to the origin and shows \suscept{} at \fsum{} in the upper-right and lower-left quadrants and \suscept{} for the differences \fdiff{} in the lower-right and upper-left quadrants \cite{Voronenko2017} (\figref{fig:model_full}). The vertical and horizontal lines at \foneb{} and \ftwob{} are very pronounced in the upper-right quadrant of \subfigrefb{fig:model_full}{A} for the nonlinearity at \fsum{} and extend into the upper-left quadrant (representing \fdiff) fading out towards more negative $f_1$ frequencies. The \fdiff{} power spectral peak observed during pure sine-wave stimulation (\subfigrefb{fig:motivation}{D}) can be explained by the horizontal line in the upper-left quadrant (\subfigrefb{fig:model_full}{A}, \cite{Schlungbaum2023}). 

%\suscept{} values at \fsum{} match the \fsum{} peak seen in the data (\figref{fig:motivation}). the fading of the


Is it possible based on this second-order susceptibility (\subfigrefb{fig:model_full}{A}) to predict nonlinearities in a three-fish setting? We can test this by providing two beats with weak amplitudes to the same model (\subfigrefb{fig:model_full}{B--E}). If we chose a frequency combination where the sum of the two beat frequencies is equal to \fbase{} a nonlinearity can be observed at the sum of the two beat frequencies in the power spectrum of the response (\subfigrefb{fig:model_full}{B}). If instead we choose two beat frequencies which difference is equal to \fbase{}, a nonlinear peak is present at the difference frequency (\subfigrefb{fig:model_full}{C}). If only one beat frequency is equal to \fbase{}, a peak at the sum, as well as at the difference frequency is present in the P-unit response (\subfigrefb{fig:model_full}{D}). And if none of these conditions are met no nonlinearity is observed in the model, neither at the sum nor at the difference of the two beat frequencies (\subfigrefb{fig:model_full}{E}). 

Even though the second-order susceptibilities here were estimated from data and models with an modulated (EOD) carrier (\figrefb{fig:model_full}) they are in good accordance with the second-order susceptibilities found in LIF models without a carrier\cite{Voronenko2017, Schlungbaum2023}.

\begin{figure*}[!ht]
  \includegraphics[width=\columnwidth]{data_overview_mod}
  \caption{\label{fig:data_overview_mod} Nonlinearity for a population of P-units (\panel{A, C, E}) and ampullary cells (\panel{B, D, F}). The peakedness of the nonlinearity \nli{} is calculated as the maximal value in the range $\fbase{} \pm 5$\,Hz of the projected diagonal divided by its median (see \Eqnref{eq:nli_equation}). Each recorded neuron contributes at maximum with two stimulus contrasts. Black squares and circles highlight recordings conducted in a single cell. Squares in  \panel{A, C, E} correspond to the cell in \figrefb{fig:cells_suscept} and circles to the cell in \figrefb{fig:cells_suscept_high_CV}. Squares in \panel{B, D, F} correspond to the cell in \figrefb{fig:ampullary}. \figitem{A, B} There is a negative correlation between the CV during baseline and \nli.  \figitem{C, D} There is a negative correlation between the CV during stimulation and \nli. \figitem{E, F} \nli{} is plotted against the response modulation, (see methods), an indicator of the subjective stimulus strength for a cell. There is a negative correlation between response modulation and \nli. Restricting the analysis to the weakest stimulus that was presented to each unique neuron, does not change the results. The number of unique neurons is 221 for P-units and 45 for ampullary cells.
  }
\end{figure*}

%\Eqnref{response_modulation}
\subsection*{Low CVs and weak stimuli are associated with strong nonlinearity}
The nonlinear effects shown for single cell examples above are supported by the analysis of the pool of 221 P-units and 47 ampullary afferents recorded in 71 specimen. To compare across cells we expressed the second-order susceptibility as the peakedness of the nonlinearity \nli{}, see \Eqnref{eq:nli_equation}. The \nli{} characterizes the peakedness of the projections onto the diagonal of the \suscept{} matrices (e.g. \subfigref{fig:cells_suscept}{G} at \fbase{}). It assumes high values when the \fbase{} peak in the projected diagonal is pronounced relative to the median of the diagonal and is small when there is no distinct peak. The P-unit population \nli{} values depend weakly on the CV of the ISI distribution under baseline condition. Cells with lower baseline CVs have the tendency to exhibit a stronger nonlinearity than those that have high CVs during baseline (\subfigrefb{fig:data_overview_mod}{A}) or during stimulation (\subfigrefb{fig:data_overview_mod}{C}). The two example P-units shown before are highlighted with dark markers in \subfigrefb{fig:data_overview_mod}{A, C, E} (squares -- \figrefb{fig:cells_suscept}, circles --  \figrefb{fig:cells_suscept_high_CV}). The stimulus strength plays an important role. Several of the recorded neurons contribute with two dots to the data as their responses to the same RAM stimulus but with different contrasts were recorded. Higher stimulus contrasts lead to a stronger drive and thus stronger response modulations (see color code bar in \subfigref{fig:data_overview_mod}{A}, see methods). Since P-units are heterogeneous in their susceptibility to the stimulus\cite{Grewe2017}, their responses to the same stimulus intensity vary a lot. When replotting the \nli{} against the response modulation (\subfigrefb{fig:data_overview_mod}{E}) a negative correlation is observed showing that cells that are strongly driven by the stimulus show less nonlinearity while those that are only weakly driven show higher nonlinearities. Whether or not a cell responds with pronounced nonlinearity thus depends on the baseline CV (i.e. the internal noise), the CV during stimulation and the response strength. 
%(Pearson's $r=-0.35$, $p<0.001$)221 P-units and 47 (Pearson's $r=-0.16$, $p<0.01$)
%In a P-unit population where each cell is represented not by several contrasts but by the lowest recorded contrast, \nli{} significantly correlates with the CV during baseline ($r=-0.17$, $p=0.01$), the response modulation ($r=-0.35$, $p<0.001$) and \fbase{} ($r=-0.32$, $p<0.001$).%, $\n{}=221$*, $\n{}=221$******, $\n{}=221$

The population of ampullary cells is generally more homogeneous, with lower CVs than P-units. Accordingly, ampullary cells show much higher \nli{} values than P-units (factor of 10). Overall, there is a negative correlation with the baseline CV. The example cell shown above (\figref{fig:ampullary}) was recorded at two different stimulus intensities and the \nli{} values are highlighted with black squares. Again, we see that cells that are strongly driven by the stimulus are at the bottom of the distribution and have \nli{} values close to one (\subfigrefb{fig:data_overview_mod}{B, D}). This is confirmed when the data is replotted against the response modulation: Those cells that are strongly driven by the stimulus show weak nonlinearities while weakly driven neurons exhibit high nonlinearity values (\subfigrefb{fig:data_overview_mod}{F}).

%(Pearson's $r=-0.35$, $p < 0.01$) (Pearson's $r=-0.59$, $p < 0.0001$)

\section*{Discussion}

Nonlinearities are ubiquitous in nervous systems, they are essential to extract certain features such as amplitude modulations of a carrier. Here, we analyzed the nonlinearity in primary electroreceptor afferents of the weakly electric fish \lepto{}. Under natural stimulus conditions, when the electric fields of two or more animals produce interference patterns that contain information of the context of the encounter, such nonlinear encoding is required to enable responding to AMs or also so-called envelopes. The work presented here is inspired by observations of electric fish interactions in the natural habitat. In these observed electrosensory cocktail-parties, a second male is intruding the conversations of a courting dyad. The courting male detects the intruder at a large distance where the foreign electric signal is strongly attenuated due to spatial distance and tiny compared to the signal emitted by the close-by female. Such a three-animal situation is exemplified in \figref{fig:motivation} for a rather specific combination of interfering EODs. There, we observe that the electroreceptor response contains components that result from nonlinear interference (\subfigref{fig:motivation}{D}) that might help to solve this detection task. Based on theoretical work we work out the circumstances under which electroreceptor afferents show such nonlinearities.


%\,\panel[iii]{C}
\subsection*{Theory applies to systems with and without carrier}
Theoretical work\cite{Voronenko2017} explained analytically the occurrence of nonlinear products when a LIF model neuron is stimulated with pure sine-waves. To investigate whether the same mechanisms occur in electroreceptor afferents which are driven by AMs of a carrier and not by pure sine-waves, we followed the previous approach and quantified the second-order susceptibility from responses to white-noise stimuli \cite{Voronenko2017, Egerland2020, Neiman2011fish,Nikias1993}. We expected to see elevated second-order susceptibility where either of the foreign signals matches the baseline firing rate ($f_1=f_{base}$ or $f_2=f_{base}$) or when the sum equals the baseline firing rate of the neuron (\fsumb{}) creating a triangular pattern of elevated \suscept{} e.g.\,\subfigref{model_and_data}\,\panel[iii]{C}. Indeed, we find traces of the same nonlinearities in the neuronal responses of p-type electroreceptor afferents. The nonlinear pattern observed in the experimental data, however, matches to the expectations only partially and only in a subset of neurons (\figsref{fig:cells_suscept} and\,\ref{fig:ampullary}). Nevertheless, the theory holds also for systems that are driven by AMs of a carrier and is thus more widely applicable.

\subsection*{Intrinsic noise limits nonlinear responses}
Only those P-units that exhibit low coefficients of variation (CV) of the interspike-interval distribution (\subfigref{fig:cells_suscept}{A}) in their unperturbed baseline response show the expected nonlinerities (\subfigref{fig:data_overview_mod}{A}). Such low-CV cells are rare among the 221 P-units that we used in this study. The afferents of the passive electrosensory system, the ampullary cells, however have generally lower CVs and show a much clearer nonlinearity pattern than the low-CV P-unit exemplified here (compare \figsref{fig:cells_suscept} and \ref{fig:ampullary}). The single ampullary cell featured in \figref{fig:ampullary} is a representative of the majority of ampullary cells analyzed here. All ampullary cells have CVs below 0.4 with a median around 0.12 and the observed \nli{}s are 10-fold higher than in P-units.

The CV serves as a proxy for the intrinsic noise in the cells. In both cell types, we observe a negative correlation between \nli{} and the CV, indicating that it is the level of intrinsic noise that plays a role here. These findings are in line with previous studies that propose that noise linearizes the system\cite{Roddey2000, Chialvo1997, Voronenko2017}. More intrinsic noise has been demonstrated to increase the CV and reduce nonlinear phase-locking in vestibular afferents\cite{Schneider2011}. Reduced noise, on the other hand, has been associated with stronger nonlinearity in pyramidal cells of the ELL\cite{Chacron2006}. Further support for the notion of noise limiting the nonlinearity comes from our P-unit LIF model that faithfully reproduces P-unit activity\cite{Barayeu2023}. We can use this model and apply a noise-split \cite{Lindner2022} based on the to the Furutsu-Novikov theorem\cite{Novikov1965,Furutsu1963}, to increase the signal-to-noise ratio in the cell while keeping the overall response variability constant (see methods). Treating 90\% of the total noise as signal and simulating large numbers of trial uncovers the full nonlinear structure (\figref{model_and_data}) seen in LIF neurons and the analytical derivations when driven with sine-wave stimuli\cite{Voronenko2017}.

%
\subsection*{Noise stimulation approximates the real three-fish interaction}
Our analysis is based on the neuronal responses to white noise stimulus sequences. For the P-units, the stimulus was a random amplitude modulation (RAM) while it was a direct noise stimulus for the ampullary cells. These broad-band stimuli have the advantage that all behaviorally relevant frequencies can be measured with a single stimulus presentation and it is a widely used approach to characterize sensory coding\cite{French1973,Marmarelis1999, Borst1999, Chacron2005, Grewe2017}. However, these stimuli also increase the total level of noise in the system and may have a linearizing effect on signal transmission. In a our P-unit models, we were able to make use of the Furutsu-Novikov theorem to estimate nonlinear signal transmission for zero-amplitude stimulation. Only with this procedure and many trials, we find for low-CV P-units all the pronounced ridges in the second-order susceptibility that we would expect according to theory \cite{Voronenko2017}.

In the natural situation, the stimuli are periodic signals defined by the difference frequencies. How well can we extrapolate from the white noise analysis to the pure sinewave situation? \notejg{Predictions from the X2 matrix and the equations in Voronekov}

In contrast to the situation with individual frequencies (direct sine-waves or sinusoidal AMs) during noise stimulation the total power of the stimulus is equally distributed on all frequencies leading to a weaker signal-to-noise ratio. This explains that the nonlinearity pattern in the electroreceptor recordings only partially matches the expectation (\figsref{fig:cells_suscept},\,\ref{fig:ampullary}) while the single-frequency stimulation shows nonlinear interference when the individual stimulus frequencies ($f_1, f_2, \Delta f_1, \Delta f_2$) match the baseline firing rate (\figref{fig:motivation}, \subfigref{fig:model_full}{B--E}). With the noise-splitting trick, we could show that in low-CV cells, that have a low-CV and are not subject to strong stimulation, the full nonlinearity pattern is present but covered by the intrinsic noise. We thus conclude that the presence of the anti-diagonal pattern in the \suscept{} matrix is sufficient to conclude that the same nonlinear interactions happen here. This also validates the application of the white noise approach to characterize the full \suscept{} matrix instead of using all combinations of individual frequencies.



% The nonlinearity of ampullary cells in paddlefish \cite{Neiman2011fish} has been previously accessed with bandpass limited white noise. 

% Here it was demonstrated that the second-order susceptibility for the two RAM noise input frequencies \fone{} and \ftwo{} can approximate a three-fish setting, where the driving force for the P-unit are two beats with frequencies \bone{} and \btwo{}. This was confirmed by a low-CV P-unit, where nonlinearities in the P-unit response occurred at the sum and difference of the beat frequencies for pure sine-wave stimulation (\figrefb{fig:motivation}). In this P-unit the nonlinearity appeared in a three-wave setting with \bone{} being close to \fbase{}, corresponding to a frequency combination on the vertical line at \foneb{} in the second-order susceptibility (\subfigrefb{fig:model_full}{B}). This implies that even if only the diagonal structure can be accessed with noise stimulation in the second-order susceptibility in an experiment (\subfigrefb{fig:model_full}{A}), it can be taken as an indicator that the whole nonlinear structure should be present during pure sine-wave stimulation in the same cell. With this RAM stimulation was demonstrated to be an effective method to scan the three-fish or two-beat plane and estimate the whole theoretically predicted nonlinear structure in experimentally recorded cells.

\subsection*{Selective readout versus integration of heterogeneous populations}% Nonlinearity might be influenced once integrating from a P-unit population with heterogeneous baseline properties}%Heterogeneity of P-units might influence 

The observed nonlinear effects might facilitate the detectability of faint signals during a three fish setting, the electrosensory cocktail party. These nonlinear effects are, however, very specific with respect to the relation of stimulus frequencies and the P-unit baseline frequency. The EOD frequencies of the interacting fish would be drawn from the distributions of EOD frequencies found in male and female fish\cite{Hopkins1974Eigen, Meyer1987, Henninger2018, Henninger2020}. To be behaviorally relevant the faint signal detection would require reliable neuronal signaling irrespective of the individual EOD frequencies. 
P-units, however are very heterogeneous in their baseline firing properties\cite{Grewe2017, Hladnik2023}. The baseline firing rates vary in wide ranges (50--450\,Hz). This range covers substantial parts of the beat frequencies that may occur during animal interactions which is limited to frequencies below the Nyquist frequency (0 -- \feod/2)\cite{Barayeu2023}. It is thus likely that there are P-units which match approximately to the specificities of the different encounters. 

On the other hand, the nonlinearity was found only in low-CV P-units (with white noise stimulation). The CVs are also very heterogeneous (0.1--1.4, \figref{fig:data_overview_mod}\panel{A}) in our sample. Only a small fraction of the P-units has a sufficiently low level of intrinsic noise and will exhibit nonlinear responses. The P-units project to the ELL\cite{Krahe2014} and the integrating pyramidal cells in the different segments receive inputs in the range of 10s to 1000s of neurons\cite{Maler2009a}. Since the receptive fields of the pyramidal neurons are patches of adjacent receptors on the fish's body surface \cite{Bastian2002, Maler2009a, Haggard2023} and the input heterogeneity does not depend on the location of the receptor on the fish body \cite{Hladnik2023} the pyramidal cell input population will be heterogeneous. Heterogeneity was shown to be generally advantageous for the encoding in this\cite{Hladnik2023} and other systems\cite{Padmanabhan2010, Beiran2018}. At the same time it contradicts the apparent need for a selective readout of low-CV cells to maintain information arising through nonlinear interactions. 
A possible readout mechanism should be the topic of future studies that need to take into account that the nonlinearities are stronger in pure sine-wave stimulation and the fraction of cells that show it under naturalistic stimulation might be larger than expected from the distribution of CVs.

\subsection*{Behavioral relevance of nonlinear interactions}
The behavioral relevance of the weak signal detection in P-units is evident from the courtship context observed in freely interacting animals\cite{Henninger2018}. Outside courtship behavior, the encoding of secondary or social envelopes is a common need\cite{Stamper2012Envelope}. In a previous study it was demonstrated that information about low-frequency secondary envelopes would not be present in P-units' responses but would arise thorough nonlinear processing downstream in the ELL \cite{Middleton2006,Middleton2007}. Based on our work we would predict that only a small subset of cells, with low CVs, should encode the social envelopes under white noise stimulation. An absence of low-CVs cells in the population analyzed in the previous studies could explain their conclusions. On the other hand, another study showed that P-units with strong nonlinearities, low firing rates and high CVs could indeed encode social envelopes\cite{Savard2011}. These findings are in contrast to the previously mentioned work\cite{Middleton2007} and, at first glance, also to our results. The missing link, that has not been considered in this work, might be the bursting of P-units, the repeated firing of spikes after one EOD period interleaved with longer intervals of quietness\cite{Chacron2004}. Bursting was not explicitly addressed in the previous work, still the reported high CVs of the envelope encoding P-units indicate a higher rate of bursting\cite{Savard2011}. How bursts influence the second-order susceptibility of P-units will be addressed in following works (in preparation). Note that in this work we operated in a regime of weak stimuli and that the envelope encoding addressed in \cite{Savard2011,Middleton2007} operates in a regime of strong stimuli, where the firing rate is saturated. The exact transition from the nonlinearities in a regime of weak stimuli to a regime of strong stimuli could be addressed in further P-unit studies. 

Sinusoidal AMs are relevant in interactions with a few fish. We can understand the noise as the presence of many animals with individual EOD frequencies at the same time. Under noise stimulation, nonlinearities were demonstrated to be strong for weak stimuli but were shown to decrease for stronger noise stimuli (\figrefb{fig:cells_suscept}). As long as the noise signal is weak, those fish are distant and the nonlinearity is maintained. An increasing stimulus amplitude would indicate that many fish are close to the receiver and a decrease of nonlinear effects can be observed. These findings imply that the nonlinear effects arising in the presence of three fish decline the more fish join. \lepto{} usually prefers small groups of fish\cite{Stamper2010}. Thus, the described second-order susceptibility might still be behaviorally relevant under natural conditions. The decline of nonlinear effects when several fish are present might be an adaptive process reducing the number of frequencies represented in its primary sensory afferents to a minimum. Such representation would still leave room to create nonlinear effects at later processing steps in higher-order neurons.

The afferents of the passive electrosensory system, the ampullary cells, were found to exhibit much stronger nonlinearities than P-units (\figref{fig:data_overview_mod}). The adequate stimulus for this system is a direct stimulation not an amplitude modulation. In this sense the ampullary cells are closer to the LIF models used by Voroneko and colleagues\cite{Voronenko2017} and we can thus expect that the same nonlinear mechanisms are at work here. For the ampullary system, the sinewave stimulation is not as relevant as for the P-unit system. Ampullary cells encode low-frequency exogenous electric signals such as muscle potentials induced by prey movement\cite{Kalmijn1974, Engelmann2010, Neiman2011fish}. The simultaneous muscle activity of a swarm of prey (such as \textit{Daphnia}) resembles Gaussian white noise\cite{Neiman2011fish}, similar to the stimuli used here. Our results show some similarities with the analyses by Neiman and Russel\cite{Neiman2011fish} who study the encoding in ampullary afferents in the paddlefish. There, the power spectrum of the spontaneous activity also shows a peak at the baseline frequency (internal oscillator) but also at the oscillation frequency measured at the epithelium and interactions of both. Most of the latter disappear in the case of external stimulation, though. Here we find only peaks at the baseline frequency of the neuron and its harmonics. There are interesting similarities and dissimilarities; stimulus encoding in the paddlefish as well as in the brown ghost is very linear for low frequencies and there are nonlinearities in both systems. Linear encoding in the paddlefish shows a gap in the spectrum at the frequency of the epitheliar oscillation, instead the nonlinear response is very pronounced there. In \lepto{}, the dominating frequency under baseline conditions is the baseline firing rate, and we do see increased nonlinearity in this frequency range. The baseline frequency, however, is outside the linear coding range\cite{Grewe2017} while it is within the linear coding range in paddlefish\cite{Neiman2011fish}. Interestingly, the nonlinear response in the paddlefish ampullaries increases with stimulus intensity while it disappears in our case (\subfigrefb{fig:data_overview_mod}{F}). The population of ampullary cells is much more homogeneous with respect to the baseline rate (131$\pm$29\,Hz) and stimulus encoding properties than the P-units\cite{Grewe2017}. This implies that, if the stimulus contains the appropriate frequency components that sum up to the baseline rate, there should be a nonlinear response at a frequency that is similar for the full population of ampullary cells (the baseline frequency) that is outside the linear coding range. Postsynaptic cells integrating ampullary input might be able to extract this nonlinear response from the input population. How such nonlinear effects in ampullary cells might influence prey detection should be addressed in further studies.

\subsection*{Conclusion}
We have demonstrated that there are pronounced nonlinear responses in the primary electrosensory afferences of the weakly electric fish \lepto{}, systems that are very often characterized using linear methods. The observed nonlinearities match the expectations from previous theoretical studies\cite{Voronenko2017}. We can confirm that the theory applies also to systems that are encoding amplitude modulations of a carrier signal. Comparisons of P-units and ampullary cells showed that it is the level of intrinsic noise that determines how strongly nonlinear the system acts. Using the second-oder susceptibility estimated from the responses to white noise stimuli provides an easy way to determine the nonlinearity of the system under study. P-units share several features with mammalian
auditory nerve fibers and such nonlinear effects might also be expected in the auditory system during the encoding of amplitude modulations \cite{Joris2004}.

\section*{Methods}

\subsection*{Experimental subjects and procedures}

Within this project we re-evaluated datasets that were recorded between 2010 and 2023 at the Ludwig Maximilian University (LMU) M\"unchen and the Eberhard-Karls University T\"ubingen. All experimental protocols complied with national and European law and were approved by the respective Ethics Committees of the Ludwig-Maximilians Universität München (permit no. 55.2-1-54-2531-135-09) and the Eberhard-Karls Unversität Tübingen (permit no. ZP 1/13 and ZP 1/16).
The final sample consisted of 221 P-units and 47 ampullary electroreceptor afferents recorded in 71 weakly electric fish of the species \lepto{}. The original electrophysiological recordings were performed on male and female weakly electric fish of the species \lepto{} that were obtained from a commercial supplier for tropical fish (Aquarium Glaser GmbH, Rodgau,
Germany). The fish were kept in tanks with a water temperature of $25\pm1\,^\circ$C and a conductivity of around $270\,\micro\siemens\per\centi\meter$ under a 12\,h:12\,h light-dark cycle. 

Before surgery, the animals were deeply anesthetized via bath application with a solution of MS222 (120\,mg/l, PharmaQ, Fordingbridge, UK) buffered with Sodium Bicarbonate (120\,mg/l). The posterior anterior lateral line nerve (pALLN) was exposed by making a small cut into the skin covering the nerve. The cut was placed dorsal of the operculum just before the nerve descends towards the anterior lateral line ganglion (ALLNG). Those parts of the skin that were to be cut were locally anesthetized by cutaneous application of liquid lidocaine hydrochloride (20\,mg/ml, bela-pharm GmbH). During the surgery water supply was ensured by a mouthpiece to maintain anesthesia with a solution of MS222 (100\,mg/l) buffered with Sodium Bicarbonate (100\,mg/l). After surgery fish were immobilized by intramuscular injection of from 25\,$\micro$l to 50\,$\micro$l of tubocurarine (5\,mg/ml dissolved in fish saline; Sigma-Aldrich).
Respiration was then switched to normal tank water and the fish was transferred to the experimental tank.

\subsection*{Experimental setup} 
For the recordings fish were positioned centrally in the experimental tank, with the major parts of their body submerged into the water. Those body parts that were above the water surface were covered with paper tissue to avoid drying of the skin. Local analgesia was refreshed in intervals of two hours by cutaneous reapplication of Lidocaine (2\,\%; bela-pharm, Vechta, Germany) around the surgical wounds. Electrodes (borosilicate; 1.5\,mm outer diameter; GB150F-8P; Science Products, Hofheim, Germany) were pulled to a resistance of 50--100\,\mega\ohm{} (model P-97; Sutter Instrument, Novato, CA) and filled with 1\,M KCl solution. Electrodes were fixed in a microdrive (Luigs-Neumann, Ratingen, Germany) and lowered into the nerve (\figrefb{fig:setup}, blue triangle). Recordings of electroreceptor afferents were amplified and lowpass filtered at 10\,kHz (SEC-05, npi-electronics, Tamm, Germany, operated in bridge mode). All signals, neuronal recordings, recorded EOD and the generated stimulus, were digitized with sampling rates of 20 or 40\,kHz (PCI-6229, National Instruments, Austin, TX). RELACS (\url{www.relacs.net}) running on a Linux computer was used for online spike and EOD detection, stimulus generation, and calibration. Recorded data was then stored on the hard drive for offline analysis.

\subsection*{Identification of P-units and ampullary cells}
The neurons were classified into cell types during the recording by the experimenter. P-units were classified based on baseline firing rates of 50--450\,Hz and a clear phase-locking to the EOD and their responses to amplitude modulations of their own EOD\cite{Grewe2017, Hladnik2023}. Ampullary cells were classified based on firing rates of 80--200\,Hz absent phase-locking to the EOD and responses to low-frequency sinusoidal stimuli\cite{Grewe2017}. We here selected only those cells of which the neuron's baseline activity as well as the responses to frozen noise stimuli were recorded.

\subsection*{Electric field recordings}
 The electric field of the fish was recorded in two ways: 1. we measured the so-called \textit{global EOD} with two vertical carbon rods ($11\,\centi\meter$ long, 8\,mm diameter) in a head-tail configuration (\figrefb{fig:setup}, green bars). The electrodes were placed isopotential to the stimulus. This signal was differentially amplified with a factor between 100 and 500 (depending on the recorded animal) and band-pass filtered (3 to 1500\,Hz pass-band, DPA2-FX; npi electronics, Tamm, Germany). 2. The so-called \textit{local EOD} was measured with 1\,cm-spaced silver wires located next to the left gill of the fish and orthogonal to the fish's longitudinal body axis (amplification 100 to 500 times, band-pass filtered with 3 to 1\,500\,Hz pass-band, DPA2-FX; npi-electronics, Tamm, Germany, \figrefb{fig:setup}, red markers). This local measurement recorded the combination of the fish's own field and the applied stimulus and thus serves as a proxy of the transdermal potential that drives the electroreceptors.

\subsection*{Stimulation}
The stimulus was isolated from the ground (ISO-02V, npi-electronics, Tamm, Germany) and delivered via two horizontal carbon rods (30 cm length, 8 mm diameter) located $15\,\centi\meter$ laterally to the fish (\figrefb{fig:setup}, gray bars). The stimulus was calibrated with respect to the local EOD.

\begin{figure*}[!ht]%(\subfigrefb{beat_amplitudes}{B}).
  \includegraphics[width=\columnwidth]{Settup}
  \caption{\label{fig:setup} Electrophysiolocical recording setup. The fish, depicted as a black scheme and surrounded by isopotential lines, was positioned in the center of the tank. Blue triangle -- electrophysiological recordings were conducted in the posterior anterior lateral line nerve (pALLN). Gray horizontal bars -- electrodes for the stimulation. Green vertical bars -- electrodes to measure the \textit{global EOD} placed isopotential to the stimulus, i.e. recording fish's unperturbed EOD. Red dots -- electrodes to measure the \textit{local EOD} picking up the combination of fish's EOD and the stimulus. The local EOD was measured with a distance of 1 \,cm between the electrodes. All measured signals were amplified, filtered, and stored for offline analysis.}
\end{figure*}

\subsection*{White noise stimulation}\label{rammethods}
The fish were stimulated with band-limited white noise stimuli with a cut-off frequency of 150, 300 or 400\,Hz. The stimulus intensity is given as the contrast, i.e. the standard deviation of the white noise stimulus in relation to the fish's EOD amplitude. The contrast varied between 1 and 20\,$\%$. Only cell recordings with at least 10\,s of white noise stimulation were included for the analysis. When ampullary cells were recorded, the white noise was directly applied as the stimulus. To create random amplitude modulations (RAM) for P-unit recordings, the EOD of the fish was multiplied with the desired random amplitude modulation profile (MXS-01M; npi electronics).

% and between 2.5 and 40\,$\%$ for \eigen

\subsection*{Data analysis} Data analysis was performed with Python 3 using the packages matplotlib\cite{Hunter2007}, numpy\cite{Walt2011}, scipy\cite{scipy2020}, pandas\cite{Mckinney2010}, nixio\cite{Stoewer2014}, and thunderfish (\url{https://github.com/bendalab/thunderfish}).

%sklearn\cite{scikitlearn2011}, 

\paragraph{Baseline analysis}\label{baselinemethods}
The baseline firing rate \fbase{} was calculated as the number of spikes divided by the duration of the baseline recording (on average 18\,s). The coefficient of variation (CV) was calculated as the standard deviation of the interspike intervals (ISI) divided by the average ISI: $\rm{CV} = \sqrt{\langle (ISI- \langle ISI \rangle) ^2 \rangle} / \langle ISI \rangle$. If the baseline was recorded several times in a recording, the average \fbase{} and CV were calculated.

\paragraph{White noise analysis} \label{response_modulation}
In the stimulus driven case, the neuronal activity of the recorded cell is modulated around the average firing rate that is similar to \fbase{} and in that way encodes the time-course of the stimulus.
The time-dependent response of the neuron was estimated from the spiking activity 
\begin{equation}\label{eq:spikes}
x_k(t) = \sum_i\delta(t-t_{k,i}) 
\end{equation}
recorded for each stimulus presentation, $k$, by kernel convolution with a Gaussian kernel 

\begin{equation}
K(t) = \scriptstyle \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{t^2}{2\sigma^2}}
\end{equation}
with $\sigma$ the standard deviation of the Gaussian which was set to 2.5\,ms if not stated otherwise. For each trial $k$ the $x_k(t)$ is convolved with the kernel $K(t)$

\begin{equation}
  r_k(t) = x_k(t) * K(t) = \int_{-\infty}^{+\infty} x_k(t') K(t-t') \, \mathrm{d}t' \;,
\end{equation}
where $*$ denotes the convolution. $r(t)$ is then calculated as the across-trial average
\begin{equation}
  r(t) = \left\langle r_k(t) \right\rangle _k.
\end{equation}

To quantify how strongly the neuron is driven by the stimulus we quantified the response modulation as the standard deviation $\sigma_{M} = \sqrt{\langle (r(t)-\langle r(t) \rangle_t)^2\rangle_t}$, where $\langle \cdot \rangle_t$ indicates averaging over time.

\paragraph{Spectral analysis}\label{susceptibility_methods}
The neuron is driven by the stimulus and thus the spiking response $x(t)$, \Eqnref{eq:spikes}, depends on the stimulus $s(t)$. To investigate the relation between stimulus and response we calculated the first- and second-order susceptibility of the neuron to the stimulus in the frequency domain. The Fourier transforms of $s(t)$ and $x(t)$ are denoted as $\tilde s(\omega)$ and $\tilde x(\omega)$ and were calculated according to $\tilde x(\omega) = \int_{0}^{T} \, x(t) \cdot e^{- i \omega t}\,dt$, with $T$ being the signal duration. Stimuli had a duration of 10\,s and spectra of stimulus and response were calculated in separate segments of 0.5\,s with no overlap resulting in a spectral resolution of 2\,Hz.

The power spectrum of the stimulus $s(t)$ was calculated as 
\begin{equation}
  \label{powereq}
	\begin{split}  
  S_{ss}(\omega) = \frac{\langle \tilde s(\omega) \tilde s^* (\omega)\rangle}{T}
	\end{split}
\end{equation}
with $\tilde s^* $ being the complex conjugate and $\langle ... \rangle$ denoting averaging over the segments. The power spectrum of the spike trains $S_{xx}(\omega)$ was calculated accordingly. The cross-spectrum $S_{xs}(\omega)$ between stimulus and evoked spike trains was calculated according to
\begin{equation}
  \label{cross}
	\begin{split}
  S_{xs}(\omega) = \frac{\langle \tilde x(\omega) \tilde s^* (\omega)\rangle}{T}
	\end{split}
\end{equation}
From $S_{xs}(\omega)$ and $ S_{ss}(\omega)$ we calculated the linear susceptibility (transfer function) as
\begin{equation}
  \label{linearencoding_methods}
	\begin{split}  
    \chi_{1}(\omega)  = \frac{S_{xs}(\omega) }{S_{ss}(\omega) }
	\end{split}
\end{equation}
The second-order cross-spectrum that depends on the two frequencies $\omega_1$ and $\omega_2$ was calculated according to
\begin{equation}
  \label{eq:crosshigh}
  S_{xss} (\omega_{1},\omega_{2}) = \frac{\langle \tilde x (\omega_{1}+\omega_{2}) \tilde s^*  (\omega_{1})\tilde s^*  (\omega_{2}) \rangle}{T}
\end{equation}
The second-order susceptibility was calculated by dividing the higher-order cross-spectrum by the spectral power at the respective frequencies.
\begin{equation}
  \label{eq:susceptibility}
	%\begin{split}  
  \chi_{2}(\omega_{1}, \omega_{2}) = \frac{S_{xss} (\omega_{1},\omega_{2})}{2S_{ss} (\omega_{1}) S_{ss} (\omega_{2})}
	%\end{split}
\end{equation}
% Applying the Fourier transform this can be rewritten resulting in:
% \begin{equation}
%   \label{susceptibility}
% 	\begin{split}
%   \chi_{2}(\omega_{1}, \omega_{2}) = \frac{TN \sum_{n=1}^N \int_{0}^{T} dt\,r_{n}(t) e^{-i(\omega_{1}+\omega_{2})t} \int_{0}^{T}dt'\,s_{n}(t')e^{i \omega_{1}t'} \int_{0}^{T} dt''\,s_{n}(t'')e^{i \omega_{2}t''}}{2 \sum_{n=1}^N \int_{0}^{T} dt\, s_{n}(t)e^{-i \omega_{1}t} \int_{0}^{T} dt'\,s_{n}(t')e^{i \omega_{1}t'} \sum_{n=1}^N \int_{0}^{T} dt\,s_{n}(t)e^{-i \omega_{2}t} \int_{0}^{T} dt'\,s_{n}(t')e^{i \omega_{2}t'}}
% 	\end{split}
% \end{equation}
The absolute value of a second-order susceptibility matrix is visualized in \figrefb{fig:model_full}. There the upper right and the lower left quadrants characterize the nonlinearity in the response $x(t)$ at the sum frequency of the two input frequencies. The lower right and upper left quadrants characterize the nonlinearity in the response $x(t)$ at the difference of the input frequencies.

\paragraph{Nonlinearity index}\label{projected_method}
We expect to see nonlinear susceptibility when $\omega_1 + \omega_2 = \fbase{}$. To characterize this we calculated the peakedness of the nonlinearity (PNL) as
  \begin{equation}
    \label{eq:nli_equation}
    \nli{} = \frac{ \max D(\fbase{}-5\,\rm{Hz} \leq f \leq \fbase{}+5\,\rm{Hz})}{\mathrm{med}(D(f))}
  \end{equation}
For this index, the second-order susceptibility matrix was projected onto the diagonal $D(f)$, by taking the mean of the anti-diagonals. The peakedness at the frequency $\fbase{}$ in $D(f)$ was quantified by finding the maximum of $D(f)$ in the range $\fbase{} \pm 5$\,Hz (\subfigrefb{fig:cells_suscept}{G}) and dividing it by the median of $D(f)$.

If the same frozen noise was recorded several times in a cell, each noise repetition resulted in a separate second-order susceptibility matrix. The mean of the corresponding \nli{} values was used for the population statistics in \figref{fig:data_overview_mod}.

\subsection*{Leaky integrate-and-fire models}\label{lifmethods}

Leaky integrate-and-fire (LIF) models with a carrier were constructed to reproduce the specific firing properties of P-units \cite{Chacron2001,Sinz2020}. The sole driving input into the P-unit model during baseline, i.e. when no external stimulus was given, is the fish's own EOD modeled as a cosine wave
\begin{equation}
    \label{eq:eod}
    \carrierinput = y_{EOD}(t) = \cos(2\pi f_{EOD} t)
  \end{equation}
with the EOD frequency $f_{EOD}$ and an amplitude normalized to one.

In the model, the input \carrierinput{} was then first thresholded to model the synapse between the primary receptor cells and the afferent. 
\begin{equation}
  \label{eq:threshold2}
  \lfloor \carrierinput \rfloor_0 = \left\{ \begin{array}{rcl} \carrierinput & ; & \carrierinput \ge 0 \\ 0 & ; & \carrierinput < 0 \end{array} \right.
\end{equation}
$\lfloor \carrierinput \rfloor_{0}$ denotes the threshold operation that sets negative values to zero (\subfigrefb{flowchart}{A}).

The resulting receptor signal was then low-pass filtered to approximate passive signal conduction in the afferent's dendrite (\subfigrefb{flowchart}{B})
\begin{equation}
  \label{eq:dendrite}
  \tau_{d} \frac{d V_{d}}{d t} = -V_{d}+  \lfloor \carrierinput \rfloor_{0}
\end{equation}
with $\tau_{d}$ as the dendritic time constant. Dendritic low-pass filtering was necessary to reproduce the loose coupling of P-unit spikes to the EOD while maintaining high sensitivity at small amplitude modulations. Because the input was dimensionless, the dendritic voltage was dimensionless, too. The combination of threshold and low-pass filtering extracts the amplitude modulation of the input \carrierinput. 

The dendritic voltage $V_d(t)$ was the input to a leaky integrate-and-fire (LIF) model
\begin{equation}
  \label{eq:LIF}
  \tau_{m} \frac{d V_{m}}{d t}  = - V_{m} + \mu + \alpha V_{d} - A + \sqrt{2D}\xi(t)
\end{equation}
where $\tau_{m}$ is the membrane time-constant, $\mu$ is a fixed bias current, $\alpha$ is a scaling factor for $V_{d}$, $A$ is an inhibiting adaptation current, and $\sqrt{2D}\xi(t)$ is a white noise with strength $D$. All state variables except $\tau_m$ are dimensionless.

The adaptation current $A$ followed
\begin{equation}
  \label{eq:adaptation}
  \tau_{A} \frac{d A}{d t} = - A
\end{equation}
with adaptation time constant $\tau_A$.

Whenever the membrane voltage $V_m(t)$ crossed the spiking threshold $\theta=1$ a spike was generated, $V_{m}(t)$ was reset to $0$, the adaptation current was incremented by $\Delta A$, and integration of $V_m(t)$ was paused for the duration of a refractory period $t_{ref}$ (\subfigrefb{flowchart}{D}). 
\begin{equation}
  \label{spikethresh}
  V_m(t) \ge \theta \; : \left\{ \begin{array}{rcl} V_m & \mapsto & 0 \\ A  & \mapsto & A + \Delta A/\tau_A \end{array} \right.
\end{equation}

% The static nonlinearity $f(V_m)$ was equal to zero for the LIF. In the case of an exponential integrate-and-fire model (EIF), this function was set to
% \begin{equation}
%   \label{eifnl}
%   f(V_m)= \Delta_V \text{e}^{\frac{V_m-1}{\Delta_V}}
% \end{equation}
% \cite{Fourcaud-Trocme2003}, where $\Delta_V$ was varied from 0.001 to 0.1.
%, \figrefb{eif}

\begin{figure*}[!ht]
  \includegraphics[width=\columnwidth]{flowchart}
  \caption{\label{flowchart}
  Flowchart of a LIF P-unit model with EOD carrier. The main steps of the model are depicted in the left model column (Model cell identifier 2012-07-03-ak, see table~\ref{modelparams} for model parameters). The three other columns show the relevant signals in three different settings. (i) the baseline situation, no external stimulus, only the animal's self-generated EOD (i.e. the carrier) is present (ii) RAM stimulation, the carrier is amplitude modulated with a weak (2\% contrast) stimulus, (iii) Noise split condition in which 90\% of the internal noise is used as a driving stimulus scaled with the correction factor $\rho$ (see text). Note: that the firing rate and the CV of the ISI distribution is the same in this and the baseline condition. \figitem{A} Thresholding: a simple linear threshold was applied to the EOD carrier, \Eqnref{eq:eod}. The red line on top depicts the amplitude modulation (AM). \figitem{B} Dendritic low-pass filtering attenuates the carrier. \figitem{C} A Gaussian noise is added to the signal in B. Note the reduced internal noise amplitude in the noise split (iii) condition. \figitem{D} Spiking output of the LIF model in response to the addition of B and C. \figitem{E} Power spectra of the LIF neuron's spiking activity. Under the baseline condition (\panel[i]{E}) there are several peaks, from left to right, at the baseline firing rate $\fbase{}$, $f_{EOD} - \fbase{}$ $f_{EOD}$, and $f_{EOD} + \fbase{}$. In the stimulus driven regime (\panel[ii]{E}), there is only a peak at \feod, while under the noise split condition (\panel[iii]{E}) again all peaks are present.}
\end{figure*}

\subsection*{Numerical implementation}
The model's ODEs were integrated by the Euler forward method with a time-step of $\Delta t = 0.05$\,ms. The intrinsic noise $\xi(t)$ (\Eqnref{eq:LIF}, \subfigrefb{flowchart}{C}) was added by drawing a random number from a normal distribution $\mathcal{N}(0,\,1)$ with zero mean and standard deviation of one in each time step $i$. This number was multiplied with $\sqrt{2D}$ and divided by $\sqrt{\Delta t}$:
\begin{equation}
  \label{eq:LIFintegration}
  V_{m_{i+1}}  = V_{m_i} + \left(-V_{m_i} + \mu + \alpha V_{d_i} - A_i + \sqrt{\frac{2D}{\Delta t}}\mathcal{N}(0,\,1)_i\right) \frac{\Delta t}{\tau_m}
\end{equation}

\subsection*{Model parameters}\label{paramtext}
The eight free parameters of the P-unit model $\beta$, $\tau_m$, $\mu$, $D$, $\tau_A$, $\Delta_A$, $\tau_d$, and $t_{ref}$, were fitted to both the baseline activity (baseline firing rate, CV of ISIs, serial correlation of ISIs at lag one, and vector strength of spike coupling to EOD) and the responses to step-like increases and decreases in EOD amplitude (onset-state and steady-state responses, effective adaptation time constant). For each simulation, the start parameters $A$, $V_{d}$ and $V_{m}$ were drawn from a random starting value distribution, estimated from a 100\,s baseline simulation after an initial 100\,s of simulation that was discarded as a transient.

\subsection*{Stimuli for the model}
The model neurons were driven with similar stimuli as the real neurons in the original experiments. To mimic the interaction with one or two foreign animals the receiving fish's EOD (\Eqnref{eq:eod}) was normalized to an amplitude of one and the respective EODs of a second or third fish were added.%\Eqnref{ eq.\,\ref{eq:eod}

The random amplitude modulation (RAM) input to the model was created by drawing random amplitude and phases from Gaussian distributions for each frequency component in the range 0--300 Hz. An inverse Fourier transform was applied to get the final amplitude RAM time-course. The input to the model was then
\begin{equation}
    \label{eq:ram_equation}
    y(t) = (1+ s(t)) \cdot \cos(2\pi f_{EOD} t)
\end{equation}
From each simulation run, the first second was discarded and the analysis was based on the last second of the data. The resulting spectra thus have a spectral resolution of 1\,Hz.
% \subsection{Second-order susceptibility analysis of the model}
% %\subsubsection{Model second-order nonlinearity}

% The second-order susceptibility in the model was calculated with \Eqnref{eq:susceptibility}, resulting in matrices as in \figrefb{model_and_data} and \figrefb{fig:model_full}. For this, the model neuron was presented the input $x(t)$ for 2\,s, with the first second being dismissed as the transient. The second-order susceptibility calculation was performed on the last second, resulting in a frequency resolution of 1\,Hz. 

\subsection*{Model noise split into a noise and a stimulus component}\label{intrinsicsplit_methods}% the Furutsu-Novikov Theorem  with the same correlation function
According to previous works \cite{Lindner2022} the total noise of a LIF model ($\xi$) can be split up into several independent noise processes. Here we split the internal noise into two parts: (i) One part is treated as a driving input signal $s_\xi(t)$, a RAM stimulus where frequencies above 300\,Hz are discarded (\Eqnref{eq:ram_split}), and used to calculate the cross-spectra in \Eqnref{eq:crosshigh} and (ii) the remaining noise $\sqrt{2D \, c_{\rm{noise}}} \cdot \xi(t)$ that is treated as pure noise (\Eqnref{eq:Noise_split_intrinsic}). In this way the effective signal-to-noise ratio can be increased while maintaining the total noise in the system. 
%\sqrt{\rho \, 2D \,c_{\rm{signal}}} \cdot \xi(t) 

%(1-c_{\rm{signal}})\cdot\xi$c_{\rm{noise}} = 1-c_{\rm{signal}}$
%c_{\rm{signal}} \cdot \xi
\begin{equation}
    \label{eq:ram_split}
    y(t) = (1+ s_\xi(t)) \cdot \cos(2\pi f_{EOD} t)
\end{equation}

\begin{equation}
  \label{eq:Noise_split_intrinsic_dendrite}
  \tau_{d} \frac{d V_{d}}{d t} = -V_{d}+  \lfloor y(t) \rfloor_{0}
\end{equation}


\begin{equation}
  \label{eq:Noise_split_intrinsic}
  \tau_{m} \frac{d V_{m}}{d t}  = - V_{m} + \mu + \alpha V_{d} - A + \sqrt{2D \, c_{\rm{noise}}} \cdot \xi(t)
\end{equation}
% das stimmt so, das c kommt unter die Wurzel!

%\begin{equation}
%  \label{Noise_split_intrinsic}
%  V_{m_{i+1}}  = V_{m_i} + \left(-V_{m_i} + \mu + \alpha V_{d_i} - A_i + \sqrt{\frac{2D c_{\rm{noise}}}{\Delta t}}\mathcal{N}(0,\,1)_i\right) \frac{\Delta t}{\tau_m}
%\end{equation}



In the here used model a small portion of the original noise was assigned to the noise component ($c_{\rm{noise}} = 0.1$, \subfigrefb{flowchart}\,\panel[iii]{C}) and a big portion used as the signal component ($c_{\rm{signal}} = 0.9$, \subfigrefb{flowchart}\,\panel[iii]{A}). For the noise split to be valid \cite{Lindner2022} it is critical that both components add up to the initial 100\,$\%$ of the total noise and the baseline properties as the firing rate and the CV of the model are maintained. This is easily achieved in a model without a carrier if the condition $c_{\rm{signal}}+c_{\rm{noise}}=1$ is satisfied. The situation here is more complicated. After the original noise was split into a signal component with $c_{\rm{signal}}$, the frequencies above 300\,Hz were discarded and the signal strength was reduced after the dendritic low pass filtering. To compensate for these transformations the initial signal component was multiplying with the factor $\rho$, keeping the baseline CV (only carrier) and the CV during the noise split comparable, and resulting in $s_\xi(t)$. $\rho$ was found by bisecting the plane of possible factors and minimizing the error between the CV during baseline and stimulation.

%that was found by minimizing the error between the
%Furutsu-Novikov Theorem \cite{Novikov1965, Furutsu1963}\Eqnref{eq:ram_split},  (red in \subfigrefb{flowchart}\,\panel[iii]{A})  bisecting the space of possible $\rho$ scaling factors
%$\rho$ a scaling factor that compensates (see below) for the signal transformations the amplitude modulation stimulus undergoes in the model, i.e. the threshold and the dendritic lowpass. 
%In our case the model has a carrier (the fish's self-generated EOD) and we thus want to drive the model with an amplitude modulation stimulus


% See section \ref{lifmethods} for model and parameter description.
\begin{table*}[hp!]
  \caption{\label{modelparams} Model parameters of LIF models, fitted to 2 electrophysiologically recorded P-units \cite{Ott2020}.}
  \begin{center}
  \begin{tabular}{lrrrrrrrr}
    \hline
    \bfseries $cell$ & \bfseries $\beta$  & \bfseries $\tau_{m}$/ms & \bfseries $\mu$ & \bfseries $D$/$\mathbf{ms}$ & \bfseries $\tau_{A}$/ms & \bfseries $\Delta_A$ & \bfseries $\tau_{d}$/ms & \bfseries $t_{ref}$/ms \\\hline
2012-07-03-ak& $10.6$& $1.38$& $-1.32$& $0.001$& $96.05$& $0.01$& $1.18$& $0.12$ \\
2018-05-08-ae& $139.6$& $1.49$& $-21.09$& $0.214$& $123.69$& $0.16$& $3.93$& $1.31$ \\
 \hline
  \end{tabular}
  \end{center}
\end{table*}% 2013-01-08-aa %  2012-07-03-ak


% Either type in your references using
% \begin{thebibliography}{}
% \bibitem{}
% Text
% \end{thebibliography}
%
% or
%
% Compile your BiBTeX database using our plos2015.bst
% style file and paste the contents of your .bbl file
% here. See http://journals.plos.org/plosone/s/latex for 
% step-by-step instructions.
% 
%\bibliographystyle{apalike}%alpha}%}%alpha}%apalike}
\bibliography{journalsabbrv,references}
% \bibliographystyle{apalike} %or any other style you like
%\bibliography{references}
%\bibliography{journalsabbrv,references}
\newpage

\section*{Supporting information}

%\subsection*{High-CV P-units do not exhibit increased nonlinear interactions at \fsum}




\paragraph*{S1 Second-order susceptibility of high-CV P-unit}
CVs in P-units can range up to 1.5 \cite{Grewe2017, Hladnik2023}. We show the same analysis as in \figrefb{fig:cells_suscept} for an example higher-CV P-unit. Similar to the low-CV cell, high-CV P-units fire at multiples of the EOD period (\subfigrefb{fig:cells_suscept_high_CV}{A}). In contrast to low-CV P-units, however, the higher CV characterizes the noisier baseline firing pattern and the peak at \fbase{} is less pronounced in the power spectrum of the baseline activity (\subfigrefb{fig:cells_suscept_high_CV}{B}). High-CV P-units do not exhibit a clear nonlinear structure related to \fbase{} neither in the second-order susceptibility matrices (\subfigrefb{fig:cells_suscept_high_CV}{E--F}), nor in the projected diagonals (\subfigrefb{fig:cells_suscept_high_CV}{G}). The overall level of nonlinearity, however shows the same dependence on the stimulus contrast. It is much reduced for high-contrast stimuli that drive the neuron much stronger (\subfigrefb{fig:cells_suscept_high_CV}{F}). 

\label{S1:highcvpunit}
\begin{figure*}[!ht]
\includegraphics[width=\columnwidth]{cells_suscept_high_CV}  
  \caption{\label{fig:cells_suscept_high_CV} Response of experimentally measured P-units to RAM stimuli. Light purple -- low RAM contrast. Dark purple -- high RAM contrast. Noisy high-CV P-Unit. \figitem{A} Interspike intervals (ISI) distribution during baseline. \figitem{B} Baseline power spectrum of the firing rate. \figitem{C} Top: EOD carrier (gray) with RAM (red). Middle: Spike trains in response to a low RAM contrast. Bottom: Spike trains in response to a high RAM contrast. \figitem{D} First-order susceptibility (see \Eqnref{linearencoding_methods}). \figitem{E} Absolute value of the second-order susceptibility, \Eqnref{eq:susceptibility}, for the low RAM contrast. 
 Pink lines -- edges of the structure when \fone, \ftwo{} or \fsum{} are equal to \fbase{}. \figitem{F} Absolute value of the second-order susceptibility for the higher RAM contrast. \figitem{G} Projected diagonals, calculated as the mean of the anti-diagonals of the matrices in \panel{E--F}. Gray dots: \fbase{}. Dashed lines: Medians of the projected diagonals.
  }
\end{figure*}


\begin{figure*}[hp]%hp!
\includegraphics[width=\columnwidth]{trialnr}  
  \caption{\label{fig:trialnr} Saturation of the second-order susceptibility depending on the stimulus repetition number $\n{}$. Gray line -- 99.9th percentile of the second-order susceptibility matrix.
  }
\end{figure*}

% \bibliographystyle{iscience}
%\bibliographystyle{apalike}%alpha}%}%alpha}%apalike}
%\bibliographystyle{elsarticle-num-names}%elsarticle-num-names}
%\ExecuteBibliographyOptions{sorting=nty}
%\bibliographystyle{authordate2}
%\bibliography{journalsabbrv,references}
%\begin{thebibliography}{00}

\end{document}