Skip to content

Commit

Permalink
new test set
Browse files Browse the repository at this point in the history
  • Loading branch information
GaelleChapuis committed Jun 7, 2023
1 parent 2a187c8 commit 4531826
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/neurodsp/waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def find_tip_trough(arr_peak, arr_peak_real, df):
df_rows = df_rows.drop(['trough_time_idx', 'trough_val'], axis=1)
# Create mini arr_peak for those rows uniquely (take the real waveforms value in, not inverted ones)
arr_peak_rows = arr_peak_real[df_index, :]
# Place into "inverted" array peak for return
arr_peak[df_index, :] = arr_peak_rows
# Get new sign for the peak
arr_peak_rows, df_rows = invert_peak_waveform(arr_peak_rows, df_rows)
# New trough
Expand All @@ -210,7 +212,7 @@ def find_tip_trough(arr_peak, arr_peak_real, df):
# Find tip
df = find_tip(arr_peak, df)

return df
return df, arr_peak


def plot_peaktiptrough(df, arr, ax, nth_wav=0, plot_grey=True):
Expand Down Expand Up @@ -479,7 +481,7 @@ def compute_spike_features(arr_in, fs=30000, recovery_duration_ms=0.16, return_p
# Invert positive spikes
arr_peak, df = invert_peak_waveform(arr_peak_real.copy(), df) # Copy otherwise overwrite the variable in memory
# Tip-trough (this also computes the peak_to_trough_ratio)
df = find_tip_trough(arr_peak, arr_peak_real, df)
df, arr_peak = find_tip_trough(arr_peak, arr_peak_real, df)
# Peak to trough duration
df = peak_to_trough_duration(df, fs=30000)
# Half peak points
Expand Down
Binary file modified src/tests/unit/cpu/fixtures/waveform_sample/test_arr_in.npy
Binary file not shown.
Binary file modified src/tests/unit/cpu/fixtures/waveform_sample/test_arr_peak.npy
Binary file not shown.
12 changes: 7 additions & 5 deletions src/tests/unit/cpu/fixtures/waveform_sample/test_df.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
,peak_trace_idx,peak_time_idx,peak_val,invert_sign_peak,trough_time_idx,trough_val,tip_time_idx,tip_val,half_peak_post_time_idx,half_peak_pre_time_idx,half_peak_post_val,half_peak_pre_val,half_peak_duration,recovery_time_idx,recovery_val,depolarisation_slope,repolarisation_slope,recovery_slope
0,20,44,-4.883662,1.0,54,1.2735074,24,0.77733666,47,40,-1.9125216,-1.7436237,0.00023333333333333333,59,0.98473907,-8491.498231887817,18471.508026123047,-1732.609748840332
1,20,45,5.153482,-1.0,69,-1.0805972,41,-2.9835296,49,43,2.1435728,2.3065486,0.0002,74,-0.9415057,61027.586460113525,-7792.599201202393,834.5489501953125
2,20,44,-4.48732,1.0,54,1.5353007,39,0.71306074,48,42,-1.6273819,-2.058325,0.0002,59,0.7605876,-31202.284812927246,18067.862033843994,-4648.2789516448975
3,20,40,1.8537197,-1.0,61,-0.49219757,23,-0.66024184,46,38,0.7720857,0.6908671,0.0002666666666666667,66,-0.35654825,4436.402741600485,-3351.310321262905,813.8959407806396
,peak_trace_idx,peak_time_idx,peak_val,invert_sign_peak,trough_time_idx,trough_val,peak_to_trough_ratio,peak_to_trough_ratio_log,tip_time_idx,tip_val,peak_to_trough_duration,half_peak_post_time_idx,half_peak_pre_time_idx,half_peak_post_val,half_peak_pre_val,half_peak_duration,recovery_time_idx,recovery_val,depolarisation_slope,repolarisation_slope,recovery_slope
0,20,44,-4.883662,1.0,54,1.2735074,3.8348126,1.3441206,24,0.77733666,0.0003333333333333333,47,40,-1.9125216,-1.7436237,0.00023333333333333333,59,0.98473907,-8491.498231887817,18471.508026123047,-1732.609748840332
1,20,45,5.153482,-1.0,69,-1.0805972,4.7691054,1.5621588,41,-2.9835296,0.0008,49,43,2.1435728,2.3065486,0.0002,74,-0.9415057,61027.586460113525,-7792.599201202393,834.5489501953125
2,20,44,-4.48732,1.0,54,1.5353007,2.9227629,1.0725293,39,0.71306074,0.0003333333333333333,48,42,-1.6273819,-2.058325,0.0002,59,0.7605876,-31202.284812927246,18067.862033843994,-4648.2789516448975
3,20,40,1.8537197,-1.0,61,-0.49219757,3.7662106,1.3260694,23,-0.66024184,0.0007,46,38,0.7720857,0.6908671,0.0002666666666666667,66,-0.35654825,4436.402741600485,-3351.310321262905,813.8959407806396
4,19,48,-2.7637115,1.0,65,1.1901706,2.3221135,0.8424778,38,3.0702133,0.0005666666666666667,54,45,-1.362757,-1.3184559,0.0003,70,0.39087203,-17501.774311065674,6977.4392071892225,-4795.791864395142
5,19,45,-2.240881,1.0,63,0.5131445,4.366959,1.474067,39,2.18663,0.0006,50,43,-0.93143564,-0.93315697,0.00023333333333333333,68,0.26503378,-22137.556076049805,4590.042432149252,-1488.6642694473267
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
1,T00500,da8dfec1-d265-44e8-84ce-6ae9c109b8bd,11
0,T00500,1a276285-8b0e-4cc9-9f0a-a3a002978724,1
1,T00500,1a276285-8b0e-4cc9-9f0a-a3a002978724,2
0,T00500,5d570bf6-a4c6-4bf1-a14b-2c878c84ef0e,10
1,T00500,5d570bf6-a4c6-4bf1-a14b-2c878c84ef0e,11

0 comments on commit 4531826

Please sign in to comment.