@@ -27,13 +27,12 @@ def read_in_data(filePath=None, header = None,
27
27
28
28
# Stimulus Buffer per Frame (aka how many frames are stored in one chunk)
29
29
StimBufPerFr = int (header ["StimBufPerFr" ])
30
-
30
+
31
31
#it seems that the framer counter, counts backwards, so to get the number of
32
32
#frames, one needs to take the total number of frames and subtract from the counter
33
33
nFrames = (int (header ["NumberOfFrames" ])- int (header ["FrameCounter" ]))* StimBufPerFr
34
34
35
35
36
-
37
36
#recording buffer (aka how much of each channel is saved before the next one
38
37
#starts - necessary so that later one can sort the binary data according to the
39
38
#channels)
@@ -77,7 +76,7 @@ def read_in_data(filePath=None, header = None,
77
76
# of frameWidthXframeHeightXnFrames
78
77
#- couldn't find this information in the header
79
78
nChannels = int (len (values )/ (nFrames * frameWidth * frameHeight ))
80
-
79
+
81
80
82
81
#empty arrays to store data
83
82
###to do: preallocate array the size of each should be (nFrames*frameWidth*frameHeight)
@@ -191,16 +190,19 @@ def read_in_header(filePath=None):
191
190
192
191
193
192
194
- def to_frame (dataArray = [],nFrames = 1 ,frameHeight = 512 ,frameWidth = 652 ):
193
+ def to_frame (dataArray = [],frameTotal = 2 , frameCounter = 1 , frameBuffer = 1 ,frameHeight = 512 ,frameWidth = 652 ):
195
194
"""function to reshape the dataArray into frame format. Currently it only
196
195
works with the direct scan mode (s shaped).Note that this function does not
197
196
cut off retrace periods.
198
197
199
198
200
- nFrames is the number of recorded frames.\n
199
+ frameTotal is the total number of frames.\n
200
+ frameCounter counts backwards from frameTotal \n
201
+ frameBuffer is the number of frames stored in one chunck. \n
201
202
frameHeight is the number of pixels in the y axis.\n
202
203
frameWidth is the number of pixels in the x axis\n """
203
-
204
+
205
+ nFrames = (frameTotal - frameCounter )* frameBuffer
204
206
205
207
c1 = np .reshape (dataArray [0 :nFrames * frameHeight * frameWidth ],
206
208
(nFrames ,frameHeight ,frameWidth ),
@@ -226,7 +228,8 @@ def trigger_detection(frameData,triggerLevel=220,triggerMode=1):
226
228
#####################
227
229
228
230
#drop triggers depending on trigger mode.
231
+
229
232
indexes = indexes [::triggerMode ]
230
233
#populate triggerArray with ones
231
234
trigArray [indexes ]= 1
232
- return indexes ,trigArray
235
+ return indexes ,trigArray
0 commit comments