ibl-neuropixel 1.8.0__tar.gz → 1.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. {ibl_neuropixel-1.8.0/src/ibl_neuropixel.egg-info → ibl_neuropixel-1.8.1}/PKG-INFO +1 -1
  2. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/setup.py +1 -1
  3. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1/src/ibl_neuropixel.egg-info}/PKG-INFO +1 -1
  4. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/voltage.py +24 -5
  5. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/LICENSE +0 -0
  6. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/MANIFEST.in +0 -0
  7. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/README.md +0 -0
  8. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/setup.cfg +0 -0
  9. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibl_neuropixel.egg-info/SOURCES.txt +0 -0
  10. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibl_neuropixel.egg-info/dependency_links.txt +0 -0
  11. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibl_neuropixel.egg-info/requires.txt +0 -0
  12. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibl_neuropixel.egg-info/top_level.txt +0 -0
  13. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/__init__.py +0 -0
  14. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/cadzow.py +0 -0
  15. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/cuda_tools.py +0 -0
  16. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/destripe_gpu.py +0 -0
  17. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/filter_gpu.py +0 -0
  18. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/fourier.py +0 -0
  19. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/icsd.py +0 -0
  20. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/plots.py +0 -0
  21. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/raw_metrics.py +0 -0
  22. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/smooth.py +0 -0
  23. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/spiketrains.py +0 -0
  24. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/utils.py +0 -0
  25. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/waveform_extraction.py +0 -0
  26. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/ibldsp/waveforms.py +0 -0
  27. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/neuropixel.py +0 -0
  28. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/neurowaveforms/__init__.py +0 -0
  29. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/neurowaveforms/model.py +0 -0
  30. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/spikeglx.py +0 -0
  31. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/np2split/NP1_meta/_spikeglx_ephysData_g0_t0.imec0.ap.meta +0 -0
  32. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/np2split/NP21_meta/_spikeglx_ephysData_g0_t0.imec0.ap.meta +0 -0
  33. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/np2split/NP24_meta/_spikeglx_ephysData_g0_t0.imec0.ap.meta +0 -0
  34. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/np2split/_spikeglx_ephysData_g0_t0.imec0.ap.ch +0 -0
  35. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/np2split/_spikeglx_ephysData_g0_t0.imec0.ap.meta +0 -0
  36. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3A_376_channels.ap.meta +0 -0
  37. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3A_g0_t0.imec.ap.meta +0 -0
  38. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3A_g0_t0.imec.lf.meta +0 -0
  39. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3A_g0_t0.imec.wiring.json +0 -0
  40. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3A_short_g0_t0.imec.ap.meta +0 -0
  41. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3B2_exported.imec0.ap.meta +0 -0
  42. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3B_catgt.ap.meta +0 -0
  43. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3B_g0_t0.imec1.ap.meta +0 -0
  44. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3B_g0_t0.imec1.lf.meta +0 -0
  45. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3B_g0_t0.nidq.meta +0 -0
  46. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3B_g0_t0.nidq.wiring.json +0 -0
  47. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sample3B_version202304.ap.meta +0 -0
  48. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sampleNP2.1_g0_t0.imec.ap.meta +0 -0
  49. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sampleNP2.1_prototype.ap.meta +0 -0
  50. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sampleNP2.4_1shank_g0_t0.imec.ap.meta +0 -0
  51. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sampleNP2.4_4shanks_appVersion20230905.ap.meta +0 -0
  52. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sampleNP2.4_4shanks_g0_t0.imec.ap.meta +0 -0
  53. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sampleNP2.4_4shanks_while_acquiring_incomplete.ap.meta +0 -0
  54. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/sampleNPultra_g0_t0.imec0.ap.meta +0 -0
  55. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/waveform_sample/test_arr_in.npy +0 -0
  56. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/waveform_sample/test_arr_peak.npy +0 -0
  57. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/waveform_sample/test_df.csv +0 -0
  58. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/fixtures/waveform_sample/test_df_wavinfo.csv +0 -0
  59. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/integration/__init__.py +0 -0
  60. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/integration/csd_experiments.py +0 -0
  61. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/integration/test_destripe.py +0 -0
  62. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/unit/__init__.py +0 -0
  63. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/unit/test_ephys_np2.py +0 -0
  64. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/unit/test_ibldsp.py +0 -0
  65. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/unit/test_neuropixel.py +0 -0
  66. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/unit/test_spikeglx.py +0 -0
  67. {ibl_neuropixel-1.8.0 → ibl_neuropixel-1.8.1}/src/tests/unit/test_waveforms.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ibl-neuropixel
3
- Version: 1.8.0
3
+ Version: 1.8.1
4
4
  Summary: Collection of tools for Neuropixel 1.0 and 2.0 probes data
5
5
  Home-page: https://github.com/int-brain-lab/ibl-neuropixel
6
6
  Author: The International Brain Laboratory
@@ -8,7 +8,7 @@ with open("requirements.txt") as f:
8
8
 
9
9
  setuptools.setup(
10
10
  name="ibl-neuropixel",
11
- version="1.8.0",
11
+ version="1.8.1",
12
12
  author="The International Brain Laboratory",
13
13
  description="Collection of tools for Neuropixel 1.0 and 2.0 probes data",
14
14
  long_description=long_description,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ibl-neuropixel
3
- Version: 1.8.0
3
+ Version: 1.8.1
4
4
  Summary: Collection of tools for Neuropixel 1.0 and 2.0 probes data
5
5
  Home-page: https://github.com/int-brain-lab/ibl-neuropixel
6
6
  Author: The International Brain Laboratory
@@ -456,8 +456,9 @@ def decompress_destripe_cbin(
456
456
  :param nbatch: (optional) batch size
457
457
  :param nprocesses: (optional) number of parallel processes to run, defaults to number or processes detected with joblib
458
458
  interp 3:outside of brain and discard
459
- :param reject_channels: (True) detects noisy or bad channels and interpolate them. Channels outside of the brain are left
460
- untouched
459
+ :param reject_channels: (True) True | False | np.array()
460
+ If True, detects noisy or bad channels and interpolate them, zero out the channels outside the brain.
461
+ If the labels are already computed, they can be provided as a numpy array.
461
462
  :param k_kwargs: (None) arguments for the kfilter function
462
463
  :param reader_kwargs: (None) optional arguments for the spikeglx Reader instance
463
464
  :param k_filter: (True) True | False | None | custom function.
@@ -475,8 +476,11 @@ def decompress_destripe_cbin(
475
476
  # handles input parameters
476
477
  reader_kwargs = {} if reader_kwargs is None else reader_kwargs
477
478
  sr = spikeglx.Reader(sr_file, open=True, **reader_kwargs)
478
- if reject_channels: # get bad channels if option is on
479
+ if reject_channels is True: # get bad channels if option is on
479
480
  channel_labels = detect_bad_channels_cbin(sr)
481
+ elif isinstance(reject_channels, np.ndarray):
482
+ channel_labels = reject_channels
483
+ reject_channels = True
480
484
  assert isinstance(sr_file, str) or isinstance(sr_file, Path)
481
485
  butter_kwargs, k_kwargs, spatial_fcn = _get_destripe_parameters(
482
486
  sr.fs, butter_kwargs, k_kwargs, k_filter
@@ -502,7 +506,6 @@ def decompress_destripe_cbin(
502
506
  DEPHAS = np.exp(
503
507
  1j * np.angle(fft_object(dephas)) * h["sample_shift"][:, np.newaxis]
504
508
  )
505
-
506
509
  # if we want to compute the rms ap across the session as well as the saturation
507
510
  if compute_rms:
508
511
  # creates a saturation memmap, this is a nsamples vector of booleans
@@ -772,7 +775,23 @@ def detect_bad_channels(
772
775
  )
773
776
  )[0]
774
777
  # the channels outside of the brains are the contiguous channels below the threshold on the trend coherency
775
- ioutside = np.where(xfeats["xcor_lf"] < -0.75)[0] # fixme: hardcoded threshold
778
+
779
+ signal_noisy = xfeats["xcor_lf"]
780
+ # Filter signal
781
+ window_size = 25 # Choose based on desired smoothing (e.g., 25 samples)
782
+ kernel = np.ones(window_size) / window_size
783
+ # Apply convolution
784
+ signal_filtered = np.convolve(signal_noisy, kernel, mode='same')
785
+
786
+ diff_x = np.diff(signal_filtered)
787
+ indx = np.where(diff_x < -0.02)[0] # hardcoded threshold
788
+ if indx.size > 0:
789
+ indx_threshold = np.floor(np.median(indx)).astype(int)
790
+ threshold = signal_noisy[indx_threshold]
791
+ ioutside = np.where(signal_noisy < threshold)[0]
792
+ else:
793
+ ioutside = np.array([])
794
+
776
795
  if ioutside.size > 0 and ioutside[-1] == (nc - 1):
777
796
  a = np.cumsum(np.r_[0, np.diff(ioutside) - 1])
778
797
  ioutside = ioutside[a == np.max(a)]
File without changes
File without changes
File without changes