Closed aamster closed 1 year ago
Validated that data in db is same as released data (or if not, matches the pkl file) for both vbo and vbn using code like
import pandas as pd from allensdk.brain_observatory.behavior.behavior_project_cache import \ VisualBehaviorOphysProjectCache from allensdk.brain_observatory.behavior.data_files import BehaviorStimulusFile from allensdk.core.auth_config import LIMS_DB_CREDENTIAL_MAP from allensdk.internal.api import db_connection_creator def check_bs(): # check behavior_sessions bs = bc.get_behavior_session_table() bs_released = pd.read_csv('/allen/aibs/informatics/aamster/behavior_session_table.csv') bs_released = bs_released.set_index('behavior_session_id') bs_released['session_type_new'] = bs['session_type'] different = bs_released[bs_released['session_type'] != bs_released['session_type_new']][['session_type', 'session_type_new']] for behavior_session_id in different.index: stim = BehaviorStimulusFile.from_lims( behavior_session_id=behavior_session_id, db=db_connection_creator( fallback_credentials=LIMS_DB_CREDENTIAL_MAP) ) assert different.loc[behavior_session_id]['session_type_new'] == stim.session_type def check_oe(): # check ophys experiments oe = bc.get_ophys_experiment_table() oe_released = pd.read_csv( '/allen/aibs/informatics/aamster/ophys_experiment_table.csv') oe_released = oe_released.set_index('ophys_experiment_id') oe_released['session_type_new'] = oe['session_type'] different = oe_released[ oe_released['session_type'] != oe_released['session_type_new']][ ['session_type', 'session_type_new', 'behavior_session_id']] for row in different.itertuples(index=False): stim = BehaviorStimulusFile.from_lims( behavior_session_id=row.behavior_session_id, db=db_connection_creator( fallback_credentials=LIMS_DB_CREDENTIAL_MAP) ) assert row.session_type_new == stim.session_type if __name__ == '__main__': bc = VisualBehaviorOphysProjectCache.from_lims( data_release_date=['2021-03-25', '2021-08-12', '2022-07-20']) check_bs() check_oe()
Validated that data in db is same as released data (or if not, matches the pkl file) for both vbo and vbn using code like