Open just-meng opened 1 year ago
I found the bug: if the folder of the suite2p registered images is passed to fissa.Experiment(images, rois, folder)
as argument images
, the tif files will be sorted according to
self.images = sorted(glob.glob(os.path.join(images, "*.tif*")))
This leads to incorrectly sorted images simply due to the naming of the tif files:
file000_chan0, file500_chan0, file1000_chan0
After sorting it lists:
file000_chan0, file1000_chan0, file500_chan0
The result is temporally mis-appended signals.
A quick fix to my code (not elegant but works):
images_folder = "./reg_tif"
images_path = glob.glob(os.path.join(images_folder, "*.tif*"))
# extract the interger that indicates the number of the starting frame of the tif and add to the path as a tuple
images_path = [(int(path.split('_')[-2].split('file')[-1]), path) for path in images_path]
# sort the path list according to the frame numbers
sorted_path = sorted(images_path)
# get rid of the integer and make a list of the now sorted paths
sorted_path = list(np.array(sorted_path)[:,1])
Now one can run fissa.Experiment(sorted_path, rois, folder)
.
Hi there,
I was running fissa on suite2p motion-corrected reg_tif files following this instruction. When comparing the result with the subtraction method (F = 0.7*Fneu) I noticed that they were nowhere similar to each other. Having a look at the extracted raw signals by fissa (
experiment.raw
) and by suite2p (F.npy
) of the same roi I noticed that also the raw traces were not similar.I triple-checked the roi identity and plotted
experiment.roi_polys[i_roi, trial][0]
to compare with suite2p GUI). It definitely is the same roi. Any idea why the raw traces do no agree?Just to be sure, the code is attached here:
n_cells
andcell_ids
are previously obtained fromF.npy
andiscell.npy
.