diff --git a/pxiii_bec/device_configs/x06da_device_config.yaml b/pxiii_bec/device_configs/x06da_device_config.yaml index eb1b8e5..818b7d6 100644 --- a/pxiii_bec/device_configs/x06da_device_config.yaml +++ b/pxiii_bec/device_configs/x06da_device_config.yaml @@ -1,3 +1,40 @@ +sldi_cenx: + description: FE slit-diaphragm horizontal center + deviceClass: ophyd.EpicsMotor + deviceConfig: {prefix: 'X06DA-FE-SLDI:CENX'} + onFailure: buffer + enabled: true + readoutPriority: monitored + readOnly: false + softwareTrigger: false +sldi_sizex: + description: FE slit-diaphragm horizontal size + deviceClass: ophyd.EpicsMotor + deviceConfig: {prefix: 'X06DA-FE-SLDI:GAPX'} + onFailure: buffer + enabled: true + readoutPriority: monitored + readOnly: false + softwareTrigger: false +sldi_ceny: + description: FE slit-diaphragm vertical center + deviceClass: ophyd.EpicsMotor + deviceConfig: {prefix: 'X06DA-FE-SLDI:CENY'} + onFailure: buffer + enabled: true + readoutPriority: monitored + readOnly: false + softwareTrigger: false +sldi_sizey: + description: FE slit-diaphragm vertical size + deviceClass: ophyd.EpicsMotor + deviceConfig: {prefix: 'X06DA-FE-SLDI:GAPY'} + onFailure: buffer + enabled: true + readoutPriority: monitored + readOnly: false + softwareTrigger: false + slh_trxr: description: OP slit inner blade motion deviceClass: ophyd.EpicsMotor @@ -25,7 +62,7 @@ fi1_try: readoutPriority: monitored readOnly: false softwareTrigger: false -dccm_pitch1: +dccm_theta1: description: Monochromator pitch 1 deviceClass: ophyd.EpicsMotor deviceConfig: {prefix: 'X06DA-OP-DCCM:PITCH1'} @@ -34,15 +71,6 @@ dccm_pitch1: readoutPriority: monitored readOnly: false softwareTrigger: false -dccm_energy1: - description: Monochromator energy 1 - deviceClass: ophyd.EpicsMotor - deviceConfig: {prefix: 'X06DA-OP-DCCM:ENERGY1'} - onFailure: buffer - enabled: true - readoutPriority: monitored - readOnly: false - softwareTrigger: false dccm_diode: description: Diode between mono crystals deviceClass: ophyd.EpicsSignalRO @@ -52,7 +80,7 @@ dccm_diode: readoutPriority: monitored readOnly: true softwareTrigger: false -dccm_pitch2: +dccm_theta2: description: Monochromator pitch 2 deviceClass: ophyd.EpicsMotor deviceConfig: {prefix: 'X06DA-OP-DCCM:PITCH2'} @@ -61,15 +89,6 @@ dccm_pitch2: readoutPriority: monitored readOnly: false softwareTrigger: false -dccm_energy2: - description: Monochromator energy 2 - deviceClass: ophyd.EpicsMotor - deviceConfig: {prefix: 'X06DA-OP-DCCM:ENERGY2'} - onFailure: buffer - enabled: true - readoutPriority: monitored - readOnly: false - softwareTrigger: false dccm_xbpm: description: XBPM total intensity after monochromator deviceClass: ophyd.EpicsSignalRO @@ -80,18 +99,18 @@ dccm_xbpm: readOnly: true softwareTrigger: false dccm_energy: - description: Monochromator energy using ECMC virtual motors + description: Monochromator energy deviceClass: ophyd.EpicsMotor - deviceConfig: {prefix: 'X06DA-OP-DCCM:_ENERGY'} + deviceConfig: {prefix: 'X06DA-OP-DCCM:ENERGY'} onFailure: buffer enabled: true readoutPriority: monitored readOnly: false softwareTrigger: false -dccm_offset: - description: Monochromator energy offset for ECMC virtual motors +dccm_eoffset: + description: Monochromator energy offset deviceClass: ophyd.EpicsMotor - deviceConfig: {prefix: 'X06DA-OP-DCCM:_OFFSET'} + deviceConfig: {prefix: 'X06DA-OP-DCCM:EOFFSET'} onFailure: buffer enabled: true readoutPriority: monitored diff --git a/pxiii_bec/devices/A3200.py b/pxiii_bec/devices/A3200.py index 3610635..d2cbfe2 100644 --- a/pxiii_bec/devices/A3200.py +++ b/pxiii_bec/devices/A3200.py @@ -157,7 +157,7 @@ class AerotechAbrStage(BECDeviceBase): """ custom_prepare_cls = AerotechAbrMixin - USER_ACCESS = ["reset", "kickoff", "bluekickoff", "complete", "set_axis_mode"] + USER_ACCESS = ["reset", "kickoff", "bluekickoff", "complete", "set_axis_mode", "arm", "disarm"] taskStop = Component(EpicsSignal, "-AERO:TSK-STOP", put_complete=True, kind=Kind.omitted) status = Component(EpicsSignal, "-AERO:STAT", put_complete=True, kind=Kind.omitted) diff --git a/pxiii_bec/scripts/beamlinescripts.py b/pxiii_bec/scripts/beamlinescripts.py new file mode 100644 index 0000000..daff74b --- /dev/null +++ b/pxiii_bec/scripts/beamlinescripts.py @@ -0,0 +1,57 @@ + + +def rock(steps, exp_time, scan_start=None, scan_end=None,datasource=None, visual=True, **kwargs): + """Demo step scan with plotting + + This is a simple user-space demo step scan with the BEC. It be a + standard BEC scan, while still setting up the environment. + + Example: + -------- + ascan(dev.dccm_energy, 12,13, steps=21, exp_time=0.1, datasource=dev.dccm_xbpm) + """ + # Dummy method to check beamline status + if not bl_check_beam(): + raise RuntimeError("Beamline is not in ready state") + + motor = dev.dccm_theta2 + if scan_start is None: + scan_start = -0.05/dev.dccm_energy.user_readback.get() + if scan_end is None: + scan_end = 0.05/dev.dccm_energy.user_readback.get() + + + if visual: + # Get or create scan specific window + window = None + for _, val in bec.gui.windows.items(): + if val.title == "CurrentScan": + window = val.widget + window.clear_all() + if window is None: + window = bec.gui.new("CurrentScan") + + # Draw a simploe plot in the window + dock = window.add_dock(f"ScanDisplay {motor}") + plt1 = dock.add_widget("BECWaveformWidget") + plt1.plot(x_name=motor, y_name=datasource) + plt1.set_x_label(motor) + plt1.set_y_label(datasource) + plt1.add_dap(motor, datasource, dap="LinearModel") + window.show() + + print("Handing over to 'scans.line_scan'") + s = scans.line_scan( + motor, scan_start, scan_end, steps=steps, exp_time=exp_time, datasource=datasource, relative=True, **kwargs + ) + + if visual: + # If fitting via GUI + firt_par = plt1.get_dap_params() + else: + # Without GUI + firt_par = bec.dap.LinearModel.fit(s, motor.name, motor.name, datasource.name, datasource.name) + + # Move to fitted maximum + + return s, firt_par diff --git a/pxiii_bec/scripts/scanwrappers.py b/pxiii_bec/scripts/scanwrappers.py index 05c0fbb..8610fa0 100644 --- a/pxiii_bec/scripts/scanwrappers.py +++ b/pxiii_bec/scripts/scanwrappers.py @@ -3,7 +3,7 @@ def bl_check_beam(): return True -def ascan(motor, scan_start, scan_end, steps, exp_time, datasource, visual=True, **kwargs): +def ascan(motor, scan_start, scan_end, steps, exp_time, datasource=None, visual=True, relative=False, **kwargs): """Demo step scan with plotting This is a simple user-space demo step scan with the BEC. It be a @@ -17,44 +17,44 @@ def ascan(motor, scan_start, scan_end, steps, exp_time, datasource, visual=True, if not bl_check_beam(): raise RuntimeError("Beamline is not in ready state") - # if visual: - # # Get or create scan specific window - # window = None - # for _, val in bec.gui.windows.items(): - # if val.title == "CurrentScan": - # window = val.widget - # window.clear_all() - # if window is None: - # window = bec.gui.new("CurrentScan") + if visual: + # Get or create scan specific window + window = None + for _, val in bec.gui.windows.items(): + if val.title == "CurrentScan": + window = val.widget + window.clear_all() + if window is None: + window = bec.gui.new("CurrentScan") - # # Draw a simploe plot in the window - # dock = window.add_dock(f"ScanDisplay {motor}") - # plt1 = dock.add_widget("BECWaveformWidget") - # plt1.plot(x_name=motor, y_name=datasource) - # plt1.set_x_label(motor) - # plt1.set_y_label(datasource) - # plt1.add_dap(motor, datasource, dap="LinearModel") - # window.show() + # Draw a simploe plot in the window + dock = window.add_dock(f"ScanDisplay {motor}") + plt1 = dock.add_widget("BECWaveformWidget") + plt1.plot(x_name=motor, y_name=datasource) + plt1.set_x_label(motor) + plt1.set_y_label(datasource) + plt1.add_dap(motor, datasource, dap="LinearModel") + window.show() print("Handing over to 'scans.line_scan'") - if "relative" in kwargs: - del kwargs["relative"] s = scans.line_scan( - motor, scan_start, scan_end, steps=steps, exp_time=exp_time, relative=False, datasource=datasource, **kwargs + motor, scan_start, scan_end, steps=steps, exp_time=exp_time, datasource=datasource, relative=relative, **kwargs ) - # if visual: - # fit = plt1.get_dap_params() - # else: - # fit = bec.dap.LinearModel.fit(s, motor.name, motor.name, datasource.name, datasource.name) - + if visual: + # If fitting via GUI + firt_par = plt1.get_dap_params() + return s, firt_par + else: + firt_par = bec.dap.LinearModel.fit(s, motor.name, motor.name, datasource.name, datasource.name) + return s, firt_par # fit = bec.dap.LinearModel(motor, datasource) # If fitting via GUI # firt_par = plt1.get_dap_params() - # return s, fit - return s + # return s, firt_par + # #return s # # Some basic fit # dkey = datasource.full_name