Skip to content

Commit 828b5e2

Browse files
Merge pull request #962 from MouseLand/dev
Dev
2 parents da6737c + e1f3790 commit 828b5e2

File tree

5 files changed

+36
-20
lines changed

5 files changed

+36
-20
lines changed

suite2p/extraction/dcnv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def preprocess(F: np.ndarray, baseline: str, win_baseline: float, sig_baseline:
105105
window (in seconds) for max filter
106106
107107
sig_baseline : float
108-
width of Gaussian filter in seconds
108+
width of Gaussian filter in frames
109109
110110
fs : float
111111
sampling rate per plane

suite2p/gui/drawroi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def masks_and_traces(ops, stat_manual, stat_orig):
5959
manual_roi_stats[n]["compact"] = 1
6060
manual_roi_stats[n]["footprint"] = 2
6161
manual_roi_stats[n]["manual"] = 1 # Add manual key
62+
if "iplane" in stat_orig[0]:
63+
manual_roi_stats[n]["iplane"] = stat_orig[0]["iplane"]
6264

6365
# subtract neuropil and compute skew, std from F
6466
dF = F - ops["neucoeff"] * Fneu

suite2p/io/save.py

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import pathlib
77

88

9-
def save_mat(ops, stat, F, Fneu, spks, iscell, redcell):
9+
def save_mat(ops, stat, F, Fneu, spks, iscell, redcell,
10+
F_chan2=None, Fneu_chan2=None):
1011
ops_matlab = ops.copy()
1112
if ops_matlab.get("date_proc"):
1213
try:
@@ -24,16 +25,30 @@ def save_mat(ops, stat, F, Fneu, spks, iscell, redcell):
2425

2526
stat = np.array(stat, dtype=object)
2627

27-
scipy.io.savemat(
28-
file_name=os.path.join(ops["save_path"], "Fall.mat"), mdict={
29-
"stat": stat,
30-
"ops": ops_matlab,
31-
"F": F,
32-
"Fneu": Fneu,
33-
"spks": spks,
34-
"iscell": iscell,
35-
"redcell": redcell
36-
})
28+
if F_chan2 is None:
29+
scipy.io.savemat(
30+
file_name=os.path.join(ops["save_path"], "Fall.mat"), mdict={
31+
"stat": stat,
32+
"ops": ops_matlab,
33+
"F": F,
34+
"Fneu": Fneu,
35+
"spks": spks,
36+
"iscell": iscell,
37+
"redcell": redcell
38+
})
39+
else:
40+
scipy.io.savemat(
41+
file_name=os.path.join(ops["save_path"], "Fall.mat"), mdict={
42+
"stat": stat,
43+
"ops": ops_matlab,
44+
"F": F,
45+
"Fneu": Fneu,
46+
"spks": spks,
47+
"iscell": iscell,
48+
"redcell": redcell,
49+
"F_chan2": F_chan2,
50+
"Fneu_chan2": Fneu_chan2
51+
})
3752

3853

3954
def compute_dydx(ops1):
@@ -205,8 +220,6 @@ def combined(save_folder, save=True):
205220
matpath = os.path.join(ops["save_path"], "Fall.mat")
206221
save_mat(ops, stat, F, Fneu, spks, iscell, redcell)
207222

208-
return stat, ops, F, Fneu, spks, iscell[:,
209-
0], iscell[:,
210-
1], redcell[:,
211-
0], redcell[:,
212-
1], hasred
223+
return (stat, ops, F, Fneu, spks,
224+
iscell[:,0], iscell[:,1],
225+
redcell[:,0], redcell[:,1], hasred)

suite2p/io/tiff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def ome_to_binary(ops):
475475
ops1[ix]["frames_per_folder"][0] += 1
476476
ops1[ix]["meanImg"] += im.astype(np.float32)
477477
reg_file[ix].write(bytearray(im))
478-
gc.collect()
478+
#gc.collect()
479479

480480
if ik % 1000 == 0:
481481
print("%d frames of binary, time %0.2f sec." % (ik, time.time() - t0))
@@ -491,7 +491,7 @@ def ome_to_binary(ops):
491491
ix = iplanes[ik]
492492
ops1[ix]["meanImg_chan2"] += im.astype(np.float32)
493493
reg_file_chan2[ix].write(bytearray(im))
494-
gc.collect()
494+
#gc.collect()
495495

496496
if ik % 1000 == 0:
497497
print("%d frames of binary, time %0.2f sec." % (ik, time.time() - t0))

suite2p/run_s2p.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ def pipeline(f_reg, f_raw=None, f_reg_chan2=None, f_raw_chan2=None,
223223
iscell = np.load(os.path.join(ops["save_path"], "iscell.npy"))
224224
redcell = np.load(os.path.join(
225225
ops["save_path"], "redcell.npy")) if ops["nchannels"] == 2 else []
226-
io.save_mat(ops, stat, F, Fneu, spks, iscell, redcell)
226+
io.save_mat(ops, stat, F, Fneu, spks, iscell, redcell,
227+
F_chan2, Fneu_chan2)
227228
else:
228229
print("no ROIs found, only ops.npy file saved")
229230
else:

0 commit comments

Comments
 (0)