Closed mayofaulkner closed 2 years ago
Thanks for this @mayofaulkner!! It is fixed in the dev branch, commit 96e43fc. Let me know if you have issues with it. I'll do some more testing on it and create a pip release.
Hey, thanks for looking at this so quickly.
I'm now getting this error
Input In [5], in <cell line: 1>()
----> 1 dat[0]
File ~/Documents/PYTHON/envs/iblenv/lib/python3.8/site-packages/wfield/io.py:431, in GenericStack.__getitem__(self, squeeze, *args)
429 img = np.empty((len(idx1),*self.dims),dtype = self.dtype)
430 for i,ind in enumerate(idx1):
--> 431 img[i] = self._get_frame(ind)
432 if not idx2 is None:
433 if squeeze:
File ~/Documents/PYTHON/envs/iblenv/lib/python3.8/site-packages/wfield/io.py:786, in VideoStack._get_frame(self, frame)
784 fileidx,frameidx = self._get_frame_index(frame)
785 if not fileidx == self.current_fileidx:
--> 786 self._load_substack(fileidx,frameidx)
787 elif not frameidx == self.current_frameidx:
788 self._load_substack(fileidx,frameidx)
File ~/Documents/PYTHON/envs/iblenv/lib/python3.8/site-packages/wfield/io.py:768, in VideoStack._load_substack(self, fileidx, frameidx)
766 if not self.pix_fmt in ['yuv420p']:
767 outputdict = inputdict
--> 768 if not -'pix_fmt' in outputdict:
769 outputdict = {'-pix_fmt':'gray'}
770 # can't handle 3 channel color right now.
TypeError: bad operand type for unary -: 'str'
Looks like it is needs to be '-pix_fmt' rather than -'pix_fmt'
There is also one more thing that I noticed if you don't mind fixing (sorry I tried to create a branch but I don't have permissions). In the hemocorrect function in this line https://github.com/jcouto/wfield/blob/master/wfield/cli.py#L546, I think it should be changed to t[np.mod(functional_channel,2)::2]
to make sure the correct timepoints are interpolated when the functional channel is not 0.
Many thanks!
Thank you! I just changed those in dev. You should have permissions now though.
Just one last small fix which I have made here #10 and now it is all working perfectly. Thank you so much for your help!
Thank you so much @mayofaulkner!!
Hi Joao,
To save space in the IBL pipeline we compress the .dat file with the widefield to a .mov file using the
labcams.io.stack_to_mj2_lossless
function. I have found that running the wfield preprocess pipeline before and after compression yields different results.I think I have sourced the problem and it is due to the way that the video stack is being read when multiple interleaved channels are used
nchannels=2
, the data for the first and second channel are identical when they shouldn't be.Below is an example snippet
Would this be something that could be fixed as it means that it isn't possible to replicate the same preprocessing pipeline once the video is compressed and the original data deleted.
Many thanks!