Skip to content

Commit 9cc473d

Browse files
authored
Add support for recording and processing dLight with pyPhotometry (#174)
* Add support for recording dLight with pyPhotometry * Update example metadata files
1 parent 7f6c331 commit 9cc473d

File tree

6 files changed

+553
-187
lines changed

6 files changed

+553
-187
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pip install -e .
1111

1212
## Usage
1313

14-
1. Open `metadata_example.yaml` in a text editor. Update the paths to point to your data and update the metadata for your experiment.
14+
1. Open one of the example metadata files in a text editor (`metadata_example_Jose.yaml` for Jose's experiments, or `metadata_example_Tim.yaml` for Tim / Yang-Sun / Stephanie's experiments). Update the paths to point to your data and update the metadata for your experiment. See `metadata_fully_explained.yaml` for an explanation of all metadata fields.
1515

1616
2. Run the conversion to generate an NWB file (replace `output_dir` with your desired output directory).
1717
The nwb file will be automatically named based on the animal name and date (i.e. `rat_date.nwb`):

metadata_example.yaml

Lines changed: 0 additions & 137 deletions
This file was deleted.

metadata_example_Jose.yaml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Example metadata file for one of Jose's experiments
2+
# Bilateral injection of gACh4h and rDA3m in NAcc
3+
# Recording using pyPhotometry in the new maze room
4+
5+
institution: University of California, San Francisco
6+
lab: Berke Lab
7+
experimenter:
8+
- Figueroa, Jose
9+
experiment_description: Hex maze task
10+
animal_name: IM-1891_jimmy
11+
date: "20250723"
12+
subject:
13+
subject_id: IM-1891
14+
species: Rattus norvegicus
15+
genotype: Wildtype
16+
sex: M
17+
date_of_birth: 2024-10-17
18+
description: Long Evans Rat
19+
20+
photometry:
21+
# Recording was done using pyPhotometry
22+
ppd_file_path: "C:/Users/j2fig/OneDrive - UCSF/ACh Rats/IM-1891_jimmy/20250723/RecordingDay17_ProbSwitch_Lhem_CKTL-2025-07-23-123503.ppd"
23+
24+
# Excitation sources for the new maze room
25+
excitation_sources:
26+
- Doric Purple LED
27+
- Doric Blue LED
28+
- Doric Green LED
29+
30+
# Photodetector for the new maze room
31+
photodetector: Doric ilFMC7-G2 (Integrated LED Fluorescence Mini Cube 5 ports Gen.2)
32+
33+
# Bilateral optic fibers in NAcc
34+
optic_fiber_implant_sites:
35+
- optic_fiber: Doric 0.66mm Flat 40mm Optic Fiber
36+
targeted_location: NAcc
37+
ap_in_mm: 1.8
38+
ml_in_mm: 1.8
39+
dv_in_mm: -6.0 # 6.0 mm deep for males, 5.8 mm deep for females
40+
recording: true # Recorded from the right hemisphere
41+
42+
- optic_fiber: Doric 0.66mm Flat 40mm Optic Fiber
43+
targeted_location: NAcc
44+
ap_in_mm: 1.8
45+
ml_in_mm: -1.8
46+
dv_in_mm: -6.0 # 6.0 mm deep for males, 5.8 mm deep for females
47+
48+
# Bilateral injection of cocktail virus in NAcc
49+
virus_injections:
50+
# Right Hemisphere
51+
- virus_name: gACh4h
52+
targeted_location: NAcc
53+
ap_in_mm: 1.8
54+
ml_in_mm: 1.8
55+
dv_in_mm: -6.2 # 6.2 mm deep for males, 6.0 mm deep for females
56+
volume_in_uL: 1.0
57+
titer_in_vg_per_mL: 1.15e13
58+
59+
- virus_name: rDA3m (AAV9)
60+
targeted_location: NAcc
61+
ap_in_mm: 1.8
62+
ml_in_mm: 1.8
63+
dv_in_mm: -6.2 # 6.2 mm deep for males, 6.0 mm deep for females
64+
volume_in_uL: 1.0
65+
titer_in_vg_per_mL: 5.89e12
66+
67+
# Left Hemisphere
68+
- virus_name: gACh4h
69+
targeted_location: NAcc
70+
ap_in_mm: 1.8
71+
ml_in_mm: -1.8
72+
dv_in_mm: -6.2 # 6.2 mm deep for males, 6.0 mm deep for females
73+
volume_in_uL: 1.0
74+
titer_in_vg_per_mL: 1.15e13
75+
76+
- virus_name: rDA3m (AAV9)
77+
targeted_location: NAcc
78+
ap_in_mm: 1.8
79+
ml_in_mm: -1.8
80+
dv_in_mm: -6.2 # 6.2 mm deep for males, 6.0 mm deep for females
81+
volume_in_uL: 1.0
82+
titer_in_vg_per_mL: 5.89e12
83+
84+
behavior:
85+
arduino_text_file_path: "C:/Users/j2fig/OneDrive - UCSF/ACh Rats/IM-1891_jimmy/20250723/arduinoraw0.txt"
86+
arduino_timestamps_file_path: "C:/Users/j2fig/OneDrive - UCSF/ACh Rats/IM-1891_jimmy/20250723/ArduinoStamps0.csv"
87+
maze_configuration_file_path: "C:/Users/j2fig/OneDrive - UCSF/ACh Rats/IM-1891_jimmy/20250723/barriers.txt"
88+
89+
video:
90+
video_file_path: "C:/Users/j2fig/OneDrive - UCSF/ACh Rats/IM-1891_jimmy/20250723/Behav_Vid0.avi"
91+
video_timestamps_file_path: "C:/Users/j2fig/OneDrive - UCSF/ACh Rats/IM-1891_jimmy/20250723/testvidtimes0.csv"
92+
dlc_path: "C:/Users/j2fig/OneDrive - UCSF/ACh Rats/IM-1891_jimmy/20250723/Behav_Vid0DLC_resnet50_Triangle_Maze_PhotMar24shuffle1_800000.h5"
93+
hex_centroids_file_path: "C:/Users/j2fig/OneDrive - UCSF/ACh Rats/IM-1891_jimmy/20250723/IM-1891_jimmy_20250723_hex_coordinates.csv"
94+
95+
surgery:
96+
Surgery took place on 2025-05-03.
97+
Rat was bilaterally injected in the nucleus accumbens core with both ACh3.8 and rDA3m AAV virus.
98+
Fibers were placed bilaterally, targeting the NAcc.
99+
No Complications
100+
101+
virus:
102+
ACh3.8 and rDA3m AAV virus were injected bilaterally into the nucleus accumbens core on 2024-05-03.
103+
The titer for rDA3m was 5.89e12 vg/mL and ACh3.8 was 1.15e13 (BrainVTA).
104+
The injection was done in a cocktail at a volume was 1.0 uL per hemisphere.
105+
106+
notes:
107+
Reward used was 30uL sucrose solution (10% sucrose, 0.1% NaCl) at each reward port.
108+
The rat was water deprived before the experiment.
109+
110+
keywords:
111+
- photometry
112+
- behavior
113+
- hex maze
114+
- dopamine
115+
- acetylcholine
116+
- reward

metadata_example_Tim.yaml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Example metadata file for one of Tim's experiments
2+
# Bilateral injection of dLight in NAcc + 256-ch silicon probe in Hippocampus CA1
3+
# Recording using LabVIEW in the old maze room
4+
5+
institution: University of California, San Francisco
6+
lab: Berke Lab
7+
experimenter:
8+
- Tim Krausz
9+
experiment_description: Hex maze task
10+
date: 07/19/2022
11+
subject:
12+
subject_id: IM-1478
13+
species: Rattus norvegicus
14+
genotype: Wildtype
15+
sex: M
16+
age: 6mo # exact age unknown
17+
description: Long Evans Rat
18+
19+
ephys:
20+
impedance_file_path: "/Volumes/Tim/Ephys/IM-1478/07192022/impedance.csv"
21+
openephys_folder_path: "/Volumes/Tim/Ephys/IM-1478/07192022/2022-07-19_13-12-30"
22+
electrodes_location: "Hippocampus CA1"
23+
targeted_x: 4.5 # AP in mm
24+
targeted_y: -2.2 # ML in mm
25+
targeted_z: -2.0 # DV in mm
26+
27+
mountain_sort_output_file_path: "/Volumes/Tim/Ephys/IM-1478/07192022/mntsort_output/firings.mda"
28+
sampling_frequency: 30000
29+
30+
probe:
31+
- "256-ch Silicon Probe, 3mm length, 66um pitch"
32+
33+
photometry:
34+
# Recording was done using LabVIEW
35+
phot_file_path: "/Volumes/Tim/Photometry/IM-1478/07192022/IM-1478_2022-07-19_13-07-06____Tim_Conditioning.phot"
36+
box_file_path: "/Volumes/Tim/Photometry/IM-1478/07192022/IM-1478_2022-07-19_13-07-06____Tim_Conditioning.box"
37+
38+
# Excitation sources for the old maze room
39+
excitation_sources:
40+
- Thorlabs Purple LED
41+
- Thorlabs Blue LED
42+
43+
# Photodetector for the old maze room
44+
photodetector: Doric iFMC7-G2 (7 ports Fluorescence Mini Cube - Three Fluorophores)
45+
46+
# Bilateral optic fibers in NAcc
47+
optic_fiber_implant_sites:
48+
- optic_fiber: Doric 0.66mm Flat 40mm Optic Fiber
49+
targeted_location: NAcc
50+
ap_in_mm: 1.7
51+
ml_in_mm: 1.7
52+
dv_in_mm: -6.0
53+
- optic_fiber: Doric 0.66mm Flat 40mm Optic Fiber
54+
targeted_location: NAcc
55+
ap_in_mm: 1.7
56+
ml_in_mm: -1.7
57+
dv_in_mm: -6.0
58+
recording: true # Recorded from left hemisphere
59+
60+
# Bilateral injection of dLight in NAcc
61+
virus_injections:
62+
- virus_name: dLight1.3b
63+
targeted_location: NAcc
64+
ap_in_mm: 1.7
65+
ml_in_mm: 1.7
66+
dv_in_mm: -6.2
67+
volume_in_uL: 1.0
68+
titer_in_vg_per_mL: 2e12
69+
- virus_name: dLight1.3b
70+
targeted_location: NAcc
71+
ap_in_mm: 1.7
72+
ml_in_mm: -1.7
73+
dv_in_mm: -6.2
74+
volume_in_uL: 1.0
75+
titer_in_vg_per_mL: 2e12
76+
77+
behavior:
78+
arduino_text_file_path: "/Volumes/Tim/Photometry/IM-1478/07192022/arduinoraw0.txt"
79+
arduino_timestamps_file_path: "/Volumes/Tim/Photometry/IM-1478/07192022/ArduinoStamps0.csv"
80+
maze_configuration_file_path: "/Volumes/Tim/Photometry/IM-1478/07192022/barriers.txt"
81+
82+
video:
83+
video_file_path: "/Volumes/Tim/Photometry/IM-1478/07192022/Behav_Vid0.avi"
84+
video_timestamps_file_path: "/Volumes/Tim/Photometry/IM-1478/07192022/testvidtimes0.csv"
85+
dlc_path: "/Volumes/Tim/Photometry/IM-1478/07192022/Behav_Vid0DLC_resnet50_Triangle_Maze_EphysDec7shuffle1_800000.h5"
86+
hex_centroids_file_path: "/Volumes/Tim/Photometry/IM-1478/07192022/IM-1478_07192022_hex_coordinates.csv"
87+
88+
surgery:
89+
Bilateral dLight 1.3b and optic fibers. Fiber implant was .2 mm above injection site (DV -6.0).
90+
Hippocampal implant was in the left hemisphere.
91+
virus:
92+
AAVDJ-CAG-dLight1.3b (Vigene) at a titer of 2x10^12 at AP +1.7, ML +/-1.7, DV -6.2
93+
notes:
94+
Reward used was 15uL sucrose solution (10% sucrose, 0.1% NaCl) at each reward port.
95+
The rat was water deprived before the experiment.
96+
keywords:
97+
- photometry
98+
- ephys
99+
- behavior
100+
- video
101+
- hex maze
102+
- dopamine
103+
- reward
104+
- credit assignment

0 commit comments

Comments
 (0)