|
44 | 44 | from packaging import version |
45 | 45 |
|
46 | 46 | import spikeglx |
47 | | -import neurodsp.utils |
| 47 | +import ibldsp.utils |
48 | 48 | import one.alf.io as alfio |
49 | 49 | from iblutil.util import Bunch |
50 | 50 | from iblutil.spacer import Spacer |
@@ -160,11 +160,11 @@ def _sync_to_alf(raw_ephys_apfile, output_path=None, save=False, parts=''): |
160 | 160 | file_ftcp = Path(output_path).joinpath(f'fronts_times_channel_polarity{uuid.uuid4()}.bin') |
161 | 161 |
|
162 | 162 | # loop over chunks of the raw ephys file |
163 | | - wg = neurodsp.utils.WindowGenerator(sr.ns, int(SYNC_BATCH_SIZE_SECS * sr.fs), overlap=1) |
| 163 | + wg = ibldsp.utils.WindowGenerator(sr.ns, int(SYNC_BATCH_SIZE_SECS * sr.fs), overlap=1) |
164 | 164 | fid_ftcp = open(file_ftcp, 'wb') |
165 | 165 | for sl in wg.slice: |
166 | 166 | ss = sr.read_sync(sl) |
167 | | - ind, fronts = neurodsp.utils.fronts(ss, axis=0) |
| 167 | + ind, fronts = ibldsp.utils.fronts(ss, axis=0) |
168 | 168 | # a = sr.read_sync_analog(sl) |
169 | 169 | sav = np.c_[(ind[0, :] + sl.start) / sr.fs, ind[1, :], fronts.astype(np.double)] |
170 | 170 | sav.tofile(fid_ftcp) |
@@ -775,7 +775,7 @@ def _extract(self, sync=None, chmap=None, sync_collection='raw_ephys_data', |
775 | 775 | bpod_start = self.bpod_trials['intervals'][:, 0] |
776 | 776 | if len(t_trial_start) > len(bpod_start) / 2: # if least half the trial start TTLs detected |
777 | 777 | _logger.warning('Attempting to get protocol period from aligning trial start TTLs') |
778 | | - fcn, *_ = neurodsp.utils.sync_timestamps(bpod_start, t_trial_start) |
| 778 | + fcn, *_ = ibldsp.utils.sync_timestamps(bpod_start, t_trial_start) |
779 | 779 | buffer = 2.5 # the number of seconds to include before/after task |
780 | 780 | start, end = fcn(self.bpod_trials['intervals'].flat[[0, -1]]) |
781 | 781 | tmin = min(sync['times'][0], start - buffer) |
@@ -1202,7 +1202,7 @@ def sync_bpod_clock(bpod_trials, fpga_trials, sync_field): |
1202 | 1202 | bpod_fpga_timestamps[i] = trials[sync_field] |
1203 | 1203 |
|
1204 | 1204 | # Sync the two timestamps |
1205 | | - fcn, drift, ibpod, ifpga = neurodsp.utils.sync_timestamps(*bpod_fpga_timestamps, return_indices=True) |
| 1205 | + fcn, drift, ibpod, ifpga = ibldsp.utils.sync_timestamps(*bpod_fpga_timestamps, return_indices=True) |
1206 | 1206 |
|
1207 | 1207 | # If it's drifting too much throw warning or error |
1208 | 1208 | _logger.info('N trials: %i bpod, %i FPGA, %i merged, sync %.5f ppm', |
|
0 commit comments