diff --git a/phoenix_bec/Documentation/Software_structure.pdf b/phoenix_bec/Documentation/Software_structure.pdf new file mode 100644 index 0000000..3891a39 Binary files /dev/null and b/phoenix_bec/Documentation/Software_structure.pdf differ diff --git a/phoenix_bec/bec_ipython_client/startup/post_startup.py b/phoenix_bec/bec_ipython_client/startup/post_startup.py index 2366baa..a544c9b 100644 --- a/phoenix_bec/bec_ipython_client/startup/post_startup.py +++ b/phoenix_bec/bec_ipython_client/startup/post_startup.py @@ -160,15 +160,11 @@ def ph_create_config(line): @register_line_magic def ph_restart_bec_server(line): os.system("bec-server restart") - os.system('gnome-terminal --geometry 120X50 -- bash -c "bec-server attach; exec bash"') + os.system( + 'gnome-terminal --geometry 120X50 -- bash -c "source /data/test/x07mb-test-bec/bec_deployment/bec_venv/bin/activate ; bec-server attach; exec bash"' + ) -### enddef - - -##@register_line_magic -# def ph_post_startup(line): -# print('import phoenix_bec.bec_ipython_client.startup.post_startup does not work caused loop ') # #import phoenix_bec.bec_ipython_client.startup.post_startup # does not work seems to build a infinite stack... @@ -177,15 +173,15 @@ def ph_restart_bec_server(line): # init phoenix.py from server version as # .................. phoenix_server=PhoenixBL() # and in ipython shell only as -# .............. phoenix = Ph.Pheonix(BL() +# .............. phoenix = Ph.Phoenix(BL() ## ##################################################################################### print("###############################################################") print("init phoenix_bec/scripts/phoenix.py in two different ways") print(" 1) phoenix_server = PhoenixBL() ... takes code from server version ") -print("SERBVR VERSION DOES NOT WORK ANYMORE ") -print("FOLDER SCRUIPT SEEMS TO BE NON_STANDARD!!!!!!! ") +print("SERVR VERSION DOES NOT WORK ANYMORE ") +print("FOLDER SCRIPT SEEMS TO BE NON_STANDARD!!!!!!! ") phoenix_server = PhoenixBL() diff --git a/phoenix_bec/devices/falcon_phoenix.py b/phoenix_bec/devices/falcon_phoenix.py index dec7bc8..988b72d 100644 --- a/phoenix_bec/devices/falcon_phoenix.py +++ b/phoenix_bec/devices/falcon_phoenix.py @@ -49,8 +49,10 @@ CHANGES LOG and import enum import os import threading +import time from bec_lib.logger import bec_logger + from ophyd import Component as Cpt from ophyd import Device, EpicsSignal, EpicsSignalRO, EpicsSignalWithRBV from ophyd.mca import EpicsMCARecord @@ -147,7 +149,7 @@ class FalconHDF5Plugins(Device): class FalconSetup(CustomDetectorMixin): """ - Falcon setup class for cSAXS + Falcon setup class for Phoenix Parent class: CustomDetectorMixin @@ -172,7 +174,7 @@ class FalconSetup(CustomDetectorMixin): - value_pixel_per_buffer (int): number of spectra in buffer of Falcon Sitoro """ - self.parent.value_pixel_per_buffer = 20 + # self.parent.value_pixel_per_buffer = 20 self.update_readout_time() def update_readout_time(self) -> None: @@ -186,8 +188,16 @@ class FalconSetup(CustomDetectorMixin): def initialize_detector(self) -> None: """Initialize Falcon detector""" + + pass + + """ + THIS IS THE OLD CSACS CODE. uncomment for now, as we consider EPICS as the boss + for initialization + self.stop_detector() self.stop_detector_backend() + self.set_trigger( mapping_mode=MappingSource.MAPPING, trigger_source=TriggerSource.GATE, ignore_gate=0 ) @@ -199,6 +209,7 @@ class FalconSetup(CustomDetectorMixin): self.parent.auto_pixels_per_buffer.put(0) # Sets the number of pixels/spectra in the buffer self.parent.pixels_per_buffer.put(self.parent.value_pixel_per_buffer) + """ def initialize_detector_backend(self) -> None: """Initialize the detector backend for Falcon.""" diff --git a/phoenix_bec/devices/phoenix_trigger.py b/phoenix_bec/devices/phoenix_trigger.py index 9b05cf2..a79974a 100644 --- a/phoenix_bec/devices/phoenix_trigger.py +++ b/phoenix_bec/devices/phoenix_trigger.py @@ -48,9 +48,11 @@ class SAMPLING(int, enum.Enum): class PhoenixTriggerSetup(CustomDetectorMixin): + """ Mixin Class to setup the PhoenixTrigger device - """ + + """ def on_stage(self) -> None: """ @@ -93,20 +95,7 @@ class PhoenixTriggerSetup(CustomDetectorMixin): raise PhoenixTriggerError( f"Device {self.parent.name} is not ready to take trigger, timeout due to waiting for Falcon to get ready. Timeout after {timeout}s" ) - - if self.parent.scaninfo.scan_type == "step": - time.sleep(0.2) - self.parent.smpl.put(1) - # Minimum of 1 cycle has to be waited. Cycle == 0.2s - - time.sleep(0.2) - - # Trigger function from ophyd.Device returns a DeviceStatus. This function - # starts a process that creates a DeviceStatus, and waits for the signal_conditions - # self.parent.smpl_done.get to change to the value SAMPLING.DONE - # Once this takes place, the DeviceStatus.done flag will be set to True. - # When BEC calls trigger() on the devices, this method will be called assuming that - # the devices config softwareTrigger=True is set. + start_csmpl = Cpt(e is set. # In ScanBase, the _at_each_point function calls # self.stubs.wait(wait_type="trigger", group="trigger", wait_time=self.exp_time) # which ensures that the DeviceStatus object resolves before continuing, i.e. DeviceStatus.done = True @@ -159,8 +148,8 @@ class PhoenixTrigger(PSIDetectorBase): ################################################################## USER_ACCESS = [] - - ##################################################################### + # + #################################################################### # specify Setup class into variable custom_prepare_cls # in __init__ of PSIDetectorBase will the initialzed by # self.custom_prepare = self.custom_prepare_cls(parent=self, **kwargs) @@ -168,12 +157,7 @@ class PhoenixTrigger(PSIDetectorBase): # in PhoenixTriggerSetup. ###################################################################### - custom_prepare_cls = PhoenixTriggerSetup - - ############################################################# - # - # Now use Component=Cpt to provide channel access - # when PhoenixTrigger is initialized, the parameters of the base class are + start_csmpl = Cpt(he base class are # inherited, most notable prefix, which is here 'X07MB-OP2:' # # The input of Component=Cpt is Cpt(deviceClass,suffix) @@ -213,7 +197,9 @@ class PhoenixTrigger(PSIDetectorBase): if __name__ == "__main__": + # Test the PhoenixTrigger class + trigger = PhoenixTrigger(name="trigger", prefix="X07MB-OP2:") trigger.wait_for_connection(all_signals=True) trigger.read()