2AFC¶
The repository contains multiple 2AFC-related analysis stacks rather than one unified package.
The main directories are:
2p_2AFC_reg_version/2p_2AFC_double_block_version/single_interval_discrimination_202505/
Common structure¶
The older 2p_2AFC_* directories share a similar layout:
Main.pyas the top-level orchestration scriptModules/for readers, trialization, clustering, and decodingPlot/for field-of-view and event-aligned figures
Common module names include:
reader.pytrialize.pyclustering_neurons.pydecoding.py
The workflow in both older variants is broadly:
- Read one or more processed session directories.
- Load masks and mean images.
- Trialize the session to produce event-aligned neural data.
- Read
neural_trialsand optional trial labels. - Generate per-session and pooled figures.
- Optionally run clustering or decoding analyses.
2p_2AFC_reg_version/¶
This looks like the earlier, simpler analysis variant.
Main.py:
- defines a hard-coded list of session paths
- loads masks and field-of-view images
- trializes each session
- plots licking and event-aligned neural responses
- performs pooled clustering and decoding when multiple sessions are provided
The main pooled analysis hooks are:
Modules.clustering_neurons.clustering_GMMModules.decoding.decoder_decisionPlot.plot_licking_neural_responsePlot.plot_events_neural_response
2p_2AFC_double_block_version/¶
This is the more feature-rich 2AFC branch currently present in the repo.
Compared with the earlier version, it adds:
- additional plotting modules such as
plot_epoch_response.pyandplot_licking.py - alternate decoding implementations including
decoding_four.pyanddecoding_multiple_settings.py - explicit handling of block structure, epoch summaries, and licking-pattern outputs
Main.py follows the same broad pattern as the earlier version, but the analysis surface is larger and more configurable.
single_interval_discrimination_202505/¶
This directory is a newer project with a different organization:
main.pyorchestrates the analysissession_configs.pydefines subject-level groupingmodules/contains trialization, significance testing, alignment, and readersvisualization*.pysplits reporting into field-of-view, behavior, perception, and decision sectionsplot/contains figure-specific helpers
Its run(session_config_list) function performs:
- session config expansion
- optional trialization
- optional significance testing
- report generation through the visualization modules
- final packaging through
webpage.pack_webpage_main
This makes it structurally closer to the passive project than to the older 2p_2AFC_* scripts.
Inputs and outputs¶
Across all 2AFC-related projects, the expected upstream inputs are generally:
- postprocessed session folders
- mask and ROI label files
dff.h5- voltage-derived event timing
- Bpod behavioral metadata
Typical outputs include:
neural_trials.h5- pooled trial labels
- field-of-view summaries
- event-aligned neural and licking figures
- clustering or decoding summaries
- in the newer stack, HTML reports
Practical note¶
Most 2AFC entry scripts currently rely on hard-coded session paths or imported session config blocks. They are best treated as lab analysis drivers that you edit for a specific dataset, not as stable general-purpose CLIs.