Skip to content

Commit 84b38ba

Browse files
authored
Merge pull request #80 from m-beau/m-beau
M beau
2 parents 2917b63 + 9d0529e commit 84b38ba

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
NeuroPyxels (npyx) is a python library built for electrophysiologists using Neuropixels electrodes. It features a suite of core utility functions for loading, processing and plotting Neuropixels data.
66

7-
This package results from the needs of an experimentalist who could not stand MATLAB, hence wrote himself a suite of functions to emotionally bear with doing neuroscience. There isn't any dedicated preprint available yet, so if you enjoy this package and use it for your research, please star [the github repo](https://github.com/m-beau/NeuroPyxels) (click on the top-right star button!) and cite [this paper](https://www.nature.com/articles/s41593-019-0381-8). Cheers!
7+
This package stems from the need of a pythonist who really did not want to transition to MATLAB to work with Neuropixels data. If you enjoy this package and use it for your research, please star [the github repo](https://github.com/m-beau/NeuroPyxels) (click on the top-right star button!). Cheers!
88

99
There isn't any better doc atm - post an issue if you have any question, or email [Maxime Beau]([email protected]) (PhD Hausser lab, UCL). You can also use the [Neuropixels slack workgroup](neuropixelsgroup.slack.com), channel #NeuroPyxels.
1010

build/lib/npyx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
npyx.stats
3939
"""
4040

41-
__version__ = '2.0.2'
41+
__version__ = '2.0.3'

build/lib/npyx/feat.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
1717
"""
18-
import tqdm
18+
from tqdm import tqdm
1919

2020
import numpy as np
2121
from pathlib import Path
@@ -38,7 +38,7 @@
3838
from sklearn.decomposition import PCA
3939
from sklearn.preprocessing import StandardScaler
4040
from npyx.corr import (ccg, StarkAbeles2009_ccg_significance, ccg_sig_stack, gen_sfc, scaled_acg)
41-
from npyx.gl import get_units
41+
from npyx.gl import get_units, get_npyx_memory
4242
#############################################
4343
# Waveform features
4444

@@ -791,7 +791,8 @@ def previous_peak(waves, chan_path, unit, n_chans = 20):
791791
# detect_peaks
792792
# find most negative peak
793793
# check if there is a peak before the most negative one
794-
max_chan_path = list(Path(chan_path/'routinesMemory').glob(f'dsm_{unit}_peakchan*'))[0]
794+
dpnm = get_npyx_memory(chan_path)
795+
max_chan_path = list(dpnm.glob(f'dsm_{unit}_peakchan*'))[0]
795796
max_chan = int(np.load(max_chan_path))
796797
# waves = waves.T
797798
if max_chan <= n_chans - 1:
@@ -932,7 +933,8 @@ def chan_spread(all_wav, chan_path, unit, n_chans = 20, chan_spread_dist = 25.6)
932933
_,_, p2p = consecutive_peaks_amp(all_wav.T)
933934

934935
# search for the file that has the given peak chan
935-
max_chan_path = list(Path(chan_path/'routinesMemory').glob(f'dsm_{unit}_peakchan*'))[0]
936+
dpnm = get_npyx_memory(chan_path)
937+
max_chan_path = list(dpnm.glob(f'dsm_{unit}_peakchan*'))[0]
936938
max_chan = int(np.load(max_chan_path))
937939

938940
chanmap = chan_map(chan_path)
@@ -1326,7 +1328,8 @@ def chan_spread_bp_plot(dp, unit, n_chans=20):
13261328
Input: datapath and unit (drift and shift matched datasets for now)
13271329
Returns: plot
13281330
"""
1329-
curr_fil = dp/'routinesMemory'/f'dsm_{unit}_all_waves_100-82_regular_False300-FalseNone-FalseNone.npy'
1331+
dpnm = get_npyx_memory(dp)
1332+
curr_fil = dpnm/f'dsm_{unit}_all_waves_100-82_regular_False300-FalseNone-FalseNone.npy'
13301333
if curr_fil.is_file():
13311334

13321335
if n_chans %2 !=0: n_chans +=1
@@ -1529,7 +1532,8 @@ def gen_ss_cs(recs_fn, show = False):
15291532

15301533
# dp = "/media/npyx/ssd2/ago/optotag/recordings/PkC/18-08-30_YC001_probe1"
15311534
# create the main folder for the images to be saved
1532-
ss_cs_folder = Path(ds['dp']+'/routinesMemory/ss_cs')
1535+
dpnm = get_npyx_memory(dp)
1536+
ss_cs_folder = dpnm / 'ss_cs'
15331537
ss_cs_folder.mkdir(exist_ok=True, parents=True)
15341538

15351539
#%% Find CCGs with long pause (at least 5ms)
@@ -1598,7 +1602,7 @@ def process_all(recs_fn, show = False, again = False):
15981602
all_feat = []
15991603
for i, ds in list(recs.items())[:]:
16001604
print(f"/nProcessing dataset {ds['dp']}...")
1601-
data_root = Path(ds['dp'])/'routinesMemory'
1605+
data_root = get_npyx_memory(ds['dp'])
16021606
features_folder = data_root / 'features'
16031607
acg_folder = data_root / 'acg'
16041608
wvf_folder = data_root / 'wvf'
@@ -1688,7 +1692,7 @@ def process_all(recs_fn, show = False, again = False):
16881692
print("Computing PCA features across datasets...")
16891693
for i, ds in list(recs.items())[:]:
16901694
# data_root = Path('/home/npyx/projects/optotag/proc_data')
1691-
data_root = Path(ds['dp'])/'routinesMemory'
1695+
data_root = get_npyx_memory(ds['dp'])
16921696
features_folder = data_root / 'features'
16931697
acg_folder = data_root / 'acg'
16941698
wvf_folder = data_root / 'wvf'
@@ -1799,7 +1803,7 @@ def process_all(recs_fn, show = False, again = False):
17991803

18001804
for i, ds in list(recs.items())[:]:
18011805
# data_root = Path('/home/npyx/projects/optotag/proc_data')
1802-
data_root = Path(ds['dp'])/'routinesMemory'
1806+
data_root = get_npyx_memory(ds['dp'])
18031807
features_folder = data_root / 'features'
18041808
acg_folder = data_root / 'acg'
18051809
wvf_folder = data_root / 'wvf'
@@ -1859,7 +1863,7 @@ def process_all(recs_fn, show = False, again = False):
18591863

18601864
for i, ds in list(recs.items())[:]:
18611865
# data_root = Path('/home/npyx/projects/optotag/proc_data')
1862-
data_root = Path(ds['dp'])/'routinesMemory'
1866+
data_root = get_npyx_memory(ds['dp'])
18631867
features_folder = data_root / 'features'
18641868
acg_folder = data_root / 'acg'
18651869
wvf_folder = data_root / 'wvf'

npyx.egg-info/PKG-INFO

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: npyx
3-
Version: 2.0.2
3+
Version: 2.0.3
44
Summary: Python routines dealing with Neuropixels data.
55
Home-page: https://github.com/Npix-routines/NeuroPyxels
66
Author: Maxime Beau
@@ -22,7 +22,7 @@ Description: # NeuroPyxels: loading, processing and plotting Neuropixels data in
2222
- [Load spike times from unit u](https://github.com/m-beau/NeuroPyxels#load-spike-times-from-unit-u)
2323
- [Load waveforms from unit u](https://github.com/m-beau/NeuroPyxels#load-waveforms-from-unit-u)
2424
- [Compute auto/crosscorrelogram between 2 units](https://github.com/m-beau/NeuroPyxels#compute-autocrosscorrelogram-between-2-units)
25-
- [Plot waveforms and crosscorrelograms of unit u](https://github.com/m-beau/NeuroPyxels#plot-correlograms-and-waveforms-from-unit-u)
25+
- [Plot waveform and crosscorrelograms of unit u](https://github.com/m-beau/NeuroPyxels#plot-correlograms-and-waveforms-from-unit-u)
2626
- [Plot chunk of raw data with overlaid units](https://github.com/m-beau/NeuroPyxels#plot-chunk-of-raw-data-with-overlaid-units)
2727
- [Plot peri-stimulus time histograms across neurons and conditions](https://github.com/m-beau/NeuroPyxels/tree/m-beau#plot-peri-stimulus-time-histograms-across-neurons-and-conditions)
2828
- [Merge datasets acquired on two probes simultaneously](https://github.com/m-beau/NeuroPyxels#merge-datasets-acquired-on-two-probes-simultaneously)
@@ -106,7 +106,7 @@ Description: # NeuroPyxels: loading, processing and plotting Neuropixels data in
106106
c = ccg(dp, [234,92], cbin=0.2, cwin=80)
107107
```
108108

109-
### Plot waveform and croccorrelogram of unit u
109+
### Plot waveform and crosscorrelogram of unit u
110110
```python
111111
# all plotting functions return matplotlib figures
112112
from npyx.plot import plot_wvf, get_peak_chan

npyx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
npyx.stats
3939
"""
4040

41-
__version__ = '2.0.3'
41+
__version__ = '2.0.4'

0 commit comments

Comments
 (0)