From 02075c0d759a104f325488ee4feac1574f192cce Mon Sep 17 00:00:00 2001 From: Roman Mankowsky Date: Tue, 22 Jun 2021 18:27:22 +0200 Subject: [PATCH] Added stuff, renamed xrd_you to xrd in eco --- eco/bernina/bernina.py | 2 +- eco/dbase/archiver.py | 16 +++++++++++----- eco/endstations/bernina_diffractometers.py | 15 ++++++++++----- eco/epics/__init__.py | 10 ++++++---- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/eco/bernina/bernina.py b/eco/bernina/bernina.py index 25d7838..adddd00 100644 --- a/eco/bernina/bernina.py +++ b/eco/bernina/bernina.py @@ -229,7 +229,7 @@ namespace.append_obj( Id="SARES21-XRD", configuration=config_berninamesp["xrd_config"], diff_detector={"jf_id": "JF01T03V01"}, - name="xrd_you", + name="xrd", lazy=True, ) diff --git a/eco/dbase/archiver.py b/eco/dbase/archiver.py index 582eeb1..2e2ed5f 100644 --- a/eco/dbase/archiver.py +++ b/eco/dbase/archiver.py @@ -16,7 +16,9 @@ class DataApi: if add_to_cnf: ecocnf.archiver = self - def get_data_time_range(self, channels=[], start=None, end=None, plot=False): + def get_data_time_range( + self, channels=[], start=None, end=None, plot=False, **kwargs + ): if not end: end = datetime.datetime.now() if isinstance(start, datetime.timedelta): @@ -27,6 +29,9 @@ class DataApi: elif isinstance(start, Number): start = datetime.timedelta(seconds=start) start = end + start + else: + start = datetime.timedelta(**kwargs) + start = end + start data = get_data(channels, start=start, end=end, range_type="time") if plot: @@ -36,10 +41,11 @@ class DataApi: x = data.index[sel] y = data[chan][sel] ah.step(x, y, ".-", label=chan, where="post") - plt.xticks(rotation=30) - plt.legend() - plt.tight_layout() - plt.xlabel(data.index.name) + plt.xticks(rotation=30) + plt.legend() + plt.tight_layout() + plt.xlabel(data.index.name) + ah.figure.tight_layout() return data def get_data_pulse_id_range(self, channels=[], start=None, end=None, plot=False): diff --git a/eco/endstations/bernina_diffractometers.py b/eco/endstations/bernina_diffractometers.py index f655c08..3aff9b6 100644 --- a/eco/endstations/bernina_diffractometers.py +++ b/eco/endstations/bernina_diffractometers.py @@ -105,14 +105,19 @@ class GPS(Assembly): ) self._append( - MotorRecord, pvname + ":MOT_MY_RYTH", name="alpha", is_setting=True + MotorRecord, pvname + ":MOT_NY_RY2TH", name="nu", is_setting=True ) + self._append( + MotorRecord, pvname + ":MOT_NY_RY2TH", name="gamma", is_setting=False, is_status=False, + ) + self._append( + MotorRecord, pvname + ":MOT_MY_RYTH", name="mu", is_setting=True + ) + self._append( + MotorRecord, pvname + ":MOT_MY_RYTH", name="alpha", is_setting=False, is_status=False, + ) self.set_base_off = DeltaTauCurrOff("SARES22-GPS:asyn2.AOUT") - ### motors XRD detector arm ### - self._append( - MotorRecord, pvname + ":MOT_NY_RY2TH", name="gamma", is_setting=True - ) if "phi_table" in self.configuration: ### motors phi table ### diff --git a/eco/epics/__init__.py b/eco/epics/__init__.py index 66d5e8b..91d5c37 100644 --- a/eco/epics/__init__.py +++ b/eco/epics/__init__.py @@ -2,14 +2,16 @@ from eco import ecocnf def get_from_archive(Obj, attribute_name="pvname"): - def get_archiver_time_range(self, start=None, end=None, plot=True): + def get_archiver_time_range(self, start=None, end=None, plot=True, **kwargs): """Try to retrieve data within timerange from archiver. A time delta from now is assumed if end time is missing.""" channelname = self.__dict__[attribute_name] return ecocnf.archiver.get_data_time_range( - channels=[channelname], start=start, end=end, plot=plot + channels=[channelname], + start=start, + end=end, + plot=plot, + **kwargs, ) Obj.get_archiver_time_range = get_archiver_time_range return Obj - -