Skip to content

Commit 907d117

Browse files
committed
get_units bug
1 parent 1737893 commit 907d117

18 files changed

+52
-65
lines changed

build/lib/npyx/spk_t.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def ids(dp, unit, sav=True, prnt=False, subset_selection='all', again=False):
5353
except:pass
5454
if type(unit) is int:
5555
spike_clusters = np.load(Path(dp,"spike_clusters.npy"))
56-
indices = np.nonzero(spike_clusters==unit)[0].squeeze()
56+
indices = np.nonzero(spike_clusters==unit)[0]
5757
if type(unit) not in [str, np.str_, int]:
5858
print('WARNING unit {} type ({}) not handled!'.format(unit, type(unit)))
5959
return
@@ -114,11 +114,11 @@ def trn(dp, unit, sav=True, prnt=False, subset_selection='all', again=False, enf
114114
if ds_table.shape[0]>1: # If several datasets in prophyler
115115
spike_clusters_samples = np.load(Path(dp, 'merged_clusters_spikes.npy'))
116116
dataset_mask=(spike_clusters_samples[:, 0]==ds_i); unit_mask=(spike_clusters_samples[:, 1]==unt)
117-
train = spike_clusters_samples[dataset_mask&unit_mask, 2].squeeze().astype(np.int64)
117+
train = spike_clusters_samples[dataset_mask&unit_mask, 2].astype(np.int64)
118118
else:
119119
spike_clusters = np.load(Path(ds_table['dp'][0],"spike_clusters.npy"))
120120
spike_samples = np.load(Path(ds_table['dp'][0],'spike_times.npy'))
121-
train = spike_samples[spike_clusters==unt].squeeze()
121+
train = spike_samples[spike_clusters==unt]
122122
else:
123123
try:unit=int(unit)
124124
except:pass

build/lib/npyx/spk_wvf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ def get_ids_subset(dp, unit, n_waveforms, batch_size_waveforms, subset_selection
403403
else:
404404
assert n_waveforms > 0
405405
spike_ids = ids(dp, unit)
406+
assert any(spike_ids)
406407
if subset_selection == 'regular':
407408
# Regular subselection.
408409
if batch_size_waveforms is None or len(spike_ids) <= max(batch_size_waveforms, n_waveforms):

dist/npyx-1.2.tar.gz

-145 KB
Binary file not shown.

dist/npyx-1.21.tar.gz

145 KB
Binary file not shown.

npyx.egg-info/PKG-INFO

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: npyx
3-
Version: 1.2
3+
Version: 1.21
44
Summary: Python routines dealing with Neuropixels data.
55
Home-page: https://github.com/Npix-routines/NeuroPyxels
66
Author: Maxime Beau
@@ -19,7 +19,7 @@ Description: # routines
1919
Python version has to be >=3.7 ot there will be imports issues!
2020

2121
Useful link to [create a python package from a git repository](https://towardsdatascience.com/build-your-first-open-source-python-project-53471c9942a7)
22-
In particular, to upload
22+
2323
## Installation:
2424
Using a conda environment is very much advised. Instructions here: [manage conda environments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)
2525
- from a local repository (recommended if plans to work on it/regularly pull upgrades)
@@ -75,22 +75,21 @@ Description: # routines
7575
setup(name='npyx',
7676
version='1.0',... # change to 1.1 or whatev
7777
```
78-
Then re-generate the distribution files for the new version using twine:
78+
Then delete the old distribution files before re-generating them for the new version using twine:
7979
```
80+
rm -r ./dist
81+
rm -r ./build
82+
rm -r ./npyx.egg-info
8083
python setup.py sdist bdist_wheel # this will generate version 1.1 wheel without overwriting version 1.0 wheel in ./dist
8184
```
82-
Before pushing them to PyPI (it will keep track of older versions!)
85+
Before pushing them to PyPI (older versions are saved online!)
8386
```
8487
$ twine upload dist/*
8588
Uploading distributions to https://upload.pypi.org/legacy/
8689
Enter your username: your-username
8790
Enter your password:
88-
Uploading npyx-1.0-py3-none-any.whl
89-
100%|█████████████████████████████████████████████████████████| 156k/156k [00:01<00:00, 154kB/s]
9091
Uploading npyx-1.1-py3-none-any.whl
9192
100%|████████████████████████████████████████████████████████| 156k/156k [00:01<00:00, 96.8kB/s]
92-
Uploading npyx-1.0.tar.gz
93-
100%|█████████████████████████████████████████████████████████| 149k/149k [00:00<00:00, 169kB/s]
9493
Uploading npyx-1.1.tar.gz
9594
100%|█████████████████████████████████████████████████████████| 150k/150k [00:01<00:00, 142kB/s]
9695

-737 Bytes
Binary file not shown.
45 Bytes
Binary file not shown.

npyx/__pycache__/gl.cpython-37.pyc

-474 Bytes
Binary file not shown.
57 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)