AllenInstitute / visual_behavior_analysis

Python package for analyzing behavioral data for Brain Observatory: Visual Behavior
Other
22 stars 6 forks source link

SDK get_params() function is broken because of VBA #660

Closed alexpiet closed 4 years ago

alexpiet commented 4 years ago

the session object has a system for tracking parameters and you can use get_params() to see those parameters. However, the VBA loading module adds a parameter to the session object include_invalid_rois but doesn't add it to the parameter tracking system defined in session_api_utils as a result calls to get_params() result in an attribute error about include_invalid_rois.

A simple hack is to add include_invalid_rois to the list of parameters to be ignored: session._ignore.add('include_invalid_rois') which then resolves the attribute error.

oeid = 986518885
import visual_behavior.data_access.loading as loading
dataset = loading.get_ophys_dataset(oeid, include_invalid_rois=False)
dataset.get_params() # throws error
dataset._ignore.add('include_invalid_rois')
dataset.get_params() #returns incorrect empty dictionary

This isn't great because we should be using the parameter tracking system. In addition, there is a separate issue that is causing get_params() to break in a different way .

If you load the session directly, the parameter system works.

cache = bpc.from_lims()
session = cache.get_session_data(oeid)
session.get_params() # returns a dictionary

@matchings @dougollerenshaw

alexpiet commented 4 years ago

After digging into this, its clear there are two separate issues here.

The first is that when BehaviorOphysDataset adds a new parameter include_invalid_rois it needs to either add it to the ._ignore set, or figure out how the session_api_utils.ParamsMixin needs it formatted for it to work.

The second is that when creating the BehaviorOphysDataset object, the eye tracking parameters are not added to the parameter list. It is unclear why this happens, and it could be related to why the invalid_rois parameter doesnt work with ParamsMixin, but I'm not sure.

I'm not super sharp on class inheritance rules in python, so this is tricky.