Experiment · data · figures · analysis — Zhong et al. 2025

Visual learning in the Zhong et al. dataset

A research reference for the experiment, released data, figure recipes, and the planned within-session comparison of passive reward with unrewarded exposure.

Nature 644, 741 · 2025 19 imaging mice · 89 recordings 20.5k–89.6k neurons/rec 421.2 GiB · 297 files CC BY 4.0

Figure and panel references link to the corresponding Nature figure page. The open-access full text, released data, analysis code, and methods review remain one click away.

01
The finding

Most measured visual-cortical plasticity was reproduced without reward

Zhong, Baptista, Gattoni, Arnold, Flickinger, Stringer and Pachitariu recorded up to approximately 90,000 neurons simultaneously across primary visual cortex (V1) and the higher visual areas (HVAs) while mice learned a texture-discrimination task, and separately while other mice were exposed to the same textures without reward (Zhong et al. 2025).

Neural changes in the task mice tracked behavioural learning, yet many of the same changes appeared in mice exposed to the stimuli without reward. The authors interpret most measured sensory-representation changes as consistent with unsupervised learning, while identifying a distinct task-specific reward-prediction signal.

Two central findings

Plasticity was highest in the medial HVAs (posteromedial, anteromedial and mediomedial-anterior areas), with smaller overall changes in V1, for both task and unrewarded cohorts (Fig. 1i,j). A reward-prediction signal that ramped in anterior HVAs was specific to task mice (Fig. 4).

Primary sources and exact figure pages
Publication, data, code, methods, and figure links used in this reference
SourceDirect linksUse here
PublicationNature article · DOI · open-access full textClaims, methods, sample sizes, and statistics
Main figuresFig. 1 · Fig. 2 · Fig. 3 · Fig. 4 · Fig. 5Panel-level interpretation and reproduction map
Extended DataED Fig. 1 · ED Fig. 2 · ED Fig. 9Threshold, locomotion, and within-day behavioural precedents
Data and codeFigshare v2 · paper-tagged codeReleased files and executable figure recipes
Analysis methodsStringer & Pachitariu 2024 · open PDFCross-validation, controls, and interpretation safeguards

Open Figure 1 on Nature ↗

Figure 1 from Zhong et al. 2025: the task, timeline, and plasticity results
Figure 1 — Plasticity in the visual cortex after supervised and unsupervised training. Reproduced from Zhong et al., Nature 644, 741 (2025), under CC BY 4.0.

The paper reports plasticity as an endpoint comparison — selectivity before versus after roughly two weeks of training. Whether the rate of change within a single session differs between passive-reward and unrewarded cohorts is not addressed, and is the subject of the within-session extension in §07.

02
Mice, cohorts & stages

The animals and the training schedule

The imaging study used 19 mice (13 male, 6 female; 2–11 months; TetO-GCaMP6s × CaMK2a-tTA, GCaMP6s in excitatory neurons) across 89 recordings. Each recording_id = {mouse}_{date}_{block} serves as the {rec} key. Reported n varies by panel; for example Fig. 1j uses n = 4 task, 9 unrewarded and 3 grating mice.

Imaging cohorts and reward conditions
CohortPrefixRewardMiceNotes
Tasksup_*Water associated with leaf14–5Train 1 before-learning: 4 mice, all passive reward. After-learning mixes passive and active-after-cue modes.
Unrewardedunsup_*None6–9Identical corridors, no water; sound cue still presented. leaf1 is the same stimulus, unrewarded
Grating control*_gratingNone3Grating walls (0°, 45°); 5–6 sessions
Naivenaive_*Untrained7–911 sessions (each mouse sees more than one pair)
A distinct behaviour-only cohort

Fig. 5 and Extended Data Fig. 9 use 23 additional mice with no imaging, split 11 naturalistic-pretrained / 7 grating-pretrained / 5 no-pretrain, followed by a simplified 5-day reward task. Their behaviour files use a per-trial schema (LickPos, LickTrind, WallType) keyed {mouse}_{date}_dayN, distinct from the imaging per-frame ft_* arrays, and carry no neural data.

Stage schedule

The task and unrewarded imaging cohorts follow the staged Train/Test sequence below, with before-learning and after-learning imaging blocks roughly two weeks apart (timeline, Fig. 1b). Naive and grating controls contribute comparison sessions rather than passing through every task stage. The release index contains 23 experiment labels spanning cohort, stage, and learning status.

Experimental stages and released file families
StageDurationStimuliDescription · files
Acclimation>8 daysgrey / spoutHead-fix and running habituation (>6 cm/s); restricted mice receive spout training.
Train 1~2 weekscircle1 (0) vs leaf1 (2)Coarse discrimination; task mice lick selectively to leaf1. Beh_{sup,unsup}_train1_{before,after}_learning.npy, {rec}_SVD_dec.npy, {rec}_trans.npz. The stage used by the within-session extension.
Test 1test session+circle2 (1), leaf2 (3)New exemplars; licking generalises to leaf2, not circle2. Basis of the visual-versus-spatial analysis (Fig. 2).
Train 2~1 weekcircle1, leaf1, leaf2Fine discrimination until licking to leaf2 ceases; leaf2 orthogonalises from leaf1, strongest in medial HVAs (Fig. 3).
Test 2test session+leaf3 (4)Novel exemplar; coding-direction generalisation.
Test 3test session+leaf1_swap (5,6)Spatially rearranged leaf1; tests stimulus identity against position.
03
Stimuli

Stimulus roles are session-specific

The paper refers to stimulus roles; the released files store physical wall names. The mapping between them is set per session, and conflating the two is a frequent source of mislabeling.

Session-normalized stimulus roles
Rolestim_idMeaning
circle10Unrewarded reference in the leaf1-vs-circle1 comparison
circle21Other exemplar, unrewarded family
leaf12Reward-associated texture in task mice; matched but unrewarded role in exposure mice
leaf23Same visual family as leaf1; introduced without reward (later leaf3 = 4, leaf1_swap = 5, 6)
Resolving roles per session

Four physical families exist (leaf, circle, rock, brick). The released WallName takes values rock1/rock2/wood1/wood2, where wood corresponds to the paper’s “brick”. Which physical wall carries which role is set per session. In rewarded sessions the role can be recovered with get_cat_id(WallName, isRew) (rewarded wall → leaf1). In unrewarded sessions isRew is uniformly false, so the role is read directly from stim_id: UniqWalls[stim_id==2] is leaf1 and UniqWalls[stim_id==0] is circle1. Either way, stim_ID=[2,0] denotes leaf1 versus circle1 for every cohort and physical pair.

04
The data

Contents of the release, and the tractable access path

The published dataset is on Figshare (doi:10.25378/janelia.28811129.v2, CC BY 4.0), and the paper recipes are in the paper-tagged analysis release. Files are keyed by recording_id = {mouse}_{date}_{block}. The reduced representation reconstructs spk = UTV and supports efficient exploratory population analysis. Exact paper-style per-neuron selectivity uses the full deconvolved traces; agreement between representations must be measured rather than assumed.

Released data layers
LayerFileContentsSize
BehaviourBeh_{experiment}.npydict: session → per-frame arrays108.1–412.5 MiB
Reduced neural{rec}_SVD_dec.npyU (comp×neuron), V (comp×frame), 400 components59.6–174.9 MiB
Full neural{rec}_neural_data.npy{'spks': [...]} → concat = neurons×frames1.4–9.3 GiB
Retinotopy{rec}_trans.npziarea (neuron→area), xy_t (cortical x,y)0.7–3.1 MiB
Area outlinesareas.npz['out'] area outline polygons158 KB
IndexImaging_Exp_info.npy142 experiment–recording memberships21 KB
Imaging & neurons

Two-photon mesoscope with temporal multiplexing, recording V1 and many higher visual areas simultaneously; 20,547–89,577 neurons per recording. Processing used Suite2p followed by non-negative deconvolution (decay 0.75 s). Neural analyses use the deconvolved traces or their released 400-component reduction.

Behaviour fields (per frame)

ft_trInd trial, ft_WallID texture, ft_move running, ft_CorrSpc in-texture, ft_Pos/ft_PosCum position, ft_RunSpeed. Per trial: WallName, UniqWalls, stim_id, isRew, ntrials, SoundDelPos.

Visual-area identifiers (neu_area_ID)

V1 = iarea==8; mHV (medial) = {0,1,2,9}, grouping PM, AM, MMA and lateral retrosplenial cortex; lHV (lateral) = {5,6}; aHV (anterior) = {3,4}. Identifiers -1 and 7 lie outside the included visual-cortical groups. The largest overall selective-fraction change is medial; the whole-V1 fraction changes less, although subregions and stimulus poles can differ.

05
The environment

Workspace layout, drive.py, and graph.py

The dataset is large enough that a single, verified copy is shared rather than duplicated per user. Two small modules sit on top of that copy: drive.py, which provides safe access to the files, and graph.py, which turns ordinary Python functions into an editable, visible dataflow so that analyses can be run without editing code.

Google Drive workspace

The shared workspace folder holds the code and notebooks at its root; the dataset is a separate shared folder, added as a shortcut and kept read-only, whose layout mirrors the Figshare release. Members add the workspace as a shortcut in their own Drive; a notebook mounts Drive and imports the two modules from that path.

Zhong et al. 2025 — Workspace            (shared folder, added as a My Drive shortcut)
├── drive.py                            access layer over the release
├── graph.py                            analysis-graph runner and widget
├── zhong2025/                          catalog + relationship helpers (Python package)
├── notebooks/                          Colab notebooks (00, 03, 04, …)
├── README.md, pyproject.toml
│
└── Janelia dataset (Figshare v2)       separate shared folder, read-only
    ├── data/
    │   ├── beh/                        behaviour bundles + Imaging_Exp_info.npy
    │   ├── spk/                        full neural recordings
    │   ├── SVD_dec/                    400-PC reduced neural
    │   └── retinotopy/                 transforms + areas.npz
    └── metadata/                       catalog.csv · RELEASE.json · MD5SUMS · TRANSFER_STATUS.json

drive.py — access layer

The module exposes a short public workflow and keeps path resolution, checksum verification, pickle handling, caching and a size guard internal. A catalog drives lookups, so listing or filtering files never scans Drive. Two modes are supported: a connected mode that reads the mounted release and validates it against metadata/catalog.csv, RELEASE.json and TRANSFER_STATUS.json; and a metadata-only mode that uses the bundled catalog without fetching files.

Public data-access workflow
CallResult
data = setup()a Dataset (connected if the release is mounted, else metadata-only)
data.recording(id)a Recording, resolving its behaviour, SVD, full-neural and retinotopy files
data.recordings(experiment=, mouse=)recordings selected by scientific identity, not by path
data.find(category=, contains=, …)catalog rows matching a query, without opening any file
rec.load(layer) / data.load(name)verified, in-memory arrays or dictionaries (size and MD5 checked before load)
data.figshare() · data.picker()the Figshare article metadata · a visual file selector

Each catalog row (DataFile) carries a name, category, size, MD5 and the recording/retinotopy/experiment keys used to relate files; a Recording groups the files belonging to one recording. A default 1 GiB guard keeps the full-neural files an explicit choice, since every reduced-neural, behaviour and retinotopy file is well under that limit.

graph.py — analysis graph and widget

An analysis is expressed as ordinary functions. Decorating a function with @graph.node(outputs=…) makes it a node; its parameter names are input ports. A parameter that matches an upstream node’s output name is wired (a filled port); a parameter with a default value is an editable input (a hollow port). graph.Graph(name, *nodes) assembles the nodes, which execute one at a time in declaration order — the graph is acyclic by construction, so results are reproducible.

graph.widget(controls=…, show=…) renders the graph as a canvas: hollow ports become dropdowns and sliders, a Run flow button executes the nodes in order, and the wires trace data to the displayed output. The result of a run is available as panel.last_run, recording the settings, intermediate outputs and timings. The module is intentionally minimal — node, Graph, and run / run_many / diagram / widget — with no scheduler, persistence, parallelism or cross-run cache.

06
The metric

Definition of d′

Discriminability between the two textures is quantified per neuron by the selectivity index d′ (defined in Fig. 1f). The article and the released code use the same denominator.

Article definition

d′paper = (μ₁ − μ₂) / (σ₁/2 + σ₂/2)

Equivalently, d′ = 2(μ₁−μ₂)/(σ₁+σ₂). This is the paper-specific average-SD definition, not the pooled-variance effect-size formula.

Released implementation

2·(nanmean(x₁) − nanmean(x₂)) / (nanstd(x₁) + nanstd(x₂))

utils.py, lines 370–374 uses ddof=0. Positive values indicate stronger responses to the first argument.

paper estimand
d′paper: per-neuron, frame-level leaf1 versus circle1 selectivity; used for Fig. 1 fractions and density maps
project estimand
d′held-out: the same average-SD algebra applied to held-out trial-level population scores within a block, using sample standard deviations (ddof=1); used for the rate hypothesis
valid frames
(ft_move>0) & ft_CorrSpc — running and inside the 0–4 m texture
paper threshold
|d′paper| ≥ 0.3; the endpoint fraction is shown across thresholds 0.1–1.0 (Extended Data Fig. 1e). The threshold does not transfer to d′held-out.
reported axis
percentage selective per whole session, before versus after; the paper does not report a within-session neural rate
07
Extension

A within-session test of reward-associated acceleration

Question supported by the release. Among Train 1 before-learning recordings, does the mouse-level early slope of held-out leaf1-versus-circle1 population discriminability differ between four mice receiving passive reward and nine mice receiving no reward? This is a reward-present versus reward-absent cohort contrast. It does not isolate action-contingent feedback and does not by itself establish causality.

Directional hypothesis. The rewarded cohort has a greater early d′held-out slope than the unrewarded cohort. A saturation curve and plateau are secondary because one short session and four rewarded mice provide limited information about an asymptote.

Locked primary specification
ElementPrimary choiceReason
Cohortssup_train1_before_learning (4 passive reward) versus unsup_train1_before_learning (9 no reward)Cleanest available reward-present versus reward-absent contrast
Independent unitOne early slope per mouseTrials, folds, features, bins, and neurons are nested observations
Primary regionV1Proposal-defined before inspecting the group result; mHV, lHV, and aHV are secondary
Representation12-feature V1 SVD population read-outTractable exploratory estimator; the upstream basis is release-wide and transductive
Contrastleaf1 versus circle1, moving only, 0–4 m, 18 position bins, complete coverageControls corridor support and prevents occupancy changes from masquerading as neural change
TimeFixed 40-trial non-overlapping blocks; 140-trial early horizonPreserves physical order and fixes the rate window across mice
Cross-validationFour contiguous folds; at least 4 training trials per role and 3 valid early blocksSeparates fitting from scoring while respecting slow temporal structure
InferenceRewarded-minus-unrewarded mean slope; one-sided exact label permutation, mouse-bootstrap 95% interval, leave-one-mouse-outMatches the directional hypothesis and the small mouse-level sample
Relationship to the published result

The paper measured endpoints after roughly two weeks and found similar qualitative plasticity patterns in task and unrewarded cohorts (Fig. 1i,j). Comparable endpoints do not determine a within-session rate. A positive slope difference would show a steeper trajectory in the rewarded cohort under these protocols; it would be consistent with, but would not prove, reward-associated acceleration. A null result would mean that no difference was detected at this sample size and resolution, not that reward is irrelevant.

Fig. 1j supplies the biological precedent, area definitions, and secondary paper-compatible statistic. The primary rate analysis is not a literal re-parameterization: it uses held-out trial-level population scores to prevent selection and evaluation on the same activity. The procedure is given in §09.

Open Figure 1 on Nature ↗

Figure 1j: percentage of selective neurons per visual area, before versus after learning
Figure 1j — Percentage of selective (|d′|≥0.3) neurons in V1, medial, lateral and anterior regions, before versus after learning, for task (green), unrewarded (dark red) and grating (grey) cohorts. Reproduced from Zhong et al., Nature 644, 741 (2025), under CC BY 4.0.

The displayed Figure 1j panel is cropped from the full CC BY 4.0 figure; the scientific content is unchanged.

08
Figure map

Figure panels most relevant to the project

Grouped by figure, ordered by relevance to the within-session analysis. high — computed or adapted directly · med — methodological template · low — reference. Each recipe names the analysis functions; full specifications are in §10. Figure headings link to the exact Nature figure page; the source directory above also provides the open-access full text.

Figure 1 plasticity after supervised & unsupervised training
Open Figure 1 on Nature ↗
1jhighPercentage selective by area, before vs after

Percentage of |d′|≥0.3 leaf1-vs-circle1 neurons per region (V1/mHV/lHV/aHV), before versus after learning, for task, unrewarded and grating cohorts. The medial fraction rises for task and unrewarded, not grating. This panel supplies a secondary paper-compatible endpoint statistic, not the primary held-out rate estimator.

filesLocally generated process_data/{sup,unsup}_train1_{before,after}_learning_leaf1_circle1_dprime_frac.npy, derived from full {rec}_neural_data.npy, {rec}_trans.npz, and Beh_*; the generated file is not a Figshare input. recipeGet_dprime_selective_neuron(stim_ID=[2,0]) → Get_selective_neuron_fraction_with_dprime; index value[:,:,thr_idx=2 (0.3), 0='both']; area masks via neu_area_ID; per-mouse, then paired t-test. usesecondary replication — compute the paper-style endpoint or within-block descriptive fractions; do not substitute them for the held-out V1 population-rate estimand
1fhighDefinition of d′

Per-neuron d′ = 2(μ₁−μ₂)/(σ₁+σ₂) from the two response distributions; selective if |d′|≥0.3.

recipedprime(x1,x2): u=nanmean(axis=1), sig=nanstd (ddof=0); return 2·(u1−u2)/(sig1+sig2). x1 = leaf1-wall frames, x2 = circle1-wall frames, under fr_valid. usereference — the algebraic form is reused for held-out trial-score distributions, but the observations and estimand differ
1ihighCortical density maps of selective neurons

Two-by-two density histograms of selective-neuron positions on the area map (rows task/unrewarded, columns before/after). Density concentrates in medial HVAs after learning for both learning cohorts.

filesLocally generated process_data/{sup,unsup}_train1_{before,after}_learning_leaf1_circle1_dprime_distribution.npy, plus areas.npz and {rec}_trans.npz recipeGet_dprime_selective_neuron([2,0]) → Get_density_map(dp_thr=0.3, typ='both', n_down=10): xpos=−xy_t[:,1], ypos=xy_t[:,0]; footprint from all-neuron background blurred with σ=1/truncate=30; selected-neuron image blurred with σ=30; divide by nneu; NaN-aware mean over mice; downsample 10×. Preserve the helper and plotting orientation, render magma_r, vmax=5e-8, and add areas.npz outlines. useadapt — recompute on early versus late trial windows
1g / 1hmedSingle-neuron and sorted-population sequences

Example mouse: circle1-selective (g) and leaf1-selective (h) neurons — single-trial heatmaps and trial-averaged population sorted by preferred corridor position. Both panels are the same task mouse (the two selectivity poles), not two cohorts.

recipeget_stimNeu_and_sorted(stim_ref=[2,0], thr=0.3): d′ on all frames from one trial-parity set (ft_trInd%2==0); interpolate to 60 bins; evaluate the other trial parity, subtract grey-space mean, divide by standard deviation; select d′≤−0.3 (g) or ≥+0.3 (h); sort by argmax over the first 40 bins. usereference — a train/test precedent for sorted visualizations; contiguous blockwise folds are used for the temporal rate
1emedMesoscope field of view and cellular-resolution zoom

Example mesoscope field of view and cellular-resolution zoom establish the scale and density of the recording. Atlas alignment and area boundaries are shown in Fig. 1i and Extended Data Fig. 1b,c.

usereference — recording scale; use areas.npz and {rec}_trans.npz for atlas-based analysis
reference: 1a task schematic · 1b timeline (the file-naming key) · 1c lick raster · 1d anticipatory-lick performance.
Figure 4 reward-prediction signal (positive control)
Open Figure 4 on Nature ↗
Figure 4 from Zhong et al. 2025: the anterior reward-prediction signal in task mice
Figure 4 — A reward-prediction signal in supervised training only. Reproduced from Zhong et al., Nature 644, 741 (2025), under CC BY 4.0.
4ghighPercentage reward-prediction neurons in anterior, before vs after

Anterior (aHV) reward-prediction fraction rises only in task mice (paired t: task p=0.0069, unrewarded p=0.708). The reward signal is anterior, not medial.

recipeGet_dprime_rewPred_neuron(dp_thr=0.3): sel_ind = stimulus-d′≥0; u_spk=interp_spk[:,:,5:40].mean(2); SoundPos=mod(SoundDelPos,60); dp1=dprime(late-cue vs early-cue leaf1 trials); idx1=(dp1≥0.3)&sel_ind; per-area fraction. usepositive control — mirrors the cohort/area/paired-t design on value d′ in anterior HVAs
4lhighLick-versus-no-lick comparison in medial stimulus neurons

Medial leaf1-selective neurons in the leaf2 corridor showed no statistically significant lick-versus-no-lick difference in this test (p=0.180). This targeted comparison does not exclude all reward, state, or movement contributions.

recipeget_kfold_reward_response: z-scored interp_spk of medial neurons with leaf1-vs-circle1 d′≥0.3; resp[:,0:40].mean; split by islick=lickCount(def_range=[0,40]). usereference — checks one contemporaneous licking explanation in a different test context; it is not a causal control for the Train 1 rate analysis
4i / 4jhighCue- and first-lick-aligned activity

Cue-aligned activity is suppressed after the sound cue in panel i, while panel j shows activity ramping in the seconds before the first lick. These alignments help characterize timing but do not by themselves establish the signal’s cause.

recipespk_2_cue / spk_2_firstLick(spk[sel].mean(0), beh, ranges=[15,15]) window ±15 frames (~±5 s) around SoundFr / first-lick frame; z-score per mouse, mean±SEM.usereference — checks whether a simple event-locked pattern can explain the signal; movement and state still require separate diagnostics
4f / 4khighAnatomical localisation and expectation coding

Density maps place the reward signal in anterior HVAs of task-after only (f); anterior neurons are higher on lick trials in the unrewarded leaf2 corridor (k, p=0.014), tracking expectation.

recipeGet_dprime_rewPred_neuron → Get_density_map(typ='stim1'); get_kfold_reward_response on leaf2 trials split by lick.
medium: 4e d′(late-vs-early cue) index · 4c anterior cluster map.  reference: 4a/b/d Rastermap rasters · 4m/n test2/test3 responses.
Figure 2 visual (not spatial) coding · population read-out
Open Figure 2 on Nature ↗
Figure 2 from Zhong et al. 2025: visual versus spatial coding on test stimuli
Figure 2 — Comparing visual and spatial coding on test stimuli. Reproduced from Zhong et al., Nature 644, 741 (2025), under CC BY 4.0.
2ihighCoding-direction projection in medial HVAs

Projection onto the leaf1-vs-circle1 axis = (leaf1-selective population mean) − (circle1-selective population mean), per position and trial-averaged (n=5 task). A population alternative to per-neuron d′.

recipeload_coding_direction: resp_diff=proj_2_stim1−proj_2_stim2; proj_tr[s]=resp_diff[:, 10:50].mean(1) (0–4 m per trial); proj_tr_mean=mean over trials; area index 1 = mHV.useadapt — proj_tr is per-trial; regressable against within-session trial index
2jhighSimilarity index for new stimuli

SI∈[−1,1] places circle2 near circle, leaf2 near leaf, per area × cohort (consistent with behaviour).

recipeGet_coding_direction([2,0]) → article definition SI=(dx−dy)/(dx+dy), where dx and dy are absolute projection gaps to the two anchors. The code’s anchor-span denominator is equivalent when the target lies between the anchors. One SI per mouse and area.useadapt — per-session task-versus-unrewarded comparison in medial HVAs
2g / 2h / 2fhighCoding-axis poles and sequence correlation

Top-5% leaf1-selective (g) and bottom-5% circle1-selective (h) medial populations by position; sequence correlation (f) is high for even-leaf1, low for leaf2 in medial — stimulus-specific, not spatial.

recipeGet_coding_direction (normalized interp_spk, percentile-selected neurons); Get_sort_spk → get_seq_corr via get_neuID_and_sortID (argmax over first 40 bins).
medium: 2d example spatial-coding sort (mHV) · 2e sequence-corr summary (mHV).  reference: 2a–c behaviour.
Figure 3 novel/adapted stimuli · methodological template
Open Figure 3 on Nature ↗
Figure 3 from Zhong et al. 2025: responses to novel stimuli and neural orthogonalization
Figure 3 — Responses to novel and adapted stimuli and neural orthogonalization. Reproduced from Zhong et al., Nature 644, 741 (2025), under CC BY 4.0.
3bmedLeaf2 selectivity changes with familiarization

The positive leaf2 pole of leaf2-versus-circle1 selectivity decreases after the additional week, especially in V1 and lateral HVAs. This is a paired before/after result, not an increase in medial selectivity.

recipeGet_dprime_selective_neuron(stim_ID=[3,0]) → Get_selective_neuron_fraction_with_dprime; select the positive leaf2 pole at threshold 0.3; compare paired test1-before and test1-after values.usereference — a reminder that novelty/familiarity can change one stimulus pole in the opposite direction
3ehighLeaf1-versus-leaf2 separation across cohorts

The fraction selective for leaf1 versus leaf2 is elevated in medial HVAs for task and unrewarded cohorts relative to naive controls. This is a separate cross-cohort comparison and includes both selectivity poles.

recipeGet_dprime_selective_neuron(stim_ID=[2,3]) → Get_selective_neuron_fraction_with_dprime; use |d′|≥0.3 and compare the specified cohorts at mouse level.usetemplate — paper-style fraction-by-area analysis on a different stimulus contrast
medium: 3a/3d density maps · 3g/3h coding direction and SI (orthogonalization).  reference: 3c/3f behaviour and V1 example.
Extended Data within-session precedent and controls
ED9highWithin-day learning  Open ED Fig. 9 ↗

Behavioural discrimination over the first versus second half of each daily session — learning accrues within a session. The closest published analog to the within-session extension.

recipeCompute the 2–4 m reward-minus-non-reward lick-discrimination metric separately for the first and second physical-trial halves; paired tests are performed within each pretraining cohort and day. The released base zone metric is get_lick_response_in_zone; there is no dedicated ED9 helper.usereference — conceptual evidence that behaviour changes within a day; not the neural rate estimator or its group-test template
ED2 a–dhighRunning-speed control  Open ED Fig. 2 ↗

Speed versus position, before/after, task and unrewarded; locomotion is largely unchanged with learning.

recipePosition-bin ft_RunSpeed by ft_Pos for running frames; per-mouse, paired t.useadapt — re-bin one session by ft_trInd as a within-session run-speed check
ED1 e / fhighThreshold robustness and pole decomposition  Open ED Fig. 1 ↗

Fraction selective versus d′ threshold (e); Fig. 1j split into leaf1/reward-associated-role and circle1 poles (f), both of which gain selectivity. In exposure mice neither pole is rewarded.

usesecondary — sweep thresholds 0.1–1.0 and inspect pole asymmetry without labeling the exposure cohort’s leaf1 role as rewarded
medium: ED8 reward/non-reward prediction · ED3 circle1-selective sequences · ED6/ED7 coding-direction and swap analyses.  reference: ED1a–c retinotopy · ED4/ED5 novelty controls.
Figure 5 pretraining accelerates learning (behaviour-only)
Open Figure 5 on Nature ↗
Figure 5 from Zhong et al. 2025: unsupervised pretraining accelerates task learning
Figure 5 — Unsupervised pretraining accelerates subsequent task learning. Reproduced from Zhong et al., Nature 644, 741 (2025), under CC BY 4.0.
5e / 5fmedBehavioural learning curves and discrimination index

Percentage of trials with a lick in the 2–4 m zone, reward versus non-reward, across days, per cohort (naturalistic 11 / grating 7 / no-pretrain 5); (f) reward−non-reward discrimination, naturalistic-pretrained learns fastest.

recipeget_lick_response_in_zone: lickResp=lickCount(def_range=[20,40])['inRange']; rew_id=get_cat_id; first 200 trials; perf.reshape(n_mice,5,2). (f) = −np.diff. The paper uses independent two-sided tests for between-pretraining comparisons by day.usereference — behavioural analogy only; all cohorts later receive reward and the design differs from the imaging contrast
reference: 5a–d design/raster · 5g first-lick positions · 5h trials per session.
09
Procedure

Analyses to compute

① Cohort audit and exact file plan required first

Select all eligible sup_train1_before_learning and unsup_train1_before_learning mice before opening neural arrays. Record reward mode, water restriction, acquisition date, sex, release notes, and the exact behaviour, reduced-neural, full-neural, and retinotopy file names. The supported primary contrast is four passive-reward mice versus nine no-reward mice; after_learning mixes task reward modes and is a named sensitivity analysis.

② Build held-out blockwise population d′ primary estimator

  1. Preserve physical time. Assign fixed, non-overlapping 40-trial blocks and four contiguous folds from ft_trInd before filtering stimulus roles. Do not use frame-level odd/even splitting as the primary cross-validation scheme.
  2. Align and validate. Reconstruct the exploratory reduced activity as spk = UT @ V; truncate behaviour and neural arrays to the same frame count; resolve leaf1 (role 2) and circle1 (role 0) per session.
  3. Make one observation per trial. Restrict to moving frames in the 0–4 m texture, divide the corridor into 18 bins, and require complete position coverage. Average activity within trial and position before model fitting so slow trials do not contribute more observations.
  4. Fit without leakage. Within each block, estimate scaling and a 12-feature V1 coding direction on the contiguous training folds only. Every requested fold must contain both roles, with at least four training trials per role.
  5. Score held-out trials. Project only held-out trials and calculate d′held-out from the two score distributions. Average fold contrasts to one value per block; also retain the stimulus-mean separation and score spread as separate diagnostics.
  6. Estimate one early rate per mouse. Fit the block values through the fixed 140-trial horizon and require at least three valid early blocks. Store all eligibility failures rather than silently dropping blocks.

③ Test the mouse-level rate difference confirmatory

Plot every mouse curve and slope. Report the rewarded-minus-unrewarded mean slope first, a one-sided exact cohort-label permutation test for rewarded > unrewarded, a mouse-bootstrap 95% interval, and all leave-one-mouse-out estimates. Mice are the independent units; trials, blocks, folds, features, positions, and neurons never increase the group-test sample size.

④ Separate rate, plateau, and representational change secondary

Fit d′(t)=b+A(1−exp(−kt)) only as a secondary description. Report initial rate A·k, plateau b+A, and half-time. Label the plateau “not observed” unless at least 90% of the fitted amplitude occurs within the common observed range and the optimum is not on a search-grid boundary. A cross-temporal matrix — train the coding axis in one block, test it in every block — distinguishes stable-axis sharpening from rotation or reorganization.

⑤ Inspect position, behaviour, and recording support Plan B

Plot trial-block × corridor-position d′, activity, speed, occupancy, missing-bin support, cue, reward, lick, and grey-space baselines. Use a mouse-resampling simultaneous band for the whole position curve rather than 18 uncorrected per-bin tests. Cue, reward, and licking may be mediators of the total reward-condition effect, so do not adjust them away in the primary estimate; use pre-cue windows, event censoring, and behaviour-adjusted models as clearly labelled sensitivities. The large-scale neural-data methods review motivates trial-level cross-validation, temporally extended splits, and movement controls.

⑥ Reproduce paper-compatible summaries secondary validation

Using full deconvolved traces where feasible, reproduce d′paper, percentage |d′|≥0.3, pole-specific fractions, threshold sweeps, and density maps from Fig. 1 and ED Fig. 1. Treat leaf1/circle1 pole asymmetry as secondary: neither role is rewarded in the exposure cohort. Compare SVD and full-trace results on feasible sessions instead of assuming equivalence. ED Fig. 9 is a useful behavioural precedent for within-day change, but its separate reward-task cohort is not the neural group-test template.

10
Released paper recipes

Recipe reference

The computations behind the paper-compatible recipes above, with direct links to the immutable paper release. These functions reproduce the publication’s frame-level analyses; the held-out trial-level project estimator is specified separately in §09.

Core primitives — d′, frame validity, roles, areas

d′(x1, x2)

utils.py:370–374 u = nanmean(x, axis=1); sig = nanstd(x, axis=1, ddof=0); d′ = 2·(u1 − u2) / (sig1 + sig2)

x1, x2 are neurons×frames; the caller groups the frames. The article and code both divide by the average of the two standard deviations, not a pooled root-mean-square variance. Positive d′ indicates tuning to the first argument.

Per-neuron d′ from the SVD without full reconstruction

derived from dprime + the 400-PC basis meanS = UT·V̄S ; meanSquareS = diag(UT·(VSVST/|S|)·U) ; d′ = 2(meanA−meanB)/(√varA+√varB)

The moments reproduce d′ for the 400-component SVD reconstruction without materializing the neurons×frames matrix. They do not make the lossy reconstruction identical to the full deconvolved traces used by the publication recipe.

Frame-validity mask

utils.py:431–433 fr_valid = (ft_move[:nfr] > 0) & ft_CorrSpc[:nfr]

Running and inside the 0–4 m texture. Always truncate ft_* to nfr = spk.shape[1].

get_cat_id(WallName, isRew) — physical wall → role

utils.py:137–147

The rewarded wall maps to role 2 (leaf1); its second exemplar to 3; the first unrewarded wall to 0 (circle1); its second exemplar to 1. This fixes leaf1 = role 2 and circle1 = role 0 for all rewarded cohorts and physical pairs. In unrewarded sessions isRew is uniformly false; read the roles from stim_id instead.

neu_area_ID(iarea) — area masks

utils.py:312–324 V1: iarea==8 · mHV: {0,1,2,9} · lHV: {5,6} · aHV: {3,4} · exclude {−1,7}

The medial selector is retinotopy[i]['neu_ar_idx']['mHV']. Identifiers −1 and 7 lie outside visual cortex and are dropped from density maps.

Selectivity — per-neuron d′, fractions, density maps

Get_dprime_selective_neuron(db, Beh, stim_ID=[2,0])

utils.py:418–441

Load the full {rec}_neural_data.npy traces; resolve stim1=UniqWalls[stim_id==2][0] and stim2=UniqWalls[stim_id==0][0]. dp = dprime(spk[:, (ft_WallID==stim1)&fr_valid], spk[:, (ft_WallID==stim2)&fr_valid]) — all valid frames, no odd/even split. Returns {'dprime':[per-session], 'retinotopy':[…], 'mname':[…]}.

Get_selective_neuron_fraction_with_dprime(dprime, retinotopy, dp_thrs=[0.1..1.0])

utils.py:443–457

Per area, per mouse, per threshold: both=|dp|≥thr, stim1=dp≥thr, stim2=dp≤−thr, each divided by the area neuron count. Output value has shape 4 areas × mice × n_thr × 3; index thr=0.3 → thr_idx=2; slice 0='both', 1=leaf1 pole, 2=circle1 pole.

Get_density_map(dprime, retinotopy, dp_thr=0.3, typ='both', n_down=10) + get_dist_img

utils.py:376–416

Mask by typ (both / stim1 / stim2). xpos=−xy_t[:,1], ypos=xy_t[:,0]. Rasterize into 5000² (+800 offset); define the footprint from the all-neuron background blurred with σ=1 and truncate=30; blur the selected-neuron image with σ=30; divide by neuron count; take the NaN-aware mouse mean; then downsample every tenth pixel. Preserve the helper’s left-right flip and the plotting orientation; render magma_r, vmax=5e-8, with areas.npz['out'] outlines.

Population — interpolation, coding direction, reward prediction

get_interpPos_spk / spk_pos_interp — 60-bin position tensor

utils.py:105–131

From spk[:, VRmove], ft_PosCum[VRmove], Corridor_Length → neurons × ntrials × 60. Bins ~0–40 are the textured metres, ~40–60 the grey space. Cached to {rec}_interpolate_spk.npy. Used by the coding-direction and reward-prediction recipes, not the primary d′.

Get_coding_direction(stim_ref=[2,0], prc=5, n_bef=10) + load_coding_direction

utils.py:503–597 · 349–364

d′ selection on ft_trInd%2==0 frames; corr_neu = texture>grey; normalize spk_norm = 2(spk−u0)/(std1+std2), u0 = grey bins 42:52; prepend 10 previous-trial grey bins; per area stim1_idx=dp≥pct95, stim2_idx=dp≤pct5. resp_diff = proj_2_stim1 − proj_2_stim2; proj_tr = resp_diff[:, 10:50].mean(1). The article’s similarity index is SI=(dx−dy)/(dx+dy); the code’s anchor-span denominator is equivalent when the target projection lies between the two anchors.

Get_dprime_rewPred_neuron(dp_thr=0.3) — anterior value d′

utils.py:459–501

sel_ind = stimulus-d′ ≥ 0; u_spk = interp_spk[:,:,5:40].mean(2); SoundPos = mod(SoundDelPos,60); dp1 = dprime(late-cue vs early-cue leaf1 trials); idx1 = (dp1≥0.3) & sel_ind; per-area fraction. This is a value/timing index in anterior HVAs, distinct from the medial stimulus d′.

get_lick_response_in_zone — behaviour metric

utils.py:280–295

lickResp = lickCount(def_range=[20,40])['inRange'] (lick in 2–4 m); rew_id = get_cat_id; istim in [2,0]; first 200 trials; perf.reshape(n_mice,5,2). Discrimination = −np.diff = reward − non-reward.

Key parameters

Methods

|d′|≥0.3 selective · reduced release representation: 400 components · deconvolution decay 0.75 s · run threshold 6 cm/s for at least 66 ms · imaging corridor: 4 m texture + 2 m grey with sound cue sampled from 0.5–3.5 m · behaviour-only task: reward-zone start sampled from 2–3 m · 20,547–89,577 neurons per recording. The paper uses paired or independent two-sided Student’s t-tests as specified in Methods and reports no multiple-comparison adjustment; the new rate analysis instead uses the locked mouse-level inference above.

11
Constraints

Constraints and interpretation rules

  • Supported contrast. Train 1 before-learning compares passive reward present with no reward. It does not identify action-contingent feedback; after-learning mixes task reward modes and remains a sensitivity analysis.
  • Association, not automatic causality. Reward condition is bundled with water restriction, motivation, licking, and protocol history. A positive rate difference is a cohort difference consistent with reward-associated acceleration, not proof that reward caused it.
  • Mouse-level inference. One early slope per mouse enters the group contrast. Trials, blocks, folds, positions, components, neurons, and repeated sessions are not independent group replicates.
  • Two estimands. d′paper is a full-trace, frame-level per-neuron statistic. d′held-out is a cross-fitted trial-score population statistic. Their numerical values and the paper’s 0.3 threshold are not interchangeable.
  • Reduced representation. The 400-component SVD supports efficient exploratory population analysis, but it is lossy and fitted release-wide. Held-out downstream trials do not make the upstream basis prospective. Full traces are required for exact paper-style selectivity replication.
  • Locked region and time choices. V1 is primary because it was specified by the proposal; medial, lateral, and anterior HVA results are secondary and require multiplicity-aware interpretation. Forty-trial blocks and the 140-trial early horizon stay fixed across mice.
  • Support and confounds. Complete position coverage, role counts, speed, occupancy, missing bins, cue/reward/lick timing, grey-space activity, and global drift must be visible beside each neural trajectory. Position inference uses a simultaneous mouse-resampling band.
  • Plateau restraint. Saturation is secondary. A fitted plateau is “not observed” unless at least 90% of fitted amplitude lies in the observed range and the optimum is not on a parameter boundary.
  • Control limits. The non-significant lick comparison in Fig. 4l checks one explanation in another test context; it does not establish stimulus causation or exclude reward and state effects.
  • Separate behavioural precedent. Fig. 5 and ED Fig. 9 contain no imaging, use another schema, and eventually reward every cohort. They motivate a within-day question but do not supply the neural group design.
  • Null-result language. Similar or uncertain trajectories mean that acceleration was not detected at this sample size and resolution. They do not demonstrate that reinforcement is absent from early cortical plasticity.

The clean report order is: rewarded-minus-unrewarded slope estimate, mouse-level uncertainty and exact permutation result, individual mouse curves, eligibility/support diagnostics, planned sensitivities, then limitations in the same paragraph.