Skip to content

Commit 6c84f25

Browse files
Merge pull request #586 from MouseLand/dev
Dev
2 parents 17501ef + d46868d commit 6c84f25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1391
-422
lines changed

.dvc/config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
url = gdrive://0ACw_QYaWTX7mUk9PVA
1212
gdrive_use_service_account = true
1313
gdrive_service_account_email = [email protected]
14-
gdrive_service_account_p12_file_path = .dvc/creds/suite2p-testdata-dvc-b0d23791539c.p12
14+
gdrive_service_account_p12_file_path = creds/suite2p-testdata-dvc-b0d23791539c.p12

data/test_data.dvc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
outs:
2-
- md5: 273c132e8b2d31901a45c70188e68535.dir
2+
- md5: eaa434ed20e421fccab8089842be58b5.dir
33
path: test_data

docs/gui.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,21 @@ added to the *.npy files as the first N ROIs (where N is the number that you dre
236236
.. image:: _static/manual_roi.png
237237
:width: 600
238238

239+
Merging ROIs
240+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
241+
You can merge selected ROIs (multi-select with CTRL) by pressing ALT+ENTER,
242+
or get suggested merges in the "Merge ROI" menu. The merged ROIs then must
243+
be saved before you close the GUI to write the new ROIs to the *.npy files.
244+
Each merged ROI is appended to the end of the list of ROIs (in stat), and the
245+
ROIs that were merged to create it are in the key 'imerge'. Note in the stat file
246+
and other files the original ROIs (that create the ROI) are NOT removed so that
247+
you retain the original signals and original suite2p output. In the GUI
248+
ROI view the merged ROIs are shown.
249+
250+
The merging of fluorescence is done by taking the mean of the selected cells'
251+
fluorescences. The list of merges are available in the stat for you to choose
252+
alternative strategies for combining signals.
253+
239254
View registered binary
240255
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
241256

docs/outputs.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ All can be loaded in python with numpy
2121
2222
import numpy as np
2323
24-
F = np.load('F.npy')
25-
Fneu = np.load('F.npy')
26-
spks = np.load('spks.npy')
27-
stat = np.load('stat.npy')
28-
ops = np.load('ops.npy')
24+
F = np.load('F.npy', allow_pickle=True)
25+
Fneu = np.load('F.npy', allow_pickle=True)
26+
spks = np.load('spks.npy', allow_pickle=True)
27+
stat = np.load('stat.npy', allow_pickle=True)
28+
ops = np.load('ops.npy', allow_pickle=True)
2929
ops = ops.item()
30-
iscell = np.load('iscell.npy')
30+
iscell = np.load('iscell.npy', allow_pickle=True)
3131
3232
MATLAB output
3333
~~~~~~~~~~~~~~~~~~~~~~~~~~~

jupyter/make_ops.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"import numpy as np\n",
1010
"import sys\n",
1111
"sys.path.insert(0, 'C:/Users/carse/github/suite2p/')\n",
12-
"from suite2p import run_s2p\n",
12+
"from suite2p import default_ops\n",
1313
"\n",
14-
"ops = run_s2p.default_ops()\n",
14+
"ops = default_ops()\n",
1515
"\n",
1616
"np.save('../suite2p/ops/ops.npy', ops)"
1717
]
@@ -24,7 +24,7 @@
2424
"source": [
2525
"import numpy as np\n",
2626
"\n",
27-
"ops = run_s2p.default_ops()\n",
27+
"ops = default_ops()\n",
2828
"\n",
2929
"ops['1Preg'] = True\n",
3030
"ops['smooth_sigma'] = 6\n",
@@ -43,7 +43,7 @@
4343
"source": [
4444
"import numpy as np\n",
4545
"\n",
46-
"ops = run_s2p.default_ops()\n",
46+
"ops = default_ops()\n",
4747
"\n",
4848
"ops['connected'] = True\n",
4949
"ops['allow_overlap'] = True\n",
@@ -74,4 +74,4 @@
7474
},
7575
"nbformat": 4,
7676
"nbformat_minor": 2
77-
}
77+
}

jupyter/run_pipeline_sbx.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"ops['um_per_pixel_y'] = um_per_pix_y\n",
6363
"\n",
6464
"# run one experiment\n",
65-
"opsEnd=run_s2p.run_s2p(ops=ops,db={})"
65+
"opsEnd=run_s2p(ops=ops,db={})"
6666
]
6767
}
6868
],

jupyter/run_pipeline_tiffs_or_batch.ipynb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
"import sys\n",
1111
"# option to import from github folder\n",
1212
"sys.path.insert(0, 'C:/Users/carse/github/suite2p/')\n",
13-
"from suite2p import run_s2p\n",
13+
"from suite2p import run_s2p, default_ops\n",
1414
"\n",
1515
"# set your options for running\n",
16-
"ops = run_s2p.default_ops() # populates ops with the default options"
16+
"ops = default_ops() # populates ops with the default options"
1717
]
1818
},
1919
{
@@ -38,7 +38,7 @@
3838
" }\n",
3939
"\n",
4040
"# run one experiment\n",
41-
"opsEnd=run_s2p.run_s2p(ops=ops,db=db)"
41+
"opsEnd = run_s2p(ops=ops, db=db)"
4242
]
4343
},
4444
{
@@ -53,7 +53,7 @@
5353
"db.append({'data_path': ['C:/Users/carse/github/tiffs2']})\n",
5454
"\n",
5555
"for dbi in db:\n",
56-
" opsEnd=run_s2p.run_s2p(ops=ops,db=dbi)"
56+
" opsEnd = run_s2p(ops=ops, db=dbi)"
5757
]
5858
},
5959
{
@@ -77,7 +77,7 @@
7777
"\n",
7878
"\n",
7979
"# run one experiment\n",
80-
"opsEnd=run_s2p.run_s2p(ops=ops,db=db)\n"
80+
"opsEnd = run_s2p(ops=ops,db=db)\n"
8181
]
8282
},
8383
{
@@ -109,7 +109,7 @@
109109
"\n",
110110
"\n",
111111
"# run one experiment\n",
112-
"opsEnd=run_s2p.run_s2p(ops=ops,db=db)\n"
112+
"opsEnd=run_s2p(ops=ops, db=db)\n"
113113
]
114114
},
115115
{
@@ -121,7 +121,7 @@
121121
"## change the save directory from 'suite2p' to a chosen name\n",
122122
"# note the fast_disk will always be in 'suite2p', just the save_path will change\n",
123123
"\n",
124-
"ops = run_s2p.default_ops() # populates ops with the default options\n",
124+
"ops = default_ops() # populates ops with the default options\n",
125125
"ops['sparse_mode'] = 1\n",
126126
"ops['threshold_scaling'] = 3.0\n",
127127
"db = {\n",
@@ -134,7 +134,7 @@
134134
" }\n",
135135
"\n",
136136
"# run one experiment\n",
137-
"opsEnd=run_s2p.run_s2p(ops=ops,db=db)"
137+
"opsEnd = run_s2p(ops=ops, db=db)"
138138
]
139139
},
140140
{
@@ -145,7 +145,7 @@
145145
"source": [
146146
"# h5py file with multiple data fields (untested)\n",
147147
"\n",
148-
"ops = run_s2p.default_ops() # populates ops with the default options\n",
148+
"ops = default_ops() # populates ops with the default options\n",
149149
"ops['nplanes'] = 12\n",
150150
"ops['nchannels'] = 2\n",
151151
"ops['fs'] = 5.0\n",
@@ -158,7 +158,7 @@
158158
" }\n",
159159
"\n",
160160
"# run one experiment\n",
161-
"opsEnd=run_s2p.run_s2p(ops=ops,db=db)"
161+
"opsEnd = run_s2p(ops=ops, db=db)"
162162
]
163163
}
164164
],
@@ -183,4 +183,4 @@
183183
},
184184
"nbformat": 4,
185185
"nbformat_minor": 2
186-
}
186+
}

setup.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,30 @@
1717
'setuptools_scm',
1818
],
1919
use_scm_version=True,
20-
install_requires=[], # see environment.yml for this info.
21-
tests_require=[
22-
'pytest',
23-
'pytest-qt',
24-
],
25-
extras_require={
26-
"docs": [
27-
'sphinx>=3.0',
28-
'sphinxcontrib-apidoc',
29-
'sphinx_rtd_theme',
30-
'sphinx-prompt',
31-
'sphinx-autodoc-typehints',
32-
'importlib-metadata',
20+
install_requires=['importlib-metadata',
3321
'natsort',
3422
'rastermap>0.1.0',
3523
'tifffile',
3624
'scanimage-tiff-reader>=1.4.1',
3725
'pyqtgraph',
38-
'importlib-metadata',
3926
'paramiko',
4027
'numpy>=1.16',
4128
'numba>=0.43.1',
4229
'matplotlib',
4330
'scipy',
4431
'h5py',
45-
'scikit-learn',
32+
'scikit-learn',], # see environment.yml for this info.
33+
tests_require=[
34+
'pytest',
35+
'pytest-qt',
36+
],
37+
extras_require={
38+
"docs": [
39+
'sphinx>=3.0',
40+
'sphinxcontrib-apidoc',
41+
'sphinx_rtd_theme',
42+
'sphinx-prompt',
43+
'sphinx-autodoc-typehints',
4644
],
4745
# Note: Available in pypi, but cleaner to install as pyqt from conda.
4846
"gui": [

suite2p/classification/classifier.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def _get_logp(self, stats):
9999
x = stats[:,n]
100100
x[x<self.grid[0,n]] = self.grid[0,n]
101101
x[x>self.grid[-1,n]] = self.grid[-1,n]
102+
x[np.isnan(x)] = self.grid[0,n]
102103
ibin = np.digitize(x, self.grid[:,n], right=True) - 1
103104
logp[:,n] = np.log(self.p[ibin,n] + 1e-6) - np.log(1-self.p[ibin,n] + 1e-6)
104105
return logp

suite2p/classification/classify.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ def classify(stat: np.ndarray,
1313
):
1414
"""Returns array of classifier output from classification process."""
1515
keys = list(set(keys).intersection(set(stat[0])))
16-
return Classifier(classfile, keys=keys).run(stat)
16+
print(keys)
17+
iscell = Classifier(classfile, keys=keys).run(stat)
18+
return iscell

0 commit comments

Comments
 (0)