Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass var_name_hdf5 when running mcorr #197

Open
oterocoronel opened this issue Apr 26, 2023 · 2 comments
Open

How to pass var_name_hdf5 when running mcorr #197

oterocoronel opened this issue Apr 26, 2023 · 2 comments

Comments

@oterocoronel
Copy link

oterocoronel commented Apr 26, 2023

I have some .h5 files that have the data in a field named 'data'.
I have tried passing var_name_hdf5 = 'data' when adding an additional parameter like this:

df.caiman.add_item(
    algo='mcorr',
    input_movie_path=movie_path,
    params=mcorr_params1,
    item_name=movie_path.stem,  
    var_name_hdf5 = 'data'
) 

But when trying to actually run mcorr, it fails. The output is:

{'success': False,
 'traceback': 'Traceback (most recent call last):\n  File "/home/lab/.mambaforge/envs/mescore/lib/python3.10/site-packages/mesmerize_core/algorithms/mcorr.py", line 67, in run_algo\n    mc.motion_correct(save_movie=True)\n  File "/home/lab/.mambaforge/envs/mescore/lib/python3.10/site-packages/caiman/motion_correction.py", line 249, in motion_correct\n    mi = min(mi, next(iterator).min()[()])\n  File "/home/lab/.mambaforge/envs/mescore/lib/python3.10/site-packages/caiman/base/movies.py", line 2254, in load_iter\n    for y in Y:\nTypeError: \'NoneType\' object is not iterable\n'}

I suspect that the issue is that when trying to run MotionCorrection, it is only passing the motion parameters. This is easy to fix in CaImAn vanilla, because I can invoke it like this:

mc = MotionCorrect(fnames, dview=dview, var_name_hdf5='data', **opts.get_group('motion'))

Any suggestions? Thanks!

@X4ndri
Copy link

X4ndri commented Apr 26, 2023

I was about to open an issue about the same thing.

@kushalkolar
Copy link
Collaborator

This would require adding a key to the params dict, call it "MotionCorrect-constructor", which is a dict of kwargs then checking if it exists and dumping it here: https://github.com/nel-lab/mesmerize-core/blob/master/mesmerize_core/algorithms/mcorr.py#L66

I could do a PR later today, unless you want to try it out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants