From 61442005510ecbd8d0c0e9755066a5cac1cc3d74 Mon Sep 17 00:00:00 2001 From: Artur Glavic Date: Tue, 2 Dec 2025 12:58:54 +0100 Subject: [PATCH] Fix raw file entries in header --- eos/normalization.py | 6 ++++-- eos/reduction_e2h.py | 2 +- eos/reduction_reflectivity.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eos/normalization.py b/eos/normalization.py index 1c78848..aeb030f 100644 --- a/eos/normalization.py +++ b/eos/normalization.py @@ -6,6 +6,8 @@ import os import numpy as np from typing import List, Optional +from orsopy import fileio + from .event_data_types import EventDatasetProtocol from .header import Header from .options import NormalisationMethod @@ -46,7 +48,7 @@ class LZNormalisation: self = super().__new__(cls) with open(filename, 'rb') as fh: hash = str(np.load(fh, allow_pickle=True)) - self.file_list = np.load(fh, allow_pickle=True) + self.file_list = np.load(fh, allow_pickle=True).tolist() self.angle = np.load(fh, allow_pickle=True) self.norm = np.load(fh, allow_pickle=True) self.monitor = np.load(fh, allow_pickle=True) @@ -98,7 +100,7 @@ class LZNormalisation: np.save(fh, self.monitor, allow_pickle=False) def update_header(self, header:Header): - header.measurement_additional_files = self.file_list + header.measurement_additional_files = [fileio.File(file=os.path.basename(entry)) for entry in self.file_list] def smooth(self, width): logging.debug(f'apply convolution with gaussian along lambda axis to smooth norm, sigma={width}') diff --git a/eos/reduction_e2h.py b/eos/reduction_e2h.py index 3fd76ed..6e7fa5e 100644 --- a/eos/reduction_e2h.py +++ b/eos/reduction_e2h.py @@ -236,7 +236,7 @@ class E2HReduction: self.event_actions(self.dataset) self.dataset.update_header(self.header) - self.header.measurement_data_files.append(fileio.File(file=fileName.split('/')[-1], + self.header.measurement_data_files.append(fileio.File(file=os.path.basename(fileName), timestamp=self.dataset.fileDate)) def add_data(self): diff --git a/eos/reduction_reflectivity.py b/eos/reduction_reflectivity.py index 6cd4d49..b6488c9 100644 --- a/eos/reduction_reflectivity.py +++ b/eos/reduction_reflectivity.py @@ -149,7 +149,7 @@ class ReflectivityReduction: self.dataset.append(di) for fileName in file_list: - self.header.measurement_data_files.append(fileio.File( file=fileName.split('/')[-1], + self.header.measurement_data_files.append(fileio.File( file=os.path.basename(fileName), timestamp=self.dataset.fileDate)) @@ -367,7 +367,7 @@ class ReflectivityReduction: if reference.data.events.shape[0] > 1e6: self.norm.safe(n_path, self.normevent_actions.action_hash()) - self.header.measurement_additional_files = self.norm.file_list + self.norm.update_header(self.header) self.header.reduction.corrections.append('normalisation with \'additional files\'') def project_on_lz(self, dataset=None):