diff --git a/eos/__init__.py b/eos/__init__.py index e24061e..b8b6b34 100644 --- a/eos/__init__.py +++ b/eos/__init__.py @@ -2,5 +2,5 @@ Package to handle data redction at AMOR instrument to be used by __main__.py script. """ -__version__ = '3.0.4' +__version__ = '3.0.5' __date__ = '2025-11-04' diff --git a/eos/event_analysis.py b/eos/event_analysis.py index ade1bb6..09f0fa9 100644 --- a/eos/event_analysis.py +++ b/eos/event_analysis.py @@ -25,8 +25,15 @@ class ExtractWalltime(EventDataAction): dataset.data.events = new_events class MergeFrames(EventDataAction): + def __init__(self, lamdaCut=None): + self.lamdaCut=lamdaCut + def perform_action(self, dataset: EventDatasetProtocol)->None: - tofCut = const.lamdaCut*dataset.geometry.chopperDetectorDistance/const.hdm*1e-13 + if self.lamdaCut is None: + lamdaCut = const.lamdaCut + else: + lamdaCut = self.lamdaCut + tofCut = lamdaCut*dataset.geometry.chopperDetectorDistance/const.hdm*1e-13 total_offset = (tofCut + dataset.timing.tau * (dataset.timing.ch1TriggerPhase + dataset.timing.chopperPhase/2)/180) dataset.data.events.tof = merge_frames(dataset.data.events.tof, tofCut, dataset.timing.tau, total_offset) diff --git a/eos/instrument.py b/eos/instrument.py index fc327c7..6040195 100644 --- a/eos/instrument.py +++ b/eos/instrument.py @@ -65,9 +65,14 @@ class LZGrid: def qzRange(self): return self._qzRange - def __init__(self, qResolution, qzRange): + def __init__(self, qResolution, qzRange, lambda_overwrite=None): self._qResolution = qResolution self._qzRange = qzRange + if lambda_overwrite is None: + self.lamdaMax = const.lamdaMax + self.lamdaCut = const.lamdaCut + else: + self.lamdaCut, self.lamdaMax = lambda_overwrite @property @cache @@ -92,8 +97,8 @@ class LZGrid: @cache def lamda(self): - lamdaMax = 16 - lamdaMin = const.lamdaCut + lamdaMax = self.lamdaMax + lamdaMin = self.lamdaCut lamda_grid = lamdaMin*(1+self.dldl)**np.arange(int(np.log(lamdaMax/lamdaMin)/np.log(1+self.dldl)+1)) return lamda_grid diff --git a/eos/projection.py b/eos/projection.py index d78ee5f..9a8f6ce 100644 --- a/eos/projection.py +++ b/eos/projection.py @@ -298,7 +298,7 @@ class LZProjection(ProjectionInterface): plt.colorbar(label='I / cpm') plt.xlabel('$\\lambda$ / $\\AA$') plt.ylabel('$\\Theta$ / °') - plt.xlim(3., 12.) + plt.xlim(self.lamda[0,0], self.lamda[-1,0]) af = self.alphaF[self.data.mask] plt.ylim(af.min(), af.max()) plt.title('Wavelength vs. Reflection Angle') diff --git a/eos/reduction_e2h.py b/eos/reduction_e2h.py index d454d79..c7a2466 100644 --- a/eos/reduction_e2h.py +++ b/eos/reduction_e2h.py @@ -88,7 +88,7 @@ class E2HReduction: self.event_actions |= eh.TofTimeCorrection(self.config.experiment.incidentAngle==IncidentAngle.alphaF) # select needed actions in depenence of plots if self.config.reduction.plot in NEEDS_LAMDA or not self.config.experiment.is_default('lambdaRange'): - self.event_actions |= ea.MergeFrames() + self.event_actions |= ea.MergeFrames(lamdaCut=self.config.experiment.lambdaRange[0]) self.event_actions |= ea.AnalyzePixelIDs(self.config.experiment.yRange) self.event_actions |= eh.TofTimeCorrection(self.config.experiment.incidentAngle==IncidentAngle.alphaF) self.event_actions |= ea.CalculateWavelength(self.config.experiment.lambdaRange) @@ -96,7 +96,7 @@ class E2HReduction: # plot dependant options if self.config.reduction.plot in [E2HPlotSelection.All, E2HPlotSelection.LT, E2HPlotSelection.Q]: - self.grid = LZGrid(0.05, [0.0, 0.25]) + self.grid = LZGrid(0.05, [0.0, 0.25], lambda_overwrite=self.config.experiment.lambdaRange) self.grid.dldl = 0.05 if self.config.reduction.plot in [E2HPlotSelection.All, E2HPlotSelection.Raw,