@@ -79,7 +79,8 @@ def load_weather_data(filename):
7979"""
8080
8181
82- def load_sabes_data (filename , bin_width_s = .05 , preprocess = True ):
82+ def load_sabes_data (filename , bin_width_s = .05 , high_pass = True , sqrt = True , thresh = 5000 ,
83+ zscore_pos = True ):
8384 # Load MATLAB file
8485 with h5py .File (filename , "r" ) as f :
8586 # Get channel names (e.g. M1 001 or S1 001)
@@ -119,10 +120,10 @@ def load_sabes_data(filename, bin_width_s=.05, preprocess=True):
119120 unique_idxs , counts = np .unique (bin_idx , return_counts = True )
120121 # make sure to ignore the hash here...
121122 binned_spikes [unique_idxs , chan_idx * n_sorted_units + unit_idx - 1 ] += counts
122- binned_spikes = binned_spikes [:, binned_spikes .sum (axis = 0 ) > 0 ]
123- if preprocess :
124- binned_spikes = binned_spikes [:, binned_spikes .sum (axis = 0 ) > 5000 ]
123+ binned_spikes = binned_spikes [:, binned_spikes .sum (axis = 0 ) > thresh ]
124+ if sqrt :
125125 binned_spikes = np .sqrt (binned_spikes )
126+ if high_pass :
126127 binned_spikes = moving_center (binned_spikes , n = 600 )
127128 result [region ] = binned_spikes
128129 # Get cursor position
@@ -131,7 +132,7 @@ def load_sabes_data(filename, bin_width_s=.05, preprocess=True):
131132 t_mid_bin = np .arange (len (binned_spikes )) * bin_width_s + bin_width_s / 2
132133 cursor_pos_interp = interp1d (t - t [0 ], cursor_pos , axis = 0 )
133134 cursor_interp = cursor_pos_interp (t_mid_bin )
134- if preprocess :
135+ if zscore_pos :
135136 cursor_interp -= cursor_interp .mean (axis = 0 , keepdims = True )
136137 cursor_interp /= cursor_interp .std (axis = 0 , keepdims = True )
137138 result ["cursor" ] = cursor_interp
0 commit comments