Main

Measurement of Ca2+-dependent fluorescence using genetically encoded calcium indicators (GECIs)1,2 is a standard method for tracking neural activity in defined neurons and neural networks9,10. Recent advances have been driven by engineered GECIs with higher sensitivity3,4,5,6,7,8, which in turn have stimulated the development of new methods for in vivo microscopy11,12,13. In particular, the green fluorescent protein (GFP)-based GCaMP sensors2,3,5,6 have been iteratively engineered to enhance the signal-to-noise ratio (SNR) for detecting Ca2+ entering neurons during neural activity. The GCaMP6 (ref. 5) and jGCaMP7 (ref. 6) sensors enable detection of single action potentials (APs) under favourable conditions and are often used to monitor the activity of large groups of neurons using two-photon microscopy or wide-field fluorescence imaging11,12. They have also been used to measure activity-induced calcium changes in small synaptic compartments such as dendritic spines5 and axons14.

Electrical signals propagate through neural circuits over timescales of milliseconds. Determining how the activity of one set of neurons influences another and ultimately animal behaviour requires tracking activity on concomitant timescales. In many neuron types, APs produce large (more than 1 μM) and rapid (rise time of less than 1 ms) increases in cytoplasmic-free calcium15. Calcium ions can activate fluorescent calcium indicators very rapidly. For example, millisecond-timescale detection of APs has been demonstrated with synthetic fluorescent calcium indicators16,17,18. However, the kinetics of GECI fluorescence changes are relatively slow and limited by sensor biophysics downstream of calcium binding19. In response to single APs in pyramidal neurons, most widely used GCaMPs have fluorescent half-rise times on the order of 100 ms (refs. 3,5,6,19,20). Consequently, GCaMPs are often used to map relatively static representations of neural information, rather than tracking the rich dynamics in neural circuits21,22.

Previous attempts to improve GCaMP kinetics have been only partially successful. Among the GCaMP6 (ref. 5) and jGCaMP7 (ref. 6) indicators, the fast (f) variants were optimized for kinetics. They have faster rise and decay times, but with reduced sensitivity compared with their slower relatives (sensitive (s) variants). Generally, attempts to improve SNR are associated with a slowing of kinetics5,6,20. The mechanisms underlying this trade-off are not simply due to changes in affinity for Ca2+. For example, the kinetics are sensitive to mutations at the interface between calmodulin (CaM) and the CaM-binding peptide RS20 (derived from myosin light chain kinase23), far from the Ca2+-binding EF hands on CaM5,20. Recently, the RS20 peptide has been swapped for the peptide from CaM-dependent kinase kinase CaMKK-α/β (ckkap peptide) in some GECIs. The resulting XCaMP and R-CaMP2 sensors provide faster kinetics7,8, confirming that calcium-dependent interactions between CaM and the CaM-binding peptide help to determine sensor kinetics5.

Here we present GCaMP sensors with improved kinetics without compromising sensitivity or brightness. jGCaMP8 sensors include: jGCaMP8s (fast rise, slow decay and sensitive), jGCaMP8f (fast rise and fast decay) and jGCaMP8m (fast rise and medium decay). All jGCaMP8 sensors have nearly tenfold-faster fluorescence rise times than previous GCaMPs and can track individual spikes in neurons with spike rates up to 50 Hz. jGCaMP8 sensors are also more linear than previous GCaMPs, allowing robust deconvolution for spike extraction. The jGCaMP8 sensors were tested in vivo in mice and flies and provide better performance across multiple metrics relevant to imaging neural populations in vivo.

Sensor design and optimization

Various CaM-binding peptides (Extended Data Table 1) were cloned into GCaMP6s, replacing RS20. Basic sensor properties were measured in bacterially purified protein, including fluorescence increase ((Fsat − Fapo)/Fapo) upon saturating calcium binding, half-decay time (t1/2,decay) of fluorescence after calcium removal, apparent binding constant Kd, Hill coefficient (cooperativity) and apparent brightness. On the basis of these measurements (Extended Data Table 1), we prioritized variants based on peptides from endothelial nitric oxide synthase (ENOSP) and death-associated protein kinase 1 (DAPKP) for optimization (Methods). The two linkers4 were systematically mutated, and sensors were screened for high calcium-dependent signal change, while retaining short t1/2,decay, in purified protein. Thirty-five promising sensors were then tested in response to APs in cultured neurons in 96-well plates24 (Methods). APs produce essentially instantaneous increases in calcium15 and are therefore ideal to screen for GECIs with fast kinetics25. Fluorescence changes were extracted from multiple single neurons per well. Sensors were evaluated based on several properties (Extended Data Table 1 and Supplementary Table 1): baseline brightness (F0); fluorescence change (ΔF/F0 = (F − F0)/F0) in response to a single AP (1AP ΔF/F0); fluorescence response to a saturating high-frequency train of 160 APs (reflective of total dynamic range); SNR quantified as the sensitivity index d′ (ref. 26) and kinetics (half-rise time (t1/2,rise) and t1/2,decay). Sensors based on DAPKP showed fast half-decay time and high sensitivity compared with jGCaMP7f, but with slow half-rise times. Sensors with ENOSP had similar sensitivity and substantially faster half-rise and half-decay times than jGCaMP7f.

We prioritized ENOSP-based sensors for further optimization, starting with variant jGCaMP8.410.80, which has a 1.8-fold faster 1AP half-rise time (1AP t1/2,rise) and a 4.4-fold faster 1AP half-decay time (1AP t1/2,decay) than jGCaMP7f, with similar resting brightness, dynamic range and sensitivity. We solved the crystal structure of jGCaMP8.410.80 (Fig. 1a, Extended Data Table 2 and Extended Data Fig. 1). Guided by the structure, we targeted interface sites (Extended Data Fig. 1c) for site-saturation mutagenesis and tested variants in cultured neurons for sensitivity and fast kinetics in response to APs. Multiple single mutations, particularly residues near the ENOSP C terminus and the interface, improved properties (Supplementary Table 1). Beneficial point mutations were combined in subsequent rounds of screening5.

Fig. 1: GCaMP mutagenesis and screening in neuronal culture.
figure 1

a, jGCaMP8 (variant 8.410.80) structure and mutations in different jGCaMP8 variants relative to GCaMP6s (top). ENOSP, linker 1 (ENOSP–cpGFP), linker 2 (cpGFP–CaM), cpGFP, CaM, mutated sites (red) and Ca2+ ions (orange) are shown. Mutations for each jGCaMP8 variant (bottom table) are also displayed. b, Sensitivity (d′) and rise kinetics (t1/2,rise) for jGCaMP8 variants. The x axis is normalized to GCaMP6s. GCaMP6, jGCaMP7, jGCaMP8 and XCaMP are highlighted in red. Mutants with normalized t1/2,rise > 1.1 are not shown. The inset shows a zoomed in view on the jGCaMP8 series. Complete multi-parameter scatterplots are available as an interactive Binder notebook (Methods). c, Screening in neurons. Field stimulation of jGCaMP8m-expressing cultured neurons (top left), a fluorescence trace (1AP) (top right) and single frames of F corresponding to the box in the image (bottom) are shown. Scale bar, 100 µm. d, Responses to 1AP (black bar; top left) and 3AP (black bars; top right). Zoomed-in insets from the top panel (dashed boxes) to highlight rise kinetics are also shown (bottom). Solid lines indicate the mean and the shaded area denotes s.e.m. (n = 48 wells and 1,696 neurons (jGCaMP8f), n = 11 wells and 496 neurons (jGCaMP8m), n = 24 wells and 1,183 neurons (jGCaMP8s), n = 283 wells and 8,700 neurons (GCaMP6s), n = 294 wells and 7,372 neurons (jGCaMP7f), n = 22 wells and 514 neurons (jGCaMP7s), and n = 69 wells and 1,305 neurons (XCaMP-Gf); overall statistics, n = 7 independent transfections, 38 96-well plates). Data shown represent a portion of the overall screened constructs in Supplementary Table 1. e, Responses to 1AP for jGCaMP8 indicators and comparison with GCaMP6s, jGCaMP7f, jGCaMP7s and XCaMP-Gf. Data and n values are the same as in d. For the box-and-whisker plots, the box indicates the median and 25–75th percentile range, and the whiskers indicate the shorter of 1.5 times the interquartile range or the extreme data point.

Screening in neurons covered 813 jGCaMP8 sensor variants (Supplementary Table 1), of which 647 (80%) produced detectable responses to 1AP (Extended Data Fig. 2). In addition, nine previously developed GECIs were included in the screen for comparison. Compared with jGCaMP7f, 1AP t1/2,rise and 1AP t1/2,decay were significantly shorter in 47% and 48% of variants, respectively. The 1AP ΔF/F0 was higher than jGCaMP7f in 19% of variants. Together, mutagenesis produced a large set of variants with significant improvement in kinetics and sensitivity to neural activity (Supplementary Table 1).

jGCaMP8 characterization

Three high-performing ‘jGCaMP8’ variants were selected for additional characterization (Fig. 1b–e, Extended Data Table 3 and Extended Data Fig. 3). jGCaMP8f (fast) exhibited 1AP t1/2,rise of 6.6 ± 1.0 ms, more than threefold shorter than jGCaMP7f. jGCaMP8s (sensitive) exhibited the highest 1AP ΔF/F0 and 1AP d′ of any construct measured. For jGCaMP8s, 1AP d′ was approximately twice that of the most sensitive GECI to date, jGCaMP7s. jGCaMP8m (medium) is a compromise between sensitivity and kinetics: it exhibits 1AP d′ comparable with jGCaMP7s, and kinetics comparable with jGCaMP8f, apart from a slower half-decay time (Fig. 1d,e and Extended Data Table 3). Overall, the jGCaMP8 series exhibited significant, multifold improvements across several parameters over previous GECIs (Fig. 1b and Extended Data Table 4).

We then compared the new jGCaMP8 sensors to the recent XCaMP series (the green XCaMP variants XCaMP-G, XCaMP-Gf and XCaMP-Gf0)8. The 1AP ΔF/F0 was significantly higher for all jGCaMP8 sensors; 1AP d′ was significantly higher for jGCaMP8m and jGCaMP8s; and kinetics were significantly faster for jGCaMP8f than the XCaMP sensors (Extended Data Table 4). Baseline fluorescence of the jGCaMP8 series was similar to jGCaMP7f, and significantly higher than the XCaMP sensors (Extended Data Fig. 4a). Photobleaching was also similar between jGCaMP7f and the jGCaMP8 sensors (Extended Data Table 3 and Extended Data Fig. 4b). In equimolar purified protein, the 488-nm absorbance of XCaMP-Gf was approximately eight times lower than jGCaMP7f and the jGCaMP8 sensors in the Ca2+-bound bright state, and the two-photon cross-section was also approximately eight times weaker (Extended Data Fig. 5). XCaMP has a much higher Ca2+-bound pKa (Extended Data Table 3), meaning a lower proportion of deprotonated bright fluorophore at physiological pH. This is consistent with its low extinction coefficient (Extended Data Table 3).

GECIs with linear fluorescence responses to AP trains provide a large effective dynamic range for quantifying spike rates and facilitate counting spikes within trains. In purified protein, Hill coefficients were lower for the jGCaMP8 variants (1.9–2.2) than jGCaMP7f (3.1) (Extended Data Table 3). We then tested GCaMP sensors with bursts (83 Hz) containing different numbers (1–40) of APs. Given their higher sensitivity to neural activity, jGCaMP8m and jGCaMP8s saturated at smaller numbers of spikes than the jGCaMP7 sensors. However, they behaved nearly linearly up to ten spikes (Extended Data Fig. 6). Finally, fluorescence recovery after photobleaching revealed that the jGCaMP8 variants showed similar diffusion in neurons compared with previous GECIs25 (Extended Data Fig. 7a–c) and independent of calcium (Extended Data Fig. 7d), suggesting that they do not have altered cellular interactions.

Imaging in larval and adult flies

jGCaMP8 responses to visual stimulation were measured in Drosophila laminar monopolar L2 neurons (Fig. 2a), which are part of the OFF-motion visual system27. These non-spiking neurons depolarize during light decrease and hyperpolarize during increase. Imaging was performed where L2 dendrites connect to columns in medulla layer 2. Fluorescence responses were first measured in multiple single neurons in response to 0.5-Hz light–dark flashes (Fig. 2b and Extended Data Fig. 8a). XCaMP-Gf, introduced using identical genetic strategies as the jGCaMP7 and jGCaMP8 sensors, was too dim to image (Extended Data Fig. 8b,c) and poorly expressed (Extended Data Fig. 9). At light–dark and dark–light transitions, all jGCaMP8 variants showed significantly faster rise, and jGCaMP8m showed faster decay, than jGCaMP7f (Fig. 2c,d). jGCaMP8m and jGCaMP8f also showed markedly larger fluorescence changes (ΔF/F0) than jGCaMP7f following light-on (Fig. 2b,c). All three jGCaMP8 indicators exhibited a negative off-response (Fig. 2c) after light-off (that is, hyperpolarization below baseline), consistent with previous electrophysiological28 and voltage imaging experiments29. Flies were next subjected to light on–off stimulation at frequencies from 0.5 to 30 Hz. In power spectra of the fluorescence signal, jGCaMP8m and jGCaMP8f showed higher spectral density than jGCaMP8s across all frequencies, and higher than jGCaMP7f above 2 Hz (Extended Data Fig. 8d). Next, short dark flashes (duration of 4–25 ms) were shown to evaluate the impulse response of the sensors. jGCaMP8m and jGCaMP8f showed higher ΔF/F0 at all stimulus durations (Extended Data Fig. 8e, top). jGCaMP8m and jGCaMP8f provided markedly superior stimulus detection than jGCaMP7f and jGCaMP8s across all dark flash durations (Extended Data Fig. 8e, bottom). The jGCaMP8 variants were somewhat dimmer than jGCaMP7f because of lower expression (Extended Data Figs. 8b,c and 9) but were sufficiently bright to provide high SNR imaging.

Fig. 2: jGCaMP8 performance in Drosophila.
figure 2

a, Schematic of the experiment. Fly with visual stimulus (top), fluorescence micrograph of L2 dendrites in medullar layer 2 (scale bar, 5 μm) (middle), and a schematic of the Drosophila visual system (bottom) are shown. b, ΔF/F0 response to a 0.5-Hz visual stimulation frequency from variants jGCaMP7f and jGCaMP8m. Individual traces show four representative individual animals per GECI (shading arbitrary). Light and dark periods are indicated by white and black bars above the graph. The error bands represent s.e.m. c, Mean ΔF/F0 response to 0.5-Hz stimulation. The solid line indicates the mean and the shaded area denotes s.e.m. The dark period is represented by a black bar above the graph. The mean was calculated from eight trials per animal and then between animals. The inset compares the response from each variant at the onset of the dark period. d, Half-rise and half-decay times for responses in c. Half-rise: 128 ± 11 ms (jGCaMP7f), 76 ± 8 ms (jGCaMP8f), 58 ± 6 ms (jGCaMP8m) and 80 ± 8 ms (jGCaMP8s) (Kruskal–Wallis multiple-comparison test, P = 2.9 × 10−4; pairwise Dunn’s comparison test with jGCaMP7f: P = 3.1 × 10−3 (jGCaMP8f), P = 2.9 × 105 (jGCaMP8m) and P = 1.3 × 102 (jGCaMP8s)). Half-decay times: 277 ± 29 ms (jGCaMP7f), 192 ± 26 ms (jGCaMP8f), 137 ± 21 ms (jGCaMP8m) and 198 ± 21 ms (jGCaMP8s) (Kruskal–Wallis multiple-comparison test, P = 2.4 × 102; pairwise Dunn’s comparison test: P = 1.1 × 101 (jGCaMP8f), P = 2.2 × 103 (jGCaMP8m) and P = 1.8 × 101 (jGCaMP8s)). *P < 0.05. Total n of flies tested for each variant in c and d: 14 (jGCaMP7f), 11 (jGCaMP8s), 11 (jGCaMP8m) and 14 (jGCaMP8f). For the box-and-whisker plots, the box indicates the median and 25–75th percentile range, and the whiskers indicate the shorter of 1.5 times the interquartile range or the extreme data point.

Next, we imaged jGCaMP8 responses at presynaptic boutons of the larval neuromuscular junction in response to electrical stimulation of motor axons5 (Extended Data Fig. 10). jGCaMP8 variants showed large responses, with faster rise and decay times than jGCaMP7f (Extended Data Fig. 10b,d,e). The jGCaMP8 series detected individual stimuli better than jGCaMP7f at low frequencies and easily resolved spikes in 20-Hz stimulation trains (Extended Data Fig. 10h).

Imaging in the mouse visual cortex

We next tested the jGCaMP8 sensors in L2/3 pyramidal neurons of mouse primary visual cortex (V1)5. We made a craniotomy over V1 and infected neurons with adeno-associated virus (AAV2/1-hSynapsin-1) (Methods) encoding the jGCaMP8 variants, jGCaMP7f6 or XCaMP-Gf20. After 3 weeks of expression, mice were lightly anaesthetized and mounted under a custom two-photon microscope. Full-field, high-contrast drifting gratings were presented in each of eight directions to the contralateral eye for five trials (Fig. 3a). Two-photon imaging was performed at frame rates (30 Hz) typical for in vivo imaging (Methods).

Fig. 3: Imaging neural population in the mouse V1 in vivo.
figure 3

a, Schematic of the experiment (top left). Example image of V1 L2/3 cells (three cells marked by yellow arrows) expressing jGCaMP8s (bottom left), and the same field of view (FOV) colour-coded (three corresponding cells circled) based on the preferred orientation of the neuron (hue) and response amplitude (brightness) (bottom right with colour coding above). This experiment was repeated independently with similar results in 26 FOVs from 6 mice. b,c, Example traces from three L2/3 neurons expressing jGCaMP8s (b; same cells as indicated in a) or jGCaMP8f (c). Averages of five trials with shaded s.e.m. The polar plots indicate the preferred direction of cells. The orientation selectivity index (OSI) is displayed above each polar plot. d, Example zoomed-in fluorescence traces corresponding to the orange boxes in b (jGCaMP8s in black) and c (jGCaMP8f in blue), normalized to the peak of the response. The inset shows additional detail of the first transient. e, Half-decay time of the fluorescence response after the end of the visual stimulus (n = 320 cells from 3 mice (jGCaMP7f), 124 cells from 3 mice (XCaMP-Gf), 317 cells from 5 mice (jGCaMP8f), 365 cells from 3 mice (jGCaMP8m) and 655 cells from 6 mice (jGCaMP8s)). Kruskal–Wallis multiple-comparison test: P < 0.001. Dunn’s comparison test: *P < 0.05, ***P < 0.001 and not significant (NS). Full statistics are in the Methods. f, Proportion of cells responding to visual stimuli (n = 12 FOVs from 3 mice (jGCaMP7f), 19 FOVs from 5 mice (jGCaMP8f), 14 FOVs from 3 mice (jGCaMP8m) and 26 FOVs from 6 mice (jGCaMP8s)). Tukey’s multiple-comparison test: P < 0.001. One-way ANOVA test was used: *P < 0.05, ***P < 0.001 and NS. Full statistics are in the Methods. g, Distribution of response amplitude (ΔF/F0) for preferred stimulus. The 75th percentile ΔF/F0 values for each construct: 98% (jGCaMP7f), 38% (jGCaMP8f), 83% (jGCaMP8m) and 183% (jGCaMP8s). n = 1,053 cells from 3 mice (jGCaMP7f), 1,253 cells from 5 mice (jGCaMP8f), 848 cells from 3 mice (jGCaMP8m) and 1,026 cells from 6 mice (jGCaMP8s). Full statistics are in the Methods.

Visual stimulus-evoked fluorescence transient responses were detected in many cells (Fig. 3b,c) and were stable across trials (Extended Data Fig. 11a). All sensors produced transient responses with rapid rise and decay (Fig. 3b,e). Nearly identical responses were measured after long-term expression of jGCaMP8 (5 additional weeks; Extended Data Fig. 11b–e). XCaMP-Gf was approximately tenfold dimmer than jGCaMP8 or jGCaMP7f (Extended Data Fig. 12a,b), with few responsive cells, whereas protein levels were similar across indicators (Extended Data Fig. 12c,d). These data are consistent with characterization of purified protein (Extended Data Fig. 5) showing that XCaMP-Gf fluorescence is very low. Thus, we did not study XCaMP further.

The contrast changes in visual stimuli were tracked faithfully by fluorescence changes (Fig. 3b,c). Consistent with in vitro characterization, jGCaMP8f showed significantly shorter t1/2,decay (median of 84 ms, first to third quartile range = 32–153 ms) than jGCaMP7f (median of 110 ms, first to third quartile range = 41–223 ms; P < 0.05) and comparable with jGCaMP8m (median of 84 ms, first to third quartile range = 32–165 ms) and XCaMP-Gf (median of 91 ms, first to third quartile range = 48–155 ms; Fig. 3e). jGCaMP8s decay was significantly slower than the other indicators.

We quantified indicator sensitivity to neural activity as the proportion of expressing neurons responsive5,6 to visual stimuli (Fig. 3f) and as the cumulative distribution of peak ΔF/F0 across cells (Fig. 3g). Significantly more responsive cells were seen for jGCaMP8s and jGCaMP8m than for jGCaMP8f and jGCaMP7f (Fig. 3f; P < 0.001). Furthermore, the distribution of peak ΔF/F0 was shifted towards larger values for jGCaMP8s than for the other indicators (Fig. 3g). Peak amplitude of visually evoked fluorescence transient responses was significantly higher for jGCaMP8s than for other sensors, followed by jGCaMP8m and jGCaMP7f, than by jGCaMP8f (Fig. 3g). The response amplitudes of indicators with short t1/2,decay, particularly jGCaMP8f, were underestimated in these experiments because the relatively slow imaging rate does not reliably catch the peaks of the responses.

Orientation tuning was similar for all sensors, except that jGCaMP8m and jGCaMP8s revealed a larger proportion of neurons with low orientation selectivity (Extended Data Fig. 13). A plausible explanation is that the high-sensitivity indicators detect activity of GABAergic interneurons that is missed by the other sensors. Interneurons yield smaller fluorescence responses5, and have less sharp orientation tuning than excitatory neurons30. This hypothesis is supported by experiments with simultaneous imaging and electrophysiology (see below).

Simultaneous imaging and electrophysiology

To quantify jGCaMP8 responses to neural activity, we combined two-photon imaging (122 Hz) and loose-seal, cell-attached electrophysiological recordings5 (Fig. 4a). We compared fluorescence changes and spiking across sensors (n = 40 cells from 8 mice (jGCaMP8f), 47 cells from 7 mice (jGCaMP8m), 49 cells from 7 mice (jGCaMP8s) and 23 cells from 5 mice (jGCaMP7f); Extended Data Fig. 14a–f and Supplementary Table 2). Fluorescent signals for cell body regions of interest were corrected for neuropil signal5,6 (Extended Data Fig. 14g–j). All jGCaMP8 variants produced large fluorescence transient responses even in response to single APs (Fig. 4b–d).

Fig. 4: Simultaneous electrophysiology and imaging in the mouse V1 in vivo.
figure 4

a, Schematic of the experiment. Representative FOV (top) is also shown. The recording pipette is indicated by dashed lines. b, Simultaneous fluorescence and spikes, for example, neurons expressing jGCaMP8f (top), jGCaMP8m (middle) and jGCaMP8s (bottom). The number of spikes for each burst is indicated below the trace (single spikes are indicated by asterisks). c, Zoomed-in view of traces corresponding to the dashed boxes in b. d, Grand average of fluorescence response elicited by single APs, aligned to the AP peak (red vertical bar), reconstructed at a temporal resolution of 500 Hz (see text and Extended Data Fig. 15 for details). e, Properties of fluorescence responses elicited by single APs. The dots indicate single cells. For the box-and-whisker plots, the box indicates the median and 25–75th percentile range, and whiskers indicate the shorter of 1.5 times the interquartile range or the extreme data point. n = 24 cells from 9 mice (jGCaMP8f), 35 cells from 11 mice (jGCaMP8m), 31 cells from 10 mice (jGCaMP8s) and 11 cells from 3 mice (jGCaMP7f). f, Normalized jGCaMP7f response to a single AP (from d) (top), and response to AP doublets, binned based on interspike intervals (bottom). Transient responses are normalized and aligned to the first AP of the doublet (dashed line). The timing of the second AP is represented by the histograms below the transient responses. The interspike intervals are selected to be approximately 5, 10, 15, 20, 25, 30 and 35 ms. Responses for jGCaMP7f (green), jGCaMP8f (blue), jGCaMP8m (red) and jGCaMP8s (black) are shown. g, Response linearity. Peak response as a function of the number of APs within a 20-ms window (left) is shown. Mean and s.e.m. are displayed. The right graph is the same as the graph on the left, but normalized to 1AP response. n = 33, 23, 14, 4 and 2 cells (jGCaMP8f); n = 41, 32, 19, 6 and 2 cells (jGCaMP8m); n = 38, 34, 18, 3 and 1 cells (jGCaMP8s); and n = 15, 13, 6, 4 and 2 cells (jGCaMP7f) for 1, 2, 3, 4 and 5 APs, respectively.

Our experiments allowed us to resolve fluorescence transient responses with much higher effective temporal resolution than the 122-Hz frame rate. Fields of view were arranged so that each individual neuron, including the patched neuron, occupied less than 20% of the scan lines of the frame (Extended Data Fig. 15). As neurons were scanned at random phases with respect to APs, average fluorescence transient responses could be reconstructed at more than 500-Hz effective temporal resolution (Extended Data Fig. 15). All three jGCaMP8 variants had t1/2,rise < 5 ms, more than five times faster than jGCaMP7f under identical conditions (Fig. 4c–e). Peak responses and SNR for all jGCaMP8 indicators were also larger than for jGCaMP7f (Fig. 4d,e). To study spike-time estimation, we first binned AP doublets with respect to their interspike interval, and reconstructed average fluorescence transient responses for spike doublets with 5-ms, 10-ms, 15-ms and 20-ms interspike intervals. The jGCaMP8 indicators resolved individual APs from doublets at spike rates of up to 50 Hz (Fig. 4f). We subsequently grouped spike bursts based on the number of APs (from 1 to 5) in a 20-ms integration window. All sensors showed monotonic increases in fluorescence response with AP count, with the jGCaMP8 sensors responding more linearly than jGCaMP7f (Fig. 4g). This greater linearity is consistent with neuronal culture and purified protein results.

The synapsin-1 promoter yields expression in all neurons, including pyramidal cells and fast-spiking (FS; presumably parvalbumin expressing) interneurons, which are interspersed in our imaged regions of interest. Out of our recorded neurons, we identified the subset of FS interneurons by their high spike rates and short spike durations31 (Extended Data Fig. 16). All three jGCaMP8 sensors produced robust responses (Extended Data Fig. 16b; approximately 3% ΔF/F0 on average, with responses up to 5%) to single APs in FS interneurons, much larger than GCaMP6s (approximately 1% ΔF/F0)5,6.

We also tested the jGCaMP8 variants alongside GCaMP6f and jGCaMP7f in mouse cerebellar Purkinje cell dendritic arbors, where spike-mediated calcium entry occurs over a period of less than 10 ms (ref. 32) (Extended Data Fig. 17a,b). jGCaMP8m and jGCaMP8f had faster half-decay time than GCaMP6f and jGCaMP7f (Extended Data Fig. 17c,d), and all jGCaMP8 variants showed faster half-rise time than the controls (Extended Data Fig. 17d,e).

Together, the jGCaMP8 sensors show excellent single-spike detection, spike time estimation, good expression, strong performance in FS interneurons and no evidence of adverse effects of long-term expression.

Spike train modelling with jGCaMP8

Calcium-dependent fluorescence changes are an indirect measure of neural activity5,33. A large body of work has been devoted to estimating spike trains from calcium imaging data. Spike extraction is limited by linearity, sensitivity and kinetics of the calcium-dependent sensors34,35. We tested the effects of the faster kinetics, superior linearity and higher SNR of the jGCaMP8 indicators on state-of-the-art models of calcium-dependent fluorescence33 (Methods), using our simultaneous imaging and electrophysiology data (Figs. 4 and 5a). We compared the variance explained across linear and non-linear (sigmoid) models, quantifying to what extent non-linearities are required to fit fluorescence dynamics for different indicators (Fig. 5b).

Fig. 5: Spike-to-fluorescence and fluorescence-to-spike models.
figure 5

a, Spike-to-fluorescence (S2F) model. Schematic plot of the S2F forward model that generates a synthetic fluorescence trace (∆F/FSynth) from an input spike train (top), and an example fit and data for one cell (bottom) are shown. Measured ∆F/F0 (black) is overlaid with the simulated ∆F/FSynth (grey) from the S2F model. The input to the model, the simultaneously recorded spikes (black), are shown below the traces. b, Exemplary cell dynamics with different degrees of non-linearities. c, The degree of non-linearity (measured by the difference of variance explained using a sigmoid fit from that using a linear fit). Non-linearity is low for jGCaMP8 sensors (see Extended Data Table 5 for more details) but high for GCaMP6 sensors (TG: GCaMP6 transgenic mouse; otherwise, AAV application). The minima indicate 0th percentile of data (0%); the maxima denote 100%; the centre line indicates 50%; the bounds of box are from 25% (lower quartile) to 75% (upper quartile); and the whiskers indicate 1.5 times the distance between the upper and lower quartiles. The number of biologically independent cells collected in each condition is shown in Extended Data Table 5. d, Fluorescence-to-spike (F2S) model. Schematic plot of the F2S inference model that generates a synthetic fluorescence trace (∆F/FSynth) from an inferred spike train (top), and an example fit and data of a cell (bottom) are shown. The first row shows experimental spikes and the measured ∆F/F0 overlaid with the simulated ∆F/FSynth from the F2S model. The second row shows the simultaneously recorded ground-truth spikes (black), shown below the traces, compared with the inferred spikes (red). The third row shows the recorded spike rate overlaid with the inferred spike rate from the F2S model. eh, Violin plots, lines from top to bottom: 75%, 50%, 25% of data, respectively. e,f, Performance of fitting activity using the linear F2S model. Fluorescence dynamics (fits compared with raw fluorescence) (e) and spiking (fits compared with ground-truth spiking dynamics) (f) are shown. g, Performance of spike detectability using the linear F2S model. h, Spike-timing error using the linear F2S model.

Linear models performed better for jGCaMP8 than for GCaMP6s or jGCaMP7f in fitting fluorescence traces (Extended Data Table 5), reflecting their linearity (Fig. 5b,c and Extended Data Table 5), SNR and kinetics (Extended Data Table 6 and Extended Data Fig. 18a–g). Model estimates of rise and decay time constants are consistent with direct measurement (Extended Data Fig. 18c,f). Moreover, the model shows that the jGCaMP8 indicators maintain linearity over a wide range of neural activity, in contrast to jGCaMP7f (Fig. 5b,c and Extended Data Fig. 18h–j).

We next examined recovery of spike timing using widely used deconvolution algorithms (Fig. 5d). A linear inference model34 showed excellent performance in fitting both fluorescence and spiking activity for the jGCaMP8 indicators (Fig. 5e,f and Extended Data Fig. 19a,b). These two measures diverged in some cases, for example, for jGCaMP6s, due to sensor non-linearity (Fig. 5c); this divergence was not reduced by using non-linear inference models (Extended Data Fig. 19f–i). Finally, the jGCaMP8m and jGCaMP8s sensors outperformed the other sensors in spike detection (Fig. 5g and Extended Data Fig. 19c) and timing accuracy (Fig. 5h and Extended Data Fig. 19d).

Discussion

Previous structure–function studies have revealed that the fluorescence kinetics of GCaMP-type indicators is sensitive to mutations at the interface between CaM and the CaM-binding peptide (RS20 in GCaMP; ckkap peptide in XCaMP)5,8. For example, the fast variants of GCaMP6f and jGCaMP7f, which were optimized for kinetics, have key beneficial mutations at the CaM–RS20 interface, far from the CaM Ca2+-binding EF hands. These studies suggest that conformational changes at the CaM–RS20 interface constitute a kinetically limiting step between Ca2+ binding and fluorescence emission. However, extensive site-saturation mutagenesis of the CaM–RS20 interface failed to dramatically improve kinetics without large sacrifices in SNR5,6,20. Inspired by previous work8, we explored larger sequence changes by replacement of RS20 with 30 diverse CaM-binding peptides. Sensors with a peptide from ENOSP had fast kinetics and good SNR and were further optimized through structure-guided mutagenesis (Fig. 1).

The resulting jGCaMP8 sensors overcome major limitations of previous GECIs. All jGCaMP8 sensors respond to calcium changes with fast kinetics. In vivo fluorescence half-rise times after APs were less than 5 ms (cortical pyramidal neurons; Fig. 4). Such fast kinetics follow neural activity modulations on the rapid timescales relevant to behaviour (Fig. 2). Moreover, the jGCaMP8 sensors are more linear than previous GCaMP sensors (Extended Data Table 3), which facilitates quantitative spike estimation from calcium imaging data (Fig. 5). jGCaMP8 retains many major characteristics of other GCaMP sensors, such as nuclear-excluded expression, bright fluorescence, and excitation and emission spectra. We saw no evidence of cytomorbidity in our experiments, although long-term, high-level expression will probably produce this, as with all GECIs3,5,36.

jGCaMP8s has the largest single-spike fluorescence change of any calcium indicator, and a moderate half-decay time (200 ms, in mouse brain). The brightness, baseline fluorescence and quantum efficiency of the calcium-bound jGCaMP8 sensors are similar to jGCaMP7 and GCaMP6. Thus, jGCaMP8s sensitivity comes at a cost: saturation at lower spike number and hence lower dynamic range (Extended Data Fig. 3), although this is ameliorated by their improved linearity and kinetics. We expect jGCaMP8s to become the new standard for most in vivo calcium imaging. jGCaMP8s has an apparent affinity for calcium comparable with resting [Ca2+] in pyramidal neurons in brain slices15 (46 nM versus 50 nM) (Extended Data Table 3). However, fluorescence changes of several-fold were routinely seen in vivo (Fig. 4), suggesting that resting fluorescence is lower in vivo than with brain slices, or that calcium affinity is weaker than that measured in cuvette.

Compared with jGCaMP8s, jGCaMP8f and jGCaMP8m have faster fluorescence decay and smaller peak fluorescence changes, and higher dynamic ranges. These sensors are ideal to track activity in FS neurons (Extended Data Fig. 16) and applications in which analysis of spike timing is critical21,37. Because of their fast fluorescence decay times, the jGCaMP8 indicators will benefit from imaging at higher sampling rates than the widely used jGCaMP7s and GCaMP6s indicators.

Calcium transients are particularly rapid in small structures such as axons, dendrites and spines18. The faster jGCaMP8 indicators capture these fleeting signals more efficiently than other sensors. As a result, we observed strong neuropil signals38 with the jGCaMP8 indicators, which may degrade the SNR in densely labelled neuronal populations39. Localizing indicators to the soma, for example, using the RiboL1 tag, may be especially helpful for the jGCaMP8 indicators to optimize the SNR and facilitate segmentation of cell bodies from neuropil40.

Genetically encoded voltage indicators (GEVIs) can be used to image spikes in single neurons in vivo with fast kinetics. Because calcium is sensed in the three-dimensional cytoplasm, whereas voltage is sensed in the two-dimensional membrane, GECIs have a substantial inherent SNR advantage. Given that the response times of jGCaMP8 sensors approach those of GEVIs41, with much higher SNR, we believe that population imaging of spiking activity will largely remain the domain of calcium imaging. Voltage imaging will be useful in neurons that lack robust spike-evoked calcium signals42 and for reporting subthreshold membrane potential changes that are largely invisible to calcium imaging.

In recent years, calcium imaging has become the dominant method to track neural activity, especially in small model systems. However, because of slow GECI kinetics, imaging has been mostly used to map relatively static representations of neural information, rather than tracking the rich dynamics in neural circuits21,22. Most imaging is performed on timescales of hundreds of milliseconds, much slower than electrical signalling and information processing in neural circuits. For example, primates can make decisions involving multiple brain areas (including higher cortical areas) in less than 100 ms (ref. 43), implying that individual neurons process information in milliseconds. So far, neural studies of these fast processes have largely been the domain of electrophysiology. The jGCaMP8 calcium indicators substantially narrow the kinetic gap between imaging and electrophysiology.

Methods

All surgical and experimental procedures were conducted in accordance with protocols approved by the Institutional Animal Care and Use Committee (IACUC) and Institutional Biosafety Committee (IBC) of Janelia Research Campus (all work but the cerebellum), and of the IACUC and IBC at Princeton University (cerebellum work).

Sensor design

We surveyed the Protein Data Bank (PDB) for unique structures of CaM in complex with a single peptide. Twenty-nine peptides were sufficiently different from the RS20 peptide sequence used in previous GCaMPs to warrant testing (Extended Data Table 1). The structures of these complexes were superimposed on the GCaMP2 structure (PDB ID: 3EK4) in PyMOL, and amino acids were added or removed to bring all peptides to a length estimated to work well in the GCaMP topology. Synthetic DNA encoding each of the 29 peptides replaced the RS20 peptide in the bacterial expression vector pRSET-A-GCaMP6s. Of the initial sensors, 20 of the 29 sensed calcium. All 20 had lower saturating fluorescence change than GCaMP6s, all but three had weaker Ca2+ affinity (apparent Kd) than GCaMP6s, all but one had lower cooperativity (Hill coefficient (n)), and many were dimmer (Extended Data Table 1). Several sensor variants showed much faster Ca2+ decay kinetics, as determined by stopped-flow fluorescence on purified protein (Extended Data Table 3). On the basis of fast kinetics, saturating fluorescence change, apparent Kd, Hill coefficient and apparent brightness, we prioritized variants based on the peptides from endothelial nitric oxide synthase (PDB ID: 1NIW; peptide ‘ENOSP’) and death-associated protein kinase 1 (PDB ID: 1YR5; peptide ‘DAPKP’) for optimization (Extended Data Table 3).

Sensor optimization

These two sensor scaffolds were optimized in protein purified from Escherichia coli expression. Libraries were constructed to mutate the linker (linker 1) connecting the peptide to circularly permuted GFP (cpGFP)4,44 and screened for high signal change and retained fast kinetics. The linker connecting cpGFP and CaM (linker 2) was similarly mutated on top of variants from the optimization of linker 1. Out of 4,000 ENOSP-based variants and 1,600 DAPKP-based variants, 23 and 10, respectively, had fast kinetics and high saturating fluorescence change in purified protein (data not shown).

Guided by the structure of jGCaMP8.410.80, we targeted 16 interface positions for site-saturation mutagenesis: 7 in ENOSP, 4 on cpGFP and 5 on CaM (Extended Data Fig. 1). Sensor variants were tested in cultured neurons for higher sensitivity in detecting neural activity while maintaining fast kinetics. Several single mutations improved properties (Supplementary Table 1), particularly residues near the ENOSP C terminus and the cpGFP–CaM interface. Beneficial point mutations were combined in subsequent rounds of screening. Ten additional CaM positions (Extended Data Fig. 1) surrounding ENOSP were next subjected to site-saturation mutagenesis. Finally, mutations (Extended Data Fig. 1) from the FGCaMP sensor (developed using CaM and RS20-like peptide sequences from the fungus Aspergillus niger and the yeast Komagataella pastoris)45,46 were introduced to improve biorthogonality and/or kinetics.

Sensor screen and characterization in solution

Cloning, expression and purification of sensor variants in E. coli, calcium titrations, pH titrations, kinetic assay and photophysical analysis were performed as previously described4,47.

In this study, the RSET tag (His6 tag-Xpress epitope-enterokinase cleavage site), which had been carried over from the pRSET-A cloning vector in earlier work3,4,5,48, was removed from all sensors; constructs instead encode a hexa-histidine affinity tag, Met-His6 tag–peptide–linker 1–cpGFP–linker 2–CaM. For the screen of linkers replacing RS20 (sometimes referred to as ‘M13’), libraries of sensors in the pRSET-A bacterial expression vector were generated using primers containing degenerate codons (NNS) with Q5 site-directed mutagenesis (New England BioLabs) and transformed into T7 Express-competent cells (New England BioLabs). A sequence encoding six repeats of the Gly-Gly-Ser tripeptide was designed as a highly flexible, presumably non-CaM-binding negative control. We expressed the new variants, as well as the presumptive Gly-Gly-Ser negative control and GCaMP6s as a positive control, in E. coli T7 Express. Single colonies were picked and grown in 800 µl ZYM-5052 autoinduction medium containing 100 µg ml−1 ampicillin in 96-deep-well blocks for 48 h at 30 °C. Cells were collected by centrifugation, frozen, thawed and lysed. Clarified lysate was used to estimate the dynamic range by measuring fluorescence in the presence of 1 mM Ca2+ or 1 mM EGTA.

For protein purification, T7 Express cells containing sensors were grown at 30 °C for 48 h in ZYM-5052 autoinduction medium with 100 µg ml−1 ampicillin. Collected cells were lysed in 1/50 volume of B-PER (Thermo Fisher) with 1 mg ml−1 lysozyme and 20 U ml−1 Pierce Universal Nuclease (Thermo Fisher) and subsequently centrifuged. Supernatants were applied to HisPur Cobalt Resin (Thermo Fisher). The resin was washed with 20 column volumes of 20 mM Tris, pH 8.0, 300 mM NaCl and 1 mM imidazole, followed by 10 column volumes of 20 mM Tris, pH 8.0, 500 mM NaCl and 5 mM imidazole. Proteins were eluted into 20 mM Tris, pH 8.0, 100 mM NaCl and 100 mM imidazole.

For calcium titrations, sensors were diluted 1:100 in duplicate into 30 mM MOPS, pH 7.2, 100 mM KCl containing either 10 mM CaEGTA (39 µM free calcium) or 10 mM EGTA (0 µM free calcium). As before, these two solutions were mixed in different amounts to give 11 different free calcium concentrations. GCaMP fluorescence (485-nm excitation, 5-nm bandpass; 510-nm emission, 5-nm bandpass) was measured in a Tecan Safire2 plate reader (Tecan). The data were fit with a sigmoidal function using KaleidaGraph (Synergy Software) to extract the apparent Kd for Ca2+, the Hill coefficient and the saturating fluorescence change.

The half-decay time of fluorescence after calcium removal (t1/2,decay) was determined at room temperature using a stopped-flow device coupled to a fluorimeter (Applied Photophysics). Each sensor variant in 1 µM Ca2+ in 30 mM MOPS, pH 7.2, and 100 mM KCl was rapidly mixed with 10 mM EGTA in 30 mM MOPS, pH 7.2, and 100 mM KCl. Fluorescence decay data were fit with a single or double exponential decay function.

For pH titrations, purified proteins were diluted into pH buffers containing 50 mM citrate, 50 mM Tris, 50 mM glycine, 100 mM NaCl and either 2 mM CaCl2 or 2 mM EGTA, which were pre-adjusted to 24 different pH values between 4.5 and 10.5 with NaOH. A sigmoidal function was used to fit fluorescence versus pH, and the pKa value was determined from the midpoint.

Sequence and structural analysis of variants

Linker1 encodes Leu-Glu in GCaMP6s- and indeed, in all previous RS20-based GCaMP sensors. This linker was extensively mutated in the GCaMP5 screen4 but the best variant, GCaMP5G, retained Leu-Glu; we first mutated Leu-Glu to fully degenerate 2-amino acid (aa) sequences and screened for variants with both high signal change and retained fast kinetics. Following selection of the best 2-aa linkers, these variants were expanded to libraries of 3-aa linkers by addition of fully degenerate codons. After optimization of linker 1, linker 2 was mutated from Leu-Pro, to which it had been selected in GCaMP5G28, the parent of GCaMP6 and GCaMP7. Mutagenesis of linker 2 was similar to that for linker 1, but alternative linker 2 sequences either slowed kinetics or decreased ΔF/F0, and linker 2 was thus retained as Leu-Pro.

In addition to jGCaMP8f, jGCaMP8m and jGCaMP8s, several other variants may be of interest, including 455, 543, 640, 707 and 712 (Supplementary Table 1). All promising variants contain, in addition to the Leu-Lys-Ile linker 1, additional mutations to the ENOSP peptide: Asn19Thr and Ser24Ile appear in every variant except 712, Ser26Arg appears in every variant but jGCaMP8s (with Ser26Met), jGCaMP8m has Ala25Gly, and 712 has Met28Ser. Every variant contains the Gln88Glu mutation at the CaM–GFP interface. Further mutations include Phe286Tyr (jGCaMP8s, jGCaMP8m and 707); Glu288Gln (707); Gln315Leu (jGCaMP8f), Gln315His (jGCaMP8s and 707), Gln315Lys (455); Met346Gln (543); and Met419Ser (640). Of these, Phe286Tyr comes from the FGCaMP sensor; all others are unique to this work. GCaMP6s data from both purified protein and cultured neurons are essentially identical between this work (lacking the RSET tag) and previous work (with the RSET tag) (data not shown), implying that the RSET tag does not noticeably modulate GCaMP function in protein and neuronal culture and that observed jGCaMP8 improvements stem from the peptide substitution and other mutations.

Photophysical measurements

All measurements were performed in 39 μM free calcium (+Ca) buffer (30 mM MOPS, 10 mM CaEGTA in 100 mM KCl, pH 7.2) or 0 μM free calcium (−Ca) buffer (30 mM MOPS, 10 mM EGTA in 100 mM KCl, pH 7.2). Absorbance measurements were performed using a UV–Vis spectrometer (Cary 100, Agilent technologies), and fluorescence excitation–emission spectra were measured using a spectrofluorometer (Cary Eclipse, Varian). ΔF/F0 was calculated from the fluorescence emission spectra of the proteins in +Ca and −Ca buffer. Quantum yield for +Ca solutions was measured using a spectrometer with an integrating sphere (Quantaurus, Hamamatsu); for −Ca, a relative method was applied using jGCaMP7f (quantum yield of 0.60) as a reference. Extinction coefficients were determined via the alkali denaturation method, using the extinction coefficient of denatured eGFP as a reference (ε = 44,000 M−1 cm−1 at 447 nm).

Photobleaching measurements

Solutions of 2–4 μM protein were prepared in 30 mM MOPS, pH 7.2 (+Ca and –Ca buffer) with 0.1% BSA added. A sample of these solutions was added to 1-octanol in a 1:9 ratio, and this mixture was vortexed briefly. The resulting emulsion was placed on a pre-silanized glass microscopy slide and fitted with a coverslip. Fluorophore bleaching was accomplished by illuminating a microdroplet using an upright microscope (Zeiss Axio Observer Z2) and a ×20, NA 0.8 objective. Light illumination was obtained using a 488-nm (Sapphire 488, Coherent) laser excitation at 11.45-mW power (intensity = 14.0 W cm2), and the emission was collected using a 525BP50 filter. Fluorescence was detected by a fibre-coupled avalanche photodiode (SPQM-AQRH14, Pacer). Obtained bleaching profiles were fit using a double-exponential fitting function in MATLAB to calculate their respective time constants (τbleach).

For quantitative comparison of photobleaching for fluorophores, the bleaching probability (Pb) needs to be computed as referenced in ref. 49. To quantify Pb for each fluorophore, their respective excitation rate (W) was obtained. The excitation rate W for a laser source can be calculated as a product of extinction coefficient (ε (λ) in M−1 cm−1) and intensity (I (λ) in W cm2) for the discrete excitation wavelength (λ, in nm) as shown in the equation (1):

$$W=0\,.\,0192\phantom{\rule{ 0.25em}{0ex}}\varepsilon \,I\,\lambda $$
(1)

Photobleaching is further characterized by the number of photons (Np) emitted before photobleaching, which is the product of fluorescence quantum yield (ϕf), excitation rate (W) and photobleaching time constant (τbleach) as shown in the equation (2):

$${N}_{p}={\varphi }_{f}\,W\,{\tau }_{{\rm{bleach}}}$$
(2)

In a rate equation model for bleaching proceeding from singlet or triplet states, the photobleaching probability Pb is inversely related to the total number of fluorescent photons emitted by \({N}_{p}={\varphi }_{f}/{P}_{b}\). Using equation (2), this can be expressed as:

$${P}_{b}=1/W\,{\tau }_{{\rm{bleach}}}$$
(3)

The photobleaching probability Pb is the most rigorous, as it is independent of the fluorescence quantum yield. The calculated Pb values for the proteins are presented in Extended Data Table 3.

Two-photon spectroscopy

The two-photon excitation spectra were performed as previously described1. Protein solutions of 1–5 μM concentration in +Ca or −Ca buffer were prepared and measured using an inverted microscope (IX81, Olympus) equipped with a ×60, 1.2 NA water immersion objective (Olympus). Two-photon excitation was obtained using an 80 MHz Ti-Sapphire laser (Chameleon Ultra II, Coherent) with sufficient power from 710 nm to 1,080 nm. Fluorescence collected by the objective was passed through a short-pass filter (720SP, Semrock) and a bandpass filter (550BP200, Semrock) and detected by a fibre-coupled avalanche photodiode (SPCM_AQRH-14, Perkin Elmer). The obtained two-photon excitation spectra were normalized to 1 μM concentration and subsequently used to obtain the action cross-section spectra with fluorescein as a reference (average action cross-section spectra from refs. 50,51).

Fluorescence correlation spectroscopy was used to obtain the two-photon molecular brightness of the protein molecule. The peak molecular brightness was defined by the rate of fluorescence obtained per total number of emitting molecules. Protein solutions (50–100 nM) were prepared in +Ca buffer and excited with 930-nm light at powers ranging from 2 mW to 30 mW for 200 s. The obtained fluorescence emission was collected by an avalanche photodiode and fed to an autocorrelator (Flex03LQ, Correlator.com). The obtained autocorrelation curve was fit to a diffusion model through a built-in MATLAB function52 to determine the number of molecules <n> present in the focal volume. The two-photon molecular brightness (ε) at each laser power was calculated as the average rate of fluorescence <F> per emitting molecule <n>, defined as ε = <F>/<n> in kilocounts per second per molecule. As a function of laser power, the molecular brightness initially increases with increasing laser power, then levels off and decreases due to photobleaching or saturation of the protein chromophore in the excitation volume. The maximum or peak brightness achieved, <εmax>, represents a proxy for the photostability of a fluorophore.

Screening in neuronal cell culture

GCaMP variants were cloned into an hSyn1-GCaMP-NLS-mCherry-WPRE expression vector, and XCaMP variants (XCaMP-G, XCaMP-Gf and XCaMP-Gf0) were cloned into the same expression vector with the nuclear export sequence that was attached to the XCaMP sensors in the original publication8. As this excludes the XCaMP sensors from the nucleus, where Ca2+ signals are slower53, whereas the variants developed here were not explicitly excluded (although GCaMPs without an explicit nuclear export sequence are nevertheless fairly nuclearly excluded), this will make the XCaMPs appear faster than they really are than the GCaMP indicators.

The primary rat culture procedure was performed as previously described6. In brief, neonatal rat pups (Charles River Laboratory) were euthanized, and neocortices were dissociated and processed to form a cell pellet. Cells were resuspended and transfected by combining 5 × 105 viable cells with 400 ng plasmid DNA and nucleofection solution in a 25-µl electroporation cuvette (Lonza). Electroporation of GCaMP mutants was performed according to the manufacturer’s protocol.

Neurons were plated onto poly-d-lysine (PDL)-coated, 96-well, glass-bottom plates (MatTek) at approximately 1 × 105 cells per well in 100 µl of a 4:1 mixture of NbActiv4 (BrainBits) and plating medium (28 mM glucose, 2.4 mM NaHCO3, 100 µg ml−1 transferrin, 25 µg ml−1 insulin, 2 mM l-glutamine, 100 U ml−1 penicillin, 10 µg ml−1 streptomycin and 10% FBS in MEM). Typically, each plate included GCaMP6s (eight wells), GCaMP6f (eight wells) and jGCaMP7f (eight wells). Other wells were electroporated with mutated variants (four wells per variant), for a total of 80 wells (the first and last columns in the plate were not used to reduce edge effects). Plates were left in the incubator at 37 °C and 5% CO2. The next day, 190 μl of NbActiv4 medium was added to each well.

On 12–15 days in vitro (DIV), neurons were rinsed three times with imaging buffer containing 140 mM NaCl, 0.2 mM KCl, 10 mM HEPES and 30 mM glucose (pH 7.3–7.4) and left in a solution containing imaging buffer with added receptor blockers (10 μM CNQX, 10 μM (R)-CPP, 10 μM gabazine and 1 mM (S)-MCPG; Tocris) to reduce spontaneous activity; neurons then underwent field stimulation and imaging6,24. Fluorescence timelapse images (200 Hz; total of 7 s) were collected on an Olympus IX81 microscope using a ×10, 0.4 NA objective (UPlanSApo, Olympus) and an ET-GFP filter cube (#49002, Chroma). A 470-nm LED (Cairn Research) was used for excitation (intensity at the image plane of 0.34 mW mm2). Images were collected using an EMCCD camera (Ixon Ultra DU897, Andor) with 4 × 4 binning, corresponding to a 0.8 mm × 0.8 mm FOV. Reference images (100-ms exposure) were used to perform segmentation. Red illumination for variants co-expressing mCherry was performed with a 590-nm LED (Cairn Research) through an ET-mCherry filter cube (#49008, Chroma) with an intensity of 0.03 mW mm2. Trains of 1, 3, 10 and 160 field stimuli were delivered with a custom stimulation electrode. For sensor linearity measurements, 1, 2, 3, 5, 10 and 40 field stimuli were delivered. All measurements were performed at room temperature, which contributed to slower kinetics than that reported in vivo (34 °C).

The responses of individual variants were analysed as previously described5,6. The Ilastik toolkit54 was used to segment cell bodies in the reference images. Wells with fewer than five detected neurons, and wells with poor neuronal proliferation, were discarded (labelled as ‘failed segmentation’ in Supplementary Table 1). Plates with more than four failed control (GCaMP6s) wells were discarded and re-screened.

When calculating ΔF/F0 (defined as (Fpeak – F0)/F0), Fpeak was taken from the single frame with the highest fluorescence intensity post-stimulus, and F0 was the average intensity of ten frames preceding the stimulus. d′ was calculated as follows:

$${d}^{{\prime} }=\frac{{\bar{F}}_{{\rm{top}}}-{\bar{F}}_{{\rm{bottom}}}}{\sqrt{\frac{1}{2}({\sigma }^{2}({F}_{{\rm{top}}})+{\sigma }^{2}({F}_{{\rm{bottom}}}))}}$$

where Ftop and Fbottom are peak and baseline fluorescence traces, respectively, six frames in duration.

As the fluorescent signal was sampled at 200 Hz, fast rise times (less than 10 ms) could not be reliably computed for single trials. Thus, to compute half-rise time (t1/2,rise), we found the two frames having fluorescence intensities below and above Fpeak/2, linearly interpolated the trace between them, and computed the timepoint at which the fluorescence would have crossed the Fpeak/2 threshold. Using this technique and averaging across hundreds of neurons for each variant allowed us to approximate (t1/2,rise) with higher resolution than the sampling interval.

Median values from each well were reported to quantify performance. Each observation was normalized to the median GCaMP6s value from the same experimental batch. Baseline brightness for constructs co-expressing mCherry was calculated by dividing the GFP cellular fluorescence in the beginning of the 3AP stimulation epoch by the mCherry cellular fluorescence (for a ratiometric measurement). For comparison with XCaMP variants (Extended Data Fig. 4a), no mCherry normalization was performed, but all baseline brightness values were still normalized to GCaMP6s in the same transfection week. To determine significant differences in observations between constructs, a two-tailed Mann–Whitney U-test was performed between constructs and controls (GCaMP6s or jGCaMP7f). A median ΔF/F0 trace was computed across all detected cell bodies in a well for each stimulus. Photobleaching was corrected in the 1AP recordings by fitting a double exponential to the beginning and end segments of the fluorescence trace.

Finally, data were filtered according to three criteria to remove variants without detectable response to 1AP. We filtered out variants (1) with t1/2,rise < 0.1× or > 4× of GCaMP6s, (2) with time-to-peak >3× of GCaMP6s, and (3) with t1/2,decay < 0.01× of GCaMP6s, as these represented inaccurate fits to non-responsive fluorescence traces (labelled as ‘no detectable response’ in Supplementary Table 1).

To evaluate the baseline fluorescence of the jGCaMP8 series compared with jGCaMP7f and the XCaMP series, all constructs were transfected side-by-side (2 consecutive transfection weeks, five 96-well plates). To minimize possible plate-to-plate variability within each transfected batch, the baseline fluorescence of each construct was normalized to in-plate GCaMP6s.

We have implemented several improvements to the neuronal culture screening rig over the years (Supplementary Table 4). These improvements to the rig result in slight changes in values of ΔF/F0 and other parameters for our control GECIs (for example, GCaMP6 and jGCaMP7) compared with in our original publications. Note that at all times, we compared variants to reference sensors in an apples-to-apples comparison, using data obtained from in-plate controls.

All of the parameters measured in our screen can be examined as an interactive scatterplot in a Binder notebook (https://mybinder.org/v2/gh/ilyakolb/jGCaMP8-neuron-culture-screen/HEAD?labpath=interactive-multiparameter-screening-plot.ipynb). The data are also collated in Microsoft Excel in Supplementary Table 1.

Fluorescence recovery after photobleaching

Fluorescence recovery after photobleaching experiments were carried out on a Nikon Ti-E inverted microscope outfitted with a Yokogowa CSU-X1 spinning disk and an Andor DU-897 EMCCD camera. Fluorescence excitation was carried out using a solid-state laser line at 488 nm, and emission was collected with a ×100 1.49 NA objective (Nikon Instruments) through a standard GFP filter set. Photobleaching was performed using a Bruker Mini-Scanner by focusing a 405-nm laser to a single, diffraction-limited spot for 100 ms. Cultured neurons plated in 35-mm glass-bottom dishes (MatTek) were immersed in regular imaging buffer with the addition of synaptic blockers (same as used for neuronal culture field stimulation) and 1 µM TTX to block AP generation. In a subset of experiments, the buffer was supplemented with 5 µM ionomycin. Bleaching spots were chosen to be on the soma of the neuron but distant from the nucleus. A spot was photobleached ten times (0.1 Hz) as the cell was concurrently imaged at 25 or 50 frames per second.

For analysis, pixels within a 1.5-µm radius around the bleach spot were averaged in each frame. The resulting fluorescence trace was normalized to the mean fluorescence of an identically sized spot on the opposite side of the soma, outside the nucleus. The trace was then split into ten epochs (each corresponding to a bleaching event) and the fluorescence fi (t) of each epoch i was normalized by dividing by the fluorescence value immediately preceding the bleaching pulse (\({f}_{i}\left({t}_{{\rm{pre}}}\right)\)) as follows:

$${\bar{f}}_{i}(t)=\frac{{f}_{i}(t)}{{f}_{i}({t}_{{\rm{pre}}})}$$

The resistant fraction (RF) was calculated as follows:

$${\rm{R}}{\rm{F}}\,({\rm{ \% }})=100\left(1-{\bar{f}}_{1}({t}_{\text{fin}})-\frac{1}{9}\mathop{\sum }\limits_{i=2}^{10}(1-{\bar{f}}_{i}({t}_{\text{fin}}))\right)$$

where \({\bar{f}}_{i}({t}_{\text{fin}})\) is the final fluorescence value at the end of epoch i, and the final term in the equation is the averaged fluorescence loss of all epochs after the first. This term is subtracted to account for the overall fluorescence loss with each bleaching pulse.

Crystal structure determination

All GCaMP samples for crystallization were kept in 20 mM Tris, 150 mM NaCl, pH 8.0, and 2 mM CaCl2. All crystallization trials were carried out at 22 °C with the hanging-drop vapour diffusion method. Commercial sparse-matrix screening solutions (Hampton Research) were used in initial screens. Of the protein solution, 1 µl was mixed with 1 µl of reservoir solution and equilibrated against 250 µl of reservoir solution. Diffraction data were collected at beamline 8.2.1 at the Berkeley Center for Structural Biology and processed with XDS55. The phase was determined by molecular replacement using MOLREP, and the structure of GCaMP2 (PDB ID: 3EK4)56 without the RS20 peptide as the starting model. Refinement was performed using REFMAC57 followed by manual remodelling with Coot58. Details of the crystallographic analysis and statistics are presented in Extended Data Table 2. The crystal structure has been released on the PDB website (rcsb.org), entry 7ST4. wwPDB validation scores are excellent (https://files.rcsb.org/pub/pdb/validation_reports/st/7st4/7st4_full_validation.pdf).

Adult Drosophila L2 assay

GECIs were tested by crossing males carrying the variant to a w+;53G02-Gal4AD (in attP40);29G11-Gal4DBD (in attP2) females59. Heterozygous flies were used in our experiments. Sensor cDNAs were codon-optimized for Drosophila. Flies were raised at 21 °C on standard cornmeal molasses medium.

Three to five days after eclosure, females were anaesthetized on ice. After transferring to a thermoelectric plate (4 °C), legs were removed, and then facing down, the head was glued into a custom-made pyramid using UV-cured glue. The proboscis was pressed in and fixed using UV-cured glue. After adding saline (103 mM NaCl, 3 mM KCl, 1 mM NaH2PO4, 5 mM TES, 26 mM NaHCO3, 4 mM MgCl2, 2.5 mM CaCl2, 10 mM trehalose and 10 mM glucose, pH 7.4, 270–275 mOsm) to the posterior side of the head, the cuticle was cut away above the right side, creating a window above the target neurons. Tracheae and fat were removed, and muscles M1 and M6 were cut to minimize head movement.

Two-photon imaging took place under a ×40 0.8 NA water-immersion objective (Olympus) on a laser-scanning microscope (BrukerNano) with GaAsP photomultiplier tubes. Laser power at 920 nm was kept constant at 8 mW using a Pockels cell. No bleaching was evident at this laser intensity. The emission dichroic was 580 nm and emission filters 511/20–25 nm. Images were 32 × 128 pixels with a frame rate at 372 Hz.

A MATLAB script drove the visual stimulation via a digital micromirror device (DMD, LightCrafter) at 0.125 Hz onto a screen covering the visual field in front of the right eye. A blue LED (M470L3, Thorlabs) emitting through a 474/23–25-nm bandpass filter (to keep blue light from contaminating the green imaging channel) provided illumination.

Light dimming produced a stereotypical calcium increase in L2 neurons27. Intensity measurements were taken in medulla layer 2 (Fig. 2a). A target region image was chosen by testing each focal layer with 0.5-Hz full-field visual stimulation until a layer with maximum ΔF/F0 was identified. Then, 2–3 columns producing a maximum response were identified within this layer. In addition to the region of interest (ROI) containing these L2 columns, a background ROI was selected where no fluorescence was evident. The mean background intensity was subtracted from the mean L2 ROI. Imaging then targeted this region over a protocol involving multiple tests, as shown in Supplementary Table 3.

Image analysis was performed using custom Python scripts. In the ΔF/F0 calculation, baseline F0 included the last 20% of images taken at the end of the light period. Stimulus onset is the light-to-dark transition. Change in fluorescence ΔF is the intensity minus baseline. ΔF/F0 is ΔF divided by baseline. The final signal is processed through a Gaussian filter (σ = 3). Discriminability index (d′) values were calculated the same as in mouse imaging (see below).

Imaging in the Drosophila larval neuromuscular junction

We made 20XUAS-IVS-Syn21-op1-GECI-p10 in VK00005 transgenic flies60 and crossed them with 10XUAS-IVS-myr::tdTomato in su(Hw)attP8 × R57C10-Gal4 at VK00020; R57C10-Gal4 at VK00040 double-insertion pan-neuronal driver line. Heterozygous flies were used in our experiments. Sensor cDNAs were codon-optimized for Drosophila. The neuromuscular junction (NMJ) assay is as in our previous study10. In brief, female third instar larvae were dissected in chilled (4 °C) Schneider’s insect medium (Sigma) to fully expose the body wall muscles. Segment nerves were severed in proximity to the ventral nerve cord. Dissection medium was then replaced with room temperature HL-6 saline in which 2 mM CaCl2 and 7 mM l-glutamate were added to induce tetany, freezing the muscles in place. A mercury lamp (X-CITE exacte) light source was used for excitation, and out-of-objective power was kept less than 5 mW to reduce bleaching. Type Ib boutons on muscle 13 from segment A3–A5 were imaged while the corresponding hemi-segment nerve was stimulated with square voltage pulses (4 V, pulse width of 0.3 ms, duration of 2 s and frequency of 1–160 Hz) through a suction electrode driven by a customized stimulator. Bath temperature and pH were continuously monitored with a thermometer and pH metre, respectively, and recorded throughout the experiment. The filters for imaging were as follows: excitation of centre wavelength (CWL) = 472 nm and bandwidth (BW) = 30 nm, dichroic of 495 nm, and emission of CWL = 520 nm and BW = 35 nm. Images were captured with an EMCCD (Andor iXon 897) at 128.5 frames per second and acquired with Metamorph software. ROIs around boutons were manually drawn, and data were analysed with a custom Python script. Discriminability index values were calculated the same as in mouse imaging.

NMJ immunofluorescence

Variants were crossed to a pan-neuronal driver line, also containing tdTomato (pJFRC22-10XUAS-IVS-myr::tdTomato in su(Hw)attP8;; R57C10 at VK00020, R57C10 at VK00040). Third instar larvae were filleted and fixed following standard techniques61. Primary chicken anti-GFP (1:1,000; A10262, Thermo Fisher) and secondary goat anti-chicken AlexaFluor Plus 488 (1:800; A32931, Thermo Fisher) were used to stain GECIs. Primary rabbit anti-RFP (1:1,000; 632496, Clontech) and secondary goat anti-rabbit Cy3 (1:1,000; 111-165-144, Jackson) labelled tdTomato.

MBON-γ2α′1 immunofluorescence

Variants were co-expressed with membrane-localized myr::tdTomato using the MB077B driver. Adults 3–6 days old were harvested, brains dissected and fixed using standard techniques. GCaMP variants were directly labelled with rabbit anti-GFP (1:500; AlexaFluor 488; A-21311, Molecular Probes). Primary rat anti-RFP (1:500; mAb 5F8, Chromotek) and secondary goat anti-rat Cy3 (1:1,000; 112-165-167, Jackson) labelled tdTomato.

Immunofluorescence quantification

ROIs were drawn on targeted regions using custom Python scripts. Within each ROI, otsu-thresholding was used to identify regions expressing myr::tdTomato. Intensity measurements were then taken for both the variant and tdTomato within these regions. The ratio is the intensity from the green channel (variant staining) divided by the intensity from the red channel (myr::tdTomato staining).

Western blot

Protein was extracted from female brains with the same genotype used in the NMJ immunostaining. Western blots were performed following standard techniques. Each variant was stained using primary rabbit anti-GFP (PC408, Millipore Sigma) and secondary goat anti-rabbit IgG conjugated to horseradish peroxidase (HRP; 31460, Thermo Fisher/Invitrogen). Actin was stained using mouse IgM anti-α-actin (1:5,000; MA1-744, Thermo Fisher/Invitrogen) and goat anti-mouse IgG and IgM-HRP (1:5,000; 31430 and 62-6820, respectively, Thermo Fisher/Invitrogen). Signal was formed using SuperSignal West Dura luminescence and was imaged on a Bio-Rad Gel imager. Band intensity was measured using Fiji62. Band intensity from the variant was divided by band intensity from the actin band to determine the ratio.

Mouse work

All mice were cared for in compliance with the Guide for the Care and Use of Laboratory Animals. All experiments at Janelia were approved by the Janelia Research Campus IACUC and IBC committees. Janelia is an AAALAC-accredited institution. Mice were maintained under specific pathogen-free conditions. Mice were housed on a free-standing, individually ventilated (approximately 60 air changes hourly) rack (Allentown). The holding room was ventilated with 100% outside filtered air with 15–20 air changes hourly. Each ventilated cage (Allentown) was provided with corncob bedding (Shepard Specialty Papers), at least 8 g of nesting material (Bed-r’Nest, The Andersons) and red Mouse Tunnel (Bio-Serv). Mice were maintained on a 12:12-h light:dark cycle. The holding room temperature was maintained at 68–72 °F with a relative humidity of 30–70%. Irradiated rodent laboratory chow (LabDiet 5053) was provided ad libitum.

At Princeton, experimental procedures were approved by the Princeton University IACUC (protocol 3080-16) and performed in accordance with the animal welfare guidelines of the US National Institutes of Health. All mice were housed under a 12:12-h regular light cycle for breeding and transferred to reverse light-cycle conditions with 12:12-h reverse light:dark cycle facility, and experiments were performed during the dark cycle. At least 1 week before the experimental days, mice were housed in darkness in an enrichment box containing bedding, houses and wheels (Bio-Serv Fast-Trac K3250/K3251). At other times, mice were housed in cages in the animal facility in groups of 2–4 mice per cage. Mice were maintained at 68–72 °F with a relative humidity of 30–70%.

Mouse surgeries for cortical imaging

Young adult (postnatal day 50–214) male C57BL/6J (Jackson Labs) mice were anaesthetized using isoflurane (2.5% for induction and 1.5% during surgery). A circular craniotomy (diameter of 3 mm) was made above V1 (centred 2.5 mm left and 0.5 mm anterior to the Lambda suture). Viral suspension (30 nl) was injected in 4–5 locations on a 500-μm grid, 300–400 μm deep. Constructs included: AAV2/1-hSynapsin-1-jGCaMP8 constructs (pGP-AAV-syn1-jGCaMP8f-WPRE, Addgene plasmid #162376, 4 × 1012 GC per millilitre titre; pGP-AAV-syn1-jGCaMP8m-WPRE, Addgene plasmid #162375, 2.2 × 1012 GC per millilitre titre; pGP-AAV-syn1-jGCaMP8s-WPRE, Addgene plasmid #162374, 2.1 × 1012 GC per millilitre titre). A 3-mm diameter circular coverslip glued to a donut-shaped 3.5-mm diameter coverslip (no. 1 thickness, Warner Instruments) was cemented to the craniotomy using black dental cement (Contemporary Ortho-Jet). A custom titanium head post was cemented to the skull. An additional surgery was performed for loose-seal recordings. Eighteen to eighty days after the virus injection, the mouse was anaesthetized with a mixture of ketamine–xylazine (0.1 mg ketamine and 0.008 mg xylazine per gram body weight), and we surgically removed the cranial window and performed durotomy63. The craniotomy was filled with 10–15 μl of 1.5% agarose, then a D-shaped coverslip was secured on top to suppress brain motion and leave access to the brain on the lateral side of the craniotomy.

Two-photon imaging in mouse cortex

Mice were kept on a warm blanket (37 °C) and anaesthetized using 0.5% isoflurane and sedated with chlorprothixene (20–30 μl at 0.33 mg ml−1, intramuscular). Imaging was performed with a custom-built two-photon microscope with a resonant scanner. The light source was an Insight femtosecond-pulse laser (Spectra-Physics) running at 940 nm. The objective was a ×16 water immersion lens with 0.8 numerical aperture (Nikon). The detection path consisted of a custom filter set (525/50 nm (functional channel), 600/60 nm (cell-targeting channel) and a 565-nm dichroic mirror) ending in a pair of GaAsP photomultiplier tubes (Hamamatsu). Images were acquired using ScanImage (vidriotechnologies.com)64. Functional images (512 × 512 pixels, 215 × 215 μm2; or 512 × 128 pixels, 215 × 55 μm2) of L2/3 cells (50–250 μm under the pia mater) were collected at 30 Hz or 122 Hz. Laser power was up to 50 mW at the front aperture of the objective unless stated otherwise for the XCaMP-Gf experiments.

Loose-seal recordings in mouse cortex

Micropipettes (3–9 MΩ) were filled with sterile saline containing 20 μM AlexaFluor 594. Somatic cell attached recordings were obtained from upper L2 neurons (50–200 μm depth from brain surface) visualized with the shadow patching technique65. Spikes were recorded either in current clamp or voltage clamp mode. Signals were filtered at 20 kHz (Multiclamp 700B, Axon Instruments) and digitized at 50 kHz using Wavesurfer (wavesurfer.janelia.org/). The frame trigger pulses of ScanImage were also recorded and used offline to synchronize individual frames to electrophysiological recordings. After establishment of a low-resistance seal (15–50 MΩ), randomized visual stimulation was delivered to increase the activity of the cells in the FOV. In a small subset of recordings, we microstimulated the recorded neuron in voltage clamp recording mode by applying DC current to increase its firing probability66.

Visual stimulation

Visual stimuli were moving gratings generated using the Psychophysics Toolbox in MATLAB (Mathworks), presented using an LCD monitor (30 × 40 cm2), placed 25 cm in front of the centre of the right eye of the mouse. Each stimulus trial consisted of a 2-s blank period (uniform grey display at mean luminance) followed by a 2-s drifting sinusoidal grating (0.05 cycles per degree, temporal frequency of 1 Hz, eight randomized different directions). The stimuli were synchronized to individual image frames using frame-start pulses provided by ScanImage.

Post hoc anatomy of the mouse cortex

After the loose-seal recording sessions, mice were anaesthetized with a mixture of ketamine–xylazine (0.1 mg ketamine and 0.008 mg xylazine per gram body weight) and were transcardially perfused with 4% PFA in 1X Dulbecco’s PBS (DPBS). The brains were extracted and post-fixed overnight in the perfusing solution. The brains were sectioned at 50-μm thickness, blocked with 2% BSA + 0.4 Triton X-100 (in PBS) for 1 h at room temperature, incubated with primary antibody (Rb-anti-GFP, 1:500; G10362, Invitrogen) for 2 days at 4 °C, and secondary antibody (AlexaFluor 594 conjugated goat anti-Rb, 1:500; A-11012, Invitrogen) overnight at 4 °C. The sections were mounted on microscope slides in Vectashield hard-set antifade mounting medium with DAPI (H-1500, Vector). Samples were imaged using a TissueFAXS 200 slide scanner (TissueGnostics) comprising an X-Light V2 spinning disk confocal imaging system (CrestOptics) built on an Axio Imager.Z2 microscope (Carl Zeiss Microscopy) equipped with a Plan-Apochromat ×20/0.8 M27 objective lens.

Analysis of two-photon imaging of the mouse cortex

The acquired data were analysed using MATLAB (population imaging) or Python (imaging during loose-seal recordings). In the MATLAB pipeline, for every recorded FOV, we selected ROIs covering all identifiable cell bodies using a semi-automated algorithm, and the fluorescence time course was measured by averaging all pixels within individual ROIs, after correction for neuropil contamination (r = 0.7), as previously described in detail5. We used one-way ANOVA tests (P < 0.01) for identifying cells with significant increase in their fluorescence signal during the stimulus presentation (responsive cells). We calculated ΔF/F0 = (FF0)/F0, where F is the instantaneous fluorescence signal and F0 is the average fluorescence in the interval 0.7 s before the start of the visual stimulus. For each responsive cell, we defined the preferred stimulus as the stimulus that evoked the maximal ΔF/F0 amplitude (peak values during the 2 s of stimulus presentation). The half-decay time was calculated as follows: for each responsive cell, we averaged its ΔF/F0 response to the preferred stimulus over five trials. We also calculated the standard deviation of the averaged baseline signal over the 0.7 s before the start of the stimulus. Only cells for which the maximal ΔF/F0 amplitude was higher than four standard deviations above the baseline signal were included in the analysis. The time required for each trace to reach half of its peak value (baseline fluorescence subtracted) was calculated by linear interpolation. The fraction of cells detected as responsive was calculated as the number of significantly responsive cells over all the cells analysed. The cumulative distribution of peak ΔF/F0 responses included the maximal response amplitude from all analysed cells, calculated as described above for the preferred stimulus of each cell. The OSI was calculated as before5,6 by fitting the fluorescence response from individual cells to the eight drifting grating stimuli with two Gaussians, centred at the preferred response angle (Rpref) and the opposite angle (Ropp). The OSI was calculated as:

$${\rm{OSI}}=\frac{{R}_{{\rm{pref}}}-{R}_{{\rm{orth}}}}{{R}_{{\rm{pref}}}+{R}_{{\rm{orth}}}}$$

where Rorth is the orthogonal angle to the preferred angle.

The movies recorded during loose-seal recordings were motion-corrected and segmented with the Python implementation of Suite2p (github.com/MouseLand/suite2p)67. The ROI corresponding to the loose-seal-recorded cell was then manually selected from the automatically segmented ROIs. For this dataset, we could calculate the neuropil contamination for most of the movies and got a distribution with a median of r_neu ~ 0.8 (Extended Data Fig. 14g–j), so we used this value uniformly for neuropil correction. Calcium events were defined by grouping APs with a 20-ms inclusion window. Then, we calculated ΔF/F0 = (FF0)/F0, where F is the instantaneous fluorescence signal and F0 was defined separately for all calcium events as the mean fluorescence value of the last 200 ms before the first AP in the group. Peak amplitudes were measured as the difference between the fluorescence intensity of the cell in the frame right before the first AP in the group, and the fluorescence intensity of the cell in the frame after the 0–95% rise time of the calcium sensor relative to the last AP in the group (30 ms (jGCaMP7f), 30 ms (XCaMP-Gf), 5 ms (jGCaMP8f), 5 ms (jGCaMP8m) and 10 ms (jGCaMP8s)). The sensitivity index (d′) was calculated as:

$${d}^{{\prime} }=\frac{\bar{{A}}}{\sqrt{\frac{1}{2}{\sigma }^{2}\left(A\right)}}$$

where A is the amplitudes of isolated calcium transients induced by a single AP. We also calculated a global ΔF/F0 trace (ΔF/F0)global, in which we used the 20th percentile of the fluorescence trace in a 60-s long running window as the F0,global. In the analyses, we only included calcium events in which this (ΔF/F0)global value was less than 0.5 right before the AP, to include only events starting near baseline fluorescence values, to exclude non-linear summation and saturation. Traces in Fig. 4 were filtered with a Gaussian kernel (σ = 5 ms).

Mouse surgeries for the cerebellum

Young adult (postnatal day 42–98) male C57BL/6J (Jackson Labs) mice were anaesthetized using isoflurane (2.5% for induction and 1.5% during surgery). A circular craniotomy (diameter of 3 mm) above medial crus I (2 mm left and 1 mm posterior to the midline junction of the interparietal and occipital bones). Viral suspension (200 nl) was injected in two locations near the centre point at a depth of 300–400 μm. Constructs injected included: AAV2/1-CAG-FLEx-jGCaMP8 constructs (pGP-AAV-CAG-FLEx-jGCaMP8f-WPRE, Addgene plasmid #162382; pGP-AAV-CAG-FLEx-jGCaMP8m-WPRE, Addgene plasmid #162381; pGP-AAV-CAG-FLEx-jGCaMP8s-WPRE, Addgene plasmid #162380; pGP-AAV-CAG-FLEx-jGCaMP7f-WPRE, Addgene plasmid #104496; and pGP-AAV-CAG-FLEx-jGCaMP6f-WPRE, Addgene plasmid #100835; all viruses were diluted to 4 × 1012 GC per millilitre titre).

Purkinje cell-specific expression was induced by co-injection of virus expressing Cre under control of a promoter fragment from the Purkinje cell protein 2 (Pcp2; also known as L7) gene (AAV2/1-sL7-Cre, 5.3 × 1010 GC per millilitre titre)68. A 3-mm diameter circular coverslip glued to a donut-shaped 3.5-mm diameter coverslip (no. 1 thickness, Warner Instruments) was cemented to the craniotomy using dental cement (C&B Metabond, Parkell). A custom titanium head post was cemented to the skull.

Two-photon imaging of the cerebellum

Head-restrained mice were allowed to freely locomote on a wheel. Imaging was performed with a custom-built two-photon microscope with a resonant scanner. The light source was a Mai Tai Sapphire laser (Spectra Physics) running at 920 nm. The objective was a ×16 CFI LWD Plan fluorite objective water immersion lens with 0.8 NA (Nikon). The detection path consisted of a bandpass filter (525/50 nm) and a 565-nm dichroic mirror directed towards a photomultiplier tube (Hamamatsu). Images were acquired using ScanImage (vidriotechnologies.com)64. Functional images (512 × 32 pixels, 215 × 27 μm2) of Purkinje cell dendrites (50–250 μm below the pia mater) were collected at 283 Hz. Laser power was up to 50 mW at the front aperture of the objective.

Analysis of two-photon imaging in the cerebellum

Purkinje cell dendrite movies were captured during free locomotion without applied stimulation. Movies were motion-corrected and converted to ΔF/F0 traces using the Python implementation of CaImAn69. Individual events within the traces were identified by finding adjacent local maxima in ΔF/F0 variance that had one local maximum in the ΔF/F0 trace between them. Statistics for individual events were calculated by fitting the equation:

$$F(t)=({F}_{\max }{(1-{e}^{-(t-{t}_{0})/{\tau }_{{\rm{rise}}}})}^{a}+{F}_{{\rm{start}}}/({F}_{1}+{F}_{2}))({F}_{1}{e}^{-(t-{t}_{0})/{\tau }_{1}}+{F}_{2}{e}^{-(t-{t}_{0})/{\tau }_{2}})$$

where t0 is the start of the peak, τrise is the rise time constant shaped by α; τ1 and τ2 are the decay time constants, Fmax is the maximum amplitude of the trace above the starting point Fstart, and F1 and F2 are component amplitudes.

Spike fluorescence models

We used a phenomenological model that converts spike times to a synthetic fluorescence time series33. This S2F model consists of two steps. First, spikes at times {tk} are converted to a latent variable, c(t), by convolution with two double-exponential kernels:

$$c(t)={\sum }_{t > {t}_{k}}\left[r\bullet \exp (\,-\,\frac{t-{t}_{k}}{{\tau }_{d1}})+\exp (\,-\,\frac{t-{t}_{k}}{{\tau }_{d2}})\right]\bullet \left[1-\exp (\,-\,\frac{t-{t}_{k}}{{\tau }_{r}})\right]+{n}_{i}(t)$$

τr, and τd1 and τd2 are the rise time and decay times, respectively. In our model, we required τd1 < τd2 (that is, fast and slow components), with r representing the ratio of the weight for the fast component to that of the slow one. \({n}_{i}\left(t\right) \sim N\left(0,{\sigma }_{i}^{2}\right)\) is the Gaussian-distributed noise. c(t) was truncated at zero if noise drove it to negative values. We tested the performance of models with various choices of rise and decay times: (1) one rise and one decay time, (2) one rise and two decay times, and (3) two rise and two decay times. Using cross-validation, we found that the models for one rise and two decay times fit pyramidal cells (as described above), whereas interneurons were fit well by one rise and a single decay time (as described above with r = 0). Subsequently, c(t) was converted to a synthetic fluorescence signal through a sigmoidal function:

$$\Delta F\,/\,{F}_{{\rm{Synth}}}(t)=\frac{{F}_{m}}{1+\exp [-k(c(t)-{c}_{1/2})]}+{n}_{e}(t)$$

where k is a non-linearity sharpness parameter, c1/2 is a half-activation parameter and Fm is the maximum possible fluorescence change. \({n}_{e}\left(t\right) \sim N(0,{\sigma }_{e}^{2})\) is the Gaussian-distributed external noise. For comparison, we also generated a S2F linear model with \(\,\Delta F/\,{F}_{{\rm{Synth}}}(t)=\) \({F}_{\max }c\left(t\right)+{F}_{0}\), where Fmax is a scaling parameter (we kept the naming as max to clarify the relationship to other models); F0 is the baseline.

We applied the linear33 (Fig. 5d–h) and non-linear70 (Extended Data Fig. 19a–e) inference models using their default parameters. The linear model provided an estimate of the number of spikes per imaging frame (Fig. 5d, middle panel), in which we considered that a spiking event occurred if the estimated spike count was above 0.6. The non-linear model provided an estimate of spike times (inferred spikes). Both models provide reconstructions of fluorescent dynamics ∆F/FSynth, based on inferred spikes and estimated model parameters from spikes to fluorescence. We computed spiking dynamics based on spike counts in a frame convolved with a Gaussian filter with standard deviation of 100 ms for both ground-truth (Fig. 5d, bottom, black line, r(t)) and inferred spikes (Fig. 5d, bottom, red line, \(\hat{r}(t)\)).

We measured the inference performance using (1) variance explained of fluorescence dynamics as \(1-\frac{{ < {(\Delta F/F(t)-\Delta F/{F}_{{\rm{Synth}}}(t))}^{2} > }_{t}}{{ < {(\Delta F/F(t)-{ < \Delta F/F(t) > }_{t})}^{2} > }_{t}}\) (Fig. 5e); (2) variance explained of spiking dynamics as \(1-\frac{{ < {({\rm{r}}(t)-\hat{{\rm{r}}}(t))}^{2} > }_{t}}{{ < {({\rm{r}}(t)-{ < {\rm{r}}(t) > }_{t})}^{2} > }_{t}}\) (Fig. 5f); (3) spike detectability \({F}_{{score}}=\frac{2\times \#\{{true\; in\; ferred\; spikes}\}}{\#\{{true\; spikes}\}+\#\{{in\; ferred\; spikes}\}}\), where an inferred spike falling into a 40-ms time window of a true spike (that is, \({| t}_{{\rm{true}}}-{t}_{{\rm{inferred}}}| < 40\,{\rm{ms}}\)) was considered as a true inferred spike (true positive) (Fig. 5g); and (4) for true inferred spikes, we measured spike timing error as \(\sqrt{ < {\left({t}_{{\rm{true}}}-{t}_{{\rm{inferred}}}\right)}^{2}\, > }\) (Fig. 5h).

Variance explained

Variance explained measures the goodness-of-fit of an S2F model, as \(1-\frac{{(\Delta F/{F}_{{\rm{raw}}}(t)-\Delta F/{F}_{{\rm{Synth}}}(t))}^{2}}{{(\Delta F/{F}_{{\rm{raw}}}(t)-{ < \Delta F/{F}_{{\rm{raw}}}(t) > }_{t})}^{2}}\). Here we used only the time t with a spike rate of more than 0 Hz after spikes in the calculation, in which the instantaneous spike rate at time t is estimated by a boxcar-rolling average over a 600-ms time window.

Experimental design

Sample size

For the cultured neuron assay, we used n consistent with our power analysis from an earlier study24; prioritized variants received many more replicates (11, 24 and 64 for the three jGCaMP8 indicators). We found the purified protein experiments to be extremely reproducible, with n of 3–5 routinely providing very small error bars. Many individuals were used for each in vivo experiment, with multiple trials per FOV per individual; values of n ranged into the hundreds for these experiments. All multiple-comparison experiments were verified to provide sufficient power with the Kruskal–Wallis multiple-comparison test before proceeding to pairwise comparison tests.

Randomization

There were no experimental groups, thus no need for randomization.

Blinding

There were no experimental groups, thus no need for blinding.

Statistics

Exact statistical tests used for each comparison, as well as n, are listed in the main text and figure legends. Box-and-whisker plots throughout the paper indicate the median and 25–75th percentile range; whiskers indicate the shorter of 1.5 times the interquartile range or the extreme data point71.

For Fig. 3e, full statistics are: jGCaMP7f (min, Q1, Q2, Q3 and max) = 0.013, 0.041, 0.11, 0.22 and 1.16, n = 320 cells from 3 mice; XCaMP-Gf (min, Q1, Q2, Q3 and max) = 0.016, 0.048, 0.091, 0.16 and 0.38, n = 124 cells from 3 mice; jGCaMP8f (min, Q1, Q2, Q3 and max) = 0.010, 0.033, 0.084, 0.15 and 0.44, n = 317 cells from 5 mice; jGCaMP8m (min, Q1, Q2, Q3 and max) = 0.011, 0.032, 0.084, 0.16 and 0.56, n = 365 cells from 3 mice; jGCaMP8s (min, Q1, Q2, Q3 and max) = 0.013, 0.059, 0.14, 0.24 and 0.67, n = 655 cells from 6 mice. Kruskal–Wallis multiple-comparison test, P = 3.1 × 10−15. jGCaMP7f versus XCaMP-Gf: P = 1.0; jGCaMP7f versus jGCaMP8f: P = 0.013; jGCaMP7f versus jGCaMP8m: P = 0.029; jGCaMP7f versus jGCaMP8m: P = 0.010; jGCaMP7f versus jGCaMP8s: P = 0.010; XCaMP-Gf versus jGCaMP8f: P = 1.0; XCaMP-Gf versus jGCaMP8m: P = 1.0; XCaMP-Gf versus jGCaMP8s: P = 0.0027; jGCaMP8f versus jGCaMP8m: P = 1.0; jGCaMP8f versus jGCaMP8s: P = 2.4 × 10−11; and jGCaMP8m versus jGCaMP8s: P = 4.49 × 10−11. For Dunn’s comparison test shown: *P < 0.05, ***P < 0.001 and not significant. For Fig. 3f, data passed Shapiro–Wilk normality test (α = 0.05 level). For Fig. 3f, full statistics are: jGCaMP8f (min, Q1, Q2, Q3 and max) = 0.12, 0.22,0.375, 0.52 and 0.72, n = 19 FOVs from 5 mice; jGCaMP8m (min, Q1, Q2, Q3 and max) = 0.32, 0.55, 0.66, 0.79 and 0.85, n = 14 FOVs from 3 mice; jGCaMP8s (min, Q1, Q2, Q3 and max) = 0.33, 0.71, 0.79, 0.89 and 1.00, n = 26 FOVs from 6 mice; and jGCaMP7f (min, Q1, Q2, Q3 and max) = 0.21, 0.32, 0.45, 0.59 and 0.73, n = 12 FOVs from 3 mice. For Tukey’s multiple comparison test: jGCaMP7f versus jGCaMP8f: P = 0.83; jGCaMP7f versus jGCaMP8m: P = 0.0184; jGCaMP7f versus jGCaMP8s: P = 4.52 × 10−5; jGCaMP8f versus jGCaMP8m: P = 0.00098; and jGCaMP8m versus jGCaMP8s: P = 0.23. For one-way ANOVA test: *P < 0.05, ***P < 0.001 and not significant. For Fig. 3g, full statistics are: jGCaMP7f versus jGCaMP8f: P = 8.7 × 10−103; jGCaMP7f versus jGCaMP8m: P = 1.0; jGCaMP7f versus jGCaMP8s: P = 5.5 × 1085; jGCaMP8f versus jGCaMP8m: P = 9.3 × 1096; and jGCaMP8m versus jGCaMP8s: P = 1.1 × 1072 (Kruskal–Wallis test with Dunn’s multiple comparison test was used to compare the magnitude of response across groups).

For Extended Data Fig. 8e, at a duration of 4 ms, Kruskal–Wallis test found P = 2.3 × 10−3 and pairwise Dunn’s multiple comparison test to jGCaMP7f as follows: jGCaMP8f P = 0.03, jGCaMP8m P = 2.0 × 10−4 and jGCaMP8s P = 0.24. At a duration of 8 ms, Kruskal–Wallis test found P = 3.5 × 10−5 and pairwise Dunn’s multiple comparison test to jGCaMP7f as follows: jGCaMP8f P = 3.5 × 10−3, jGCaMP8m P = 2.8 × 10−5 and jGCaMP8s P = 0.73. At a duration of 25 ms, Kruskal–Wallis test found P = 3.4 × 10−5 and pairwise Dunn’s multiple comparison test to jGCaMP7f as follows: jGCaMP8f P = 0.074, jGCaMP8m P = 1.6 × 10−3 and jGCaMP8s P = 0.11. Numbers tested are the same as Extended Data Fig. 8c.

Reagent availability

DNA constructs and AAV particles of jGCaMP8s, jGCaMP8m and jGCaMP8f (pCMV, pAAV-synapsin-1, pAAV-synapsin-1-FLEX and pAAV-CAG-FLEX) have been deposited at Addgene (#162371–162382). Sequences have been deposited in GenBank (#OK646318–OK646320). The crystal structure of jGCaMP8.410.80 has been deposited in the PDB (PDB ID: 7ST4). Drosophila stocks were deposited at the Bloomington Drosophila Stock Center (http://flystocks.bio.indiana.edu) - #92587–92595; Drosophila UAS and lexAOp plasmids have been deposited at Addgene (#162383–162388). Email GENIEreagents@janelia.hhmi.org for additional requests.

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.