@@ -103,6 +103,7 @@ def read(self):
103
103
104
104
105
105
class ScalaNWBReader (NWBReader ):
106
+
106
107
def read (self ):
107
108
""" Read and format the content of the NWB file
108
109
@@ -112,6 +113,11 @@ def read(self):
112
113
113
114
data = []
114
115
116
+ if self .repetition :
117
+ repetitions_content = self .content ['general' ]['intracellular_ephys' ]['intracellular_recordings' ]['repetition' ]
118
+ if isinstance (self .repetition , (int , str )):
119
+ self .repetition = [int (self .repetition )]
120
+
115
121
for sweep in list (self .content ['acquisition' ].keys ()):
116
122
key_current = sweep .replace ('Series' , 'StimulusSeries' )
117
123
try :
@@ -132,12 +138,23 @@ def read(self):
132
138
if key_current not in self .content ['stimulus' ]['presentation' ]:
133
139
continue
134
140
135
- data .append (self ._format_nwb_trace (
136
- voltage = self .content ['acquisition' ][sweep ]['data' ],
137
- current = self .content ['stimulus' ]['presentation' ][key_current ]['data' ],
138
- start_time = self .content ["acquisition" ][sweep ]["starting_time" ],
139
- trace_name = sweep ,
140
- ))
141
+ if self .repetition :
142
+ sweep_id = int (sweep .split ("_" )[- 1 ])
143
+ if (int (repetitions_content [sweep_id ]) in self .repetition ):
144
+ data .append (self ._format_nwb_trace (
145
+ voltage = self .content ['acquisition' ][sweep ]['data' ],
146
+ current = self .content ['stimulus' ]['presentation' ][key_current ]['data' ],
147
+ start_time = self .content ['acquisition' ][sweep ]["starting_time" ],
148
+ trace_name = sweep ,
149
+ repetition = int (repetitions_content [sweep_id ])
150
+ ))
151
+ else :
152
+ data .append (self ._format_nwb_trace (
153
+ voltage = self .content ['acquisition' ][sweep ]['data' ],
154
+ current = self .content ['stimulus' ]['presentation' ][key_current ]['data' ],
155
+ start_time = self .content ["acquisition" ][sweep ]["starting_time" ],
156
+ trace_name = sweep ,
157
+ ))
141
158
142
159
return data
143
160
0 commit comments