diff --git a/events2histogram_2025.py b/events2histogram_2025.py index 3ac1f2a..a73a418 100755 --- a/events2histogram_2025.py +++ b/events2histogram_2025.py @@ -144,8 +144,7 @@ class Meta: year_date = str(datetime.today()).split(' ')[0].replace("-", "/", 1) # deside from where to take the control paralemters - #try: - if True: + try: self.mu = float(np.take(fh['/entry1/Amor/instrument_control_parameters/mu'], 0)) self.nu = float(np.take(fh['/entry1/Amor/instrument_control_parameters/nu'], 0)) self.kap = float(np.take(fh['/entry1/Amor/instrument_control_parameters/kap'], 0)) @@ -155,26 +154,26 @@ class Meta: chopperPhase = float(np.take(fh['/entry1/Amor/chopper/phase'], 0)) ch1TriggerPhase = float(np.take(fh['/entry1/Amor/chopper/ch1_trigger_phase'], 0)) polarizationConfigLabel = float(np.take(fh['/entry1/Amor/polarization/configuration/value'], 0)) - #except (KeyError, IndexError): - # logging.warning(f" using parameters from nicos cache") - # cachePath = '/home/amor/cache/' - # value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-mu/'+year_date)).split('\t')[-1] - # self.mu = float(value) - # value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-nu/'+year_date)).split('\t')[-1] - # self.nu = float(value) - # value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-kap/'+year_date)).split('\t')[-1] - # self.kap = float(value) - # value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-kad/'+year_date)).split('\t')[-1] - # self.kad = float(value) - # value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-div/'+year_date)).split('\t')[-1] - # self.div = float(value) - # value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-ch1_speed/'+year_date)).split('\t')[-1] - # chopperSpeed = float(value) - # value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-chopper_speed'+year_date)).split('\t')[-1] - # chopperPhase = float(value) - # value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-chopper_phase'+year_date)).split('\t')[-1] - # ch1TriggerPhase = float(value) - # value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-ch1_trigger_phase'+year_date)).split('\t')[-1] + except (KeyError, IndexError): + logging.warning(f" using parameters from nicos cache") + cachePath = '/home/amor/cache/' + value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-mu/'+year_date)).split('\t')[-1] + self.mu = float(value) + value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-nu/'+year_date)).split('\t')[-1] + self.nu = float(value) + value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-kap/'+year_date)).split('\t')[-1] + self.kap = float(value) + value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-kad/'+year_date)).split('\t')[-1] + self.kad = float(value) + value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-div/'+year_date)).split('\t')[-1] + self.div = float(value) + value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-ch1_speed/'+year_date)).split('\t')[-1] + chopperSpeed = float(value) + value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-chopper_speed'+year_date)).split('\t')[-1] + chopperPhase = float(value) + value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-chopper_phase'+year_date)).split('\t')[-1] + ch1TriggerPhase = float(value) + value = str(subprocess.getoutput('/usr/bin/grep "value" '+cachePath+'nicos-ch1_trigger_phase'+year_date)).split('\t')[-1] self.tau = 30. / chopperSpeed diff --git a/libeos/__init__.py b/libeos/__init__.py index 9e4d443..eab63f5 100644 --- a/libeos/__init__.py +++ b/libeos/__init__.py @@ -3,5 +3,5 @@ Package to handle data redction at AMOR instrument to be used by eos.py script. """ __version__ = '3.0.0' -__date__ = '2025-05-28' +__date__ = '2025-06-08' diff --git a/libeos/command_line.py b/libeos/command_line.py index 4da18dc..f77d6c6 100644 --- a/libeos/command_line.py +++ b/libeos/command_line.py @@ -185,6 +185,7 @@ def command_line_options(): ) experiment_config = ExperimentConfig( sampleModel = clas.sampleModel, + chopperSpeed = clas.chopperSpeed, chopperPhase = clas.chopperPhase, chopperPhaseOffset = clas.chopperPhaseOffset, yRange = clas.yRange, diff --git a/libeos/file_reader.py b/libeos/file_reader.py index 919f84a..a81a353 100644 --- a/libeos/file_reader.py +++ b/libeos/file_reader.py @@ -378,8 +378,7 @@ class AmorData: try: self.mu = float(np.take(self.hdf['/entry1/Amor/instrument_control_parameters/mu'], 0)) self.nu = float(np.take(self.hdf['/entry1/Amor/instrument_control_parameters/nu'], 0)) - self.kap = 0.245 - #self.kap = float(np.take(self.hdf['/entry1/Amor/instrument_control_parameters/kap/value'], 0)) + self.kap = float(np.take(self.hdf['/entry1/Amor/instrument_control_parameters/kap'], 0)) self.kad = float(np.take(self.hdf['/entry1/Amor/instrument_control_parameters/kad'], 0)) self.div = float(np.take(self.hdf['/entry1/Amor/instrument_control_parameters/div'], 0)) self.chopperSpeed = float(np.take(self.hdf['/entry1/Amor/chopper/rotation_speed'], 0)) @@ -393,8 +392,6 @@ class AmorData: logging.warning(" using parameters from nicos cache") year_date = str(self.start_date).replace('-', '/', 1) # TODO: check new cache pathes - #cachePath = '/home/amor/nicosdata/amor/cache/' - #cachePath = '/home/nicos/amorcache/' cachePath = '/home/amor/cache/' value = str(subprocess.getoutput(f'/usr/bin/grep "value" {cachePath}nicos-mu/{year_date}')).split('\t')[-1] self.mu = float(value) diff --git a/libeos/options.py b/libeos/options.py index 8f4e162..91d95da 100644 --- a/libeos/options.py +++ b/libeos/options.py @@ -31,8 +31,8 @@ class Defaults: yRange = [11, 41] qzRange = [0.005, 0.30] chopperSpeed = 500 - chopperPhase = -13.5 - chopperPhaseOffset = 7 + chopperPhase = 0.0 + chopperPhaseOffset = -9.1 muOffset = 0 mu = 0 nu = 0