diff --git a/efel/DependencyV5.txt b/efel/DependencyV5.txt index 75b2928..af4fda5 100644 --- a/efel/DependencyV5.txt +++ b/efel/DependencyV5.txt @@ -1,22 +1,22 @@ -LibV1:peak_indices #LibV1:interpolate +LibV5:peak_indices #LibV1:interpolate LibV1:trace_check #LibV1:peak_time LibV1:ISI_values #LibV1:peak_time LibV1:doublet_ISI #LibV1:peak_time -LibV1:peak_voltage #LibV1:peak_indices -LibV1:burst_ISI_indices #LibV1:peak_indices #LibV1:ISI_values +LibV1:peak_voltage #LibV5:peak_indices +LibV1:burst_ISI_indices #LibV5:peak_indices #LibV1:ISI_values LibV1:mean_frequency #LibV1:peak_time -LibV1:peak_time #LibV1:peak_indices +LibV1:peak_time #LibV5:peak_indices LibV1:time_to_first_spike #LibV1:peak_time LibV1:adaptation_index #LibV1:peak_time LibV1:adaptation_index2 #LibV1:peak_time LibV1:spike_width2 #LibV5:min_AHP_indices -LibV1:AP_width #LibV1:peak_indices #LibV5:min_AHP_indices +LibV1:AP_width #LibV5:peak_indices #LibV5:min_AHP_indices LibV1:burst_mean_freq #LibV1:burst_ISI_indices #LibV1:peak_time LibV1:burst_number #LibV1:burst_mean_freq LibV1:interburst_voltage #LibV1:burst_ISI_indices LibV1:AP_height #LibV1:peak_voltage LibV1:AP_amplitude #LibV5:AP_begin_indices #LibV1:peak_voltage #LibV1:peak_time -LibV1:AHP_depth_abs_slow #LibV1:peak_indices +LibV1:AHP_depth_abs_slow #LibV5:peak_indices LibV1:AHP_slow_time #LibV1:AHP_depth_abs_slow LibV1:time_constant LibV1:voltage_deflection @@ -30,18 +30,18 @@ LibV1:threshold_current LibV1:steady_state_voltage LibV3:depolarized_base LibV1:ISI_CV #LibV1:ISI_values -LibV1:Spikecount #LibV1:peak_indices +LibV1:Spikecount #LibV5:peak_indices LibV5:Spikecount_stimint #LibV1:peak_time LibV1:AHP_depth #LibV5:voltage_base #LibV5:min_AHP_values -LibV2:AP_rise_indices #LibV1:peak_indices #LibV5:AP_begin_indices -LibV2:AP_end_indices #LibV1:peak_indices -LibV2:AP_fall_indices #LibV1:peak_indices #LibV5:AP_begin_indices #LibV2:AP_end_indices +LibV2:AP_rise_indices #LibV5:peak_indices #LibV5:AP_begin_indices +LibV2:AP_end_indices #LibV5:peak_indices +LibV2:AP_fall_indices #LibV5:peak_indices #LibV5:AP_begin_indices #LibV2:AP_end_indices LibV2:AP_duration #LibV5:AP_begin_indices #LibV2:AP_end_indices LibV2:AP_duration_half_width #LibV2:AP_rise_indices #LibV2:AP_fall_indices -LibV2:AP_rise_time #LibV5:AP_begin_indices #LibV1:peak_indices -LibV2:AP_fall_time #LibV1:peak_indices #LibV2:AP_end_indices -LibV2:AP_rise_rate #LibV5:AP_begin_indices #LibV1:peak_indices -LibV2:AP_fall_rate #LibV1:peak_indices #LibV2:AP_end_indices +LibV2:AP_rise_time #LibV5:AP_begin_indices #LibV5:peak_indices +LibV2:AP_fall_time #LibV5:peak_indices #LibV2:AP_end_indices +LibV2:AP_rise_rate #LibV5:AP_begin_indices #LibV5:peak_indices +LibV2:AP_fall_rate #LibV5:peak_indices #LibV2:AP_end_indices LibV2:fast_AHP #LibV5:AP_begin_indices #LibV5:min_AHP_indices LibV2:AP_amplitude_change #LibV1:AP_amplitude LibV2:AP_duration_change #LibV2:AP_duration @@ -91,7 +91,7 @@ LibV5:ISI_log_slope #LibV1:ISI_values LibV5:ISI_semilog_slope #LibV1:ISI_values LibV5:ISI_log_slope_skip #LibV1:ISI_values LibV1:AHP_depth_diff #LibV1:AHP_depth -LibV5:min_AHP_indices #LibV1:peak_indices +LibV5:min_AHP_indices #LibV5:peak_indices LibV5:min_AHP_values #LibV5:min_AHP_indices LibV5:number_initial_spikes #LibV1:peak_time LibV5:irregularity_index #LibV1:ISI_values @@ -104,8 +104,8 @@ LibV5:AP2_AP1_diff #LibV1:AP_amplitude LibV5:AP2_AP1_peak_diff #LibV1:peak_voltage LibV5:AP1_width #LibV5:spike_half_width LibV5:AP2_width #LibV5:spike_half_width -LibV5:AHP_depth_from_peak #LibV1:peak_indices #LibV5:min_AHP_indices -LibV5:AHP_time_from_peak #LibV1:peak_indices #LibV5:min_AHP_indices +LibV5:AHP_depth_from_peak #LibV5:peak_indices #LibV5:min_AHP_indices +LibV5:AHP_time_from_peak #LibV5:peak_indices #LibV5:min_AHP_indices LibV5:AHP1_depth_from_peak #LibV5:AHP_depth_from_peak LibV5:AHP2_depth_from_peak #LibV5:AHP_depth_from_peak LibV5:time_to_second_spike #LibV1:peak_time @@ -117,7 +117,7 @@ LibV5:inv_fourth_ISI #LibV5:all_ISI_values LibV5:inv_fifth_ISI #LibV5:all_ISI_values LibV5:inv_last_ISI #LibV5:all_ISI_values LibV5:inv_time_to_first_spike #LibV1:time_to_first_spike -LibV5:spike_half_width #LibV5:min_AHP_indices #LibV1:peak_indices +LibV5:spike_half_width #LibV5:min_AHP_indices #LibV5:peak_indices LibV5:AP_begin_indices #LibV5:min_AHP_indices LibV5:AHP_depth_abs #LibV5:min_AHP_values LibV5:AP_begin_width #LibV5:min_AHP_indices #LibV5:AP_begin_indices @@ -143,7 +143,7 @@ LibV5:BAC_width #LibV1:AP_width;location_epsp LibV5:BAC_maximum_voltage #LibV1:maximum_voltage;location_epsp LibV5:all_ISI_values #LibV1:peak_time LibV5:AP_amplitude_from_voltagebase #LibV5:voltage_base #LibV1:peak_voltage -LibV5:min_voltage_between_spikes #LibV1:peak_indices +LibV5:min_voltage_between_spikes #LibV5:peak_indices LibV5:voltage LibV5:steady_state_voltage_stimend LibV5:voltage_base diff --git a/efel/api.py b/efel/api.py index 1d5534a..1661bc3 100644 --- a/efel/api.py +++ b/efel/api.py @@ -77,6 +77,7 @@ def reset(): setDoubleSetting('voltage_base_end_perc', 1.0) setDoubleSetting("initial_perc", 0.1) setDoubleSetting("min_spike_height", 20.0) + setIntSetting("strict_stiminterval", 0) _initialise() diff --git a/efel/cppcore/FillFptrTable.cpp b/efel/cppcore/FillFptrTable.cpp index bcfb56b..035a897 100644 --- a/efel/cppcore/FillFptrTable.cpp +++ b/efel/cppcore/FillFptrTable.cpp @@ -256,6 +256,8 @@ int FillFptrTable() { &LibV5::maximum_voltage_from_voltagebase; FptrTableV5["Spikecount_stimint"] = &LibV5::Spikecount_stimint; + FptrTableV5["peak_indices"] = &LibV5::peak_indices; + //****************** end of FptrTableV5 ***************************** return 1; diff --git a/efel/cppcore/LibV5.cpp b/efel/cppcore/LibV5.cpp index 8036467..3790f08 100644 --- a/efel/cppcore/LibV5.cpp +++ b/efel/cppcore/LibV5.cpp @@ -19,6 +19,7 @@ #include "LibV5.h" #include "Utils.h" +#include #include #include #include @@ -27,7 +28,6 @@ #include #include - using std::bind2nd; using std::greater_equal; @@ -67,14 +67,12 @@ static int __ISI_log_slope(const vector& isiValues, } } - if (x.size() == 0 || log_isivalues.size() == 0) - return -1; + if (x.size() == 0 || log_isivalues.size() == 0) return -1; linear_fit_result fit; fit = slope_straight_line_fit(x, log_isivalues); - if (fit.slope == 0. || is_nan(fit.slope)) - return -1; + if (fit.slope == 0. || is_nan(fit.slope)) return -1; slope.push_back(fit.slope); @@ -218,7 +216,8 @@ int LibV5::time_to_last_spike(mapStr2intVec& IntFeatureData, setDoubleVec(DoubleFeatureData, StringData, "time_to_last_spike", last_spike); } else { - retVal = getDoubleVec(DoubleFeatureData, StringData, "stim_start", stimstart); + retVal = + getDoubleVec(DoubleFeatureData, StringData, "stim_start", stimstart); if (retVal <= 0) return -1; last_spike.push_back(peaktime[peaktime.size() - 1] - stimstart[0]); setDoubleVec(DoubleFeatureData, StringData, "time_to_last_spike", @@ -418,7 +417,8 @@ int LibV5::min_AHP_indices(mapStr2intVec& IntFeatureData, vector t; retVal = getDoubleVec(DoubleFeatureData, StringData, "V", v); if (retVal <= 0) return -1; - retVal = getIntVec(IntFeatureData, StringData, "peak_indices", peak_indices_plus); + retVal = + getIntVec(IntFeatureData, StringData, "peak_indices", peak_indices_plus); if (retVal < 1) { GErrorStr += "\n At least one spike required for calculation of " @@ -532,9 +532,11 @@ int LibV5::spike_width1(mapStr2intVec& IntFeatureData, if (retVal < 0) return -1; retVal = getDoubleVec(DoubleFeatureData, StringData, "T", t); if (retVal < 0) return -1; - retVal = getDoubleVec(DoubleFeatureData, StringData, "stim_start", stim_start); + retVal = + getDoubleVec(DoubleFeatureData, StringData, "stim_start", stim_start); if (retVal < 0) return -1; - retVal = getIntVec(IntFeatureData, StringData, "min_AHP_indices", minAHPIndex); + retVal = + getIntVec(IntFeatureData, StringData, "min_AHP_indices", minAHPIndex); if (retVal < 0) return -1; retVal = getIntVec(IntFeatureData, StringData, "peak_indices", PeakIndex); if (retVal < 0) return -1; @@ -817,7 +819,8 @@ int LibV5::AP1_peak(mapStr2intVec& IntFeatureData, if (retVal) return nSize; vector peak_voltage, AP1_peak; - retVal = getDoubleVec(DoubleFeatureData, StringData, "peak_voltage", peak_voltage); + retVal = + getDoubleVec(DoubleFeatureData, StringData, "peak_voltage", peak_voltage); if (retVal < 1) { setDoubleVec(DoubleFeatureData, StringData, "AP1_peak", AP1_peak); return 0; @@ -861,7 +864,8 @@ int LibV5::AP2_peak(mapStr2intVec& IntFeatureData, if (retVal) return nSize; vector peak_voltage, AP2_peak; - retVal = getDoubleVec(DoubleFeatureData, StringData, "peak_voltage", peak_voltage); + retVal = + getDoubleVec(DoubleFeatureData, StringData, "peak_voltage", peak_voltage); if (retVal < 2) { setDoubleVec(DoubleFeatureData, StringData, "AP2_peak", AP2_peak); return 0; @@ -998,7 +1002,8 @@ int LibV5::AHP_time_from_peak(mapStr2intVec& IntFeatureData, if (retval < 0) return -1; vector minAHPIndices; - retval = getIntVec(IntFeatureData, StringData, "min_AHP_indices", minAHPIndices); + retval = + getIntVec(IntFeatureData, StringData, "min_AHP_indices", minAHPIndices); if (retval < 0) return -1; vector ahpTimeFromPeak; @@ -1042,11 +1047,13 @@ int LibV5::AHP_depth_from_peak(mapStr2intVec& IntFeatureData, if (retval < 0) return -1; vector minAHPIndices; - retval = getIntVec(IntFeatureData, StringData, "min_AHP_indices", minAHPIndices); + retval = + getIntVec(IntFeatureData, StringData, "min_AHP_indices", minAHPIndices); if (retval < 0) return -1; vector ahpDepthFromPeak; - retval = __AHP_depth_from_peak(V, peakIndices, minAHPIndices, ahpDepthFromPeak); + retval = + __AHP_depth_from_peak(V, peakIndices, minAHPIndices, ahpDepthFromPeak); if (retval >= 0) { setDoubleVec(DoubleFeatureData, StringData, "AHP_depth_from_peak", ahpDepthFromPeak); @@ -1151,7 +1158,8 @@ int LibV5::AP_begin_width(mapStr2intVec& IntFeatureData, if (retVal < 0) return -1; retVal = getDoubleVec(DoubleFeatureData, StringData, "T", t); if (retVal < 0) return -1; - retVal = getIntVec(IntFeatureData, StringData, "min_AHP_indices", minAHPIndex); + retVal = + getIntVec(IntFeatureData, StringData, "min_AHP_indices", minAHPIndex); if (retVal < 0) return -1; retVal = getIntVec(IntFeatureData, StringData, "AP_begin_indices", AP_begin_indices); @@ -1442,7 +1450,8 @@ int LibV5::is_not_stuck(mapStr2intVec& IntFeatureData, vector stim_end; retval = getDoubleVec(DoubleFeatureData, StringData, "peak_time", peak_time); if (retval < 0) return -1; - retval = getDoubleVec(DoubleFeatureData, StringData, "stim_start", stim_start); + retval = + getDoubleVec(DoubleFeatureData, StringData, "stim_start", stim_start); if (retval < 0) return -1; retval = getDoubleVec(DoubleFeatureData, StringData, "stim_end", stim_end); if (retval < 0) return -1; @@ -1510,7 +1519,8 @@ int LibV5::mean_AP_amplitude(mapStr2intVec& IntFeatureData, if (retVal > 0) return nSize; vector AP_amplitude; - retVal = getDoubleVec(DoubleFeatureData, StringData, "AP_amplitude", AP_amplitude); + retVal = + getDoubleVec(DoubleFeatureData, StringData, "AP_amplitude", AP_amplitude); if (retVal < 0) { GErrorStr += "Error calculating AP_amplitude for mean_AP_amplitude"; @@ -1939,7 +1949,8 @@ int LibV5::AP_amplitude_from_voltagebase(mapStr2intVec& IntFeatureData, } else { voltage_base = voltage_base_vec[0]; } - retVal = getDoubleVec(DoubleFeatureData, StringData, "peak_voltage", peakvoltage); + retVal = + getDoubleVec(DoubleFeatureData, StringData, "peak_voltage", peakvoltage); if (retVal <= 0) { GErrorStr += "Error calculating peak_voltage for AP_amplitude_from_voltagebase"; @@ -2203,7 +2214,8 @@ int LibV5::decay_time_constant_after_stim(mapStr2intVec& IntFeatureData, decay_start_after_stim = 1.0; } - retVal = getDoubleVec(DoubleFeatureData, StringData, "decay_end_after_stim", vect); + retVal = + getDoubleVec(DoubleFeatureData, StringData, "decay_end_after_stim", vect); if (retVal == 1) { decay_end_after_stim = vect[0]; } else { @@ -2240,7 +2252,8 @@ int LibV5::voltage_deflection_vb_ssse(mapStr2intVec& IntFeatureData, if (retVal) return nSize; vector voltage_base; - retVal = getDoubleVec(DoubleFeatureData, StringData, "voltage_base", voltage_base); + retVal = + getDoubleVec(DoubleFeatureData, StringData, "voltage_base", voltage_base); if (retVal <= 0) return -1; vector steady_state_voltage_stimend; @@ -2273,9 +2286,9 @@ int LibV5::ohmic_input_resistance_vb_ssse(mapStr2intVec& IntFeatureData, if (retVal) return nSize; vector voltage_deflection_vb_ssse; - retVal = getDoubleVec(DoubleFeatureData, StringData, - "voltage_deflection_vb_ssse", - voltage_deflection_vb_ssse); + retVal = + getDoubleVec(DoubleFeatureData, StringData, "voltage_deflection_vb_ssse", + voltage_deflection_vb_ssse); if (retVal <= 0) return -1; vector stimulus_current; retVal = getDoubleVec(DoubleFeatureData, StringData, "stimulus_current", @@ -2309,7 +2322,8 @@ int LibV5::maximum_voltage_from_voltagebase(mapStr2intVec& IntFeatureData, if (retVal <= 0) return -1; vector voltage_base; - retVal = getDoubleVec(DoubleFeatureData, StringData, "voltage_base", voltage_base); + retVal = + getDoubleVec(DoubleFeatureData, StringData, "voltage_base", voltage_base); if (retVal <= 0) return -1; vector maximum_voltage_from_voltagebase; @@ -2325,8 +2339,7 @@ int LibV5::maximum_voltage_from_voltagebase(mapStr2intVec& IntFeatureData, } struct InInterval { - InInterval(double lower, double upper) - : lower(lower), upper(upper) {} + InInterval(double lower, double upper) : lower(lower), upper(upper) {} bool operator()(double value) { return ((value >= lower) && (value <= upper)); } @@ -2352,16 +2365,16 @@ int LibV5::Spikecount_stimint(mapStr2intVec& IntFeatureData, vector stimstart; retval = getDoubleVec(DoubleFeatureData, StringData, "stim_start", stimstart); if (retval <= 0) { - GErrorStr += "\nSpikecount_stimint: stim_start not found\n"; - return -1; + GErrorStr += "\nSpikecount_stimint: stim_start not found\n"; + return -1; } // Get stimulus end vector stimend; retval = getDoubleVec(DoubleFeatureData, StringData, "stim_end", stimend); if (retval <= 0) { - GErrorStr += "\nSpikecount_stimint: stim_start not found\n"; - return -1; + GErrorStr += "\nSpikecount_stimint: stim_start not found\n"; + return -1; } // Get the times of the peaks @@ -2369,18 +2382,131 @@ int LibV5::Spikecount_stimint(mapStr2intVec& IntFeatureData, retval = getDoubleVec(DoubleFeatureData, StringData, "peak_time", peaktimes); if (retval < 0) { - GErrorStr += "\nSpikecount_stimint: peak_time failed\n"; + GErrorStr += "\nSpikecount_stimint: peak_time failed\n"; return -1; } else { - // Get the number of peaks between stim start and end - spikecount_stimint_value = count_if(peaktimes.begin(), peaktimes.end(), - InInterval(stimstart[0], stimend[0])); - + // Get the number of peaks between stim start and end + spikecount_stimint_value = count_if(peaktimes.begin(), peaktimes.end(), + InInterval(stimstart[0], stimend[0])); - vector spikecount_stimint(1, spikecount_stimint_value); - setIntVec(IntFeatureData, StringData, "Spikecount_stimint", - spikecount_stimint); - return 1; + vector spikecount_stimint(1, spikecount_stimint_value); + setIntVec(IntFeatureData, StringData, "Spikecount_stimint", + spikecount_stimint); + return 1; } } // end of Spikecount_stimint + +static int __peak_indices(double threshold, vector& V, + vector& t, vector& PeakIndex, + bool strict_stiminterval, double stim_start, + double stim_end) { + vector upVec, dnVec; + double dtmp; + int itmp; + + for (unsigned i = 1; i < V.size(); i++) { + if (V[i] > threshold && V[i - 1] < threshold) { + upVec.push_back(i); + } else if (V[i] < threshold && V[i - 1] > threshold) { + dnVec.push_back(i); + } + } + if (dnVec.size() == 0) { + GErrorStr += + "\nVoltage never goes below or above threshold in spike detection.\n"; + return 0; + } + + if (dnVec.size() != upVec.size()) { + GErrorStr += "\nVoltage never goes below threshold after last spike.\n"; + return 0; + } + + PeakIndex.clear(); + int j = 0; + for (unsigned i = 0; i < upVec.size(); i++) { + dtmp = -1e9; + itmp = -1; + for (j = upVec[i]; j <= dnVec[i]; j++) { + if (dtmp < V[j]) { + dtmp = V[j]; + itmp = j; + } + } + if (itmp != -1) { + if (strict_stiminterval) { + EFEL_ASSERT(itmp < t.size(), "peak_time falls outside of time array"); + EFEL_ASSERT(itmp >= 0, "peak_time is negative"); + if (t[itmp] >= stim_start && t[itmp] <= stim_end) { + PeakIndex.push_back(itmp); + } + } else { + PeakIndex.push_back(itmp); + } + } + } + return PeakIndex.size(); +} + +int LibV5::peak_indices(mapStr2intVec& IntFeatureData, + mapStr2doubleVec& DoubleFeatureData, + mapStr2Str& StringData) { + int retVal, nSize; + + retVal = CheckInIntmap(IntFeatureData, StringData, "peak_indices", nSize); + if (retVal) return nSize; + + vector PeakIndex, strict_stiminterval_vec; + vector v, t, threshold, stim_start_vec, stim_end_vec; + bool strict_stiminterval = false; + double stim_start = 0.0, stim_end = 0.0; + + retVal = getDoubleVec(DoubleFeatureData, StringData, "V", v); + if (retVal <= 0) { + return -1; + } + + retVal = getDoubleVec(DoubleFeatureData, StringData, "T", t); + if (retVal <= 0) { + return -1; + } + + retVal = getDoubleParam(DoubleFeatureData, "Threshold", threshold); + if (retVal <= 0) { + return -1; + } + + retVal = getIntParam(IntFeatureData, "strict_stiminterval", + strict_stiminterval_vec); + if (retVal <= 0) { + strict_stiminterval = false; + } else { + strict_stiminterval = bool(strict_stiminterval_vec[0]); + } + + retVal = + getDoubleVec(DoubleFeatureData, StringData, "stim_start", stim_start_vec); + if (retVal <= 0) { + return -1; + } else { + stim_start = stim_start_vec[0]; + } + + retVal = + getDoubleVec(DoubleFeatureData, StringData, "stim_end", stim_end_vec); + if (retVal <= 0) { + return -1; + } else { + stim_end = stim_end_vec[0]; + } + + int retval = __peak_indices(threshold[0], v, t, PeakIndex, + strict_stiminterval, stim_start, stim_end); + + if (retval >= 0) { + setIntVec(IntFeatureData, StringData, "peak_indices", PeakIndex); + } + + return retval; +} diff --git a/efel/cppcore/LibV5.h b/efel/cppcore/LibV5.h index e4c030f..a75d8ae 100644 --- a/efel/cppcore/LibV5.h +++ b/efel/cppcore/LibV5.h @@ -214,5 +214,8 @@ int maximum_voltage_from_voltagebase(mapStr2intVec& IntFeatureData, int Spikecount_stimint(mapStr2intVec& IntFeatureData, mapStr2doubleVec& DoubleFeatureData, mapStr2Str& StringData); +int peak_indices(mapStr2intVec& IntFeatureData, + mapStr2doubleVec& DoubleFeatureData, + mapStr2Str& StringData); } #endif diff --git a/efel/tests/test_basic.py b/efel/tests/test_basic.py index af9cce3..420c09a 100644 --- a/efel/tests/test_basic.py +++ b/efel/tests/test_basic.py @@ -449,6 +449,73 @@ def test_zero_ISI_log_slope_skip(): nt.assert_equal(feature_values[0]['ISI_log_slope_skip'], None) +def test_peak_indices(): + """basic: Test peak_indices""" + + import efel + efel.reset() + + stim_start = 650.0 + stim_end = 900.0 + + time = efel.io.load_fragment('%s#col=1' % meanfrequency1_url) + voltage = efel.io.load_fragment('%s#col=2' % meanfrequency1_url) + trace = {} + + trace['T'] = time + trace['V'] = voltage + trace['stim_start'] = [stim_start] + trace['stim_end'] = [stim_end] + + features = ['peak_indices'] + + feature_values = \ + efel.getFeatureValues( + [trace], + features, raise_warnings=False) + + peak_indices = feature_values[0]['peak_indices'] + + nt.assert_equal(len(peak_indices), 5) + + +def test_strict_stiminterval(): + """basic: Test strict_stiminterval""" + + import efel + + for strict, n_of_spikes in [(False, 5), (True, 3)]: + efel.reset() + efel.setIntSetting("strict_stiminterval", strict) + + stim_start = 600.0 + stim_end = 750.0 + + time = efel.io.load_fragment('%s#col=1' % meanfrequency1_url) + voltage = efel.io.load_fragment('%s#col=2' % meanfrequency1_url) + trace = {} + + trace['T'] = time + trace['V'] = voltage + trace['stim_start'] = [stim_start] + trace['stim_end'] = [stim_end] + + features = ['peak_indices', 'peak_time', 'Spikecount'] + + feature_values = \ + efel.getFeatureValues( + [trace], + features, raise_warnings=False) + + peak_indices = feature_values[0]['peak_indices'] + peak_time = feature_values[0]['peak_time'] + spikecount = feature_values[0]['Spikecount'] + + nt.assert_equal(len(peak_indices), n_of_spikes) + nt.assert_equal(len(peak_time), n_of_spikes) + nt.assert_equal(spikecount, n_of_spikes) + + def test_ISI_log_slope(): """basic: Test ISI_log_slope"""