Merge branch 'refs/heads/master' into master-unstable

This commit is contained in:
martinappleby
2025-11-18 13:42:39 +01:00
6 changed files with 47 additions and 0 deletions
+1
View File
@@ -691,6 +691,7 @@ class BeamlineStatus(BaseModel):
light: Annotated[float, Field(ge=0.0, le=100.0)]
cryojet_K: float
shutter_open: bool
exp_shutter_open: bool | None
flux_ph_s: float
sample_camera: SampleCameraSettings
transmission: Annotated[float, Field(ge=0.0, le=1.0)] | None
+3
View File
@@ -800,6 +800,8 @@ class AareDAQ:
print(f"!!!!! ABR MAY HAVE DISCONNECTED !!!!!")
print(f"!!!!! CHECK ABR EPICS PANEL FOR ERRORS!!!!!")
print("!!!!! IF NOT RESTART GUI !!!!!")
print("CLOSING EXPERIMENTAL HUCTH FOR SAFETY")
self.__devs.exp_shutter.close()
return SampleGeometryModel(
beam_location_pxl=self.__cfg.beam_mark_coeff.apply(zoom),
pixel_in_mm=self.__cfg.pixel_to_mm(zoom),
@@ -1483,6 +1485,7 @@ class AareDAQ:
light=self.light,
cryojet_K=self.__devs.cryojet_temp,
shutter_open=self.__devs.shutter,
exp_shutter_open=self.__devs.exp_shutter.state(),
flux_ph_s=self.__devs.full_flux,
sample_camera=self.__devs.samcam_settings,
name=self.__bl,
+3
View File
@@ -10,6 +10,7 @@ from mxlibs3.area_detector import epicsAD
from mxlibs3.enum_pv import EnumPv
from mxlibs3.filter_transmission import FilterTransmission
from mxlibs3.fluorimeter import Fluorimeter
from mxlibs3.experimental_hutch_shutter import ExperimentalHutchShutter
from mxlibs3.my_motor import MyMotor
from mxlibs3.non_standard import NonStandard
from mxlibs3.tell_client import TellClient
@@ -113,6 +114,8 @@ class BeamlineDevices:
self.__shutter_rbv = PV(f"{BEAMLINE}-ES-PH1:GET")
self.__shutter = PV(f"{BEAMLINE}-ES-PH1:SET")
self.exp_shutter = ExperimentalHutchShutter(beamline)
# xrf_stage = EnumPv(
# {
# "name": "KetekStage",
+1
View File
@@ -87,6 +87,7 @@ async def status(token: str = Depends(oauth2_scheme)) -> DAQStatusModel:
)
except Exception as e:
logger.error(f"Error getting status: {e}")
raise HTTPException(
status_code=api_status.HTTP_500_INTERNAL_SERVER_ERROR,
detail=f"Error getting status: {e}"
@@ -0,0 +1,32 @@
from aaredaqlib.beamline import MXBeamline
from epics import PV
class ExperimentalHutchShutter:
def __init__(self, beamline: MXBeamline):
BEAMLINE = beamline.value.upper()
self.__close= PV(f"{BEAMLINE}-EH1-PSYS:SH-A-CLOSE-SET") # 1, 0
self.__open = PV(f"{BEAMLINE}-EH1-PSYS:SH-A-OPEN-SET")
self.__state = PV(f"{BEAMLINE}-OP-PSH1-EMLS-0010:OPEN")
def state(self):
state = self.__state.get()
if state == "Open" or state == 1:
print(f"Open {state}")
return True
elif state == "Not Open" or state == 0:
print(f"Not Open {state}")
return False
else:
print(ValueError(f"unknown state: {state}"))
return False
def open(self):
self.__open.put(0)
self.__open.put(1)
#print(self.__open.get())
self.__open.put(0)
def close(self):
self.__close.put(1)
self.__close.put(0)
+7
View File
@@ -52,12 +52,14 @@ class StatusBar(QStatusBar):
self.shutter_label = ClickableLabel(parent=self)
self.shutter_label.clicked.connect(self.show_shutter_menu)
self.exp_shutter_label = ValueLabel("ExpHutch Shutter", "", self)
self.addPermanentWidget(self.flux)
self.addPermanentWidget(self.transmission)
self.addPermanentWidget(self.ring_current)
self.addPermanentWidget(self.wvl)
self.addPermanentWidget(self.cryo_label)
self.addPermanentWidget(self.shutter_label)
self.addPermanentWidget(self.exp_shutter_label)
self.addPermanentWidget(self.pgroup_label)
self.addPermanentWidget(self.pgroup_label)
self.addPermanentWidget(self.state_label)
@@ -98,6 +100,11 @@ class StatusBar(QStatusBar):
else:
self.shutter_label.setText(f"""Shutter: <span style="color: green ; "> Closed 🚪 </span>""")
if status.bl.exp_shutter_open:
self.exp_shutter_label.setText("""ExpHutch Shutter: <span style="color: red ; "> Open </span>""")
else:
self.exp_shutter_label.setText("""ExpHutch Shutter: <span style="color: green ; "> Closed 🚪 </span>""")
if status.session.current_pgroup is not None:
self.pgroup_label.setText(f"""p-group: {status.session.current_pgroup} """)
else: