Fix device_logs being lost when appending to datasets
Unit Testing / test (3.11) (push) Successful in 54s
Unit Testing / test (3.8) (push) Successful in 55s
Unit Testing / test (3.10) (push) Successful in 1m7s
Unit Testing / test (3.12) (push) Successful in 1m8s
Unit Testing / test (3.9) (push) Successful in 1m6s

This commit is contained in:
2026-08-24 12:44:47 +02:00
parent 3327d7d890
commit b98f0decf1
+12 -1
View File
@@ -621,9 +621,20 @@ class AmorEventData(AmorHeader):
new_beam_monitor = None
else:
new_beam_monitor = np.concatenate([self.data.beam_monitor, other.data.beam_monitor]).view(np.recarray)
if self.data.device_logs is None or other.data.device_logs is None:
new_device_logs = None
else:
new_device_logs = {}
for key, slog in self.data.device_logs.items():
olog = other.data.device_logs[key]
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])
new_device_logs[key].value = np.concatenate([slog.value, olog.value])
new_packets = np.concatenate([self.data.packets, other.data.packets]).view(np.recarray)
new_packets.start_index[self.data.packets.shape[0]:] += self.data.events.shape[0]
self.data = AmorEventStream(new_events, new_packets, new_pulses, new_proton_current, new_beam_monitor)
self.data = AmorEventStream(new_events, new_packets, new_pulses, new_proton_current, new_beam_monitor,
new_device_logs)
# Indicate that this is a modified dataset, basically counts number of appends as negative indices
self.last_index = min(self.last_index-1, -1)
self.file_list += other.file_list