@@ -61,14 +61,13 @@ def from_Solis(filepath, name=None, parent=None, verbose=True) -> Data:
6161 axis0 = []
6262 arr = []
6363 attrs = {}
64- for i in range (2 ):
65- line = f .readline ().strip ()[:- 1 ]
66- line = [float (x ) for x in line .split ("," )] # TODO: robust to space, tab, comma
67- axis0 .append (line .pop (0 ))
68- arr .append (line )
69- axis0_increasing = axis0 [1 ] - axis0 [0 ] > 0
70-
71- def get_frames (f , arr , axis0 , increasing ):
64+
65+ line0 = f .readline ().strip ()[:- 1 ]
66+ line0 = [float (x ) for x in line0 .split ("," )] # TODO: robust to space, tab, comma
67+ axis0 .append (line0 .pop (0 ))
68+ arr .append (line0 )
69+
70+ def get_frames (f , arr , axis0 ):
7271 axis0_written = False
7372 while True :
7473 line = f .readline ().strip ()[:- 1 ]
@@ -77,7 +76,7 @@ def get_frames(f, arr, axis0, increasing):
7776 else :
7877 line = [float (x ) for x in line .split ("," )]
7978 # signature of new frames is restart of axis0
80- if not axis0_written and (( line [0 ] - axis0 [- 1 ] > 0 ) != increasing ):
79+ if not axis0_written and (line [0 ] == axis0 [0 ] ):
8180 axis0_written = True
8281 if axis0_written :
8382 line .pop (0 )
@@ -86,7 +85,7 @@ def get_frames(f, arr, axis0, increasing):
8685 arr .append (line )
8786 return arr , axis0
8887
89- arr , axis0 = get_frames (f , arr , axis0 , axis0_increasing )
88+ arr , axis0 = get_frames (f , arr , axis0 )
9089 nframes = len (arr ) // len (axis0 )
9190
9291 i = 0
@@ -136,8 +135,6 @@ def get_frames(f, arr, axis0, increasing):
136135 axes = ["frame" ] + axes
137136
138137 data .transform (* axes )
139- print (f"arr.shape { arr .shape } " )
140- print (f"nframes { nframes } " )
141138 arr /= float (attrs ["Exposure Time (secs)" ])
142139 # signal has units of Hz because time normalized
143140 data .create_channel (name = "signal" , values = arr , signed = False , units = "Hz" )
0 commit comments