Skip to content

Commit 160ed6a

Browse files
chris-langfieldchris-langfield
andauthored
drop in ibldsp (#729)
Co-authored-by: chris-langfield <[email protected]>
1 parent ad00f63 commit 160ed6a

File tree

20 files changed

+32
-32
lines changed

20 files changed

+32
-32
lines changed

brainbox/behavior/dlc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import scipy.interpolate as interpolate
1010
from scipy.stats import zscore
1111

12-
from neurodsp.smooth import smooth_interpolate_savgol
12+
from ibldsp.smooth import smooth_interpolate_savgol
1313
from iblutil.numerical import bincount2D
1414
import brainbox.behavior.wheel as bbox_wheel
1515

brainbox/metrics/electrode_drift.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import numpy as np
22

3-
from neurodsp import smooth, utils, fourier
3+
from ibldsp import smooth, utils, fourier
44
from iblutil.numerical import bincount2D
55

66

examples/archive/ibllib/synchronisation_ephys.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import neurodsp.utils
1+
import ibldsp.utils
22
import spikeglx
33
import ibllib.io.extractors.ephys_fpga
44

@@ -15,7 +15,7 @@
1515

1616
# if the data is needed as well, loop over the file
1717
# raw data contains raw ephys traces, while raw_sync contains the 16 sync traces
18-
wg = neurodsp.utils.WindowGenerator(sr.ns, BATCH_SIZE_SAMPLES, overlap=1)
18+
wg = ibldsp.utils.WindowGenerator(sr.ns, BATCH_SIZE_SAMPLES, overlap=1)
1919
for first, last in wg.firstlast:
2020
rawdata, rawsync = sr.read_samples(first, last)
2121
wg.print_progress()

examples/loading_data/loading_raw_ephys_data.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
"metadata": {},
237237
"outputs": [],
238238
"source": [
239-
"from neurodsp.voltage import destripe\n",
239+
"from ibldsp.voltage import destripe\n",
240240
"# Reminder : If not done before, remove first the sync channel from raw data\n",
241241
"# Apply destriping algorithm to data\n",
242242
"destriped = destripe(raw_ap, fs=sr_ap.fs)"
@@ -445,7 +445,7 @@
445445
"source": [
446446
"## Useful modules\n",
447447
"* [ibllib.io.spikeglx](https://int-brain-lab.github.io/ibl-neuropixel/_autosummary/spikeglx.html)\n",
448-
"* [ibllib.voltage.dsp](https://int-brain-lab.github.io/ibl-neuropixel/_autosummary/neurodsp.voltage.html)\n",
448+
"* [ibllib.voltage.dsp](https://int-brain-lab.github.io/ibl-neuropixel/_autosummary/ibldsp.voltage.html)\n",
449449
"* [brainbox.io.spikeglx.stream](https://int-brain-lab.github.io/iblenv/_autosummary/brainbox.io.spikeglx.html#brainbox.io.spikeglx.stream)\n",
450450
"* [viewephys](https://github.com/oliche/viewephys) to visualise raw data snippets (Note: this package is not within `ibllib` but standalone)"
451451
]

examples/one/histology/coverage_map.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
33
from one.api import ONE
4-
from neurodsp.utils import fcn_cosine
4+
from ibldsp.utils import fcn_cosine
55

66
import iblatlas.atlas as atlas
77
from ibllib.pipes.histology import coverage

ibllib/ephys/ephysqc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from iblutil.util import Bunch
1212
import spikeglx
1313
import neuropixel
14-
from neurodsp import fourier, utils, voltage
14+
from ibldsp import fourier, utils, voltage
1515
from tqdm import tqdm
1616

1717
from brainbox.io.spikeglx import Streamer

ibllib/ephys/sync_probes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def sync_probe_front_times(t, tref, sr, display=False, type='smooth', tol=2.0):
199199
to the sampling rate of digital channels. The residual is fit using frequency domain
200200
smoothing
201201
"""
202-
import neurodsp.fourier
202+
import ibldsp.fourier
203203
CAMERA_UPSAMPLING_RATE_HZ = 300
204204
PAD_LENGTH_SECS = 60
205205
STAT_LENGTH_SECS = 30 # median length to compute padding value
@@ -214,7 +214,7 @@ def sync_probe_front_times(t, tref, sr, display=False, type='smooth', tol=2.0):
214214
res_filt = np.pad(res_upsamp, lpad, mode='median',
215215
stat_length=CAMERA_UPSAMPLING_RATE_HZ * STAT_LENGTH_SECS)
216216
fbounds = [0.001, 0.002]
217-
res_filt = neurodsp.fourier.lp(res_filt, 1 / CAMERA_UPSAMPLING_RATE_HZ, fbounds)[lpad[0]:-lpad[1]]
217+
res_filt = ibldsp.fourier.lp(res_filt, 1 / CAMERA_UPSAMPLING_RATE_HZ, fbounds)[lpad[0]:-lpad[1]]
218218
tout = np.arange(0, np.max(tref) + SYNC_SAMPLING_RATE_SECS, 20)
219219
sync_points = np.c_[tout, np.polyval(pol, tout) + np.interp(tout, t_upsamp, res_filt)]
220220
if display:

ibllib/io/extractors/camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import matplotlib.pyplot as plt
1111
from iblutil.util import range_str
1212

13-
import neurodsp.utils as dsp
13+
import ibldsp.utils as dsp
1414
from ibllib.plots import squares, vertical_lines
1515
from ibllib.io.video import assert_valid_label, VideoStreamer
1616
from iblutil.numerical import within_ranges

ibllib/io/extractors/ephys_fpga.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
from packaging import version
4545

4646
import spikeglx
47-
import neurodsp.utils
47+
import ibldsp.utils
4848
import one.alf.io as alfio
4949
from iblutil.util import Bunch
5050
from iblutil.spacer import Spacer
@@ -160,11 +160,11 @@ def _sync_to_alf(raw_ephys_apfile, output_path=None, save=False, parts=''):
160160
file_ftcp = Path(output_path).joinpath(f'fronts_times_channel_polarity{uuid.uuid4()}.bin')
161161

162162
# 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)
164164
fid_ftcp = open(file_ftcp, 'wb')
165165
for sl in wg.slice:
166166
ss = sr.read_sync(sl)
167-
ind, fronts = neurodsp.utils.fronts(ss, axis=0)
167+
ind, fronts = ibldsp.utils.fronts(ss, axis=0)
168168
# a = sr.read_sync_analog(sl)
169169
sav = np.c_[(ind[0, :] + sl.start) / sr.fs, ind[1, :], fronts.astype(np.double)]
170170
sav.tofile(fid_ftcp)
@@ -775,7 +775,7 @@ def _extract(self, sync=None, chmap=None, sync_collection='raw_ephys_data',
775775
bpod_start = self.bpod_trials['intervals'][:, 0]
776776
if len(t_trial_start) > len(bpod_start) / 2: # if least half the trial start TTLs detected
777777
_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)
779779
buffer = 2.5 # the number of seconds to include before/after task
780780
start, end = fcn(self.bpod_trials['intervals'].flat[[0, -1]])
781781
tmin = min(sync['times'][0], start - buffer)
@@ -1202,7 +1202,7 @@ def sync_bpod_clock(bpod_trials, fpga_trials, sync_field):
12021202
bpod_fpga_timestamps[i] = trials[sync_field]
12031203

12041204
# 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)
12061206

12071207
# If it's drifting too much throw warning or error
12081208
_logger.info('N trials: %i bpod, %i FPGA, %i merged, sync %.5f ppm',

ibllib/io/extractors/fibrephotometry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from ibllib.io.extractors.base import BaseExtractor
2626
from ibllib.io.raw_daq_loaders import load_channels_tdms, load_raw_daq_tdms
2727
from ibllib.io.extractors.training_trials import GoCueTriggerTimes
28-
from neurodsp.utils import rises, sync_timestamps
28+
from ibldsp.utils import rises, sync_timestamps
2929

3030
_logger = logging.getLogger(__name__)
3131

0 commit comments

Comments
 (0)