diff --git a/alignment_laser.py b/alignment_laser.py new file mode 100644 index 0000000..b3f9a1d --- /dev/null +++ b/alignment_laser.py @@ -0,0 +1,39 @@ +from slic.core.adjustable import PVAdjustable +from slic.utils import typename + + +class AlignmentLaser: + """Class for the alignment laser""" + def __init__(self, ID,name="Cristallina alignment laser"): + self.ID = ID + self.name = name or ID + pvname_setvalue = ID + pvname_readback = ID + self._adj = PVAdjustable(pvname_setvalue, pvname_readback, accuracy=0, internal=True) + + def set_in(self): + self._adj.set_target_value(-19).wait() + + def set_out(self): + self._adj.set_target_value(-1).wait() + + @property + def status(self): + state = self._adj.get_current_value() + if state is None: + return "not connected" + elif state < -18: + return "In" + elif state >-6: + return "Out" + else: + return "in an undefined position" + + #TODO: Save the status downstream of the beamline when laser is out before bringing it back in + def get_downstream_status(self): + return + + + def __repr__(self): + tn = typename(self) + return f"{tn} \"{self.name}\" is {self.status}" \ No newline at end of file diff --git a/cristallina.py b/cristallina.py index 03c27c8..19c2bb5 100644 --- a/cristallina.py +++ b/cristallina.py @@ -16,7 +16,7 @@ os.chdir('/sf/cristallina/applications/slic/cristallina') # from tqdm import trange from epics import PV - +from alignment_laser import AlignmentLaser from slic.gui import GUI from slic.core.adjustable import Adjustable, PVAdjustable, DummyAdjustable from slic.core.acquisition import SFAcquisition, PVAcquisition @@ -58,16 +58,16 @@ cta = CTASequencer("SAR-CCTA-ESC") pbps113 = IntensityMonitorPBPS( "SAROP31-PBPS113", - # VME_crate="SAROP11-CVME-PBPS2", # please check this! + # vme_crate="SAROP31-CVME-PBPS1", # please check this! # link=9, - description="Intensity/position monitor in the optics hutch (after first aperture))" + description="Intensity/position monitor in the optics hutch", ) pbps149 = IntensityMonitorPBPS( "SAROP31-PBPS149", - # VME_crate="SAROP11-CVME-PBPS2", # please check this! + # vme_crate="SAROP31-CVME-PBPS2", # please check this! # link=9, - description="Intensity/position monitor in the optics hutch (after first aperture))" + description="Intensity/position monitor in the experimental hutch" ) def test_attenuator(): @@ -87,6 +87,9 @@ undulators = undulator.Undulators() shutter = PP_Shutter("SARES30-LTIM01-EVR0:RearUniv0-Ena-SP",name="Cristallina pulse picker shutter") # Shutter buttton when using the pulse picker pulsepicker = PulsePicker("SAROP31-OPPI151","SARES30-LTIM01-EVR0:Pul3", name="Cristallina X-ray pulse picker OPPI151") +# Alignmnet laser +alaser = AlignmentLaser("SAROP31-OLAS147:MOTOR_1",name="Cristallina alignment laser OLAS147") + ## Slits from slic.devices.xoptics import slits @@ -96,6 +99,7 @@ from attocube_device_def import attocube # KBs from slic.devices.xoptics.kb import KBBase,KBHor,KBVer + kbHor = KBHor( "SAROP31-OKBH154", description="Cristallina horizontal KB mirror"