DOI: 10.5061/dryad.jq2bvq8fp
title: Data from: Exponential history integration with diverse temporal scales in retrosplenial cortex supports hyperbolic behavior

description: Animals rely on their experience to guide their next choice. In
 foraging-type tasks guided by history-dependent value, these experiences
 are typically integrated such that the weights of past events initially
 decay quickly over time but show a longer tail than expected by
 exponential decay. Rather, such integration is better described by a
 hyperbolic function. Hyperbolic integration affords sensitivity to both
 recent environmental dynamics and long-term trends, however the mechanism
 by which the brain implements this hyperbolic integration is unknown. We
 trained mice on a history-dependent, value-based decision task and found
 that the mice indeed showed hyperbolic decay on their weighting of past
 experience. However, the activity of history-encoding cortical neurons
 showed weighting with exponential decay. In resolving this apparent
 mismatch, we observed that cortical neurons encode history information
 heterogeneously across a wide variety of exponential time-constants, with
 the retrosplenial cortex (RSC) overrepresenting longer time-constants
 compared to other areas. A model that combines these diverse timescales of
 exponential history integration can recreate the heavy-tailed, hyperbolic
 history integration observed in behavior. In particular, time-constants of
 RSC neurons best matched the behavior, and optogenetic inactivation of RSC
 uniquely reduced the use of history information. These results indicate
 that behavior-relevant history information is maintained in neurons across
 multiple timescales in parallel, and suggest that the neural population in
 RSC is a critical reservoir of this information guiding decision-making.
description: This dataset includes the processed data from <em>in
 vivo</em> two-photon calcium imaging, optogenetic stimulation, and
 behavioral choices from mice performing a decision-making task. The
 imaging data is trial-aligned fluorescence and deconvolved activity
 traces, as well as further analysis products of that data. The
 optogenetics data includes the stimulus parameters and the trial-by-trial
 choices made by the mice. Further details for the processing and
 acquisition can be found in the associated publication.
description: Analysis Code Code written in Python
 available in the linked Zenodo repository.  Behavior
 data Data was recorded during mouse in vivo imaging or
 inactivation sessions. Behavior data is saved in Python pickle files in
 the pandas dataframe format.<br>a: choice type for each trial (Right
 choice, Left choice, Alarm, Miss) = (1,2,3,4)<br>R: reward outcome
 type for each trial. (Reward delivered, Reward not delivered) =
 (1,0) Imaging data Processed
 two-photon calcium imaging data, aligned to trial ‘ready’ period or
 ‘choice’ period. Saved as a netcdf file in the xarray dataset format,
 bundling neural activity for all cells recorded in a session with that
 session’s behavior metrics. <br>spks: deconvolved estimate spike
 rate, aligned to ready cue onset. First data point corresponds to 2sec
 before ready cue onset. Last data point corresponds to 10sec after ready
 cue onset.<br>z_spks: zscore normalized spks, each cell zscored over
 the entire session. Inactivation data
 Behavior data from the inactivation sessions includes variable
 ‘a’ and ‘R’ as well as the inactivation condition ‘Opto’ and metadata
 associated with the inactivation parameters. <br>a: choice type for
 each trial (Right choice, Left choice, Alarm, Miss) =
 (1,2,3,4)<br>R: reward outcome type for each trial. (Reward
 delivered, Reward not delivered) = (1,0)<br>Opto: inactivation
 status for the trial. (cortical inactivation, control inactivation) =
 (1,0)<br>Inac Type: trial-aligned timing of inactivation, either
 aligned to the 'ready-answer' periods, the 'intertrial
 interval', or the both. String = ('ra', 'iti',
 '0i1ra')<br>Area: the area targeted for inactivation in
 that session Analysis outputs All
 of the outputs associated with the analysis are located in the respective
 directories. Reference the Jupyter notebook files for the specific
 analysis performed and the generation of the figures from the output
 data.
description: # Exponential history integration with diverse temporal scales in
 retrosplenial cortex supports hyperbolic behavior. This repository
 contains the code and processed data necessary to regenerate figures from:
 &gt; Danskin B.P. et al. Exponential history integration with diverse
 temporal scales in retrosplenial cortex supports hyperbolic behavior
 (2023). Science Advances. DOI: 10.1126/sciadv.adj4897 . Data deposited to
 Dryad, doi:10.5061/dryad.jq2bvq8fp . Code deposited to Zenodo via Github,
 doi:10.5281/zenodo.8152662 . All necessary analysis functions are
 contained in the associated notebook, or in `bdanskin.py` . ## Repository
 layout `. BDanskin_SciAdvances_2023 ### source folder`\ `|- py_code/ ###
 expected location of bdanskin.py`\ `|- chr2_optogenetics/ ### zipped
 directory containing pkl files for analysis and plotting`\ `|-
 hattori_datasets_behavior/ ### nested zipped directory containing pkl
 files for analysis and plotting`\ `|- hattori_datasets_xarray/ ### nested
 zipped directory containing netcdf files in the xarray format; imaging and
 behavior data for analysis`\ `|- hattori_datasets_xarray_cellfits/ ###
 zipped directory containing netcdf files in the xarray format; the outputs
 of analysis and used for plotting`\ `| bdanskin_analysis_all.ipynb ###
 notebook file to run all analysis`\ `| bdanskin_plot_figure_1.ipynb ###
 notebook file to load analysis outputs and plot Fig 1`\ `|
 bdanskin_plot_figure_2.ipynb ### notebook file to load analysis outputs
 and plot Fig 2`\ `| bdanskin_plot_figure_3.ipynb ### notebook file to load
 analysis outputs and plot Fig 3`\ `| bdanskin_plot_figure_4.ipynb ###
 notebook file to load analysis outputs and plot Fig 4` ## Data files ###
 Behavior data `|---
 hattori_datasets_behavior//imaging_processed_data_behonly//(mouse_id)_(date)_(brain_area).pkl` Data was recorded during mouse in vivo imaging session. Behavior data is saved in Python pickle files in the pandas dataframe format. a: choice type for each trial (Right choice, Left choice, Alarm, Miss) = (1,2,3,4) R: reward outcome type for each trial. (Reward delivered, Reward not delivered) = (1,0) `|-- hattori_datasets_behavior//all_behavior_df.pkl` The concatenation of the behavior data from all imaging sessions. Saved as a Python pickle file in the pandas dataframe format. a: choice type for each trial (Right choice, Left choice, Alarm, Miss) = (1,2,3,4) R: reward outcome type for each trial. (Reward delivered, Reward not delivered) = (1,0) Area: the area targeted for inactivation in that session Date: the date of the session in YYMMDD Mouse: the id of the mouse, string `|-- hattori_datasets_behavior//all_behavior_contingency_df.pkl` The concatenation of the behavior data from all imaging sessions, with metadata on the reward contingency. Saved as a Python pickle file in the pandas dataframe format. a: choice type for each trial (Right choice, Left choice, Alarm, Miss) = (1,2,3,4) R: reward outcome type for each trial. (Reward delivered, Reward not delivered) = (1,0) 6:1 : boolean for the reward contingency with a 6:1 probability 3:1 : boolean for the reward contingency with a 3:1 probability Area: the area targeted for inactivation in that session Date: the date of the session in YYMMDD Mouse: the id of the mouse, string `|-- hattori_datasets_behavior//early_behavior_df.pkl` The concatenation of the behavior data from early imaging sessions, before expert criterion. Saved as a Python pickle file in the pandas dataframe format. a: choice type for each trial (Right choice, Left choice, Alarm, Miss) = (1,2,3,4) R: reward outcome type for each trial. (Reward delivered, Reward not delivered) = (1,0) Area: the area targeted for inactivation in that session Date: the date of the session in YYMMDD Mouse: the id of the mouse, string ### Imaging data `|-- hattori_datasets_xarray//(mouse_id)_(date)_(brain_area)_readyaligned.nc` Two-photon calcium imaging data, aligned to trial ‘ready’ period period. Saved as a netcdf file in the xarray dataset format, bundling neural activity for all cells recorded in a session with that session’s behavior metrics. a: choice type for each trial (Right choice, Left choice, Alarm, Miss) = (1,2,3,4) R: reward outcome type for each trial. (Reward delivered, Reward not delivered) = (1,0) spks: deconvolved estimate spike rate, aligned to ready cue onset. First data point corresponds to 2sec before ready cue onset. Last data point corresponds to 10sec after ready cue onset z_spks: zscore normalized spks, each cell zscored over the entire session `|--- hattori_datasets_xarray//preprocess_data_2s//(mouse_id)_(date)_(brain_area)_(temporal_alignment)_2s.nc` Two-photon calcium imaging data, with the 2-second average of neural activity aligned to various trial epochs, across all trials and cells for the session Saved as a netcdf file in the xarray dataset format, bundling neural activity for all cells recorded in a session with that session’s behavior metrics a: choice type for each trial (Right choice, Left choice, Alarm, Miss) = (1,2,3,4) R: reward outcome type for each trial. (Reward delivered, Reward not delivered) = (1,0) spks: deconvolved estimate spike rate, aligned to ready cue onset. Mean over 2 sec z_spks: zscore normalized spks, each cell zscored over the entire session. Mean over 2 sec ### Inactivation data `|-- chr2_optogenetics//ChR2_session_summary.pkl` Behavior data from the inactivation sessions includes variable ‘a’ and ‘R’ as well as the inactivation condition ‘Opto’ and metadata associated with the inactivation parameters. a: choice type for each trial (Right choice, Left choice, Alarm, Miss) = (1,2,3,4) R: reward outcome type for each trial. (Reward delivered, Reward not delivered) = (1,0) Opto: inactivation status for the trial. (cortical inactivation, control inactivation) = (1,0) Inac Type: trial-aligned timing of inactivation, either aligned to the ready-answer periods, the intertrial interval, or the both. String = (ra, iti, 0i1ra) Area: the area targeted for inactivation in that session Date: the date of the session in YYMMDD Mouse: the id of the mouse, string ## Analysis outputs All of the outputs associated with the analysis are located in the respective directories. Reference the Jupyter notebook files for the specific analysis performed and the generation of the figures from the output data. Intermediate processing files derived from and used by the notebook files are as follows: ### Behavior data `|-- hattori_datasets_behavior//behlogit_exp_hyp_history.nc` Model performance and parameter estimates for the exponential and hyperbolic behavior models, compared across history terms. Saved as a netcdf file in the xarray dataset format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//behlogit_imaging_15_hist.pkl` Model performance and parameter estimates for the temporal behavior models on the imaging data. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//behlogit_imaging_15_hist_constrained.pkl` Model performance and parameter estimates for the temporal behavior models on the imaging data with different optimization parameters. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//behlogit_imaging_compare_hist.pkl` Model performance and parameter estimates for the temporal behavior models on the imaging data, compared across history terms. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//behlogit_rl_base_15_hist.pkl` Model performance and parameter estimates for the temporal behavior models on the simulated behavior. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//behlogit_rl_base_compare_hist.pkl` Model performance and parameter estimates for the temporal behavior models on the simulated behavior, compared across history terms. Saved in Python pickle files in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//behlogit_rl_full_15_hist.pkl` Model performance and parameter estimates for the temporal behavior models on the simulated behavior. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//behlogit_rl_full_compare_hist.pkl` Model performance and parameter estimates for the temporal behavior models on the simulated behavior, compared across history terms. Saved in Python pickle files in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//logistic_base_rl_10_hist.pkl` Model performance and parameter estimates for the logistic regression on the simulated behavior. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//logistic_full_rl_10_hist.pkl` Model performance and parameter estimates for the logistic regression on the simulated behavior. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//logistic_imaging_10_hist.pkl` Model performance and parameter estimates for the logistic regression on the imaging behavior. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. `|-- hattori_datasets_behavior//quasihyp_subsample_cv.nc` Model performance for the quasihyperbolic behavior model, with the outputs from 1000 iterations. Saved as a netcdf file in the xarray dataset format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#QuasiHyp. Used for in Jupyter notebook file bdanskin_plot_figure_3.ipynb. `|-- hattori_datasets_behavior//rl_simulation_full_base_all_imaging_(n_trials).pkl` Output of the behavior simulation with either 600 or 10000 trials. Saved in Python pickle files in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#BehaviorAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_1.ipynb. ### Imaging data `|--- hattori_datasets_xarray_cellfits//ready_cellfits_RCp1//RCp1_2s_(mouse_id)_(date)_(brain_area).nc` Model performance and parameter estimates for the null cell model with one past history term. Saved as netcdf files in the xarray dataset format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#ImagingAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_2.ipynb. `|--- hattori_datasets_xarray_cellfits//ready_shuffle//partition_300_2s_(mouse_id)_(date)_(brain_area)_15hist_shuffle.nc` Model performance and parameter estimates for the cell temporal history model on trial-shuffled data. Saved as netcdf files in the xarray dataset format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#ImagingAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_2.ipynb and bdanskin_plot_figure_3.ipynb `|---- hattori_datasets_xarray_cellfits//ready_cellfits//cv_compare_mdl//sse_(mouse_id)_(date)_(brain_area)_15hist.nc` Detailed model performance, compared across multiple versions of the cell temporal history model. Saved as netcdf files in the xarray dataset format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#ImagingAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_2.ipynb and bdanskin_plot_figure_3.ipynb `|---- hattori_datasets_xarray_cellfits//ready_cellfits//halves_compare_mdl//sse_(mouse_id)_(date)_(brain_area).nc` Model performance and parameter estimates of the cell history model across temporal windows within a session. Saved as netcdf files in the xarray dataset format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#ImagingAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_2.ipynb and bdanskin_plot_figure_3.ipynb ### Inactivation data `|-- chr2_optogenetics//ChR2_wsls.pkl` Win-Stay and Lose-Switch probabilities under optogenetic inactivation. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#OptoAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_4.ipynb. `|-- chr2_optogenetics//logistic_ChR2_l1l2_subsample1000.pkl` Model performance and parameter estimates for the logistic regression on inactivation data. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#OptoAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_4.ipynb. `|-- chr2_optogenetics//opto_behlogit_RA_10hist.pkl` Model performance and parameter estimates for the temporal behavior models on inactivation data. Saved as a Python pickle file in the pandas dataframe format. Generated in Jupyter notebook file bdanskin_analysis_all.ipynb#OptoAnalysis. Used for in Jupyter notebook file bdanskin_plot_figure_4.ipynb.