def cache(cache_test_base): return bpc.BehaviorProjectCache(cache_test_base)
# Grab the experiment ID experiment_id = sys.argv[1] # Define the cache cache_json = { 'manifest_path': '/allen/programs/braintv/workgroups/nc-ophys/visual_behavior/SWDB_2019/visual_behavior_data_manifest.csv', 'nwb_base_dir': '/allen/programs/braintv/workgroups/nc-ophys/visual_behavior/SWDB_2019/nwb_files', 'analysis_files_base_dir': '/allen/programs/braintv/workgroups/nc-ophys/visual_behavior/SWDB_2019/extra_files' } # load the session cache = bpc.BehaviorProjectCache(cache_json) nwb_path = cache.get_nwb_filepath(experiment_id) api = BehaviorOphysNwbApi(nwb_path, filter_invalid_rois=True) session = BehaviorOphysExperiment(api) # Where to save the results output_path = '/allen/programs/braintv/workgroups/nc-ophys/visual_behavior/SWDB_2019/flash_response_500msec_response' # Define parameters for dff_trace, and response_window response_analysis_params = { 'window_around_timepoint_seconds': [-.5, .75], # -500ms, 750ms 'response_window_duration_seconds': 0.5, 'baseline_window_duration_seconds': 0.5 } # compute the base flash_response_df
# , makeHeatmap, plotCluesToEngagementVsNot, plotStatisticsOfVariableVariance, # seaborn is another library for statistical data visualization # seaborn style & context settings make plots pretty & legible import seaborn as sns sns.set_context('notebook', font_scale=1.5, rc={'lines.markeredgewidth': 2}) sns.set_style('white') sns.set_palette('deep') #%% # Allen Brain import # Import allensdk modules for loading and interacting with the data from allensdk.brain_observatory.behavior.swdb import behavior_project_cache as bpc cache_path = '/media/charles/Brain2019/dynamic-brain-workshop/visual_behavior/2019' cache = bpc.BehaviorProjectCache(cache_path) #%% ''' Choose an experiment: ''' # get the experiments as a panda: experiments = cache.experiment_table # select an experiment_id: expList = experiments.loc[(experiments.passive_session == False) & (experiments.cre_line == 'Slc17a7-IRES2-Cre')] # & (experiments.imaging_depth == 175) ] # 175 or 375. inhibitory = 'Vip-IRES-Cre' # Note: the 'index' col is not 0 to n, but rather are a subset of the indices of the full table #%% # add column with checkout times: expList = addRewardedExcitationExperimentCheckoutTimesToExperimentTable(