How to run the protocols
Pre-flight checklist
Before running either protocol, ensure:
Protocol 1 — GUI-based
Protocol 1 is run through the G4_experiment_conductor GUI.
A detailed explanation of Protocol 1 can be found here.
Step-by-step
Open the experiment conductor: Type
G4_experiment_conductorin the MATLAB Command Window.Load the protocol: Click File → Load, then navigate to the appropriate
.g4pfile within theprotocols/folder. For the most recent version, use:- Left hemisphere recording:
protocols/bkg4/LHS/protocol1_10kHz_4reps_12px_6px_LHS_2sbkg_200msfl_150msint_07-10-25_15-45-60/ - Right hemisphere recording:
protocols/bkg4/RHS/
- Left hemisphere recording:
Verify settings: Check that the
processing_settings.matfile is present in the protocol folder and thatsettings.is_ephys_grid = 1.Run the protocol: Click the Run button. The protocol will take approximately 6 to 7.5 minutes to complete.
Automatic processing: After the protocol finishes, the processing functions should run automatically (provided the
processing_settings.matis configured correctly). This generates 4 grid plots showing the cell’s responses.
Between Protocol 1 and Protocol 2
After P1 completes, you need to determine two things before running P2:
1. Identify the peak_frame
Examine the 6 pixel flash grid plots (both bright and dark contrasts). Each subplot shows the cell’s voltage response to a flash at that location on the screen. The number above each subplot is the frame number of that flash within the pattern.
- Find the subplot with the largest response (biggest deflection from baseline).
- Note the frame number above that subplot — this is your
peak_frame. - The
peak_framewill be used to generate the Protocol 2 stimulus at the same location but with higher spatial resolution. The preferred contrast of the cell is determined automatically based on thepeak_framevalue.
If the peak_frame corresponds to a flash near the edge of the stimulus area, the 30 x 30 pixel Protocol 2 area may extend beyond the arena boundary. The code will warn you if this is the case. Consider whether Protocol 2 is still worthwhile for edge cases.
Protocol 2 — Script-based
Protocol 2 is generated and run entirely through a single MATLAB script. Unlike Protocol 1, it does not use the G4_experiment_conductor GUI.
A detailed explanation of Protocol 2 can be found here.
Step-by-step
Run the script: Type
generate_protocol2in the MATLAB Command Window, or run the script directly.Fill in the pop-up dialog: A GUI dialog will appear with the following fields:
Field Description Example Frame The peak_framenumber from the P1 6px grid plot with the largest response42Side Which side of the arena was used in P1 ( Lfor left,Rfor right)LAge Age of the fly in days (1-8, or NaN if unknown) 3Strain Fly genotype — select from the dropdown list 42F06_T4T5_control
If a new strain is being run that is not in the dropdown list, add it to the field Items for the variable strainDropdown within the script get_input_parameters.m.
Wait for generation: The script will:
- Convert the
peak_frameto screen coordinates usingpatt_frame_to_coord.m - Determine the ON/OFF contrast from the peak_frame value
- Generate all flash patterns, bar patterns, and position functions
- Assemble the experiment into
currentExp.mat - Create a new timestamped folder (format
YYYY_MM_DD_HH_MM)
- Convert the
The protocol runs automatically: After generation, the script calls
run_protocol2()which connects to the PanelsController and runs all stimuli with 3 repetitions. The protocol takes approximately 20 to 25 minutes.During the experiment: The arena will cycle through the stimulus sequence (flashes → bar sweeps at different speeds → bar flashes) three times. You should see the arena LEDs changing as each stimulus is presented.
Post-experiment: After completion:
- TDMS log files are automatically converted to
.matformat - Metadata is saved to the experiment folder
- Experiment details are exported to the Google Sheets log (unless strain is set to
test) - The script returns the
peak_framevalue for the inverse contrast, so you can run P2 again with the opposite contrast if desired
- TDMS log files are automatically converted to
Protocol 2 only presents one contrast (ON or OFF) per run. After the first run completes, the script returns the peak_frame value that would generate the protocol at the same location with the inverse contrast. You can use this to run P2 a second time to collect data for both contrasts.
After Protocol 2
Once Protocol 2 is complete, you can analyse the data using process_protocol2(). See How to analyse P2 for instructions.