Skip to content

Commit

Permalink
Rename neurodsp (#23)
Browse files Browse the repository at this point in the history
* initial drop-in replace

* bump version and update changelog

* you cant change history

* update tests

* catch and assert warning

* add dummy module to warn user

* flake

* update change log

* unused import

---------

Co-authored-by: chris-langfield <[email protected]>
  • Loading branch information
chris-langfield and chris-langfield authored Feb 8, 2024
1 parent 6514a62 commit 15e3eb0
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This relies on a fast fourier transform external library: `pip install pyfftw`.
Minimal working example to destripe a neuropixel binary file.
```python
from pathlib import Path
from neurodsp.voltage import decompress_destripe_cbin
from ibldsp.voltage import decompress_destripe_cbin
sr_file = Path('/datadisk/Data/spike_sorting/pykilosort_tests/imec_385_100s.ap.bin')
out_file = Path('/datadisk/scratch/imec_385_100s.ap.bin')

Expand Down
5 changes: 5 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.9.1
## 0.9.1
- `neurodsp` is now `ibldsp`. Drop-in replacement of the package name is all that is required to update. The `neurodsp` name will disappear on
01-Sep-2024; until then both names will work.

# 0.9.0
## 0.9.0 2024-01-17
- `neurodsp.utils.sync_timestamps`: uses FFT based correlation to speed up large arrays alignments
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="ibl-neuropixel",
version="0.9.0",
version="0.9.1",
author="The International Brain Laboratory",
description="Collection of tools for Neuropixel 1.0 and 2.0 probes data",
long_description=long_description,
Expand Down
Empty file added src/ibldsp/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/neurodsp/raw_metrics.py → src/ibldsp/raw_metrics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from neurodsp.voltage import destripe, destripe_lfp, detect_bad_channels
from neurodsp.utils import rms
from ibldsp.voltage import destripe, destripe_lfp, detect_bad_channels
from ibldsp.utils import rms
import spikeglx
import pandas as pd
import scipy
Expand Down
2 changes: 1 addition & 1 deletion src/neurodsp/smooth.py → src/ibldsp/smooth.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from scipy.interpolate import interp1d

import neurodsp.fourier as ft
import ibldsp.fourier as ft


def lp(ts, fac, pad=0.2):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/neurodsp/voltage.py → src/ibldsp/voltage.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import spikeglx
import neuropixel

import neurodsp.fourier as fourier
import neurodsp.utils as utils
import ibldsp.fourier as fourier
import ibldsp.utils as utils


def agc(x, wl=.5, si=.002, epsilon=1e-8, gpu=False):
Expand Down
1 change: 1 addition & 0 deletions src/neurodsp/waveforms.py → src/ibldsp/waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ def plot_peaktiptrough(df, arr, ax, nth_wav=0, plot_grey=True, fs=30000):
ax.set_ylabel('(Volt)')
ax.set_xlabel('Time (ms)')


def half_peak_point(arr_peak, df):
'''
Compute the two intersection points at halp-maximum peak
Expand Down
8 changes: 8 additions & 0 deletions src/neurodsp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import ibldsp, sys
from warnings import warn

sys.modules["neurodsp"] = ibldsp
warn(
"neurodsp has been renamed to ibldsp and the old name will be deprecated on 01-Sep-2024.",
FutureWarning,
)
2 changes: 1 addition & 1 deletion src/neuropixel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy as np

import spikeglx
from neurodsp.utils import WindowGenerator
from ibldsp.utils import WindowGenerator

_logger = logging.getLogger('ibllib')

Expand Down
2 changes: 1 addition & 1 deletion src/neurowaveforms/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
from neurodsp.fourier import fshift
from ibldsp.fourier import fshift


def generate_waveform(spike=None, sxy=None, wxy=None, fs=30000, vertical_velocity_mps=3):
Expand Down
2 changes: 1 addition & 1 deletion src/tests/integration/cpu/csd_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ibllib.atlas import BrainRegions
from viewephys.gui import viewephys

from neurodsp import voltage, fourier
from ibldsp import voltage, fourier
from neuropixel import trace_header


Expand Down
2 changes: 1 addition & 1 deletion src/tests/integration/cpu/test_destripe.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from neuropixel import trace_header
import spikeglx
from neurodsp import voltage, utils
from ibldsp import voltage, utils

_logger = logging.getLogger(__name__)

Expand Down
33 changes: 26 additions & 7 deletions src/tests/unit/cpu/test_dsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import scipy.fft
import spikeglx

import neurodsp.fourier as fourier
import neurodsp.utils as utils
import neurodsp.voltage as voltage
import neurodsp.cadzow as cadzow
import neurodsp.smooth as smooth
import neurodsp.spiketrains as spiketrains
import neurodsp.raw_metrics as raw_metrics
import ibldsp.fourier as fourier
import ibldsp.utils as utils
import ibldsp.voltage as voltage
import ibldsp.cadzow as cadzow
import ibldsp.smooth as smooth
import ibldsp.spiketrains as spiketrains
import ibldsp.raw_metrics as raw_metrics

from pathlib import Path
import tempfile
Expand Down Expand Up @@ -604,3 +604,22 @@ def test_compute_features(self):
self.assertEqual(multi_index, list(df.index))
self.assertEqual(["snippet_id", "channel_id"], list(df.index.names))
self.assertEqual(num_snippets * (self.nc - 1), len(df))


class TestNameDeprecationDate(unittest.TestCase):
def test_neurodsp_import(self):
# Check that the old import still works and gives the same package.
# (ibldsp.voltage is imported at the top of this file.)
with self.assertWarnsRegex(FutureWarning, "01-Sep-2024"):
import neurodsp
self.assertEqual(neurodsp.voltage, voltage)

def test_deprecation_countdown(self):
# Fail on 01-Sep-2024, when `neurodsp` will be retired.
# When this test fails, remove the entire dummy
# `neurodsp` package at the top level of the ibl-neuropixel
# repository
import datetime
if datetime.datetime.now() > datetime.datetime(2024, 9, 1):
raise NotImplementedError("neurodsp will not longer be supported. "
"Change all references to ibldsp.")
2 changes: 1 addition & 1 deletion src/tests/unit/cpu/test_waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd

import neurodsp.waveforms as waveforms
import ibldsp.waveforms as waveforms
from neurowaveforms.model import generate_waveform


Expand Down
2 changes: 1 addition & 1 deletion src/tests/unit/gpu/test_filter_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from scipy.signal import butter, sosfiltfilt
import unittest

from neurodsp.filter_gpu import sosfiltfilt_gpu
from ibldsp.filter_gpu import sosfiltfilt_gpu


class TestFilterGpuCpuParity(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion src/tests/unit/gpu/test_fourier.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import cupy as cp
import unittest

from neurodsp.fourier import fshift, channel_shift
from ibldsp.fourier import fshift, channel_shift


class TestFourierAlignmentGpuCpuParity(unittest.TestCase):
Expand Down

0 comments on commit 15e3eb0

Please sign in to comment.