Synchronizing stimulation with data acquisitionΒΆ

Here, we demonstrate the communication with a custom-built two-photon microscope. We performed two-photon calcium imaging in a seven days post fertilization, head-restrained fish larva pan-neuronally expressing the calcium indicator GCaMP6f (Tg(elavl3:GCaMP6f), [WDB+17]). For a complete description of the calcium imaging protocol see [KKM+17]. These and following experiments were performed in accordance with approved protocols set by the Max Planck Society and the Regierung von Oberbayern.

We designed a simple protocol in Stytra consisting of either open- or closed-loop forward-moving gratings, similar to the optomotor assay described in the closed-loop section, with the gain set to either 0 or 1. At the beginning of the experiment, the microscope sends a ZeroMQ message to Stytra, as described in the previous section. This triggers the beginning of the visual stimulation protocol, as well as the online tracking of the fish tail, with a 10-20 ms delay.

The figure belows shows the trace obtained from the live tracking of the tail during the experiment together with the vigor, the gain, and the grating velocities before and after calculating the closed loop velocity. Light shades represent open-loop trials and dark shades closed loop trials, and the triggering time is maked by an arrow: