AllenInstitute / visual_behavior_analysis

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

AttributeError: 'VisualBehaviorOphysProjectCache' object has no attribute 'get_experiment_table' #747

Closed dougollerenshaw closed 3 years ago

dougollerenshaw commented 3 years ago

When running

from visual_behavior.data_access import loading
oeid = 993863108
session = loading.get_ophys_dataset(oeid)
session.behavior_movie_predictions['timestamps']

I get

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-10-7dcc47bc9814> in <module>
----> 1 session.behavior_movie_predictions['timestamps']

/allen/programs/braintv/workgroups/nc-ophys/Doug/code/AllenSDK/allensdk/core/lazy_property/lazy_property_mixin.py in __getattribute__(self, name)
     11 
     12         lazy_class = super(LazyPropertyMixin, self).__getattribute__('LazyProperty')
---> 13         curr_attr = super(LazyPropertyMixin, self).__getattribute__(name)
     14         if isinstance(curr_attr, lazy_class):
     15             return curr_attr.__get__(curr_attr)

/allen/programs/braintv/workgroups/nc-ophys/Doug/code/visual_behavior_analysis/visual_behavior/data_access/loading.py in behavior_movie_predictions(self)
    441     def behavior_movie_predictions(self):
    442         cache = get_visual_behavior_cache()
--> 443         ophys_session_id = utilities.get_ophys_session_id_from_ophys_experiment_id(self.ophys_experiment_id, cache)
    444         movie_predictions = get_behavior_movie_predictions_for_session(ophys_session_id)
    445         movie_predictions.index.name = 'frame_index'

/allen/programs/braintv/workgroups/nc-ophys/Doug/code/visual_behavior_analysis/visual_behavior/data_access/utilities.py in get_ophys_session_id_from_ophys_experiment_id(ophys_experiment_id, cache)
    290     """
    291     if cache:
--> 292         ophys_experiments = cache.get_experiment_table()
    293         if ophys_experiment_id not in ophys_experiments.index:
    294             raise Exception('ophys_experiment_id not in experiment table')

AttributeError: 'VisualBehaviorOphysProjectCache' object has no attribute 'get_experiment_table'

It looks like this may be related to changes in the SDK. Investigating...but before I get too deep, @matchings any guess as to the source of this?

dougollerenshaw commented 3 years ago

Note that this same error occurs when I call:

session.behavior_movie_pc_activations

It looks like this should be a simple matter of changing the method for converting ophys_experiment_id to ophys_session_id. I'll put a PR in shortly.

@alexpiet, note, that this likely explains why the GLM has been failing to load the face motion regressor latey!

matchings commented 3 years ago

@dougollerenshaw i believe it should just be get_ophys_experiment_table instead of get_experiment_table

dougollerenshaw commented 3 years ago

@matchings I actually solved this by using a different method for converting the ophys_experiment_id to ophys_session_id. See PR #749

dougollerenshaw commented 3 years ago

fixed in PR #749