Fix combining datasets when missing logs during file write
Unit Testing / test (3.8) (push) Successful in 1m21s
Unit Testing / test (3.12) (push) Successful in 1m24s
Unit Testing / test (3.9) (push) Successful in 1m24s
Unit Testing / test (3.10) (push) Successful in 1m26s
Unit Testing / test (3.11) (push) Successful in 1m27s
Unit Testing / test (3.8) (push) Successful in 1m21s
Unit Testing / test (3.12) (push) Successful in 1m24s
Unit Testing / test (3.9) (push) Successful in 1m24s
Unit Testing / test (3.10) (push) Successful in 1m26s
Unit Testing / test (3.11) (push) Successful in 1m27s
This commit is contained in:
+12
-3
@@ -605,8 +605,9 @@ class AmorEventData(AmorHeader):
|
||||
output = np.recarray(a1.shape[0]+a2.shape[0], dtype=new_fields)
|
||||
for field in new_fields.fields.keys():
|
||||
output[field] = np.concatenate([a1[field], a2[field]])
|
||||
logging.warning("Missing data when combining datasets, "
|
||||
f"{tuple(a1.dtype.fields.keys())} != {tuple(a2.dtype.fields.keys())}")
|
||||
logging.warning(" Missing data when combining datasets,\n"
|
||||
f" {tuple(a1.dtype.fields.keys())} \n"
|
||||
f" !={tuple(a2.dtype.fields.keys())}")
|
||||
return output
|
||||
|
||||
def append(self, other):
|
||||
@@ -626,7 +627,15 @@ class AmorEventData(AmorHeader):
|
||||
else:
|
||||
new_device_logs = {}
|
||||
for key, slog in self.data.device_logs.items():
|
||||
olog = other.data.device_logs[key]
|
||||
try:
|
||||
olog = other.data.device_logs[key]
|
||||
except KeyError:
|
||||
if getattr(other.experiment, 'end_date', None) is None:
|
||||
logging.warning(f" Device logs for '{key}' not found in dataset to be added, "
|
||||
f"ignoring key as file is not finalized")
|
||||
continue
|
||||
else:
|
||||
raise KeyError(f"Device logs for '{key}' not found in dataset to be added")
|
||||
new_device_logs[key] = np.recarray(slog.shape[0]+olog.shape[0],
|
||||
dtype = slog.dtype)
|
||||
new_device_logs[key].time = np.concatenate([slog.time, olog.time])
|
||||
|
||||
Reference in New Issue
Block a user