forked from mesoscale-activity-map/workshop-ret1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ret1.py
executable file
·242 lines (196 loc) · 5.02 KB
/
ret1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#! /usr/bin/env python
import datajoint as dj
schema = dj.schema('catalog_ret1', locals())
@schema
class Lab(dj.Manual):
definition = """
# Lab
lab : varchar(255) # lab conducting the study
----
institution : varchar(255) # sponsoring institution
"""
@schema
class Keyword(dj.Lookup):
definition = """
# Study Keywords
keyword : varchar(24) # study types
"""
contents = zip(['behavior', 'extracellular', 'photostim'])
@schema
class Study(dj.Manual):
definition = """
# Study
study : varchar(8) # short name of the study
---
study_description : varchar(255) # detailed study description
-> Lab
reference_atlas : varchar(255) # e.g. "paxinos"
"""
@schema
class StudyKeyword(dj.Manual):
definition = """
# Study keyword (see general/notes)
-> Study
-> Keyword
"""
# XXX: empty
@schema
class Publication(dj.Manual):
definition = """
# Publication
doi : varchar(60) # publication DOI
----
full_citation : varchar(4000)
authors='' : varchar(4000)
title='' : varchar(1024)
"""
# XXX: empty
@schema
class RelatedPublication(dj.Manual):
definition = """
-> Study
-> Publication
"""
# XXX: empty
@schema
class AnimalSource(dj.Lookup):
definition = """
animal_source : varchar(30)
"""
contents = zip(['unknown', 'JAX'])
@schema
class Strain(dj.Lookup):
definition = """
# Mouse strain
strain : varchar(30) # mouse strain
"""
contents = zip(['kj18', 'kl100', 'ai32', 'pl56'])
@schema
class GeneModification(dj.Lookup):
definition = """
gene_modification : varchar(60)
"""
contents = zip(['sim1-cre', 'rbp4-cre', 'chr2-eyfp', 'tlx-cre'])
@schema
class User(dj.Lookup):
definition = """
# User (lab member)
username : varchar(16) # database username
----
full_name='' : varchar(60)
"""
@schema
class Subject(dj.Manual):
definition = """
subject_id : int # institution animal ID
---
species : varchar(30)
date_of_birth : date
sex : enum('M','F','Unknown')
-> [nullable] AnimalSource
"""
class GeneModification(dj.Part):
definition = """
# Subject gene modifications
-> Subject
-> GeneModification
"""
# XXX: empty
class Strain(dj.Part):
definition = """
-> Subject
-> Strain
"""
# XXX: empty
@schema
class Session(dj.Manual):
definition = """
-> Subject
session: int
---
-> Study
record: int
sample: int
session_date: date # session date
session_suffix: char(2) # suffix for disambiguating sessions
(experimenter) -> User
session_start_time: datetime
"""
@schema
class Ephys(dj.Manual):
definition = """
-> Session
"""
class Electrode(dj.Part):
definition = """
-> Ephys
electrode : tinyint # electrode no
---
electrode_x : decimal(5,2) # (x in mm)
electrode_y : decimal(5,2) # (y in mm)
"""
# XXX: do we actually have a cell mapping in dataset?
class Mapping(dj.Part):
definition = """
-> Ephys
"""
class Unit(dj.Part):
definition = """
-> Ephys
cell_no : int # cell no
"""
class Spikes(dj.Part):
definition = """
-> Ephys.Unit
---
spike_times : longblob # all events
"""
@schema
class Movie(dj.Manual):
definition = """
movie_id : smallint # movie IDs
----
x : int
y : int
dx : int
dy : int
dim_a : int
dim_b : int
bpp : tinyint # bits per pixel
pixel_size : decimal(3,2) # (mm)
movie : longblob # 3d array
source_fname : varchar(255) # source file
"""
@schema
class Stimulus(dj.Manual):
definition = """
-> Session
"""
class Trial(dj.Part):
# XXX: len(timestamps) varies w/r/t len(movie); timestamps definitive
# ... actually 'num_samples' definitive, but same as len(timestamps)
# and so is redundant and discarded.
definition = """
-> Stimulus
trial_idx : smallint # trial within a session
---
-> Movie
start_time : float # (s)
stop_time : float # (s)
timestamps : longblob # (s)
"""
@schema
class RF(dj.Computed):
definition = """
# Receptive Fields
-> Ephys
-> Stimulus
"""
class Unit(dj.Part):
definition = """
# Receptive fields
-> RF
-> Ephys.Spikes
----
rf : longblob # computed RF
"""