File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -198,19 +198,18 @@ def parse_line(line):
198198 except ValueError :
199199 pass
200200
201- string_coords = content [start_idx :start_idx + num_points ]
201+ if not is_binary :
202+ string_coords = content [start_idx :start_idx + num_points ]
202203
203- data = np .array (list (map (parse_line , string_coords )), dtype = float )
204- return data
205-
206- #TODO binary
207- # if is_binary:
208- # buf = b''.join(content[n+1:])
209- # disp = struct.calcsize('c')
210- # vv = np.array(struct.unpack('{}d'.format(num*3),
211- # buf[disp:num*3*struct.calcsize('d') + disp]))
212- # data = vv.reshape((num, 3))
204+ data = np .array (list (map (parse_line , string_coords )), dtype = float )
205+ else :
206+ buf = b'' .join (content [start_idx - 1 :])
207+ disp = struct .calcsize ('c' )
208+ vv = np .array (struct .unpack ('{}d' .format (num_points * 3 ),
209+ buf [disp :num_points * 3 * struct .calcsize ('d' ) + disp ]))
210+ data = vv .reshape ((num_points , 3 ))
213211
212+ return data
214213
215214 @classmethod
216215 def parse_owner_neighbour_content (cls , content , is_binary , skip = 10 ):
You can’t perform that action at this time.
0 commit comments