Skip to content

Commit 64ab8f4

Browse files
committed
fix: Update .ang file reader to work with more files
1 parent 188f7e4 commit 64ab8f4

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

defdap/file_readers.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ def load(self, file_name: pathlib.Path) -> None:
289289
self.check_metadata()
290290

291291
# Construct fixed data format
292+
# .ang format seems to take all sorts of forms, only columns that seem
293+
# to be agreed on by most files are loaded
292294
self.data_format = np.dtype([
293295
('ph1', 'float32'),
294296
('phi', 'float32'),
@@ -298,10 +300,8 @@ def load(self, file_name: pathlib.Path) -> None:
298300
('IQ', 'float32'),
299301
('CI', 'float32'),
300302
('phase', 'uint8'),
301-
# ('SE_signal', 'float32'),
302-
('FF', 'float32'),
303303
])
304-
load_cols = (0, 1, 2, 5, 6, 7, 8, 9)
304+
load_cols = (0, 1, 2, 5, 6, 7)
305305

306306
# now read the data from file
307307
data = np.loadtxt(
@@ -325,15 +325,8 @@ def load(self, file_name: pathlib.Path) -> None:
325325
'clabel': 'Confidence index',
326326
}
327327
)
328-
self.loaded_data.add(
329-
'fit_factor', data['FF'].reshape(shape),
330-
unit='', type='map', order=0,
331-
plot_params={
332-
'plot_colour_bar': True,
333-
'clabel': 'Fit factor',
334-
}
335-
)
336-
self.loaded_data.phase = data['phase'].reshape(shape) + 1
328+
add_phase = 1 if data['phase'].min() == 0 else 0
329+
self.loaded_data.phase = data['phase'].reshape(shape) + add_phase
337330
self.loaded_data['phase', 'plot_params']['vmax'] = len(self.loaded_metadata['phases'])
338331

339332
# flatten the structured dtype

0 commit comments

Comments
 (0)