MouseLand / suite2p

cell detection in calcium imaging recordings
http://www.suite2p.org
GNU General Public License v3.0
344 stars 240 forks source link

BUG: ops['nblocks'] ops['xblock'] ops['yblock'] not saved in suite2p 0.13.0? #972

Open jlarsch opened 1 year ago

jlarsch commented 1 year ago

Describe the issue:

I want to perform motion correction on a filtered stack and then apply the motion correction to the raw data. Using suite2p 0.10.0, I was able to apply the shifts from the filtered stack to the raw data using registration.register.nonrigid.transform_data as shown below. For this, I re-used the ops from the filtered stack.

Using suite2p 0.13.0, I can no longer do this. An error is thrown because the ops nblocks, xblock, and yblock are no longer saved.

Reproduce the code example:

## just copying a few relevant code bits here...

# running the correction on filtered data:
        ops = default_ops()
        db = {
            'look_one_level_down': False,
            'data_path': [self.temp_path_2],
            'tau': self.tau,
            'fs': self.volrate,
            'diameter': self.diameter,
            'reg_tif': True,
            'roidetect': False,
            'do_registration': True,
            'nonrigid': True,
            'keep_movie_raw': True,
            'do_regmetrics': True
        }

        run_s2p(ops=ops, db=db)

# then applying the shifts to the raw data:

registration.register.nonrigid.transform_data(
                data,
                nblocks=ops['nblocks'],
                xblock=ops['xblock'],
                yblock=ops['yblock'],
                ymax1=ymax1,
                xmax1=xmax1
            )

Error message:

No response

Version information:

0.13.0

Context for the issue:

Current workaround is to downgrade suite2p to 0.10.0