BlueBrain / eFEL

Electrophys Feature Extraction Library
http://efel.readthedocs.io
Other
68 stars 38 forks source link

What do certain settings do - where to look it up? #120

Closed SvennoNito closed 6 years ago

SvennoNito commented 6 years ago

Hey,

thanks for this amazing toolbox! If it works it will save me so much work. I have intracellular recordings of leech neurons. We injected different electrical current during recording, which elicited action potentials. I try to detect certain spike train characteristics, yet for some stimulus values the toolbox doesn't detect action potentials correctly, yet. I already found out that I can change certain setting using

setDoubleSetting('spike_skipf', 0.1) setIntSetting('max_spike_skip', 2) setDoubleSetting('Threshold', _settings.threshold) setDoubleSetting('DerivativeThreshold', _settings.derivative_threshold) setDoubleSetting('interp_step', 0.1) setDoubleSetting('burst_factor', 1.5) setDoubleSetting('voltage_base_start_perc', 0.9) setDoubleSetting('voltage_base_end_perc', 1.0) setDoubleSetting("initial_perc", 0.1) setDoubleSetting("min_spike_height", 20.0) setIntSetting("strict_stiminterval", 0)

However, instead of randomly changing those values until my peaks are detected correctly, I would like to look up what these settings actually mean. I only found documentation for Threshold and DerivativeThreshold. Is there documentation for all setting somewhere? I will upload two plots showing trials in which spikes are detected wrongly or not at all.

stim_1 0 stim_1 75

wvangeit commented 6 years ago

hi, what actually seems to be happening is that you have traces are close to threshold. For eFEL the definition of a spike is "the voltage has to cross the threshold, and go below the threshold again" (the default value is -20 mV).

In figure 2, trail 11, the eFEL basically assume the entire stimulus is 1 spike, and finds the max voltage in that range.

Are these traces by chance the output of a parameters optimisation ? Sometimes these optimisers find these kind of weird solutions.

You're correct that that the definition of Threshold and DerivateThreshold are not in the documentation. I will create a separate issue for that.

For now: Threshold: used to detect spikes. For a spike to be detected, the voltage should cross the threshold, and go back below the threshold afterwards. DerivateThreshold: Used to detect the beginning of a spike (after the Threshold was used to detect the spike as a whole). Once the dV/dt crosses this threshold for 3 time point (in the interval starting from previous AHP and tip of spike), the beginning of the spike is set there.

SvennoNito commented 6 years ago

Hey, thanks for the explanation, that helps a lot! I will try that later, maybe that will change my problem already. Nevertheless: do you know whether the other paramters (e.g. spike_skipf) are explained somewhere, too?

wvangeit commented 6 years ago

No, that's not there either. A quick summary:

interp_step: before the eFEL runs the feature extraction it first interpolates the traces, this is the interpolation interval (default: 0.1 ms)

strict_stiminterval: if set to 1: make sure all features are extracted 'only' inside the stimulus interval (for. e.g. spikes outside stiminterval are not included).

min_spike_height: not used (only used in old feature that is not accesible through the python api anymore)

spike_skipf: the fraction of the stimulus interval to skip for features ISI log slope and adaptation index (this is to avoid the burst at the beginning of a trace)

max_spike_skip: maximum number of spikes to skip by spike_skipf.

burst_factor: if an ISI is larger that burst_factor * dMedian, a new burst is started during burst detection. dMedian is a rolling median of the ISIs in a burst.

voltage_base_start_perc: voltage_base is the average of the voltage before the stimulus. This value is the percentage of this interval the average calculate starts

voltage_base_end_perc: same as above, but the end. So the default interval to calculate voltage_base is 90 -> 100 % of interval before stimulus

initial_perc: used in feature "number_initial_spikes". It's the fraction of the stimulus interval to calculate spikes for this feature

SvennoNito commented 6 years ago

Amazing thank you! I managed to handle the spike detection pretty well by changing the threshold value, thanks so much for the explanation. Do you by chance know the default value of "DerivateThreshold" ?

wvangeit commented 6 years ago

This values are defined here: https://github.com/BlueBrain/eFEL/blob/master/efel/settings.py#L40 So it's 10 (mV/ms)