class Wave8V2EventBuilder(BaseInterface, Device): """ Class for controlling the LCLS-II Wave8 event builder registers. """ cnt_rst = Cpt(EpicsSignal, ':CntRst', kind='config') set_metadata(cnt_rst, dict(variety='command-proc', value=1)) hard_rst = Cpt(EpicsSignal, ':HardRst', kind='config') set_metadata(hard_rst, dict(variety='command-proc', value=1)) soft_rst = Cpt(EpicsSignal, ':SoftRst', kind='config') set_metadata(soft_rst, dict(variety='command-proc', value=1)) timer_rst = Cpt(EpicsSignal, ':TimerRst', kind='config') set_metadata(timer_rst, dict(variety='command-proc', value=1)) blowoff_ext = Cpt(EpicsSignalRO, ':BlowoffExt', kind='config') blowoff = Cpt(EpicsSignal, ':Blowoff_RBV', write_pv=':Blowoff', kind='config') bypass = Cpt(EpicsSignal, ':Bypass_RBV', write_pv=':Bypass', kind='config') # DataCnt1 through DataCnt9 are the raw waveforms; captured elsewhere. datacnt0 = Cpt(EpicsSignalRO, ':DataCnt0', kind='config') datacnt10 = Cpt(EpicsSignalRO, ':DataCnt10', kind='config') # NullCnt1 through NullCnt9 are not needed here. nullcnt0 = Cpt(EpicsSignalRO, ':NullCnt0', kind='config') nullcnt10 = Cpt(EpicsSignalRO, ':NullCnt10', kind='config') # TimeoutDropCnt1 through TimeoutDropCnt9 are not needed here. timeout_dropcnt0 = Cpt(EpicsSignalRO, ':NullCnt0', kind='config') timeout_dropcnt10 = Cpt(EpicsSignalRO, ':NullCnt10', kind='config') timeout = Cpt(EpicsSignal, ':Timeout_RBV', write_pv=':Timeout', kind='config') num_slaves_g = Cpt(EpicsSignalRO, ':NUM_SLAVES_G', kind='config') trans_tdest_g = Cpt(EpicsSignalRO, ':TRANS_TDEST_G', kind='config') state = Cpt(EpicsSignalRO, ':State', kind='config') transaction_cnt = Cpt(EpicsSignalRO, ':TransactionCnt', kind='config')
class DetectorDiode(Device): diode = Cpt(EpicsSignalRO, '.VAL', name = 'Diode Current') _default_read_attrs = ['diode']
class StandardPointGrey(SingleTrigger, PointGreyDetector): image = Cpt(ImagePlugin, 'image1:') stats1 = Cpt(StatsPlugin, 'Stats1:') stats2 = Cpt(StatsPlugin, 'Stats2:') stats3 = Cpt(StatsPlugin, 'Stats3:') stats4 = Cpt(StatsPlugin, 'Stats4:') stats5 = Cpt(StatsPlugin, 'Stats5:') trans1 = Cpt(TransformPlugin, 'Trans1:') roi1 = Cpt(ROIPlugin, 'ROI1:') roi2 = Cpt(ROIPlugin, 'ROI2:') roi3 = Cpt(ROIPlugin, 'ROI3:') roi4 = Cpt(ROIPlugin, 'ROI4:') proc1 = Cpt(ProcessPlugin, 'Proc1:') # This class does not save TIFFs. We make it aware of the TIFF plugin # only so that it can ensure that the plugin is not auto-saving. tiff = Cpt(TIFFPluginEnsuredOff, suffix='TIFF1:') @property def hints(self): return {'fields': [self.stats1.total.name]}
class OCMTable(Device): ocm_y_upstream = Cpt(EpicsMotor, 'YU}Mtr') ocm_y_downstream = Cpt(EpicsMotor, 'YD}Mtr') ocm_x_table = Cpt(EpicsMotor, 'X}Mtr')
class FilterBank(Device): flt1 = Cpt(EpicsSignal, '1}Cmd:Opn-Cmd', string=True) flt2 = Cpt(EpicsSignal, '2}Cmd:Opn-Cmd', string=True) flt3 = Cpt(EpicsSignal, '3}Cmd:Opn-Cmd', string=True) flt4 = Cpt(EpicsSignal, '4}Cmd:Opn-Cmd', string=True)
class XIPPlugin(PluginBase): 'A class for the centroiding plugin' _suffix_re = 'XIP\d:' _default_read_attrs = (PluginBase._default_read_attrs + ('count_possible_event', 'count_above_threshold', 'count_below_threshold', 'count_neighbours', 'count_event_2x2', 'count_event_3x3')) _default_configuration_attrs = ( PluginBase._default_configuration_attrs + ('algorithm', 'output_mode', 'bkgd_update_mode', 'bkgd_value', 'sum_3x3_threshold_min', 'sum_3x3_threshold_max', 'hist_start', 'hist_bin_width', 'hist_bin_count', 'source_region', 'dim0_region_start', 'dim0_region_size', 'dim1_region_start', 'dim1_region_size', 'x_expansion_factor', 'y_expansion_factor', 'centroid_correction', 'beamline_energy', 'isolinear_correction', 'isolinear_coefficient_x2_1', 'isolinear_coefficient_x1_1', 'isolinear_coefficient_x0_1', 'isolinear_coefficient_x2_2', 'isolinear_coefficient_x1_2', 'isolinear_coefficient_x0_2', 'isolinear_threshold')) algorithm = Cpt(EpicsSignal, 'ALGORITHM', string=True) output_mode = Cpt(EpicsSignal, 'OUTPUT_MODE', string=True) bkgd_update_mode = Cpt(EpicsSignal, 'BACKGROUND_UPDATE_MODE', string=True) bkgd_value = Cpt(SignalWithRBV, 'BACKGROUND_VALUE') sum_3x3_threshold_min = Cpt(SignalWithRBV, 'SUM3X3_THRESHOLD_MINIMUM') sum_3x3_threshold_max = Cpt(SignalWithRBV, 'SUM3X3_THRESHOLD_MAXIMUM') hist_start = Cpt(SignalWithRBV, 'HISTOGRAM_RANGEMINIMUM') hist_bin_width = Cpt(SignalWithRBV, 'HISTOGRAM_BINWIDTH') hist_bin_count = Cpt(SignalWithRBV, 'HISTOGRAM_BINCOUNT') source_region = Cpt(EpicsSignal, 'ENABLE_SOURCE_REGION', string=True) dim0_region_start = Cpt(SignalWithRBV, 'DIM0_MIN') dim0_region_size = Cpt(SignalWithRBV, 'DIM0_SIZE') dim1_region_start = Cpt(SignalWithRBV, 'DIM1_MIN') dim1_region_size = Cpt(SignalWithRBV, 'DIM1_SIZE') x_expansion_factor = Cpt(SignalWithRBV, 'EXPAND_FACTOR_X') y_expansion_factor = Cpt(SignalWithRBV, 'EXPAND_FACTOR_Y') frames_accumulated = Cpt(EpicsSignalRO, 'FRAMES_ACCUMULATED_RBV') centroid_correction = Cpt(EpicsSignal, 'CENTROID_FILENAME', string=True) beamline_energy = Cpt(EpicsSignal, 'BEAMLINE_ENERGY') isolinear_correction = Cpt(EpicsSignal, 'ENABLE_ISOLINEAR_CORRECTION', string=True) isolinear_coefficient_x2_1 = Cpt(SignalWithRBV, 'ISOLINEAR_COEFFICIENT_X2_1') isolinear_coefficient_x1_1 = Cpt(SignalWithRBV, 'ISOLINEAR_COEFFICIENT_X1_1') isolinear_coefficient_x0_1 = Cpt(SignalWithRBV, 'ISOLINEAR_COEFFICIENT_X0_1') isolinear_coefficient_x2_2 = Cpt(SignalWithRBV, 'ISOLINEAR_COEFFICIENT_X2_2') isolinear_coefficient_x1_2 = Cpt(SignalWithRBV, 'ISOLINEAR_COEFFICIENT_X1_2') isolinear_coefficient_x0_2 = Cpt(SignalWithRBV, 'ISOLINEAR_COEFFICIENT_X0_2') isolinear_threshold = Cpt(EpicsSignal, 'HR_ISOLINEAR_CALIBRATION_THRESHOLD') count_possible_event = Cpt(EpicsSignalRO, 'COUNT_POSSIBLE_EVENT_RBV') count_above_threshold = Cpt(EpicsSignalRO, 'COUNT_ABOVE_THRESHOLD_RBV') count_below_threshold = Cpt(EpicsSignalRO, 'COUNT_BELOW_THRESHOLD_RBV') count_neighbours = Cpt(EpicsSignalRO, 'COUNT_NEIGHBOURING_RBV') count_event_2x2 = Cpt(EpicsSignalRO, 'COUNT_ACTUAL_2X2_RBV') count_event_3x3 = Cpt(EpicsSignalRO, 'COUNT_ACTUAL_3X3_RBV') max_threads = Cpt(SignalWithRBV, 'MAX_THREADS')
class EventSequencer(Device, MonitorFlyerMixin, FlyerInterface): """ Event Sequencer The LCLS Event Sequencer implemented as an Flyer; i.e it has the methods :meth:`.kickoff`, :meth:`.complete` and :meth:`.collect`. This allows the EventSequencer to be used succinctly with the `fly_during_wrapper` and associated preprocessor. Parameters ---------- prefix: str Base prefix of the EventSequencer name : str Name of Event Sequencer object Examples -------- Run the EventSequencer throughout my scan .. code:: fly_during_wrapper(scan([det], motor, ...), [sequencer]) Run the EventSequencer at each step in my scan after completing the motor move and detector reading: .. code:: def step_then_sequence(detectors, step, pos_cache) yield from one_nd_step(detectors, step, pos_cache) yield from kickoff(sequencer) yield from complete(sequencer) # Waits for sequence to complete if # not in "Run Forever" mode scan([det], motor, ..., per_step=step_then_sequence) Note ---- It is ambiguous what the correct behavior for the EventSequencer is when we pause and resume during a scan. The current implementation will stop the EventSequencer and restart the sequence from the beginning. This may impact applications which depend on a long single looped sequence running through out the scan """ play_control = Cpt(EpicsSignal, ':PLYCTL', kind='omitted') sequence_length = Cpt(EpicsSignal, ':LEN', kind='config') current_step = Cpt(EpicsSignal, ':CURSTP', kind='normal') play_count = Cpt(EpicsSignal, ':PLYCNT', kind='normal') play_status = Cpt(EpicsSignalRO, ':PLSTAT', auto_monitor=True, kind='normal') play_mode = Cpt(EpicsSignal, ':PLYMOD', kind='config') sync_marker = Cpt(EpicsSignal, ':SYNCMARKER', kind='config') next_sync = Cpt(EpicsSignal, ':SYNCNEXTTICK', kind='config') pulse_req = Cpt(EpicsSignal, ':BEAMPULSEREQ', kind='config') sequence_owner = Cpt(EpicsSignalRO, ':HUTCH_NAME', kind='omitted') def __init__(self, prefix, *, name=None, monitor_attrs=None, **kwargs): monitor_attrs = monitor_attrs or ['current_step', 'play_count'] # Device initialization super().__init__(prefix, name=name, monitor_attrs=monitor_attrs, **kwargs) @raise_if_disconnected def kickoff(self): """ Start the EventSequencer Returns ------- status : SubscriptionStatus Status indicating whether or not the EventSequencer has started """ self.start() # Start monitor signals super().kickoff() # Create our status def done(*args, value=None, old_value=None, **kwargs): return value == 2 and old_value == 0 # Create our status object return SubscriptionStatus(self.play_status, done, run=True) @raise_if_disconnected def start(self): """ Start the EventSequencer """ # Start the sequencer logger.debug("Starting EventSequencer ...") self.play_control.put(1) def pause(self): """Stop the event sequencer and stop monitoring events""" # Order a stop self.stop() # Pause monitoring super().pause() def resume(self): """Resume the EventSequencer procedure""" super().resume() self.start() def complete(self): """ Complete the EventSequencer's current sequence The result of this method varies on the mode that the EventSequencer is configured. If the EventSequencer is either set to "Run Once" or "Run N Times" this method allows the current sequence to complete and returns a status object that indicates a successful completion. However, this mode of operation does not make sense if the EventSequencer is in "Run Forever" mode. In this case, the EventSequencer is stopped immediately and a completed status object is returned. Returns ------- status: DeviceStatus or SubscriptionStatus Status indicating completion of sequence Note ---- If you want to stop the sequence from running regardless of configuration use the :meth:`.stop` command. """ # Clear the monitor subscriptions super().complete() # If we are running forever we can stop whenever if self.play_mode.get() == 2: logger.debug("EventSequencer is set to run forever, " "stopping immediately") self.stop() return DeviceStatus(self, done=True, success=True) # Otherwise we should wait for the sequencer to end def done(*args, value=None, old_value=None, **kwargs): return value == 0 and old_value == 2 # Create a SubscriptionStatus logger.debug("EventSequencer has a determined stopping point, " " waiting for sequence to complete") st = SubscriptionStatus(self.play_status, done, run=True) return st def stop(self): """Stop the EventSequencer""" logger.debug("Stopping the EventSequencer") self.play_control.put(0)
class Wave8V2(Wave8V2Simple): """ Complete top-level class for the LCLS-II Wave8. Put _all_ the things in. """ sys_regs = Cpt(Wave8V2SystemRegs, ':SystemRegs') raw_buffers = Cpt(Wave8V2RawBuffers, ':RawBuffers') sfp0 = Cpt(Wave8V2Sfp, ':Sfp0') # Typ. DAQ fiber sfp1 = Cpt(Wave8V2Sfp, ':Sfp1') # Typ. Controls fiber sfp2 = Cpt(Wave8V2Sfp, ':Sfp2') # Typ. LCLS-II timing sfp3 = Cpt(Wave8V2Sfp, ':Sfp3') # Typ. LCLS-I timing adc_config0 = Cpt(Wave8V2ADCRegs, ':AdcConfig0') adc_config1 = Cpt(Wave8V2ADCRegs, ':AdcConfig1') adc_config2 = Cpt(Wave8V2ADCRegs, ':AdcConfig2') adc_config3 = Cpt(Wave8V2ADCRegs, ':AdcConfig3') adc_sample_readout0 = Cpt(Wave8V2ADCSampleReadout, ':AdcReadout0') adc_sample_readout1 = Cpt(Wave8V2ADCSampleReadout, ':AdcReadout1') adc_sample_readout2 = Cpt(Wave8V2ADCSampleReadout, ':AdcReadout2') adc_sample_readout3 = Cpt(Wave8V2ADCSampleReadout, ':AdcReadout3') axi_version = Cpt(Wave8V2AxiVersion, ':AxiVersion') event_builder = Cpt(Wave8V2EventBuilder, ':EventBuilder') evr_v2 = Cpt(Wave8V2EvrV2, ':EvrV2') integrators = Cpt(Wave8V2Integrators, ':Integrators') pgp_mon0 = Cpt(Wave8V2PgpMon, ':PgpMon0') pgp_mon1 = Cpt(Wave8V2PgpMon, ':PgpMon1') timing = Cpt(Wave8V2Timing, ':Timing') trigger_event_manager = Cpt(Wave8V2TriggerEventManager, ':TrEvent') xpm_mini = Cpt(Wave8V2XpmMini, ':XpmMini') xpm_msg = Cpt(Wave8V2XpmMsg, ':TrEvent')
class Qadc(QadcBase): """ Class for older qadc, based on Abaco FMC126. """ gain0_i = Cpt(EpicsSignal, ":GAIN0_I", kind="omitted") gain0_ni = Cpt(EpicsSignal, ":GAIN0_NI", kind="omitted") gain1_i = Cpt(EpicsSignal, ":GAIN1_I", kind="omitted") gain1_ni = Cpt(EpicsSignal, ":GAIN1_NI", kind="omitted") gain2_i = Cpt(EpicsSignal, ":GAIN2_I", kind="omitted") gain2_ni = Cpt(EpicsSignal, ":GAIN2_NI", kind="omitted") gain3_i = Cpt(EpicsSignal, ":GAIN3_I", kind="omitted") gain3_ni = Cpt(EpicsSignal, ":GAIN3_NI", kind="omitted") ichan = Cpt(EpicsSignal, ":ICHAN", kind="config") interleave = Cpt(EpicsSignal, ":INTERLEAVE", kind="config") length = Cpt(EpicsSignal, ":LENGTH", kind="config") off0_i = Cpt(EpicsSignal, ":OFF0_I", kind="omitted") off0_ni = Cpt(EpicsSignal, ":OFF0_NI", kind="omitted") off1_i = Cpt(EpicsSignal, ":OFF1_I", kind="omitted") off1_ni = Cpt(EpicsSignal, ":OFF1_NI", kind="omitted") off2_i = Cpt(EpicsSignal, ":OFF2_I", kind="omitted") off2_ni = Cpt(EpicsSignal, ":OFF2_NI", kind="omitted") off3_i = Cpt(EpicsSignal, ":OFF3_I", kind="omitted") off3_ni = Cpt(EpicsSignal, ":OFF3_NI", kind="omitted") out = Cpt(EpicsSignalRO, ":OUT", kind="normal") rawdata = Cpt(EpicsSignalRO, ":RAWDATA", kind="normal") start = Cpt(EpicsSignal, ":START", kind="normal") train = Cpt(EpicsSignal, ":TRAIN", kind="omitted") trig_delay = Cpt(EpicsSignal, ":TRIG_DELAY", kind="config") trig_event = Cpt(EpicsSignal, ":TRIG_EVENT", kind="config")
class Wave8V2TriggerEventManager(BaseInterface, Device): """ Class for controlling the LCLS-II Wave8 trigger event manager. """ master_enable = Cpt(EpicsSignal, ':MasterEnable_RBV', write_pv=':MasterEnable', kind='config') fifo_overflow = Cpt(EpicsSignalRO, ':FifoOverflow', kind='config') fifo_pause = Cpt(EpicsSignalRO, ':FifoPause', kind='config') fifo_reset = Cpt(EpicsSignal, ':FifoReset', kind='config') fifo_wr_cnt = Cpt(EpicsSignalRO, ':FifoWrCnt', kind='config') l0_cnt = Cpt(EpicsSignalRO, ':L0Count', kind='config') l1_accept_cnt = Cpt(EpicsSignalRO, ':L1AcceptCount', kind='config') l1_reject_cnt = Cpt(EpicsSignalRO, ':L1RejectCount', kind='config') partition = Cpt(EpicsSignal, ':Partition_RBV', write_pv=':Partition', kind='config') pause_threshold = Cpt(EpicsSignal, ':PauseThreshold_RBV', write_pv=':PauseThreshold', kind='config') pause_to_trig = Cpt(EpicsSignalRO, ':PauseToTrig', kind='config') not_pause_to_trig = Cpt(EpicsSignalRO, ':NotPauseToTrig', kind='config') reset_counters = Cpt(EpicsSignal, ':ResetCounters', kind='config') transition_count = Cpt(EpicsSignalRO, ':TransitionCount', kind='config') trigger_count = Cpt(EpicsSignalRO, ':TriggerCount', kind='config') trigger_delay = Cpt(EpicsSignal, ':TriggerDelay_RBV', write_pv=':TriggerDelay_RBV', kind='config')
class Wave8V2XpmMsg(BaseInterface, Device): """ Class for the LCLS-II Wave8 XPM message related PVs. """ xpm_message_cnt = Cpt(EpicsSignalRO, ':XpmMessageCount', kind='config') xpm_overflow = Cpt(EpicsSignalRO, ':XpmOverflow', kind='config') xpm_pause = Cpt(EpicsSignal, ':XpmPause', kind='config') xpmmsg_partition_delay0 = Cpt(EpicsSignal, ':XpmMsg:PartitionDelay0', kind='config') xpmmsg_partition_delay1 = Cpt(EpicsSignal, ':XpmMsg:PartitionDelay1', kind='config') xpmmsg_partition_delay2 = Cpt(EpicsSignal, ':XpmMsg:PartitionDelay2', kind='config') xpmmsg_partition_delay3 = Cpt(EpicsSignal, ':XpmMsg:PartitionDelay3', kind='config') xpmmsg_partition_delay4 = Cpt(EpicsSignal, ':XpmMsg:PartitionDelay4', kind='config') xpmmsg_partition_delay5 = Cpt(EpicsSignal, ':XpmMsg:PartitionDelay5', kind='config') xpmmsg_partition_delay6 = Cpt(EpicsSignal, ':XpmMsg:PartitionDelay6', kind='config') xpmmsg_partition_delay7 = Cpt(EpicsSignal, ':XpmMsg:PartitionDelay7', kind='config') xpmmsg_rx_id = Cpt(EpicsSignalRO, ':XpmMsg:RxId', kind='config') xpmmsg_tx_id = Cpt(EpicsSignal, ':XpmMsg:TxId_RBV', write_pv=':XpmMsg:TxId', kind='config')
class Wave8V2Timing(BaseInterface, Device): """ Class for controlling the LCLS-II Wave8 timing registers. """ clk_sel = Cpt(EpicsSignal, ':ClkSel_RBV', write_pv=':ClkSel', kind='config') c_rx_reset = Cpt(EpicsSignal, ':C_RxReset', kind='config') eof_count = Cpt(EpicsSignal, ':eofCount', kind='config') fid_count = Cpt(EpicsSignal, ':FidCount', kind='config') mode_sel_en = Cpt(EpicsSignal, ':ModeSelEn_RBV', write_pv=':ModeSelEn', kind='config') mode_sel = Cpt(EpicsSignal, ':ModeSel_RBV', write_pv=':ModeSel', kind='config') rx_down = Cpt(EpicsSignal, ':RxDown_RBV', write_pv=':RxDown', kind='config') rx_link_up = Cpt(EpicsSignalRO, ':RxLinkUp', kind='config') rx_pll_rst = Cpt(EpicsSignal, ':RxPllReset_RBV', write_pv=':RxPllReset', kind='config') sof_cnt = Cpt(EpicsSignalRO, ':sofCount', kind='config') rx_user_rst = Cpt(EpicsSignal, ':timingRxUserRst', kind='config') tx_user_rst = Cpt(EpicsSignal, ':timingTxUserRst', kind='config') use_mini_tpg = Cpt(EpicsSignal, ':UseMiniTpg_RBV', write_pv=':UseMiniTpg', kind='config')
class Wave8V2PgpMon(BaseInterface, Device): """ Class for monitoring the PGP status of the LCLS-II Wave8. """ count_reset = Cpt(EpicsSignal, ':CountReset', kind='config') rx_eb_overflow_cnt = Cpt(EpicsSignalRO, ':RxStatus:EbOverflowCnt', kind='config') rx_frame_cnt = Cpt(EpicsSignalRO, ':RxStatus:FrameCnt', kind='config') rx_link_down_cnt = Cpt(EpicsSignalRO, ':RxStatus:LinkDownCnt', kind='config') rx_link_error_cnt = Cpt(EpicsSignalRO, ':RxStatus:LinkErrorCnt', kind='config') rx_link_ready_cnt = Cpt(EpicsSignalRO, ':RxStatus:LinkReadyCnt', kind='config') rx_link_ready = Cpt(EpicsSignalRO, ':RxStatus:LinkReady', kind='config') rx_phy_active_cnt = Cpt(EpicsSignalRO, ':RxStatus:PhyActiveCnt', kind='config') rx_phy_active = Cpt(EpicsSignalRO, ':RxStatus:PhyActive', kind='config') rx_rem_overflow_cnt0 = Cpt(EpicsSignalRO, ':RxStatus:RemOverflowCnt0', kind='config') rx_rem_overflow_cnt1 = Cpt(EpicsSignalRO, ':RxStatus:RemOverflowCnt1', kind='config') rx_rem_overflow_cnt2 = Cpt(EpicsSignalRO, ':RxStatus:RemOverflowCnt2', kind='config') rx_rem_overflow_cnt3 = Cpt(EpicsSignalRO, ':RxStatus:RemOverflowCnt3', kind='config') rx_rem_link_ready_cnt = Cpt(EpicsSignalRO, ':RxStatus:RemRxLinkReadyCnt', kind='config') rx_rem_link_ready = Cpt(EpicsSignalRO, ':RxStatus:RemRxLinkReady', kind='config') tx_frame_cnt = Cpt(EpicsSignalRO, ':TxStatus:FrameCnt', kind='config') tx_link_ready_cnt = Cpt(EpicsSignalRO, ':TxStatus:LinkReadyCnt', kind='config') tx_link_ready = Cpt(EpicsSignalRO, ':TxStatus:LinkReady', kind='config') tx_loc_overflow_cnt0 = Cpt(EpicsSignalRO, ':TxStatus:LocOverflowCnt0', kind='config') tx_loc_overflow_cnt1 = Cpt(EpicsSignalRO, ':TxStatus:LocOverflowCnt1', kind='config') tx_loc_overflow_cnt2 = Cpt(EpicsSignalRO, ':TxStatus:LocOverflowCnt2', kind='config') tx_loc_overflow_cnt3 = Cpt(EpicsSignalRO, ':TxStatus:LocOverflowCnt3', kind='config') tx_phy_active_cnt = Cpt(EpicsSignalRO, ':TxStatus:PhyActiveCnt', kind='config') tx_phy_active = Cpt(EpicsSignalRO, ':TxStatus:PhyActive', kind='config')
class Wave8V2Integrators(BaseInterface, Device): """ Class for controlling the LCLS-II Wave8 integrators. """ # Including PVs based on EDM GUI. integral_size = Cpt(EpicsSignal, ':IntegralSize_RBV', write_pv=':IntegralSize', kind='config') baseline_size = Cpt(EpicsSignal, ':BaselineSize_RBV', write_pv=':BaselineSize', kind='config') trig_delay = Cpt(EpicsSignal, ':TrigDelay_RBV', write_pv=':TrigDelay', kind='config') quadrant_sel = Cpt(EpicsSignal, ':QuadrantSel_RBV', write_pv=':QuadrantSel', kind='config') corr_coeff_raw0 = Cpt(EpicsSignal, ':CorrCoefficientRaw0_RBV', write_pv=':CorrCoefficientRaw0', kind='config') corr_coeff_raw1 = Cpt(EpicsSignal, ':CorrCoefficientRaw1_RBV', write_pv=':CorrCoefficientRaw1', kind='config') corr_coeff_raw2 = Cpt(EpicsSignal, ':CorrCoefficientRaw2_RBV', write_pv=':CorrCoefficientRaw2', kind='config') cnt_rst = Cpt(EpicsSignal, ':CntRst_RBV', write_pv=':CntRst', kind='config') proc_fifo_pause_thresh = Cpt(EpicsSignal, ':ProcFifoPauseThreshold', kind='config') int_fifo_pause_thresh = Cpt(EpicsSignal, ':IntFifoPauseThreshold_RBV', write_pv=':IntFifoPauseThreshold', kind='config') intensity_raw = Cpt(EpicsSignalRO, ':IntensityRaw', kind='config') pos_x_raw = Cpt(EpicsSignalRO, ':PositionXRaw', kind='config') pos_y_raw = Cpt(EpicsSignalRO, ':PositionYRaw', kind='config') adc_integral0 = Cpt(EpicsSignalRO, ':AdcIntegral0', kind='config') adc_integral7 = Cpt(EpicsSignalRO, ':AdcIntegral7', kind='config') baseline0 = Cpt(EpicsSignalRO, ':Baseline0', kind='config') baseline7 = Cpt(EpicsSignalRO, ':Baseline7', kind='config') proc_fifo_pause_cnt = Cpt(EpicsSignalRO, ':ProcFifoPauseCnt', kind='config') int_fifo_pause_cnt = Cpt(EpicsSignalRO, ':IntFifoPauseCnt', kind='config') trig_cnt = Cpt(EpicsSignalRO, ':TrigCnt', kind='config')
class SSRLXspress3Detector(XspressTrigger, Xspress3Detector): roi_data = Cpt(PluginBase, 'ROIDATA:') channel1 = Cpt(Xspress3Channel, 'C1_', channel_num=1, read_attrs=['rois']) channel2 = Cpt(Xspress3Channel, 'C2_', channel_num=2, read_attrs=['rois']) hdf5 = Cpt(Xspress3FileStore, 'HDF5:', write_path_template='/home/xspress3/data', read_path_template='/home/xspress3/data') def __init__(self, prefix, *, configuration_attrs=None, read_attrs=None, **kwargs): if configuration_attrs is None: configuration_attrs = [ 'external_trig', 'total_points', 'spectra_per_point', 'settings', 'rewindable' ] if read_attrs is None: read_attrs = ['channel1', 'channel2', 'hdf5'] super().__init__(prefix, configuration_attrs=configuration_attrs, read_attrs=read_attrs, **kwargs) self._asset_docs_cache = deque() self._datum_counter = None def trigger(self): if self.hdf5.capture.get() == 0: # create new resource document, stage does this the first time self.hdf5._fn = self.hdf5.file_template.get() % ( self.hdf5._fp, self.hdf5.file_name.get(), self.hdf5.file_number.get()) self.hdf5._generate_resource({}) self.hdf5._filestore_res = self.hdf5._asset_docs_cache[-1][-1] #stage() turns this on once, but subsequent triggers don't self.hdf5.capture.put(1) ret = super().trigger() return ret def stop(self): # .stop() walks back to Device class... which does not return anything #print('>>>>>>>>>>>>>>>>>>>>>>>> xsp3.stop') ret = super().stop() self.hdf5.stop() return ret def stage(self): if self.spectra_per_point.get() != 1: raise NotImplementedError( "multi spectra per point not supported yet") ret = super().stage() self._datum_counter = itertools.count() return ret def unstage(self): #self.settings.trigger_mode.put(0) # 'Software' super().unstage() self._datum_counter = None def complete(self, *args, **kwargs): for resource in self.hdf5._asset_docs_cache: self._asset_docs_cache.append(('resource', resource[1])) self._datum_ids = [] num_frames = self.hdf5.num_captured.get() for frame_num in range(num_frames): for channel_num in self.hdf5.channels: # Channels (1, 2) as of 03/04/2020 datum_id = '{}/{}'.format(self.hdf5._resource_uid, next(self._datum_counter)) datum = { 'resource': self.hdf5._resource_uid, 'datum_kwargs': { 'frame': frame_num, 'channel': channel_num }, 'datum_id': datum_id } self._asset_docs_cache.append(('datum', datum)) self._datum_ids.append(datum_id) return NullStatus() def collect(self): now = ttime.time() print(f'now: {now}') for datum_id in self._datum_ids: data = {self.name: datum_id} yield { 'data': data, 'timestamps': {key: now for key in data}, 'time': now, # TODO: use the proper timestams from the mono start and stop times 'filled': {key: False for key in data} } def collect_asset_docs(self): file_plugins = [ s for s in self._signals.values() if hasattr(s, 'collect_asset_docs') ] for p in file_plugins: yield from p.collect_asset_docs()
class Qadc134(QadcBase): """ Class for the Abaco FMC134 digitizer card. """ sparsification = Cpt(Qadc134Sparsification, '', kind='omitted') full_en = Cpt(EpicsSignal, ":FULL_EN_RBV", write_pv=":FULL_EN", kind="config", doc="Enable full size output arrays") ichan = Cpt(EpicsSignal, ":ICHAN_RBV", write_pv=":ICHAN", kind="config", doc="Interleave channel") interleave = Cpt(EpicsSignal, ":INTERLEAVE_RBV", write_pv=":INTERLEAVE", kind="config", doc="Enable interleaving on ichan") length = Cpt(EpicsSignal, ":LENGTH_RBV", write_pv=":LENGTH", kind="config") prescale = Cpt(EpicsSignal, ":PRESCALE_RBV", write_pv=":PRESCALE", kind="config") trig_delay = Cpt(EpicsSignal, ":TRIG_DELAY_RBV", write_pv=":TRIG_DELAY", kind="config", doc="Delay in 156.17 MHz ticks") trig_event = Cpt(EpicsSignal, ":TRIG_EVENT_RBV", write_pv=":TRIG_EVENT", kind="config") clear_config = Cpt(EpicsSignal, ":CLEAR_CONFIG", kind="config") set_metadata(clear_config, dict(variety='command-proc', value=1)) out0 = Cpt(EpicsSignalRO, ":OUT0", kind="normal", doc="Signal in Volts") out1 = Cpt(EpicsSignalRO, ":OUT1", kind="normal", doc="Signal in Volts") rawdata0 = Cpt(EpicsSignalRO, ":RAWDATA0", kind="normal", doc="Signal in ADU") rawdata1 = Cpt(EpicsSignalRO, ":RAWDATA1", kind="normal", doc="Signal in ADU") start = Cpt(EpicsSignal, ":START", kind="normal")
class Annealer(Device): air = Cpt(EpicsSignal, 'Air-Sel') status = Cpt(EpicsSignalRO, 'In-Sts') # status: 0 (Not In), 1 (In)
class Wave8V2RawBuffers(BaseInterface, Device): """ Class for LCLS-II Wave8 raw buffer registers. """ buffer0_enable = Cpt(EpicsSignal, ':BuffEn0_RBV', write_pv=':BuffEn0', kind='config') buffer1_enable = Cpt(EpicsSignal, ':BuffEn1_RBV', write_pv=':BuffEn1', kind='config') buffer2_enable = Cpt(EpicsSignal, ':BuffEn2_RBV', write_pv=':BuffEn2', kind='config') buffer3_enable = Cpt(EpicsSignal, ':BuffEn3_RBV', write_pv=':BuffEn3', kind='config') buffer4_enable = Cpt(EpicsSignal, ':BuffEn4_RBV', write_pv=':BuffEn4', kind='config') buffer5_enable = Cpt(EpicsSignal, ':BuffEn5_RBV', write_pv=':BuffEn5', kind='config') buffer6_enable = Cpt(EpicsSignal, ':BuffEn6_RBV', write_pv=':BuffEn6', kind='config') buffer7_enable = Cpt(EpicsSignal, ':BuffEn7_RBV', write_pv=':BuffEn7', kind='config') overflow_cnt_buffer0 = Cpt(EpicsSignal, ':OvflCntBuff0_RBV', write_pv=':OvflCntBuff0', kind='config') # Currently excluded from EDM screen. # overflow_cnt_buffer1 = Cpt(EpicsSignal, ':OvflCntBuff1_RBV', # write_pv=':OvflCntBuff1', kind='config') # overflow_cnt_buffer2 = Cpt(EpicsSignal, ':OvflCntBuff2_RBV', # write_pv=':OvflCntBuff2', kind='config') # overflow_cnt_buffer3 = Cpt(EpicsSignal, ':OvflCntBuff3_RBV', # write_pv=':OvflCntBuff3', kind='config') # overflow_cnt_buffer4 = Cpt(EpicsSignal, ':OvflCntBuff4_RBV', # write_pv=':OvflCntBuff4', kind='config') # overflow_cnt_buffer5 = Cpt(EpicsSignal, ':OvflCntBuff5_RBV', # write_pv=':OvflCntBuff5', kind='config') # overflow_cnt_buffer6 = Cpt(EpicsSignal, ':OvflCntBuff6_RBV', # write_pv=':OvflCntBuff6', kind='config') overflow_cnt_buffer7 = Cpt(EpicsSignal, ':OvflCntBuff7_RBV', write_pv=':OvflCntBuff7', kind='config') buffer_length = Cpt(EpicsSignal, ':BuffLen_RBV', write_pv=':BuffLen', kind='config') trigger_prescale = Cpt(EpicsSignal, ':TrigPrescale_RBV', write_pv=':TrigPrescale', kind='config') counter_reset = Cpt(EpicsSignal, ':CntRst_RBV', write_pv=':CntRst', kind='config') fifo_pause_threshold = Cpt(EpicsSignal, ':FifoPauseThreshold_RBV', write_pv=':FifoPauseThreshold', kind='config') fifo_pause_count = Cpt(EpicsSignalRO, ':FifoPauseCnt', kind='config') trigger_count = Cpt(EpicsSignalRO, ':TrigCnt', kind='config')
class RIXSCam(RIXSSingleTrigger, AreaDetector): exposure = Cpt(TriggeredCamExposure, '') centroid_enable = Cpt(Signal, value=False) xip = Cpt(XIPPlugin, suffix='XIP1:') hdf5 = Cpt( RIXSCamHDF5PluginWithFileStore, suffix='HDF1:', read_path_template='/nsls2/xf02id1/data/RIXSCAM/%Y/%m/%d', #read_path_template='/nsls2/xf02id1/RIXSCAM/DATA/%Y/%m/%d', write_path_template='X:\data\RIXSCAM\\%Y\\%m\\%d\\', #write_path_template='X:\nsls2\xf02id1\RIXSCAM\DATA\\%Y\\%m\\%d\\', #read_path_template='/XF02ID1/RIXSCAM/DATA/%Y/%m/%d', #root='/XF02ID1', root='/nsls2/xf02id1', reg=db.reg) # Once the hdf2 IOC issues are sorted then Uncomment out the next 6 lines hdf2 = Cpt( RIXSCamHDF5PluginForXIP, suffix='HDF2:', read_path_template='/nsls2/xf02id1/data/RIXSCAM/%Y/%m/%d', #read_path_template='/nsls2/xf02id1/RIXSCAM/DATA/%Y/%m/%d', write_path_template='X:\data\RIXSCAM\\%Y\\%m\\%d\\', root='/nsls2/xf02id1', reg=db.reg) set_node = Cpt(EpicsSignal, 'cam1:SEQ_NODE_SELECTION') # Delays delay_adc = Cpt(EpicsSignal, 'cam1:SEQ_ADC_DELAY') delay_intminus = Cpt(EpicsSignal, 'cam1:SEQ_INT_MINUS_DELAY') delay_intplus = Cpt(EpicsSignal, 'cam1:SEQ_INT_PLUS_DELAY') delay_inttime = Cpt(EpicsSignal, 'cam1:SEQ_INT_TIME') delay_serialT = Cpt(EpicsSignal, 'cam1:SEQ_SERIAL_T') delay_parT = Cpt(EpicsSignal, 'cam1:SEQ_PARALLEL_T') # Sensor Physical Size (this will never change) sensor_xsize = 1648 sensor_ysize = 1608 # ROI definition (aka Region size/start) sensor_region_xsize = Cpt(EpicsSignal, 'cam1:SizeX') sensor_region_ysize = Cpt(EpicsSignal, 'cam1:SizeY') sensor_region_xstart = Cpt(EpicsSignal, 'cam1:MinX') sensor_region_ystart = Cpt(EpicsSignal, 'cam1:MinY') # Binning sensor_binning_x = Cpt(EpicsSignal, 'cam1:BinX') sensor_binning_y = Cpt(EpicsSignal, 'cam1:BinY') # Voltages # CCD1 vod1 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_OD_1') vdd1 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_DD_1') vrd1 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_RD_1') vog1 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_OG_1') vss1 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_SS_1') hv_dc1 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_HVDC_1') pedestal = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_PEDESTAL_1') ccd1_hv = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_HV_1') vclk_im1 = Cpt(EpicsSignal, 'cam1:VOLT_CLOCK_IMAGE_1') vclk_st1 = Cpt(EpicsSignal, 'cam1:VOLT_CLOCK_STORE_1') vclk_se1 = Cpt(EpicsSignal, 'cam1:VOLT_CLOCK_SERIAL_1') vclk_rst1 = Cpt(EpicsSignal, 'cam1:VOLT_CLOCK_RESET_1') # CCD2 vod2 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_OD_2') vdd2 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_DD_2') vrd2 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_RD_2') vog2 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_OG_2') vss2 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_SS_2') hv_dc2 = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_HVDC_2') pedestal = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_PEDESTAL_2') ccd2_hv = Cpt(EpicsSignal, 'cam1:VOLT_BIAS_HV_2') vclk_im2 = Cpt(EpicsSignal, 'cam1:VOLT_CLOCK_IMAGE_2') vclk_st2 = Cpt(EpicsSignal, 'cam1:VOLT_CLOCK_STORE_2') vclk_se2 = Cpt(EpicsSignal, 'cam1:VOLT_CLOCK_SERIAL_2') vclk_rst2 = Cpt(EpicsSignal, 'cam1:VOLT_CLOCK_RESET_2') # Temperature Control en_ctr = Cpt(EpicsSignal, 'cam1:TEMP_ENABLE') ctr_mode = Cpt(EpicsSignal, 'cam1:TEMP_MANUAL_MODE') heater_sel = Cpt(EpicsSignal, 'cam1:TEMP_HEATER_SELECT') sensor_sel = Cpt(EpicsSignal, 'cam1:TEMP_SENSOR_SELECT') err_lim = Cpt(EpicsSignal, 'cam1:TEMP_ACCUMULATED_ERROR_LIMIT') out_bias = Cpt(EpicsSignal, 'cam1:TEMP_OUTPUT_BIAS') gain_prop = Cpt(EpicsSignal, 'cam1:TEMP_PROP_GAIN') gain_int = Cpt(EpicsSignal, 'cam1:TEMP_INT_GAIN') gain_der = Cpt(EpicsSignal, 'cam1:TEMP_DERIV_GAIN') rate_prop = Cpt(EpicsSignal, 'cam1:TEMP_PROP_RATE') rate_int = Cpt(EpicsSignal, 'cam1:TEMP_INT_RATE') rate_der = Cpt(EpicsSignal, 'cam1:TEMP_DERIV_RATE') def set_HR_RT(self): yield from self.set_HR() yield from mv(self.vss1, 9.0) yield from mv(self.vss2, 9.0) def set_LS_RT(self): yield from self.set_LS() yield from mv(self.vss1, 9.0) yield from mv(self.vss2, 9.0) yield from mv(self.ccd1_hv, 20) yield from mv(self.ccd2_hv, 20) def set_voltages(self): yield from mv(self.vod1, 32.85) yield from mv(self.vdd1, 20.02) yield from mv(self.vrd1, 19.08) yield from mv(self.vog1, 5.64) yield from mv(self.vss1, 6.20) yield from mv(self.hv_dc1, 5.73) yield from mv(self.pedestal, 1.16) yield from mv(self.vclk_im1, 6.60) yield from mv(self.vclk_st1, 11.90) yield from mv(self.vclk_se1, 12.38) yield from mv(self.vclk_rst1, 9.02) yield from mv(self.vod2, 32.85) yield from mv(self.vdd2, 20.02) yield from mv(self.vrd2, 19.08) yield from mv(self.vog2, 5.64) yield from mv(self.vss2, 6.20) yield from mv(self.hv_dc2, 5.73) yield from mv(self.pedestal, 1.16) yield from mv(self.vclk_im2, 6.60) yield from mv(self.vclk_st2, 11.90) yield from mv(self.vclk_se2, 12.38) yield from mv(self.vclk_rst2, 9.02) def set_HR(self): # missing Node Readout mode "HR node" yield from self.set_voltages() yield from mv(self.set_node, 1) yield from mv(self.delay_adc, 1) yield from mv(self.delay_intminus, 14) yield from mv(self.delay_intplus, 13) yield from mv(self.delay_inttime, 255) yield from mv(self.delay_serialT, 3) yield from mv(self.delay_parT, 255) yield from mv(self.ccd1_hv, 20) yield from mv(self.ccd2_hv, 20) def set_LS(self): # missing Node Readout mode "LS node" yield from self.set_voltages() yield from mv(self.set_node, 0) yield from mv(self.delay_adc, 168) yield from mv(self.delay_intminus, 4) yield from mv(self.delay_intplus, 2) yield from mv(self.delay_inttime, 80) yield from mv(self.delay_serialT, 255) yield from mv(self.delay_parT, 151) #Calibration done on 10/10/2018 for the CCD HV values below using LED light yield from mv(self.ccd1_hv, 44.5) yield from mv(self.ccd2_hv, 45.1) def set_temp_control(self): yield from mv(self.en_ctr, 'On') yield from mv(self.ctr_mode, 'Auto') yield from mv(self.heater_sel, 'Output 1') yield from mv(self.sensor_sel, 'Input 1') yield from mv(self.err_lim, 8192) yield from mv(self.out_bias, 13087) yield from mv(self.gain_prop, 255) yield from mv(self.gain_int, 255) yield from mv(self.gain_der, 0) yield from mv(self.rate_prop, 128) yield from mv(self.rate_int, 128) yield from mv(self.rate_der, 7) def set_mode(self, mode): '''This function sets the device to either perform centroiding or not. Parameters ---------- mode : str This is a string which indicates weather the detector should be run in centroiding mode ( `mode = 'centroid'`) or image mode ( `mode = 'image'`). ''' if mode == 'image': self.read_attrs = ['hdf5'] yield from mv(self.centroid_enable, False) yield from mv(self.hdf2.enable, 'Disable', self.xip.enable, 'Disable') elif mode == 'centroid': self.read_attrs = ['hdf5', 'hdf2', 'xip'] yield from mv(self.centroid_enable, True) yield from mv(self.hdf2.enable, 'Enable', self.xip.enable, 'Enable') else: raise ValueError( "The input parameter, mode, needs to be 'image' or\ 'centroid' but got {}".format(mode))
class SaturnDXP(EpicsDXP): baseline_energy_array = Cpt(EpicsSignal, 'BaselineEnergyArray') baseline_histogram = Cpt(EpicsSignal, 'BaselineHistogram') calibration_energy = Cpt(EpicsSignal, 'CalibrationEnergy_RBV') current_pixel = Cpt(EpicsSignal, 'CurrentPixel') dynamic_range = Cpt(EpicsSignal, 'DynamicRange_RBV') elapsed_live_time = Cpt(EpicsSignal, 'ElapsedLiveTime') elapsed_real_time = Cpt(EpicsSignal, 'ElapsedRealTime') elapsed_trigger_live_time = Cpt(EpicsSignal, 'ElapsedTriggerLiveTime') energy_threshold = Cpt(EpicsSignalWithRBV, 'EnergyThreshold') gap_time = Cpt(EpicsSignalWithRBV, 'GapTime') max_width = Cpt(EpicsSignalWithRBV, 'MaxWidth') mca_bin_width = Cpt(EpicsSignal, 'MCABinWidth_RBV') num_ll_params = Cpt(EpicsSignal, 'NumLLParams') peaking_time = Cpt(EpicsSignalWithRBV, 'PeakingTime') preset_events = Cpt(EpicsSignalWithRBV, 'PresetEvents') preset_mode = Cpt(EpicsSignalWithRBV, 'PresetMode') preset_triggers = Cpt(EpicsSignalWithRBV, 'PresetTriggers') read_ll_params = Cpt(EpicsSignal, 'ReadLLParams') trace_data = Cpt(EpicsSignal, 'TraceData') trace_mode = Cpt(EpicsSignalWithRBV, 'TraceMode') trace_time_array = Cpt(EpicsSignal, 'TraceTimeArray') trace_time = Cpt(EpicsSignalWithRBV, 'TraceTime') trigger_gap_time = Cpt(EpicsSignalWithRBV, 'TriggerGapTime') trigger_peaking_time = Cpt(EpicsSignalWithRBV, 'TriggerPeakingTime') trigger_threshold = Cpt(EpicsSignalWithRBV, 'TriggerThreshold')
class BeamStop(Device): x = Cpt(EpicsMotor, 'X}Mtr') y = Cpt(EpicsMotor, 'Y}Mtr')
class SaturnMCA(EpicsMCA): # TODO: fix upstream preset_real_time = Cpt(EpicsSignal, '.PRTM') preset_live_time = Cpt(EpicsSignal, '.PLTM') elapsed_real_time = Cpt(EpicsSignalRO, '.ERTM') elapsed_live_time = Cpt(EpicsSignalRO, '.ELTM') check_acquiring = Cpt(EpicsSignal, 'CheckACQG') client_wait = Cpt(EpicsSignal, 'ClientWait') collect_data = Cpt(EpicsSignal, 'CollectData') enable_wait = Cpt(EpicsSignal, 'EnableWait') erase = Cpt(EpicsSignal, 'Erase') erase_start = Cpt(EpicsSignal, 'EraseStart') read_signal = Cpt(EpicsSignal, 'Read') read_callback = Cpt(EpicsSignal, 'ReadCallback') read_data_once = Cpt(EpicsSignal, 'ReadDataOnce') read_status_once = Cpt(EpicsSignal, 'ReadStatusOnce') set_client_wait = Cpt(EpicsSignal, 'SetClientWait') start = Cpt(EpicsSignal, 'Start') status = Cpt(EpicsSignal, 'Status') stop_signal = Cpt(EpicsSignal, 'Stop') when_acq_stops = Cpt(EpicsSignal, 'WhenAcqStops') why1 = Cpt(EpicsSignal, 'Why1') why2 = Cpt(EpicsSignal, 'Why2') why3 = Cpt(EpicsSignal, 'Why3') why4 = Cpt(EpicsSignal, 'Why4')
class ECS(Device): laser_y = Cpt(EpicsMotor, 'Lsr:1-Ax:Y}Mtr') reflective_foil_x = Cpt(EpicsMotor, 'Foil:1-Ax:X}Mtr') filter_wheel_1_phi = Cpt(EpicsMotor, 'Fltr:Whl1-Ax:Phi}Mtr') filter_wheel_2_phi = Cpt(EpicsMotor, 'Fltr:Whl2-Ax:Phi}Mtr')
class Saturn(Device): dxp = Cpt(SaturnDXP, 'dxp1:') mca = Cpt(SaturnMCA, 'mca1') channel_advance = Cpt(EpicsSignal, 'ChannelAdvance') client_wait = Cpt(EpicsSignal, 'ClientWait') dwell = Cpt(EpicsSignal, 'Dwell') max_scas = Cpt(EpicsSignal, 'MaxSCAs') num_scas = Cpt(EpicsSignalWithRBV, 'NumSCAs') poll_time = Cpt(EpicsSignalWithRBV, 'PollTime') prescale = Cpt(EpicsSignal, 'Prescale') save_system = Cpt(EpicsSignalWithRBV, 'SaveSystem') save_system_file = Cpt(EpicsSignal, 'SaveSystemFile') set_client_wait = Cpt(EpicsSignal, 'SetClientWait')
class FilterBankTwoButtonShutter(Device): flt1 = Cpt(TwoButtonShutter, '1}') flt2 = Cpt(TwoButtonShutter, '2}') flt3 = Cpt(TwoButtonShutter, '3}') flt4 = Cpt(TwoButtonShutter, '4}')
class TwoButtonShutter(Device): # TODO: this needs to be fixed in EPICS as these names make no sense # the value coming out of the PV does not match what is shown in CSS open_cmd = Cpt(EpicsSignal, 'Cmd:Opn-Cmd', string=True) open_val = 'Open' close_cmd = Cpt(EpicsSignal, 'Cmd:Cls-Cmd', string=True) close_val = 'Not Open' status = Cpt(EpicsSignalRO, 'Pos-Sts', string=True) fail_to_close = Cpt(EpicsSignalRO, 'Sts:FailCls-Sts', string=True) fail_to_open = Cpt(EpicsSignalRO, 'Sts:FailOpn-Sts', string=True) enabled_status = Cpt(EpicsSignalRO, 'Enbl-Sts', string=True) # user facing commands open_str = 'Open' close_str = 'Close' def set(self, val): if self._set_st is not None: raise RuntimeError(f'trying to set {self.name}' ' while a set is in progress') cmd_map = { self.open_str: self.open_cmd, self.close_str: self.close_cmd } target_map = { self.open_str: self.open_val, self.close_str: self.close_val } cmd_sig = cmd_map[val] target_val = target_map[val] st = DeviceStatus(self) if self.status.get() == target_val: st._finished() return st self._set_st = st print(self.name, val, id(st)) enums = self.status.enum_strs def shutter_cb(value, timestamp, **kwargs): value = enums[int(value)] if value == target_val: self._set_st = None self.status.clear_sub(shutter_cb) st._finished() cmd_enums = cmd_sig.enum_strs count = 0 def cmd_retry_cb(value, timestamp, **kwargs): nonlocal count value = cmd_enums[int(value)] count += 1 if count > 10: cmd_sig.clear_sub(cmd_retry_cb) self._set_st = None self.status.clear_sub(shutter_cb) st._finished(success=False) if value == 'None': if not st.done: time.sleep(.5) cmd_sig.set(1) ts = datetime.datetime.fromtimestamp(timestamp) \ .strftime(_time_fmtstr) if count > 2: msg = '** ({}) Had to reactuate shutter while {}ing' print( msg.format( ts, val if val is not 'Close' else val[:-1])) else: cmd_sig.clear_sub(cmd_retry_cb) cmd_sig.subscribe(cmd_retry_cb, run=False) self.status.subscribe(shutter_cb) cmd_sig.set(1) return st def stop(self, success): import time prev_st = self._set_st if prev_st is not None: while not prev_st.done: time.sleep(.1) self._was_open = (self.open_val == self.status.get()) st = self.set('Close') while not st.done: time.sleep(.5) def resume(self): import time prev_st = self._set_st if prev_st is not None: while not prev_st.done: time.sleep(.1) if self._was_open: st = self.set('Open') while not st.done: time.sleep(.5) def unstage(self): self._was_open = False return super().unstage() def __init__(self, *args, **kwargs): self._was_open = False super().__init__(*args, **kwargs) self._set_st = None self.read_attrs = ['status']
class UTemperatures(Device): 'Undulator temperatures' T1 = Cpt(EpicsSignal, '-Pt:1}T') T2 = Cpt(EpicsSignal, '-Pt:2}T') T3 = Cpt(EpicsSignal, '-Pt:3}T') T4 = Cpt(EpicsSignal, '-Pt:4}T') T5 = Cpt(EpicsSignal, '-Pt:5}T') T6 = Cpt(EpicsSignal, '-Pt:6}T') T7 = Cpt(EpicsSignal, '-Pt:7}T') T8 = Cpt(EpicsSignal, '-Pt:8}T') T9 = Cpt(EpicsSignal, '-Pt:9}T') T10 = Cpt(EpicsSignal, '-Pt:10}T') T11 = Cpt(EpicsSignal, '-Pt:11}T') T12 = Cpt(EpicsSignal, '-Pt:12}T') T13 = Cpt(EpicsSignal, '-Pt:13}T') T14 = Cpt(EpicsSignal, '-Pt:14}T') T15 = Cpt(EpicsSignal, '-Pt:15}T') T16 = Cpt(EpicsSignal, '-Pt:16}T')
class EpicsMotorWithLimits(EpicsMotor): low_limit = Cpt(EpicsSignal, ".LLM") high_limit = Cpt(EpicsSignal, ".HLM")
class StandardPointGreyWithTIFF(StandardPointGrey): tiff = Cpt(TIFFPluginWithFileStore, suffix='TIFF1:', write_path_template='/mnt/ws4/XPDD_Data1/pg1/%Y/%m/%d/', root='/mnt/ws4/XPDD_Data1')
class Wave8V2ADCRegs(BaseInterface, Device): """ Class for accessing LCLS-II Wave8 ADC registers. """ adc_reg_x0006 = Cpt(EpicsSignal, ':AdcReg_0x0006_RBV', write_pv=':AdcReg_0x0006', kind='config') adc_reg_x0007 = Cpt(EpicsSignal, ':AdcReg_0x0007_RBV', write_pv=':AdcReg_0x0007', kind='config') adc_reg_x0008 = Cpt(EpicsSignal, ':AdcReg_0x0008_RBV', write_pv=':AdcReg_0x0008', kind='config') # No x0009, x000A adc_reg_x000B = Cpt(EpicsSignal, ':AdcReg_0x000B_RBV', write_pv=':AdcReg_0x000B', kind='config') adc_reg_x000C = Cpt(EpicsSignal, ':AdcReg_0x000C_RBV', write_pv=':AdcReg_0x000C', kind='config') adc_reg_x000D = Cpt(EpicsSignal, ':AdcReg_0x000D_RBV', write_pv=':AdcReg_0x000D', kind='config') # No x000E adc_reg_x000F = Cpt(EpicsSignal, ':AdcReg_0x000F_RBV', write_pv=':AdcReg_0x000F', kind='config') adc_reg_x0010 = Cpt(EpicsSignal, ':AdcReg_0x0010_RBV', write_pv=':AdcReg_0x0010', kind='config') adc_reg_x0011 = Cpt(EpicsSignal, ':AdcReg_0x0011_RBV', write_pv=':AdcReg_0x0011', kind='config') adc_reg_x0012 = Cpt(EpicsSignal, ':AdcReg_0x0012_RBV', write_pv=':AdcReg_0x0012', kind='config') adc_reg_x0013 = Cpt(EpicsSignal, ':AdcReg_0x0013_RBV', write_pv=':AdcReg_0x0013', kind='config') adc_reg_x0014 = Cpt(EpicsSignal, ':AdcReg_0x0014_RBV', write_pv=':AdcReg_0x0014', kind='config') adc_reg_x0015 = Cpt(EpicsSignal, ':AdcReg_0x0015_RBV', write_pv=':AdcReg_0x0015', kind='config') adc_reg_x0016 = Cpt(EpicsSignal, ':AdcReg_0x0016_RBV', write_pv=':AdcReg_0x0016', kind='config') adc_reg_x0017 = Cpt(EpicsSignal, ':AdcReg_0x0017_RBV', write_pv=':AdcReg_0x0017', kind='config') adc_reg_x0018 = Cpt(EpicsSignal, ':AdcReg_0x0018_RBV', write_pv=':AdcReg_0x0018', kind='config') # No x0019 through x001E adc_reg_x001F = Cpt(EpicsSignal, ':AdcReg_0x001F_RBV', write_pv=':AdcReg_0x001F', kind='config') adc_reg_x0020 = Cpt(EpicsSignal, ':AdcReg_0x0020_RBV', write_pv=':AdcReg_0x0020', kind='config')