Fix raw file entries in header
This commit is contained in:
@@ -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}')
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user