# Fast 2-photon stimulation using holographic patterns

Maia Brunstein, Jules Lubetzki, Cédric Moutoussamy, Wei Li, Jérémie Barral

► To cite this version:

Maia Brunstein, Jules Lubetzki, Cédric Moutoussamy, Wei Li, Jérémie Barral. Fast 2-photon stimulation using holographic patterns. Optics Express, 2023, 31 (23), pp.39222. 10.1364/OE.498644. pasteur-04290131

HAL Id: pasteur-04290131

https://pasteur.hal.science/pasteur-04290131

Submitted on 16 Nov 2023

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Fast 2-photon stimulation using holographic patterns

MAIA BRUNSTEIN,<fnref n="1" /> JULES LUBETZKI,<fnref n="1" /> CÉDRIC MOUTOUSSAMY,<fnref n="1" /> WEI LI,<fnref n="1" /> AND JÉRÉMIE BARRAL<fnref n="1" />,<fnref n="2" />,*

**Abstract:** Two decades after its introduction, optogenetics – a biological technique to control the activity of neurons or other cell types with light – remains a cutting edge and promising tool to study biological processes. Its increasing usage in research varies widely from causally exploring biological mechanisms and neural computations, to neurostimulation and sensory restauration. To stimulate neurons in the brain, a variety of approaches have been developed to generate precise spatiotemporal light patterns. Yet certain constrains still exists in the current optical techniques to activate a neuronal population with both cellular resolution and millisecond precision. Here, we describe an experimental setup allowing to stimulate a few tens of neurons in a plane at sub-millisecond rates using 2-photon activation. A liquid crystal on silicon spatial light modulator (LCoS-SLM) was used to generate spatial patterns in 2 dimensions. The image of the patterns was formed on the plane of a digital micromirror device (DMD) that was used as a fast temporal modulator of each region of interest. Using fluorescent microscopy and patch-clamp recording of neurons in culture expressing the light-gated ion channels, we characterized the temporal and spatial resolution of the microscope. We described the advantages of combining the LCoS-SLM with the DMD to maximize the temporal precision, modulate the illumination amplitude, and reduce background activation. Finally, we showed that this approach can be extended to patterns in 3 dimensions. We concluded that the methodology is well suited to address important questions about the role of temporal information in neuronal coding.

© 2023 Optica Publishing Group under the terms of the [Optica Open Access Publishing Agreement](#)

## 1. Introduction

A fundamental question in neuroscience is to understand how patterns of neuronal activity can represent useful sensory or motor information to drive animal behavior. To build a causal link between brain activity and behavior, it is necessary to control the neuronal dynamics and observe how animal comportment is affected [1]. Addressing this challenge requires tools to manipulate a population of neurons in a very controlled manner, both spatially and temporally. This can now be achieved by optogenetics, a genetic manipulation that drives the expression a light-modulated actuator in a defined cell type in order to modify cellular properties during illumination. These actuators interact with diverse biochemical pathways (transcription, second messengers, or other signaling pathways) or can be ion pumps or channels [2]. The latter category is particularly interesting for neuroscience applications because neurons expressing the light gated ion channel channelrhodopsin or alternative variants can be efficiently activated by brief light pulses [3]. Combined with diverse optical methods to produce precise light patterns, it allows to specifically activate a defined ensemble of neurons [4,5].

Because neurons are embedded in the scattering brain tissue, 2-photon (2P) activation is often necessary to reach cells in deep structures with single-cell resolution. Two classes of strategies have been developed to stimulate neurons using 2P activation. A first possibility is to scan a femtosecond infrared laser beam onto target cells using galvanometric mirror [6] or optoacoustic

<footnote n="1">¹Institut Pasteur, Université Paris Cité, INSERM, Institut de l'Audition, F-75012 Paris, France</footnote>

<footnote n="2">²CNRS, France</footnote>

<footnote>*jeremie.barral@pasteur.fr</footnote>
deflectors [7]. However, this approach is too slow to activate a large population of neurons with good temporal precision, especially in 3 dimensions.

The optimal choice for stimulating simultaneously several cell targets is to benefit from non-scanning methods [8,9], such as computer-generated holography which enables to generate arbitrary patterns in 3 dimensions. However, using this technique alone to update temporal patterns rapidly is limited by two major bottlenecks. First, the refresh rate of the fastest Liquid Crystal on Silicon Spatial Light Modulator (LCoS-SLM) on the market is effectively limited to about 300-400 Hz because liquid crystals have a rise time of ~2 ms when used with infrared wavelengths. Therefore, better temporal precision cannot be achievable in this configuration. The second constraint concerns the number of phase patterns to generate: if for example we need to stimulate several targets with random temporal patterns, one can reasonably assume that each pattern of the sequence will be different. Considering a 1 s stimulation sequence with a 500 Hz refresh rate of the LCoS-SLM, 500 phase patterns need to be built. Although this is feasible to pre-build the patterns and store them either on a computer or on the onboard memory of the device, it precludes any real-time control of neuronal activity because of the necessary computational time to calculate these patterns with the Gerchberg-Saxton iterative algorithm [10].

Considering 1P stimulation, one simple approach is to use a spatial light modulator in a plane conjugated with the sample plane and modulate the amplitude of the light [5]. An example of spatial modulator is a Digital Micromirror Devices (DMD) which can achieve binary frame rates up to 10 kHz. This device has been successfully employed to activate an arbitrary number of targets with sub-millisecond precision [11,12]. However, the intensity of each pixel is, in this case, the intensity of the light source divided by the total number of pixels. As a simplified example and taking a very conservative approach, if a 40 W laser is able to bring 10 W of light to the sample, we cannot expect more than 10 µW of light per pixel with a DMD of 1000 × 1000 pixels. With a pixel size on the sample of 0.5 µm (considering a 20X magnification and a 10 µm pixel size on the DMD), it represents 40 µW·µm⁻². This is clearly enough for 1P stimulation where the saturating activation of channelrhodospin ChR2 is usually around 0.01 µW·µm⁻², but this only allows to activate a small fraction of opsin molecules with 2P stimulation [13–15] (see also Fig. 4(e) below). To reliably activate the opsin and reach a light intensity of 100 µW·µm⁻² necessary for scanless 2P activation with this scenario, we would need to increase the laser power to at least 120 W. This approach is thus both inefficient because of the loss of most of the light power and unfeasible because such a laser is not presently available.

To overcome these limitations, we used a LCoS-SLM to generate a single spatial pattern in 2 or 3 dimensions containing multiple regions of interest and projected this pattern onto a DMD that was employed as a fast temporal shutter for each region of interest. In this way, the total laser power was efficiently dedicated to activating only potential targets without wasting laser power on unused DMD pixels. This approach had been applied to imaging application with the development of an encoded multisite 2P microscope [16] or to multi-site photolysis of caged neurotransmitters [17]. The main advantages of our optical developments are (i) to push the temporal resolution to the limitations of the opsin time constant, (ii) to reduce the complexity of the phase pattern calculation since only 1 phase pattern needs to be built, (iii) to enable real-time control of neuronal activity. We further demonstrate that the set-up allows to generate patterns with increased contrast and enables stimulation in 3 dimensions.

## 2. Methods

### 2.1. *Microscope apparatus*

To achieve a precise control of the light pattern both temporally and spatially, we developed a homemade high-speed photo-stimulation system coupled to a 2-photon microscope (Fig. 1). The architecture of the 2-photon microscope was inspired by an open-source design previously
published [18]. The excitation beam (920 nm, Opera HP, Coherent) was first sent through a λ/2 wave retarder (AHWP10M-980, Thorlabs) mounted on a motorized rotation stepper motor (K10CR1/M, Thorlabs) and a polarizer cube (GL10-B, Thorlabs) for control of the laser power. The beam was expanded through a telescope ($f_1$ = 40 mm, AC254-040-B, Thorlabs; $f_2$ = 60 mm, AC254-060-B, Thorlabs) and sent to a pair of scanning galvanometer mirrors (GVSM002/M, Thorlabs). After the scanner, the beam impinged the scan lens (LSM04-BB, Thorlabs) followed by the tube lens ($f$ = 200 mm; AC508-200-B, Thorlabs) to be finally focalized by a 20X objective (XLUMPLFLN20XW, Olympus). The emission of the sample was collected with the same objective and sent via a dichroic filter (DMLP735B, Thorlabs) through an emission tube lens ($f$ = 150 mm, AC254-150-A, Thorlabs) to the detection path. The detection unit was composed of a dichroic filter (DMLP567R, Thorlabs) to separate the green and the red channels, each of them were de-scanned via a collector lens ($f$ = 30 mm, LA1805-A, Thorlabs), filtered (FF01-520/70-25 and FF01-650/150-25 for the green and the red channels, respectively, Semrock) and detected by a photomultiplier tube (GaAsP PMT, PMT2101/M, Thorlabs, and Multialkali PMT, PMT1001/M, Thorlabs). In order to find the region of interest on the focal plane, we added an epi-fluorescence system, composed by a 470 nm LED, a 469/35 excitation filter, a 500LP dichroic, and a 525/40 emission filter (MDF-GFP, Thorlabs). Because our laser for 2P microscopy had a low repetition rate (2 MHz), we synchronized the acquisition of the fluorescent signal with the laser pulses to correct the fluorescent signal by the actual number of laser pulses within each pixel. To do so, we built a custom user interface programmed with LabVIEW (National Instrument) that controlled the whole microscope apparatus described here.

In the photostimulation path, the emission of the laser (1035 nm, Monaco, Coherent) was expended through a telescope ($f_1$ = 30 mm, AC254-030-B, Thorlabs; $f_2$ = 250 mm, AC508-250-B, Thorlabs) to fill the sensitive area of the LCoS-SLM (E-series 1920 × 1152 pixels, Meadowlarks optics). The LCoS-SLM allowed modifying the phase of the incident beam at the back focal plane of the objective in order to create an arbitrary intensity pattern on the image plane (i.e. several diffraction-limited spots, large patterns or arbitrary shapes in 3D). The beam reflected from the LCoS-SLM formed the first intensity pattern in the focal plane of the Fourier hologram lens ($f$ = 150 mm, AC508-150-B, Thorlabs). A blocking mask in this plane was used to obstruct the 'zero order' of the LCoS-SLM (non-modulated light). To be able to modify the illumination of individual targets at high speed, we relayed this intensity pattern to a DMD (DLP650LNIR, 1280 × 800 pixels, Texas Instruments) via a 1:1 telescope ($f$ = 250 mm, AC508-250-B, Thorlabs). The DMD was controlled by a third-party controller (V-650 L, Vialux) to achieve full-frame temporal modulation above 10 kHz. Finally, the phase-modulated beam was relayed using a 1:1 telescope ($f$ = 250 mm, AC508-250-B, Thorlabs) and combined to the imaging beam with a 1020 nm short-pass dichroic mirror (DMSP1020B, Thorlabs) before going through the tube lens and the objective and being projected on the sample plane.

To characterize 2D patterns, we used a camera located at Camera 1 position. For the analysis of contrast ratio, we visualized the reflected fluorescence emitted from a thin layer of fluorescent ink enclosed between a slide and a coverslip. A CMOS camera (acA1920-40um, Basler) was placed after the emission tube lens and a short-pass filter (FESH0750, Thorlabs). To characterize the spatiotemporal properties of the optical setup, we visualized 2D patterns generated onto a fluorescent microscope slide (Chroma) placed at the sample plane and imaged through the same fluorescent light path by a rapid camera (ORCA-Flash4.0, Hamamatsu).

To reconstruct 3D patterns, a visualization system composed of an additional 20X objective (UMPLFLN20XW, Olympus), a short-pass filter (FESH0750, Thorlabs) a tube lens ($f$ = 150 mm, AC254-150-A, Thorlabs) and a CMOS camera (acA1920-40um, Basler) was positioned under the sample (Camera 2 position). The thin layer sample was positioned at the focal plane of the lower objective and both the sample, and the lower visualization unit were mounted onto a
<figure><img src="image_2.png" /><figcaption>**Fig. 1.** Optical light paths of the 2-photon microscope and 2-photon stimulation device. The 920 nm laser was scanned on the sample plane trough the objective by the galvanometer mirrors. The fluorescence emission was collected by the same objective and sent to the PMT. The phase of the 1035 nm laser was modulated by the LCoS-SLM to form an arbitrary pattern on the DMD surface. This last element was used as a fast temporal shutter to excite different regions of interest on the sample plane with high temporal resolution. A second objective was placed under the sample to image patterns in 3D. Abbreviations: AOM: acousto-optic modulator; BE: beam expander; CL: collector lens; DMD: digital micromirror device; ETL: emission tube lens; FL: Fourier lens; LCoS-SLM: liquid crystal on silicon spatial light modulator; LP: long-pass dichroic mirror; OB: objective; OPA: optical parametric amplifier; PMT: photomultiplier tube; SL: scan lens; SP: short-pass dichroic mirror; TL: tube lens.</figcaption></figure>

motorized translation stage (PLS-X, Thorlabs). This configuration was used to visualize the 3D illumination patterns as well as the intensity profiles of the stimulation spots in X-Y-Z.

## 2.2. Calibration and image analysis

The system was calibrated before each use to match the image from the camera (Camera 1) with both the LCoS-SLM and DMD projection units and the image from the 2P microscope. For simplicity, the image from the camera was considered as the reference. To calibrate the LCoS-SLM, a phase mask was sent from the LCoS-SLM to create a grid of 4 × 4 spots while the DMD was in an all-ON configuration. Spots generated by the LCoS-SLM were detected on the camera and a geometric matching algorithm (Vision Development Module, LabView, National Instruments) was used to calibrate for perspective or nonlinear distortion errors. With our settings, the LCoS-SLM pixel size was 0.43 µm x0.72 µm at the sample plane. To calibrate the DMD, the LCoS-SLM sent a uniform illumination pattern to the DMD which was configured to create a grid of 4 × 4 spots. With our settings, the DMD pixel size was 0.50 µm x0.53 µm at the sample plane. It should also be noted that the image of the LCoS-SLM at the DMD plane (which was a square of 16.8 mm side) was larger than the DMD active area (13.8 mm x 8.6 mm), such that the field of excitation was only defined by the locations accessible with the DMD
and took a value of 640 µm x 430 µm at the sample plane. Finally, the 2P imaging path was calibrated by sending spots sequentially at different locations using fixed angle deflections with the galvanometer mirrors.

We also used the calibration grid generated by the LCoS-SLM to adjust the light intensity of the different spots. Because light is diffracted differently according to the target location, we first fitted the intensity profile of the spots in the (x,y) plane by a 2-dimensional Gaussian function and compensated the target spot intensity to achieve a nearly homogenous field of excitation. This simple method allowed us to decrease the standard deviation of the 2P absorption from 42% down to 18% (Fig. 2) comparable to published data [13,19].

Image analysis and quantification were performed with the Image Processing toolbox (Matlab). 3D visualization was performed with Vaa3d software [20] or with Matlab.

<figure><img src="image_3.png" /><figcaption>**Fig. 2.** Diffraction efficiency characterization and correction. (a) Example of an optical pattern containing 16 disks of 10 µm diameter randomly located in the field of excitation without any correction for intensity (top). Histogram of the normalized integrated intensity of the spots for different patterns (data were collected from 10 different patterns with 16-32 disks randomly positioned in the field of excitation). (b) Same as in (a) after intensity compensation.</figcaption></figure>

## 2.3. Neuronal cultures and electrophysiology

Dissociated cortical neurons from postnatal (P0-P1) mice were prepared as described previously [11,12,21] and in accordance with French and European regulations for the care and protection of laboratory animals (EC Directive 2010/63, French Law 2013-118). Briefly, the mouse cortex of FVB wild type mice (Janvier Laboratory) was dissected in cold CMF-HBSS (Ca²⁺ and Mg²⁺ free Hank's balanced salt solution containing 1 mM pyruvate, 15 mM HEPES, 10 mM NaHCO₃). The tissue was dissociated in papain (15 U/mL, Roche) containing 1 mM L-cystein, 5 mM 2-amino-5-phosphonopentanoic acid and 100 U/ml DNase (DN25, Sigma) for 25 min. After enzymatic inactivation in CMF-HBSS containing 100 mg/mL BSA (A9418, Sigma) and 40 mg/mL trypsin inhibitor (T9253, Sigma), pieces were mechanically dissociated with a pipette and plated on a glass coverslip. Before plating, glass was cleaned in 3 N HCl for 48 h and immersed in sterile aqueous solution of 0.1 mg/mL poly-L-lysine (P4707, Sigma) for 12 h. Neurons were grown in Neurobasal medium (supplemented with B27, Glutamax and penicillin/streptomycin cocktail, Gibco) in a humidified incubator at 37 °C, 5% CO₂. One third of the culture medium was exchanged every 3 days.

Expression of channelrhodopsin (ChR2) was achieved by viral infection with AAV2-hSyn-hChR2(H134R)-EYFP of cortical neurons. The virus was produced at 3 × 10¹² cfu/mL by the University of Pennsylvania Vector Core using plasmid provided by Karl Deisseroth (Stanford University). At 3 days *in vitro* (DIV), the culture was infected with 1 µL of virus. Experiments were performed at 14-21 DIV, when neuronal characteristics and network connectivity were mature and expression of ChR2 was sufficient to enable reliable photostimulation.

Recordings were performed at room temperature in artificial cerebrospinal fluid (aCSF). The aCSF solution contained (in mM): 125 NaCl, 15 NaHCO₃, 25 D-glucose, 10 HEPES, 2.5 KCl, 2 CaCl₂, 1.25 NaH₂PO₄ and 1 MgCl₂. Electrodes, pulled from borosilicate pipettes (1.5 OD)
on a Flaming/Brown micropipette puller (Sutter Instruments), had resistances in the range of 6-10 MΩ when filled with internal solution containing (in mM): 130 K-gluconate, 10 HEPES, 10 phosphocreatine, 5 KCl, 1 MgCl₂, 4 ATP-Mg and 0.3 mM GTP.

Cells were visualized through the water-immersion objective and fluorescence microscopy was used to confirm ChR2 expression. Whole-cell current-clamp recordings were made using Intan CLAMP amplifier (Intan Technologies). The signal was filtered at 10 kHz and digitized at 50 kHz.

## 3. Results

### 3.1. Microscope design and pattern quality

<figure><img src="image_4.png" /><figcaption>**Fig. 3.** Profile of an optical pattern (10 µm diameter disk) when all mirrors of the DMD were in the ON position (a) or when only the mirrors corresponding to the ROIs were ON (b). 3-dimensional reconstruction of a stimulation volume (**left**). Intensity profiles of one stimulation target in the XY plane (**middle**) and in the planes along the optical axis (**right**). (c) Average (n = 75 ROIs) intensity profile along the X axis when all the mirrors of the DMD were in the ON position (red) or when only the mirrors corresponding to the ROIs were ON (blue). The shaded area represents ± 1 STD. Data were collected from patterns containing 5-20 ROIs simultaneously displayed in the same plane as in the examples provided in panels (a) and (b) and normalized to their maximal intensity. (d) Same as in (c) for the intensity profile along the Z axis (n = 9 ROIs). (e) Measured axial confinement (full width at half maximum, FWHM) of the 2P fluorescence intensity distribution produced by circular holographic spots of increasing size when 10 spots were simultaneously displayed (mean ± STD).</figcaption></figure>

The 2P stimulation path of the microscope was based on a fixed-wavelength femtosecond laser at 1035 nm capable of delivering a power of 40 W (Fig. 1). The laser beam was expanded onto
the LCoS-SLM and the zero-order diffraction was physically eliminated. The image was then projected onto the DMD and further relayed to the sample plane. Several calibration steps were necessary to find the corresponding locations of pixels on the LCoS-SLM, DMD, camera, and 2P scanning image (see Methods). Once the system was calibrated, the user defined Regions of Interest (ROIs) on the sample that was imaged either by the camera or by the 2P microscope. Typically, ROIs were disks of 10 µm diameter at the sample plane which corresponds to the average size of a neuron in neuroscience applications. The corresponding amplitude masks in the LCoS-SLM and DMD coordinate systems were then computed. A unique phase mask containing all the ROIs was generated using the Gerchberg-Saxton iterative algorithm [10] and projected by the LCoS-SLM. A collection of corresponding DMD masks were also designed. Each mask defined whether each ROI was relayed or not to the sample. The DMD was thus used as a switchable mirror for each region of interest. Because these masks were simply 1-bit images, they could be pre-built or generated and uploaded rapidly for real-time applications.

Some concerns could be raised whether using only a fraction of the DMD mirrors could degrade the quality of patterns generated by the LCoS-SLM. To characterize the spatial performances of our photostimulation light path, we visualized with a camera the reflected fluorescence emitted from a thin layer of fluorescent ink enclosed between a slide and a coverslip. We measured the intensity profile in 3 dimensions of individual disks randomly distributed in the field of excitation when all mirrors of the DMD where in ON position (Fig. 3(a)) or when only the mirrors corresponding to the ROI were reflecting the optical pattern (Fig. 3(b)), while keeping the phase mask identical in both conditions. Both in the sample plane (Fig. 3(c)) or in a plane containing the optical axis (Fig. 3(d)), the different configurations provided similar profiles although having a mask on the DMD seemed to sharpen slightly the fluorescent pattern. Along the axial direction, the full width at half maximum (FWHM) decreased on average from 21.0 ± 0.3 to 20.0 ± 0.3 µm for a 10 µm disk (mean ± SE, n = 10, paired t-test with *p*-value < 10⁻⁴). A thickness of about 20 µm is very comparable to published data [13,22,23] but could notably be reduced with the introduction of temporal focusing [8,13,15,24,25]. In particular, temporal focusing would permit to avoid the decrease of spatial confinement as the size of the ROI is increased (Fig. 3(e)). We did not use this technique in the present study, but it would be adaptable to our optical design and would help to increase axial confinement if needed.

Altogether, these intensities profiles are comparable to those found in the literature using only a LCoS-SLM [9,19,23] thereby suggesting that the introduction of a grid of micromirrors did not degrade significantly the quality of patterns generated by the LCoS-SLM.

## 3.2. Improvement of contrast ratio

Comparing images acquired with a fully reflective DMD or when the DMD was only reflecting the corresponding ROIs shows that there is slightly less background light for equal target intensities (Fig. 3(c)). This can also be appreciated by subtracting the corresponding images (Fig. 4(a)): there is in proportion more light in the target than outside when the DMD is used as a spatial modulator. To fully characterize the amount of light projected to the desired area, we quantified the contrast ratio defined as the average pixel intensity within a ROI divided by the average background intensity. For this, we generated random patterns with 1-128 ROIs of 10 µm diameter each. When the pattern contained only a single ROI, the background intensity was low resulting in a high contrast ratio of ~4900:1 (Fig. 4(b)) that was actually increased to ~6200:1 when the DMD allowed to reflect only the corresponding ROI (Fig. 4(c)), resulting in an improvement by 25% (Fig. 4(d)). We then systematically increased the number of ROIs while adjusting the laser intensity (Fig. 4(e)) to maintain target's intensities constant (Fig. 4(b)-(c)). Background intensity increased almost linearly, mirroring the increase of laser intensity that was necessary to keep the ROI's intensity constant (Fig. 4(e)). This resulted in an inverse relationship between contrast ratio and ROIs number (Fig. 4(b)-(c), right). However, the contrast ratio with the DMD
<figure><img src="image_5.png" /><figcaption>**Fig. 4.** Contrast ratio of holographic patterns. (a) Example of an optical pattern containing 16 disks of 10 µm diameter randomly located in the field of excitation when all mirrors of the DMD were in the ON position (**left**) or when only the mirrors corresponding to the ROIs were ON (**middle**). Images were normalized to their mean intensity before being subtracted (**right**). Note that the inside of the targets shows relatively higher intensity (red) and that the border shows lower intensity (blue) when the DMD was turning OFF outside pixels. Scalebar 50 µm and 10 µm for the full image and the inset zoom, respectively. (b) **left**, Fluorescent intensity of the regions of interest (boxplot) and of the background (red shaded area representing the mean ± STD) as a function of ROIs' number when all mirrors of the DMD were in the ON position. **right**, Corresponding contrast ratio. (c) Same as in (b) when only the mirrors corresponding to the ROIs were ON. (d) Increase in contrast ratio observed when only the mirrors corresponding to the ROIs were ON compared to a situation where the DMD was reflecting all the light. For each number of ROIs, the increase of contrast ratio is significantly higher than 1 ($t$-test statistic for each number of ROIs: $P < 10^{-10}$, $n = 30-640$, depending on ROIs number). The orange line represents the average increase. (e) Laser intensity used to match the mean ROI intensity when their number was increased. (f) **left**, Expected pixel intensity in the ROI (black) or in the background (red) computed from the holographic phase patterns. **right**, Corresponding contrast ratio. (g) **left**, Fluorescent intensity of the regions of interest (solid lines) and of the background (dashed lines) for a pattern containing 10 ROIs of 10 µm diameter as a function of laser intensity in 3 different conditions: when only the SLM was used to produce a pattern and the DMD was flat (red), when the SLM produced a pattern and the DMD relayed the same pattern (blue), or when the SLM was flat and only the DMD was used to produce the pattern (orange). **right**, Corresponding contrast ratios with horizontal lines indicating the maximum for the different configurations. The grey line denotes the power law of exponent 1 in panels (b), (c), (e), and (f) and of exponent 2 in panel (g).</figcaption></figure>
as a spatial modulator was consistently higher than the one obtained when the DMD was fully reflective, leading to an average improvement of contrast ratio by 21.8% (Fig. 4(d)).

To estimate an upper limit of efficiency, we quantified the ideal contrast ratio that would be expected from the numerical generation of the hologram, which is simply the 2D Fourier transform of the phase mask. For a direct comparison, we took the patterns that were actually used in this experimental characterization. We found that the increase of background light and the corresponding decrease of contrast ratio when ROIs number increases are also expected by numerical results (Fig. 4(f)). Quantitatively speaking, the experimentally measured contrast ratios are higher than the one expected from holograms because of nonlinear 2P absorption that effectively boosts contrast.

One worry with the addition of the DMD might be related to the decrease in brightness. Pattern brightness when the DMD was used to reflect only the ROIs was reduced by about 25% (red and blue solid curves in Fig. 4 g, respectively). But it should be noted that this decrease is small compared to the brightness that would be expected in a configuration without LCoS-SLM, i.e. where a laser beam is expanded onto the whole DMD. To mimic this situation, we generated a flat SLM pattern to illuminate the whole DMD chip uniformly (orange curve in Fig. 4(e)). For a given laser intensity and by extrapolating these curves, 2P absorption decreased by 5 orders of magnitude in this configuration. In other words, a laser intensity 200-fold higher was necessary to achieve the same level of fluorescence and even with a laser power of 34 W, we were not able to evoke sufficient 2P absorption for photoactivation. Also, this design generated patterns with reduced contrast ratios compared to holographic methods.

### 3.3. Fast 2-photon stimulation

To assess the temporal characteristics of the optical stimulation, we used a rapid CMOS camera and imaged a fluorescent sample. In a first experiment, we reduced the field of view of the camera to several lines to achieve a frame rate of 10 kHz that matched the DMD framerate. We built a phase mask to generate 6 ROIs that were successively illuminated for 1 ms via updating the corresponding patterns on the DMD (Fig. 5(a)). This enabled us to verify that the temporal resolution of the set-up was only limited by the frame rate of the DMD and that no cross-illumination was generated by introducing the DMD between the LCoS-SLM and the objective.

In a second experiment, we increased the number of ROIs to 20 to make it more realistic regarding brain stimulation. The frame rate was decreased to 1 kHz to increase the field of view of the camera and the stimulation duration was set to 5 ms for each ROI (Fig. 5(b)). However, the DMD was still displaying patterns at 10 kHz and onsets had thus a 0.1 ms resolution. Also in this case, each ROI was faithfully activated without cross-illumination demonstrating that our approach permits to activate independently an arbitrary number of targets.

### 3.4. Amplitude modulation

The DMD can be used as a temporal modulator but also as an amplitude modulator. To obtain the maximal intensity $I_{max}$, all mirrors are turned ON within a single ROI. Because a typical ROIs (10 µm diameter disk at the sample plane) corresponds to ~300 DMD pixels (one DMD pixel is 0.50 µm x0.53 µm at the sample plane), one can potentially select only a fraction $P$ of the mirrors (Fig. 6(a)) to illuminate a given target with a fraction of the total intensity $P \cdot I_{max}$. To display spatially homogeneous patterns, we generated random patterns where each pixel within the ROI had a probability $P$ to be ON. We updated these random patterns at the DMD refresh rate (i.e. 10 kHz). Therefore, the positions of ON pixels was changed at each frame to provide an average illumination intensity. This approach is only applicable if the biological process under study is slower than the DMD framerate (> 10 kHz), which is often the case.
<figure><img src="image_6.png" /><figcaption>**Fig. 5.** Temporal characterization of optical stimulation. (a) 6 ROIs illuminated consecutively for 1 ms by updating the DMD patterns (DMD and camera framerates: 10 kHz). Each image shows the fluorescence at a single point in time indicated in green on the right. Bottom graph shows the fluorescence signal of each ROI as a function of time, with a zoom around the period of stimulation on the right (traces were aligned to the stimulation time and normalized in terms of intensity). Note that the fluorescence rises from 5% to 95% in one acquisition frame (i.e. 0.1 ms). (b) 20 ROIs illuminated randomly for 5 ms by updating the DMD pattern (DMD framerate 10 kHz and camera framerate 1 kHz). The fluorescent image shows here the average light intensity during the duration of a whole sequence. Bottom graph shows the fluorescence signal of each ROI as a function of time.</figcaption></figure>

We verified the performance of the method by increasing the fraction of ON mirrors on a single ROI while measuring the integrated fluorescence on the ROI shape with the camera (Fig. 6(b), left). We first quantified the average fluorescence intensity for each fraction of ON mirrors (Fig. 6(b), middle). The relation was monotonic but nonlinear because the size of a single DMD mirror on the sample plane (~500 nm) is on the same order of magnitude than the microscope resolution. Thus, neighboring mirrors were not independent and nonlinear 2P effects were present. However, a proper calibration permits to target the desired light intensity. We also observed fluctuations around the mean in the fluorescence trace (Fig. 6(b), left), which were due to different realizations of the DMD patterns and not to measurement noise. For a given targeted intensity, fluctuations were low when mirrors were mostly ON or OFF and highest for intermediate value (Fig. 6(b), right). Fluctuations could arise from: 1) variations in the number of ON pixels at each time step (since each pixels had a given probability to be ON), and 2) variations in the intensity of each pixel (because of speckles). The bell-shape variance makes sense because the intensity at each time step should follow a binomial distribution whose variance is proportional to $P \cdot (1 - P)$, where P is the probability of a mirror to be ON. Note that the peak was not observed for $P = 0.5$ because of nonlinear 2P absorption. If needed, total noise could be reduced by fixing the percentage of ON mirrors at each frame instead of assigning an ON probability for each pixel but fluctuations due to speckles would remain.

We then turned to fast modulations of intensity. Using either a camera (Fig. 6(c)) or the fast PMT (Fig. 6(d)) to collect the average fluorescence intensity of the whole ROI, we established
<figure><img src="image_7.png" /><figcaption>**Fig. 6.** Using the DMD as a fast amplitude modulator. (a) Examples of DMD patterns with variable fractions of ON mirrors in order to modulate the average illumination amplitude of a single ROI. Note that in experiments, these patterns were randomly generated and varied at each DMD frame. (b) Step modulation. Relative fluorescence (**left**) of a 10 µm diameter ROI measured using the camera and plotted as a function of time when an increasing fraction of mirrors on the DMD were turned ON by steps of 10%. The average fluorescence (**middle**) and variance (**right**) were calculated during each step and plotted as a function of percentage of ON mirrors. (c) Frequency modulation measured with the camera. Chirp response for a modulating frequency varying between 1 and 500 Hz (**left**). Examples of sinusoidal modulation for 3 frequencies and plotted as a function of time. (d) Frequency modulation measured with the PMT and plotted as a function of cycle to display the frequency limit of the device. Note that all temporal traces displayed here were not averaged and correspond to single trials.</figcaption></figure>

that a sinusoidal modulation of light intensity was possible up to the kHz frequency range. Taken together, this shows that this strategy enables to stimulate independently and with varying intensities an arbitrary number of ROIs with a frame rate only limited by the refresh rate of the DMD.

### 3.5. Modulation of 3D patterns

We extended our stimulation method to patterns in 3 dimensions. First, we characterized the spatial footprint of patterns along the lateral and axial dimensions when the targets were at different axial positions (Fig. 7(a)). As expected, we observed an enlargement along the axial position when the ROI was away from the objective focal plane. Although, our approach is based on conjugating the amplitude pattern produced by the LCoS-SLM with the DMD plane, it is still possible to modulate a ROI even if it is not in the right plane as long as DMD patterns are sufficiently large and thus ROIs are not too close. To characterize the optimal mask on the DMD, we varied both the diameter of the disk on the DMD and the axial position of the ROI and measured the integrated fluorescence in the XY center plane (Fig. 7(b)). We observed that out-of-focus targets needed larger disks on the DMD to be efficiently relayed to the sample (Fig. 7(c)). As a result, if targets are within ± 100 µm in respect to the objective focal plane, mask diameters on the DMD do not need to be larger than ~100 µm to obtain efficient light delivery
and thus limited cross-activation. Interestingly, it is even possible to modulate two ROIs that are superimposed in XY but located at different axial planes if one target lies in the objective focal plane and the other is sufficiently separated. In this condition, a disk on the DMD adjusted to the size of the ROI will only select the target in the focal plane (Fig. 7(d), middle). Conversely, a donut shape on the DMD will only opt for the out-of-focus target (Fig. 7(d), right).

<figure><img src="image_8.png" /><figcaption>**Fig. 7.** Modulation of patterns in 3 dimensions. (a) Spatial footprint measured as the full width at half maximum (FWHM) of the lateral (top) and axial (bottom) integrated intensities as a function of axial position of the target ROI (10 µm diameter, n = 16 ROIs on the same pattern). The DMD was fully reflective in this case. (b) Normalized fluorescent intensity as a function of DMD mask diameter for ROIs at different axial positions (from red to black). (c) Mask diameter on the DMD necessary to reach 50% (cyan) or 90% (orange) of the maximal fluorescence as a function of axial position of the target. (d) Intensity profiles in the XY plane at two different axial positions when the LCoS-SLM was generating 2 ROIs centered at these two axial locations. Three different DMD masks were used to select both ROI (**left**, fully reflective DMD), the ROI on the objective focal plane (**center**, small disk on the DMD) or the out of focus ROI (**right**, donut shape on the DMD).</figcaption></figure>

We further characterize the 3D capability of our system by constructing more complex multidimensional patterns. To target 4 different planes, we divided the grid of the LCoS-SLM in 4 sub-grids that were each targeting a different plane (Z = -95, -40, 45, 100 µm). Pixels from each sub-array were uniformly distributed to maximize homogeneity of the light source intensity. We designed disks on the DMD that had a diameter of about 60 µm compared to the 8 µm of the actual ROI. Compared to a case where all the mirrors of the DMD are ON (Fig. 8(a)), the pattern quality was not significantly affected when only mirrors corresponding to the different ROIs where ON (Fig. 8(b)). Thus, we could selectively erase 1 or more ROIs (Fig. 8(c)-(d)) even if the image generated by the LCoS-SLM is out of the DMD focus. Importantly, the selective modulation of the patterns in 3D could be done at the DMD framerate.

### 3.6. Physiological assessment of spatial characteristics

To characterize the spatial performance of the optical stimulation functionally, we grew primary cortical neurons *in vitro* and expressed the light-gated ion channel channelrhodopsin ChR2(H134R) using viral transfection (see Methods). We monitored membrane potential using patch-clamp recordings (Fig. 9(a)). Cells had intrinsic properties similar to published data (Table 1) [11]. We stimulated neurons either using 2P light patterning as described above or with the fiber-coupled LED of the 1P fluorescent light path where an iris was placed on the conjugated plane of the sample (Fig. 1). Light intensity for 1P activation (5-10 mW·mm⁻²) was close to the saturation level and distributed over a disk of 60 µm diameter. For 2P activation, non-saturating power of 60-120 W·mm⁻² (i.e. 10-20 mW in a 15 µm disk or 60-120 µW·µm⁻²) was used to avoid heating cells substantially. Upon light activation, light-sensitive channels on the neuron's membrane open, leading to a photocurrent and thus neuron's depolarization from its resting membrane potential (Fig. 9(b)). Neurons were significantly more depolarized using 1P than with 2P stimulation
<figure><img src="image_9.png" /><figcaption>**Fig. 8.** Selective modulation of patterns in 3 dimensions. (a) 3-dimensional reconstruction (top) of the optical patterns when all the mirrors of the DMD where in the ON position. Two selected planes are shown (bottom). (b-d) Same as in (a) when only the mirrors corresponding to the 8 ROIs where ON (b) or when only 7 (c) or 6 (d) ROIs were ON on the DMD.</figcaption></figure>

(Table 1) mostly because of the larger illumination spot for 1P than for 2P stimulation. Single photon activation is also often more efficient and has been observed for a variety of opsin variants even at saturating light amplitude [6,15,26]. However, recent advances in biochemical engineering have now permitted to produce much more efficient opsins for 2P activation both in terms of kinetics and photocurrent [27].

<figure><img src="image_10.png" /><figcaption>**Fig. 9.** Functional characterization of the spatial precision of holographic stimulation. (a) Experimental design where patch-clamp recording was made from a cortical neuron in culture. (b) Example data of a depolarizing step upon 2P activation. (c-d) Steady voltage depolarization as a function of the axial (top) and lateral (bottom) position of the stimulation spot for 2P (c) and 1P (d) stimulations. Except for 1P axial sensitivity, experimental data points were fitted by a Gaussian curve. (e) Population data showing the normalized voltage depolarization as a function of the axial position of the stimulation spot for 2P activation (n = 19 neurons). For each individual neuron, fit parameters were used to normalize the maximal depolarization to 1 and center the Gaussian curve to Z = 0. An axial precision of 67 µm (FWHM) for a spot of 15 µm diameter was found.</figcaption></figure>
<table><caption>Table 1. Electrophysiological characterization of neuron intrinsic properties and light stimulation</caption><thead><tr><th></th><th>V<sub>m</sub> (mV)</th><th>R (MΩ)</th><th>C (pF)</th><th>ΔV 1P (mV)</th><th>ΔV 2P (mV)</th><th>FWHM in Z (μm)</th></tr></thead><tbody><tr><td>Mean ± SE</td><td>-62.3 ± 2.6</td><td>245 ± 33</td><td>55.7 ± 5.9</td><td>14.4 ± 1.2</td><td>5.6 ± 0.6</td><td>66.9 ± 3.7</td></tr><tr><td>n</td><td></td><td>14</td><td></td><td>22</td><td></td><td>19</td></tr></tbody></table>

Here, we used this approach to describe only the spatial resolution of the setup because the slow kinetics of the opsin did not permit to fully appreciate the fast temporal performances of the microscope. Further experiments using fast opsins would be valuable to assess the temporal characteristics of the setup. To assess spatial resolution, we measured the depolarization of single neurons as a function of the position of the stimulation pattern. Depolarization dropped by 50% when the stimulation region was moved within the sample plane by about 54 µm and 32 µm for 1P and 2P stimulation, respectively (Fig. 9(c)-(d)). Note that the lower resolution for 1P stimulation is mainly due to the iris size that had a diameter of about 60 µm on the sample plane, compared to the 15 µm spot diameter that were generated with the LCoS-SLM. Upon 2P stimulation, depolarization was decreased by 50% when the focus was moved away by 34 µm (Table 1, Fig. 9(c)-(e)), a value comparable to published data using conventional holography [13,22] given that our stimulation spots were 15 µm and had thus a broader axial tuning (axial FWHM is 25 µm for 15 µm spots; Fig. 3(e)). Notably, these profiles could be substantially sharpened along the optical axis using temporal focusing [8,13,15].

# 4. Discussion

## 4.1. Relation to previous work and potential improvements

A DMD has already been used for a rapid switching of targets and has found applications in population calcium imaging using multiplexing [16] or in multi-site photolysis of caged neurotransmitters [17]. Here, we advance this approach by decreasing the background illumination, demonstrating the ability to modulate the amplitude of each target independently, and assessing the 3D capability of the system. Further improvements on the axial resolution would be effective with the use of temporal focusing. For this, a diffraction grating needs to be introduced in a conjugated plane of the DMD. It could be either a reflective grating if the optical path permits or a volume phase holographic transmission grating. Yet, one should keep in mind that the DMD is also dispersive because it is an array of tilted mirrors analog to a blazed grating. As such, DMD has been used as the dispersive element in a temporal focusing setup [28] but nonetheless be coupled with a diffraction grating for 2 photon application [29]. However, in our configuration, we used the zero-order diffraction of the DMD which does not lead to temporal focusing and associated benefits on the axial resolution.

An alternative approach to increase the temporal resolution of a LCoS-SLM based system is multiplexing. This has been done by incorporating two SLMs along the same photostimulation path, enabling temporally multiplexed ensemble stimulation [30]. Each SLM was used alternatively by switching the polarization of the incident beam. Thus, this approach can only increase the speed limit by a factor of 2 for a single wavelength system. An elegant study showed that multiplexing is also possible using a single LCoS-SLM. By sequentially illuminating discrete bands on the LCoS-SLM using galvo-based scanning, kHz rates were achieved [31]. However, both approaches necessitate more complex hardware and software implementations and are not compatible with fast real-time control because of the computation time necessary to design the collection of phase masks. Depending on the application and on the tradeoff between temporal resolution, contrast ratio, 3D capability, real-time update of patterns, and simplicity, the end-user has a variety of options available.
## 4.2. Potential benefits of a DMD-based system

All-optical methods, where presynaptic neurons are optogenetically activated and postsynaptic neurons activity is read by calcium of voltage fluorescent indicators, allow to probe synaptic connections efficiently in the intact brain [32–34]. Development of compressed sensing algorithms permits to explore several presynaptic neurons at the same time and to increase the rate at which the existence and strength of synapses are screened [35]. However, to search for relevant connections, this class of algorithms needs to update the stimulation patterns in real time and the generation of phase mask appeared to be the limiting step. By selectively activating a subset of the potential targets and by modulating the amplitude of these ROIs to titrate the resulting activation, our optical design integrating a DMD could be used to probe synaptic connections with graded stimulation intensities without the need of computing a new phase mask for each stimulation pattern.

The increase of contrast ratio that we report here would be valuable for such experiments were cross-activation can produce confounding artifacts. This improvement of contrast is due to the imperfect spatial pattern generated by the LCoS-SLM where light is also diffracted to unwanted regions. By discarding part of this diffracted light, the DMD permitted to reduce background illumination. With our settings, 128 ROIs could be displayed simultaneously while keeping a contrast ratio above 97% as measured in the XY plane.

## 4.3. Need for temporal resolution

A temporal resolution of 0.1 ms might not seem necessary at first sight because neuronal spike latency upon light stimulation is usually around 3-6 ms [3, 27, 36, 37]. However, spike timing precision is well below latency values. Using the high-speed variant opsin Chronos, fast spiking interneurons could trigger spikes with a temporal precision of 0.2 ms upon 2P activation [36]. Sub-millisecond time jitter was also achieved with the newly developed opsin family ChroME [27,37]. ChroME variants have activation spectra centered around 1000 nm, a slightly higher wavelength than Chronos, which make them ideal for stimulation using Yb:YAG fiber lasers that can provide the necessary power to target a large number of cells in parallel and study how spatiotemporal patterns of neuronal activation are both necessary and sufficient for encoding information in the brain.

Spike timing with millisecond precision is important in many physiological processes such as spike-timing dependent plasticity [38], song generation in the bird song [39], sensory processing [40], or hippocampal memory replay [41]. With the aim at reproducing precise neuronal sequences, our approach coupled to newly developed opsins provides a valuable resource to tackle fundamental questions about the role of temporal information in neuronal coding.

## 4.4. Extension to 3D patterns

The ability to produce patterns in 3 dimensions is important for applications in biological tissues. An axial resolution of the 2P stimulation of the order of 67 µm for a spot of 15 µm diameter was found. This value could be reduced to ~10 µm with the addition of temporal focusing technique described in several studies [8, 13, 15]. It is thus expected that the single cell resolution can be achieved in complex biological tissues. This resolution is often necessary when dealing with specimens in 3 dimensions to avoid unwanted cross-activations.

Previous approaches used either holography [13], tunable lenses [42] or AOD [7] to target different planes, all of which did not provide a sufficient temporal resolution to activate a large population of neurons in 3D simultaneously or with precise temporal patterns. Our optical design alleviates this limitation by using the DMD as a temporal modulator of each ROI independently. For 3D applications, we showed that temporal patterns could be modulated by the DMD as long as the different patterns are not too close 1) in XY if they are close in Z, or 2) in Z if they are close in XY (Fig. 7). Here, we were able to control specifically individual ROIs from different
planes that were separated by up to 200 µm which represents a volume relevant for the study of cortical processes for example.

**Funding.** Fondation Pour l'Audition (FPA IDA01); Human Frontier Science Program (CDA00009/2017-3); Centre National de la Recherche Scientifique (CNRS Momentum).

**Acknowledgments.** We thank Nicolas Michalski and Boris Gourévitch for lending us the CMOS camera and Brice Bathellier for the virus sample.

**Disclosures.** The authors declare that their principal affiliations are with not-for-profit organizations and that they have no potential conflict of interest in the publication of this article.

**Data availability.** The data that support the findings of this study are not publicly available at this time but may be obtained from the corresponding authors upon reasonable request. Data acquisition (Labview) and analysis (Labview or Matlab) software used in this paper are described in the Methods and will be available upon request.

## References

1. S. Panzeri, C. D. Harvey, E. Piasini, P. E. Latham, and T. Fellin, "Cracking the Neural Code for Sensory Perception by Combining Statistics, Intervention, and Behavior," *Neuron* **93**(3), 491–507 (2017).

2. V. Emiliani, E. Entcheva, R. Hedrich, P. Hegemann, K. R. Konrad, C. Lüscher, M. Mahn, Z. H. Pan, R. R. Sims, J. Vierock, and O. Yizhar, "Optogenetics for light control of biological systems," *Nat. Rev. Methods Primers* **2**(1), 55 (2022).

3. O. Yizhar, L. E. Fenno, T. J. Davidson, M. Mogri, and K. Deisseroth, "Optogenetics in neural systems," *Neuron* **71**(1), 9–34 (2011).

4. I. W. Chen, E. Papagiakoumou, and V. Emiliani, "Towards circuit optogenetics," *Curr. Opin. Neurobiol.* **50**, 179–189 (2018).

5. E. Ronzitti, C. Ventalon, M. Canepari, B. C. Forget, E. Papagiakoumou, and V. Emiliani, "Recent advances in patterned photostimulation for optogenetics," *J. Opt.* **19**(11), 113001 (2017).

6. J. P. Rickgauer and D. W. Tank, "Two-photon excitation of channelrhodopsin-2 at saturation," *Proc. Natl. Acad. Sci. U. S. A.* **106**(35), 15025–15030 (2009).

7. P. Ricci, M. Marchetti, M. Sorelli, L. Turrini, F. Resta, V. Gavryusev, G. de Vito, G. Sancataldo, F. Vanzi, L. Silvestri, and F. S. Pavone, "Power-effective scanning with AODs for 3D optogenetic applications," *J Biophotonics* **15**(4), e202100256 (2022).

8. E. Papagiakoumou, F. Anselmi, A. Begue, V. de Sars, J. Gluckstad, E. Y. Isacoff, and V. Emiliani, "Scanless two-photon excitation of channelrhodopsin-2," *Nat. Methods* **7**(10), 848–854 (2010).

9. E. Papagiakoumou, E. Ronzitti, I. W. Chen, M. Gajowa, A. Picot, and V. Emiliani, "Two-Photon Optogenetics by Computer-Generated Holography," *Optogenetics: A Roadmap* **1**, 175–197 (2018).

10. R. W. Gerchberg and W. O. Saxton, "Practical Algorithm for Determination of Phase from Image and Diffraction Plane Pictures," *Optik* **35**, 237 (1972).

11. J. Barral and A. D. Reyes, "Synaptic scaling rule preserves excitatory-inhibitory balance and salient neuronal network dynamics," *Nat. Neurosci.* **19**(12), 1690–1696 (2016).

12. J. Barral and A. D. Reyes, "Optogenetic Stimulation and Recording of Primary Cultured Neurons with Spatiotemporal Control," *Bio-Protoc.* **7**, 1 (2017).

13. N. C. Pegard, A. R. Mardinly, I. A. Oldenburg, S. Sridharan, L. Waller, and H. Adesnik, "Three-dimensional scanless holographic optogenetics with temporal focusing (3D-SHOT)," *Nat. Commun.* **8**(1), 1228 (2017).

14. I. W. Chen, E. Ronzitti, B. R. Lee, T. L. Daigle, D. Dalkara, H. Zeng, V. Emiliani, and E. Papagiakoumou, "In Vivo Submillisecond Two-Photon Optogenetics with Temporally Focused Patterned Light," *J. Neurosci.* **39**, 1785-18 (2019).

15. B. K. Andrasfalvy, B. V. Zemelman, J. Tang, and A. Vaziri, "Two-photon single-cell optogenetic control of neuronal activity by sculpted light," *Proc. Natl. Acad. Sci. U. S. A.* **107**(26), 11981–11986 (2010).

16. M. Ducros, Y. Goulam Houssen, J. Bradley, V. de Sars, and S. Charpak, "-encoded multisite two-photon microscopy," *Proc. Natl. Acad. Sci. U. S. A.* **110**(32), 13138–13143 (2013).

17. M. A. Go, M. S. To, C. Stricker, S. Redman, H. A. Bachor, G. J. Stuart, and V. R. Daria, "Four-dimensional multi-site photolysis of caged neurotransmitters," *Front. Cell. Neurosci.* **7**, 231 (2013).

18. D. G. Rosenegger, C. H. Tran, J. LeDue, N. Zhou, and G. R. Gordon, "A high performance, cost-effective, open-source microscope for scanning two-photon microscopy that is modular and readily adaptable," *PLoS One* **9**(10), e110475 (2014).

19. O. Hernandez, E. Papagiakoumou, D. Tanese, K. Fidelin, C. Wyart, and V. Emiliani, "Three-dimensional spatiotemporal focusing of holographic patterns," *Nat. Commun.* **7**(1), 11928 (2016).

20. H. Peng, Z. Ruan, F. Long, J. H. Simpson, and E. W. Myers, "V3D enables real-time 3D visualization and quantitative analysis of large-scale biological image data sets," *Nat. Biotechnol.* **28**(4), 348–353 (2010).

21. L. G. Hilgenberg and M. A. Smith, "Preparation of dissociated mouse cortical neuron cultures," *J. Visualized Exp.* **562**(10), 1 (2007).

22. O. A. Shemesh, D. Tanese, V. Zampini, C. Linghu, K. Piatkevich, E. Ronzitti, E. Papagiakoumou, E. S. Boyden, and V. Emiliani, "Temporally precise single-cell-resolution optogenetics," *Nat. Neurosci.* **20**(12), 1796–1806 (2017).
23. M. Dal Maschio, F. Difato, R. Beltramo, A. Blau, F. Benfenati, and T. Fellin, "Simultaneous two-photon imaging and photo-stimulation with structured light illumination," *Opt. Express* **18**(18), 18720–18731 (2010).

24. E. Papagiakoumou, E. Ronzitti, and V. Emiliani, "Scanless two-photon excitation with temporal focusing," *Nat. Methods* **17**(6), 571–581 (2020).

25. E. Papagiakoumou, V. de Sars, D. Oron, and V. Emiliani, "Patterned two-photon illumination by spatiotemporal shaping of ultrashort pulses," *Opt. Express* **16**(26), 22039–22047 (2008).

26. R. Prakash, O. Yizhar, B. Grewe, C. Ramakrishnan, N. Wang, I. Goshen, A. M. Packer, D. S. Peterka, R. Yuste, M. J. Schnitzer, and K. Deisseroth, "Two-photon optogenetic toolbox for fast inhibition, excitation and bistable modulation," *Nat. Methods* **9**(12), 1171–1179 (2012).

27. S. Sridharan, M. A. Gajowa, M. B. Ogando, U. K. Jagadisan, L. Abdeladim, M. Sadahiro, H. A. Bounds, W. D. Hendricks, T. S. Turney, I. Tayler, K. Gopakumar, I. A. Oldenburg, S. G. Brohawn, and H. Adesnik, "High-performance microbial opsins for spatially and temporally precise perturbations of large neuronal networks," *Neuron* **110**(7), 1139–1155.e6 (2022).

28. J. N. Yih, Y. Y. Hu, Y. D. Sie, L. C. Cheng, C. H. Lien, and S. J. Chen, "Temporal focusing-based multiphoton excitation microscopy via digital micromirror device," *Opt. Lett.* **39**(11), 3134–3137 (2014).

29. Y. C. Li, L. C. Cheng, C. Y. Chang, C. H. Lien, P. J. Campagnola, and S. J. Chen, "Fast multiphoton microfabrication of freeform polymer microstructures by spatiotemporal focusing and patterned excitation," *Opt. Express* **20**(17), 19030–19038 (2012).

30. J. H. Marshel, Y. S. Kim, T. A. Machado, S. Quirin, B. Benson, J. Kadmon, C. Raja, A. Chibukhchyan, C. Ramakrishnan, M. Inoue, J. C. Shane, D. J. McKnight, S. Yoshizawa, H. E. Kato, S. Ganguli, and K. Deisseroth, "Cortical layer-specific critical dynamics triggering perception," *Science* **365**(6453), eaaw5202 (2019).

31. G. Faini, D. Tanese, C. Molinier, C. Telliez, M. Hamdani, F. Blot, C. Tourain, V. de Sars, F. Del Bene, B. C. Forget, E. Ronzitti, and V. Emiliani, "Ultrafast light targeting for high-throughput precise control of neuronal networks," *Nat Commun* **14**(1), 1888 (2023).

32. C. McRaven, D. Tanese, L. Zhang, C.-T. Yang, M. B. Ahrens, V. Emiliani, and M. Koyama, "High-throughput cellular-resolution synaptic connectivity mapping in vivo with concurrent two-photon optogenetics and volumetric Ca2+ imaging," *bioRxiv*, 2020.2002.2021.959650 (2020).

33. A. M. Packer, L. E. Russell, H. W. Dalgleish, and M. Hausser, "Simultaneous all-optical manipulation and recording of neural circuit activity with cellular resolution in vivo," *Nat. Methods* **12**(2), 140–146 (2015).

34. C. A. Baker, Y. M. Elyada, A. Parra, and M. M. Bolton, "Cellular resolution circuit mapping with temporal-focused excitation of soma-targeted channelrhodopsin," *Elife* **5**, e14193 (2016).

35. M. A. Triplett, M. Gajowa, B. Antin, M. Sadahiro, H. Adesnik, and L. Paninski, "Rapid learning of neural circuitry from holographic ensemble stimulation enabled by model-based compressed sensing," *bioRxiv*, 2022.009.2014.507926 (2022).

36. E. Ronzitti, R. Conti, V. Zampini, D. Tanese, A. J. Foust, N. Klapoetke, E. S. Boyden, E. Papagiakoumou, and V. Emiliani, "Submillisecond Optogenetic Control of Neuronal Firing with Two-Photon Holographic Photoactivation of Chronos," *J. Neurosci.* **37**(44), 10679–10689 (2017).

37. A. R. Mardinly, I. A. Oldenburg, N. C. Pegard, S. Sridharan, E. H. Lyall, K. Chesnov, S. G. Brohawn, L. Waller, and H. Adesnik, "Precise multimodal optical control of neural ensemble activity," *Nat. Neurosci.* **21**(6), 881–893 (2018).

38. G. Q. Bi and M. M. Poo, "Synaptic modifications in cultured hippocampal neurons: dependence on spike timing, synaptic strength, and postsynaptic cell type," *J. Neurosci.* **18**(24), 10464–10472 (1998).

39. R. H. Hahnloser, A. A. Kozhevnikov, and M. S. Fee, "An ultra-sparse code underlies the generation of neural sequences in a songbird," *Nature* **419**(6902), 65–70 (2002).

40. J. E. Rose, J. F. Brugge, D. J. Anderson, and J. E. Hind, "Phase-locked response to low-frequency tones in single auditory nerve fibers of the squirrel monkey," *J Neurophysiol* **30**(4), 769–793 (1967).

41. M. F. Carr, S. P. Jadhav, and L. M. Frank, "Hippocampal replay in the awake state: a potential substrate for memory consolidation and retrieval," *Nat. Neurosci.* **14**(2), 147–153 (2011).

42. W. Yang, L. Carrillo-Reid, Y. Bando, D. S. Peterka, and R. Yuste, "Simultaneous two-photon imaging and two-photon optogenetics of cortical circuits in three dimensions," *Elife* **7**, 1 (2018).