diff --git a/libeos/command_line.py b/libeos/command_line.py index 66375ac..3bcda6f 100644 --- a/libeos/command_line.py +++ b/libeos/command_line.py @@ -181,6 +181,7 @@ def command_line_options(): ) reduction_config = ReductionConfig( qResolution = clas.qResolution, + qzRange = clas.qzRange, autoscale = clas.autoscale, thetaRange = clas.thetaRange, thetaRangeR = clas.thetaRangeR, diff --git a/libeos/instrument.py b/libeos/instrument.py index 9a48817..3760eb4 100644 --- a/libeos/instrument.py +++ b/libeos/instrument.py @@ -20,10 +20,11 @@ class Detector: class Grid: - def __init__(self, qResolution): + def __init__(self, qResolution, qzRange): self.lamdaCut = const.lamdaCut self.dldl = 0.005 # Delta lambda / lambda self.qResolution = qResolution + self.qzRange = qzRange def q(self): resolutions = [0.005, 0.01, 0.02, 0.025, 0.04, 0.05, 0.1, 1] @@ -35,7 +36,8 @@ class Grid: # linear up to qq q_grid = np.arange(0, qq, qq*dqdq) # exponential from qq on - q_grid = np.append(q_grid, qq*(1.+dqdq)**np.arange(int(np.log(0.3/qq)/np.log(1+dqdq)))) + q_grid = np.append(q_grid, qq*(1.+dqdq)**np.arange(int(np.log(self.qzRange[1]/qq)/np.log(1+dqdq)))) + q_grid = q_grid[q_grid>=self.qzRange[0]] return q_grid def lamda(self): diff --git a/libeos/options.py b/libeos/options.py index 13dedee..6f2a16c 100644 --- a/libeos/options.py +++ b/libeos/options.py @@ -58,6 +58,7 @@ class ExperimentConfig: @dataclass class ReductionConfig: qResolution: float + qzRange: Tuple[float, float] thetaRange: Tuple[float, float] thetaRangeR: Tuple[float, float] @@ -178,4 +179,4 @@ class EOSConfig: return mlst - \ No newline at end of file + diff --git a/libeos/reduction.py b/libeos/reduction.py index 2ab8e9b..a6f3642 100644 --- a/libeos/reduction.py +++ b/libeos/reduction.py @@ -17,7 +17,7 @@ class AmorReduction: self.reader_config = config.reader self.reduction_config = config.reduction self.output_config = config.output - self.grid = Grid(config.reduction.qResolution) + self.grid = Grid(config.reduction.qResolution, config.experiment.qzRange) self.header = Header() self.header.reduction.call = EOSConfig.call_string(self) @@ -87,15 +87,16 @@ class AmorReduction: headerRqz = self.header.orso_header() headerRqz.data_set = f'Nr {i} : mu = {self.file_reader.mu:6.3f} deg' - # projection on q-grid + # projection on qz-grid q_q, R_q, dR_q, dq_q = self.project_on_qz(qz_lz, ref_lz, err_lz, res_lz, self.norm_lz, self.mask_lz) - filter_q = np.where((self.experiment_config.qzRange[0]>q_q) & (q_q>self.experiment_config.qzRange[1]), - False, True) - q_q = q_q[filter_q] - R_q = R_q[filter_q] - dR_q = dR_q[filter_q] - dq_q = dq_q[filter_q] + # The filtering is now done by restricting the qz-grid + #filter_q = np.where((self.experiment_config.qzRange[0]>q_q) & (q_q>self.experiment_config.qzRange[1]), + # False, True) + #q_q = q_q[filter_q] + #R_q = R_q[filter_q] + #dR_q = dR_q[filter_q] + #dq_q = dq_q[filter_q] if self.reduction_config.autoscale: if i==0: