class ScalerRecord(RecordBase): alarm_status = Cpt(EpicsSignalRO, '.STAT') code_version = Cpt(EpicsSignalRO, '.VERS') count = Cpt(EpicsSignal, '.CNT') number_of_channels = Cpt(EpicsSignalRO, '.NCH') oneshot_autocount = Cpt(EpicsSignal, '.CONT') prev_count = Cpt(EpicsSignalRO, '.PCNT') scaler_state = Cpt(EpicsSignalRO, '.SS') timer = Cpt(EpicsSignalRO, '.T') user_state = Cpt(EpicsSignalRO, '.US') # - common auto_display_rate_hz = Cpt(EpicsSignal, '.RAT1') auto_mode_delay = Cpt(EpicsSignal, '.DLY1') cnt_output = Cpt(EpicsSignal, '.COUT$', string=True) cnt_output_prompt = Cpt(EpicsSignal, '.COUTP$', string=True) channels = DDC(_scaler_fields('chan', '.S', range(1, NUM_CH + 1))) presets = DDC(_scaler_fields('preset', '.PR', range(1, NUM_CH + 1))) gates = DDC(_scaler_fields('gate', '.G', range(1, NUM_CH + 1))) count_directions = DDC( _scaler_fields('direction', '.D', range(1, NUM_CH + 1))) names = DDC(_string_scaler_fields('name', '.NM', range(1, NUM_CH + 1))) delay = Cpt(EpicsSignal, '.DLY') display_precision = Cpt(EpicsSignal, '.PREC') display_rate_hz = Cpt(EpicsSignal, '.RATE') output_specification = Cpt(EpicsSignalRO, '.OUT$', string=True) time_preset = Cpt(EpicsSignal, '.TP') time_preset_tp1 = Cpt(EpicsSignal, '.TP1') time_base_freq = Cpt(EpicsSignal, '.FREQ') units_name = Cpt(EpicsSignal, '.EGU$', string=True)
class TransformRecord(RecordBase): inputs = DDC(_make_inputs('ABCDEFGHIJKLMNOP')) outputs = DDC(_make_outputs('ABCDEFGHIJKLMNOP')) alarm_status = Cpt(EpicsSignalRO, '.STAT') code_version = Cpt(EpicsSignalRO, '.VERS') # - common calc_option = Cpt(EpicsSignal, '.COPT') display_precision = Cpt(EpicsSignal, '.PREC') input_bitmap = Cpt(EpicsSignal, '.MAP') invalid_link_action = Cpt(EpicsSignal, '.IVLA') units_name = Cpt(EpicsSignal, '.EGU$', string=True)
class CalcRecord(RecordBase): inputs = DDC(_make_inputs('ABCDEFGHIJKL')) alarm_status = Cpt(EpicsSignalRO, '.STAT') last_val_monitored = Cpt(EpicsSignalRO, '.MLST') last_value_alarmed = Cpt(EpicsSignalRO, '.LALM') last_value_archived = Cpt(EpicsSignalRO, '.ALST') # - alarms alarm_deadband = Cpt(EpicsSignal, '.HYST') high_alarm_limit = Cpt(EpicsSignal, '.HIGH') high_severity = Cpt(EpicsSignal, '.HSV') hihi_alarm_limit = Cpt(EpicsSignal, '.HIHI') hihi_severity = Cpt(EpicsSignal, '.HHSV') lolo_alarm_limit = Cpt(EpicsSignal, '.LOLO') lolo_severity = Cpt(EpicsSignal, '.LLSV') low_alarm_limit = Cpt(EpicsSignal, '.LOW') low_severity = Cpt(EpicsSignal, '.LSV') # - calc calculation = Cpt(EpicsSignal, '.CALC$', string=True) # - display archive_deadband = Cpt(EpicsSignal, '.ADEL') display_precision = Cpt(EpicsSignal, '.PREC') high_operating_rng = Cpt(EpicsSignal, '.HOPR') low_operating_range = Cpt(EpicsSignal, '.LOPR') monitor_deadband = Cpt(EpicsSignal, '.MDEL') units_name = Cpt(EpicsSignal, '.EGU$', string=True)
class Transfocator(Device): crl = DDC({'num%d' % i: (EpicsMotor, '%d-Ax:X}Mtr' % i, {}) for i in range(1, 9)}) x = Cpt(EpicsMotor, 'Ves-Ax:X}Mtr') y = Cpt(EpicsMotor, 'Ves-Ax:Y}Mtr') z = Cpt(EpicsMotor, 'Ves-Ax:Z}Mtr') ph = Cpt(EpicsMotor, 'Ves-Ax:Ph}Mtr') th = Cpt(EpicsMotor, 'Ves-Ax:Th}Mtr')
class Lakeshore336(Device): temp = DDC(_temp_fields(["A", "B", "C", "D"])) out1 = Cpt(Lakeshore336Setpoint, "-Out:1}") out2 = Cpt(Lakeshore336Setpoint, "-Out:2}") out3 = Cpt(Lakeshore336Setpoint, "-Out:3}") out4 = Cpt(Lakeshore336Setpoint, "-Out:4}") ChanA = Cpt(Lakeshore336Channel, "-Chan:A}") ChanB = Cpt(Lakeshore336Channel, "-Chan:B}") ChanC = Cpt(Lakeshore336Channel, "-Chan:C}") ChanD = Cpt(Lakeshore336Channel, "-Chan:D}")
class AsubRecord(RecordBase): inputs = DDC(_make_inputs('ABCDEFGHIJKLMNOPQRSTU')) outputs = DDC(_make_outputs('ABCDEFGHIJKLMNOPQRSTU')) alarm_status = Cpt(EpicsSignalRO, '.STAT') old_return_value = Cpt(EpicsSignalRO, '.OVAL') # - display display_precision = Cpt(EpicsSignal, '.PREC') # - output output_event_flag = Cpt(EpicsSignal, '.EFLG') # - sub bad_return_severity = Cpt(EpicsSignal, '.BRSV') initialize_subroutine_name = Cpt(EpicsSignalRO, '.INAM$', string=True) old_subroutine_name = Cpt(EpicsSignalRO, '.ONAM$', string=True) process_subroutine_name = Cpt(EpicsSignal, '.SNAM$', string=True) subroutine_input_enable = Cpt(EpicsSignal, '.LFLG') subroutine_name_link = Cpt(EpicsSignalRO, '.SUBL$', string=True)
class Xspress3Channel(ADBase): roi_name_format = 'Det{self.channel_num}_{roi_name}' roi_sum_name_format = 'Det{self.channel_num}_{roi_name}_sum' rois = DDC(make_rois(range(1, 17))) vis_enabled = Cpt(EpicsSignal, 'PluginControlVal') extra_rois_enabled = Cpt(EpicsSignal, 'PluginControlValExtraROI') def __init__(self, prefix, *, channel_num=None, **kwargs): self.channel_num = int(channel_num) super().__init__(prefix, **kwargs) @property def all_rois(self): for roi in range(1, self.rois.num_rois.get() + 1): yield getattr(self.rois, 'roi{:02d}'.format(roi)) def set_roi(self, index, ev_low, ev_high, *, name=None): '''Set specified ROI to (ev_low, ev_high) Parameters ---------- index : int or Xspress3ROI The roi index or instance to set ev_low : int low eV setting ev_high : int high eV setting name : str, optional The unformatted ROI name to set. Each channel specifies its own `roi_name_format` and `roi_sum_name_format` in which the name parameter will get expanded. ''' if isinstance(index, Xspress3ROI): roi = index else: if index <= 0: raise ValueError('ROI index starts from 1') roi = list(self.all_rois)[index - 1] roi.configure(ev_low, ev_high) if name is not None: roi_name = self.roi_name_format.format(self=self, roi_name=name) roi.name = roi_name roi.value.name = roi_name roi.value_sum.name = self.roi_sum_name_format.format(self=self, roi_name=name) def clear_all_rois(self): '''Clear all ROIs''' for roi in self.all_rois: roi.clear()
class CalcoutRecord(RecordBase): inputs = DDC(_make_inputs('ABCDEFGHIJKL')) alarm_status = Cpt(EpicsSignalRO, '.STAT') calc_valid = Cpt(EpicsSignal, '.CLCV') last_val_monitored = Cpt(EpicsSignalRO, '.MLST') last_value_alarmed = Cpt(EpicsSignalRO, '.LALM') last_value_archived = Cpt(EpicsSignalRO, '.ALST') ocal_valid = Cpt(EpicsSignal, '.OCLV') out_pv_status = Cpt(EpicsSignalRO, '.OUTV') output_delay_active = Cpt(EpicsSignalRO, '.DLYA') output_value = Cpt(EpicsSignal, '.OVAL') prev_value_of_oval = Cpt(EpicsSignal, '.POVL') previous_value = Cpt(EpicsSignal, '.PVAL') # - alarms alarm_deadband = Cpt(EpicsSignal, '.HYST') high_alarm_limit = Cpt(EpicsSignal, '.HIGH') high_severity = Cpt(EpicsSignal, '.HSV') hihi_alarm_limit = Cpt(EpicsSignal, '.HIHI') hihi_severity = Cpt(EpicsSignal, '.HHSV') lolo_alarm_limit = Cpt(EpicsSignal, '.LOLO') lolo_severity = Cpt(EpicsSignal, '.LLSV') low_alarm_limit = Cpt(EpicsSignal, '.LOW') low_severity = Cpt(EpicsSignal, '.LSV') output_execute_delay = Cpt(EpicsSignal, '.ODLY') # - calc calculation = Cpt(EpicsSignal, '.CALC$', string=True) output_calculation = Cpt(EpicsSignal, '.OCAL$', string=True) output_data_opt = Cpt(EpicsSignal, '.DOPT') output_execute_opt = Cpt(EpicsSignal, '.OOPT') # - clock event_to_issue = Cpt(EpicsSignal, '.OEVT') # - display archive_deadband = Cpt(EpicsSignal, '.ADEL') display_precision = Cpt(EpicsSignal, '.PREC') high_operating_rng = Cpt(EpicsSignal, '.HOPR') low_operating_range = Cpt(EpicsSignal, '.LOPR') monitor_deadband = Cpt(EpicsSignal, '.MDEL') units_name = Cpt(EpicsSignal, '.EGU$', string=True) # - output invalid_output_action = Cpt(EpicsSignal, '.IVOA') invalid_output_value = Cpt(EpicsSignal, '.IVOV') output_specification = Cpt(EpicsSignal, '.OUT$', string=True)
class SwaitRecord(RecordBase): alarm_status = Cpt(EpicsSignalRO, '.STAT') calc_valid = Cpt(EpicsSignal, '.CLCV') code_version = Cpt(EpicsSignalRO, '.VERS') dol_pv_status = Cpt(EpicsSignalRO, '.DOLV') inputs = DDC(_make_inputs('ABCDEFGHIJKL')) initialized = Cpt(EpicsSignalRO, '.INIT') last_val_monitored = Cpt(EpicsSignalRO, '.MLST') last_value_archived = Cpt(EpicsSignalRO, '.ALST') out_pv_status = Cpt(EpicsSignalRO, '.OUTV') old_value = Cpt(EpicsSignal, '.OVAL') simulation_mode = Cpt(EpicsSignal, '.SIMM') simulation_value = Cpt(EpicsSignal, '.SVAL') # - alarms high_operating_range = Cpt(EpicsSignal, '.HOPR') output_execute_delay = Cpt(EpicsSignal, '.ODLY') # - bits1 low_operating_range = Cpt(EpicsSignal, '.LOPR') # - calc dol_pv_name = Cpt(EpicsSignal, '.DOLN$', string=True) out_pv_name = Cpt(EpicsSignal, '.OUTN$', string=True) output_data_option = Cpt(EpicsSignal, '.DOPT') output_execute_opt = Cpt(EpicsSignal, '.OOPT') # - clock archive_deadband = Cpt(EpicsSignal, '.ADEL') calculation = Cpt(EpicsSignal, '.CALC$', string=True) desired_output_data = Cpt(EpicsSignal, '.DOLD') event_to_issue = Cpt(EpicsSignal, '.OEVT') monitor_deadband = Cpt(EpicsSignal, '.MDEL') # - common display_precision = Cpt(EpicsSignal, '.PREC') # - pulse sim_input_specifctn = Cpt(EpicsSignal, '.SIOL$', string=True) sim_mode_location = Cpt(EpicsSignal, '.SIML$', string=True) # - select sim_mode_alarm_svrty = Cpt(EpicsSignal, '.SIMS')
class AcalcoutRecord(RecordBase): array_inputs = DDC(_make_inputs(['AA', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH', 'II', 'JJ', 'KK', 'LL'], AcalcoutArrayInput) ) inputs = DDC(_make_inputs('ABCDEFGHIJKL', AcalcoutInput)) alarm_status = Cpt(EpicsSignalRO, '.STAT') array_mod = Cpt(EpicsSignalRO, '.AMASK') array_size_reported_to_clients = Cpt(EpicsSignal, '.SIZE') calc_valid = Cpt(EpicsSignal, '.CLCV') calc_active = Cpt(EpicsSignalRO, '.CACT') calc_status = Cpt(EpicsSignalRO, '.CSTAT') code_version = Cpt(EpicsSignalRO, '.VERS') last_val_monitored = Cpt(EpicsSignalRO, '.MLST') last_value_alarmed = Cpt(EpicsSignalRO, '.LALM') last_value_archived = Cpt(EpicsSignalRO, '.ALST') ocal_valid = Cpt(EpicsSignal, '.OCLV') out_pv_status = Cpt(EpicsSignalRO, '.OUTV') output_delay_active = Cpt(EpicsSignalRO, '.DLYA') output_value = Cpt(EpicsSignal, '.OVAL') prev_value_of_oval = Cpt(EpicsSignal, '.POVL') previous_value = Cpt(EpicsSignal, '.PVAL') wait_for_completion = Cpt(EpicsSignal, '.WAIT') new_array_value_mask = Cpt(EpicsSignalRO, '.NEWM') # - alarms alarm_deadband = Cpt(EpicsSignal, '.HYST') high_alarm_limit = Cpt(EpicsSignal, '.HIGH') high_severity = Cpt(EpicsSignal, '.HSV') hihi_alarm_limit = Cpt(EpicsSignal, '.HIHI') hihi_severity = Cpt(EpicsSignal, '.HHSV') lolo_alarm_limit = Cpt(EpicsSignal, '.LOLO') lolo_severity = Cpt(EpicsSignal, '.LLSV') low_alarm_limit = Cpt(EpicsSignal, '.LOW') low_severity = Cpt(EpicsSignal, '.LSV') output_execute_delay = Cpt(EpicsSignal, '.ODLY') # - calc calculation = Cpt(EpicsSignal, '.CALC$', string=True) output_calculation = Cpt(EpicsSignal, '.OCAL$', string=True) output_data_opt = Cpt(EpicsSignal, '.DOPT') output_execute_opt = Cpt(EpicsSignal, '.OOPT') # - clock event_to_issue = Cpt(EpicsSignal, '.OEVT') # - display archive_deadband = Cpt(EpicsSignal, '.ADEL') display_precision = Cpt(EpicsSignal, '.PREC') high_operating_rng = Cpt(EpicsSignal, '.HOPR') low_operating_range = Cpt(EpicsSignal, '.LOPR') monitor_deadband = Cpt(EpicsSignal, '.MDEL') units_name = Cpt(EpicsSignal, '.EGU$', string=True) # - output invalid_output_action = Cpt(EpicsSignal, '.IVOA') invalid_output_value = Cpt(EpicsSignal, '.IVOV') output_link = Cpt(EpicsSignal, '.OUT$', string=True) # - wave elem_s_in_use = Cpt(EpicsSignal, '.NUSE') number_of_elements = Cpt(EpicsSignalRO, '.NELM')
class Lakeshore336(Device): temp = DDC(_temp_fields(['A','B','C','D'])) out1 = Cpt(Lakeshore336Setpoint, '-Out:1}') out2 = Cpt(Lakeshore336Setpoint, '-Out:2}') out3 = Cpt(Lakeshore336Setpoint, '-Out:3}') out4 = Cpt(Lakeshore336Setpoint, '-Out:4}')
class Syringe_Pump(Device): "Syringe pump controller" vol_sp = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Val:Vol-SP'%i, {}) for i in range(1, 3)}) vol_rb = DDC({'p%d' % i: (EpicsSignalRO, '{Pmp:%s}Val:Vol-RB'%i, {}) for i in range(1, 3)}) rate_sp = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Val:Rate-SP'%i, {}) for i in range(1, 3)}) rate_rb = DDC({'p%d' % i: (EpicsSignalRO, '{Pmp:%s}Val:Rate-RB'%i, {}) for i in range(1, 3)}) dia_sp = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Val:Dia-SP'%i, {}) for i in range(1, 3)}) dia_rb = DDC({'p%d' % i: (EpicsSignalRO, '{Pmp:%s}Val:Dia-RB'%i, {}) for i in range(1, 3)}) dir_sp = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Val:Dir-Sel'%i, {}) for i in range(1, 3)}) dir_rb = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Val:Dir-Sts'%i, {}) for i in range(1, 3)}) vol_unit_sp = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Unit:Vol-Sel'%i, {}) for i in range(1, 3)}) rate_unit_sp = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Unit:Rate-Sel'%i, {}) for i in range(1, 3)}) vol_unit_rb = DDC({'p%d' % i: (EpicsSignalRO, '{Pmp:%s}Unit:Vol-Sel'%i, {}) for i in range(1, 3)}) rate_unit_rb = DDC({'p%d' % i: (EpicsSignalRO, '{Pmp:%s}Unit:Rate-Sel'%i, {}) for i in range(1, 3)}) Run = DDC({'p%s' % i: (EpicsSignal, '{Pmp:%s}Cmd:Run-Cmd'%i, {}) for i in [1,2,'All'] } ) Stop = DDC({'p%s' % i: (EpicsSignal, '{Pmp:%s}Cmd:Stop-Cmd'%i, {}) for i in [1,2,'All'] } ) Purge = DDC({'p%s' % i: (EpicsSignal, '{Pmp:%s}Cmd:Purge-Cmd'%i, {}) for i in [1,2,'All'] } ) disI_vol_rb = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Val:InfDisp-I'%i, {}) for i in [1,2] } ) disI_unit_rb = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Val:InfDisp-I.EGU'%i, {}) for i in [1,2] } ) disW_vol_rb = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Val:WdlDisp-I'%i, {}) for i in [1,2] } ) disW_unit_rb = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Val:WdlDisp-I.EGU'%i, {}) for i in [1,2] } ) Clr = DDC({'p%d' % i: (EpicsSignal, '{Pmp:%s}Cmd:Clr-Cmd'%i, {}) for i in [1,2] } ) p='All' run_all = Cpt(EpicsSignal, '{Pmp:%s}Cmd:Run-Cmd'%p) purge_all = Cpt(EpicsSignal, '{Pmp:%s}Cmd:Purge-Cmd'%p) stop_all = Cpt(EpicsSignal, '{Pmp:%s}Cmd:Stop-Cmd'%p) def get_vol( self, pump =1 ): if pump==1: return self.vol_rb.p1.value else: return self.vol_rb.p2.value def get_vol_unit( self, pump =1 ): if pump==1: return self.vol_unit_rb.p1.value else: return self.vol_unit_rb.p2.value def set_vol_unit( self, pump =1 ): if pump==1: return self.vol_unit_sp.p1.value else: return self.vol_unit_sp.p2.value def get_rate_unit( self, pump =1 ): if pump==1: return self.rate_unit_rb.p1.value else: return self.rate_unit_rb.p2.value def set_rate_unit( self, pump =1 ): if pump==1: return self.rate_unit_sp.p1.value else: return self.rate_unit_sp.p2.value def set_vol( self, val, pump =1 ): if pump==1: return self.vol_sp.p1.set( val) else: return self.vol_sp.p2.set( val) def get_rate( self, pump =1 ): if pump==1: return self.rate_rb.p1.value else: return self.rate_rb.p2.value def set_rate( self, val, pump =1 ): if pump==1: return self.rate_sp.p1.set( val) else: return self.rate_sp.p2.set( val) def get_dia( self, pump =1 ): if pump==1: return self.dia_rb.p1.value else: return self.dia_rb.p2.value def set_dia( self, val, pump =1 ): if pump==1: return self.dia_sp.p1.set( val) else: return self.dia_sp.p2.set( val) def get_dir( self, pump =1 ): if pump==1: return self.dir_rb.p1.value else: return self.dir_rb.p2.value def set_dir( self, val, pump =1 ): if pump==1: return self.dir_sp.p1.set( val) else: return self.dir_sp.p2.set( val) def run( self, pump=1 ): if pump==1: return self.Run.p1.set(1) elif pump==2: return self.Run.p2.set(1) else: return sp.Run.pAll.set(1) def stop( self, pump=1 ): if pump==1: return self.Stop.p1.set(1) elif pump==2: return self.Stop.p2.set(1) else: return self.Stop.pAll.set(1) def get_disvol( self, pump=1, Dir=None, ): '''dir: 0 for infusion, 1 for withdraw ''' if Dir is None: Dir = self.get_dir( pump ) if Dir ==0: if pump==1: return self.disI_vol_rb.p1.value else: return self.disI_vol_rb.p2.value else: if pump==1: return self.disW_vol_rb.p1.value else: return self.disW_vol_rb.p2.value def clr( self, pump=1, Dir=None, ): '''dir: 0 for infusion, 1 for withdraw ''' if Dir is None: Dir = self.get_dir( pump ) if pump==1: return self.Clr.p1.set( Dir ) else: return self.Clr.p2.set( Dir ) @property def hints(self): fields = [] for name in self.component_names: motor = getattr(self, name) fields.extend(motor.hints['fields']) return {'fields': fields}
class Lakeshore336Ext(Lakeshore336): temp = DDC(_temp_fields(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']))
class Lakeshore336(Device): temp = DDC(_temp_fields(['A', 'B'])) #,'C','D'])) ctrl1 = Cpt(Lakeshore336Setpoint, '-Out:1}') ctrl2 = Cpt(Lakeshore336Setpoint, '-Out:2}')
class ThingHaver(Device): a = DDC({'A': (Thing, '', {})})