A detector for EOD cycles of weakly electric fish
- Author
- Jan Benda
- Version
- 1.7 (Feb 3, 2013)
Detects each cycle of a periodic input waveform, like the EOD of a wave-type weakly electric fish.
The threshold defines the minimum distance between peaks and troughs that are detected. If adapt is set to true
, then the threshold is set automatically to ratio times the two-fold size of the EOD amplitude. Once a peak is detected the time of the EOD cycles is computed as the threshold crossing time of a voltage level that is at zeroratio times the peak-to-peak amplitude below the peak. You can select from four methods to determine the exact threshold crossing time (interpolation):
closest
datapoint
takes the time of the the data point right before the threshold crossing.
linear
interpolation
takes the time of a linear interpolation between the two data points directly below and above the threshold crossing.
linear
fit
and quadratic
fit
fit a line or a parabola to the region determined by fitwin and compute from the fit the threshold crossing time.
For computing the size (amplitude, half of the peak-to-peak amplitude) of the EOD a parabola is fitted to the three data points around the peak and the peak of this parabula is used as the peak size. If filtertau is greater than zero the the EOD waveform is low-pass filtered with this time constant and this mean value is subtracted from the peak size to result in the desired amplitude.
- Input
- A single voltage trace of the periodic input waveform
- Output
- The times of the EOD peaks and their amplitude.
- Options
threshold=1mV
: Threshold (number
)
adapt=false:
Adapt threshold (boolean
)
ratio=50%
: Ratio (number
)
autoratio=50%
: Auto sets threshold relative to EOD peak-to-peak amplitude (number
)
maxperiod=100ms
: Maximum EOD period for analyzing (number
)
filtertau=100ms
: Filter time constant (number
)
zeroratio=25%
: Time is computed from threshold crossing by ratio of peak-to-peak amplitude below peak (number
)
interpolation=linear
interpolation: Method for threshold-crossing time (string
)
fitwin=40%
: Fraction between threshold crossing and peak used for fit (number
)
- Auto Button
- Clicking on the "Auto" button sets the threshold to
autoratio
of the peak-to-peak amplitude.