def add_command(state_machine): command = EigerTask("command") command.add_child(add_initialize_command(state_machine)) command.add_child(add_arm_command(state_machine)) command.add_child(add_trigger_command(state_machine)) command.add_child(add_disarm_command(state_machine)) return command
def add_status(): command = EigerTask("status") command.add_child( EigerValueContainer(name="state", access_mode="rw", value="na")) command.add_child( EigerValueContainer(name="error", access_mode="rw", value="na")) command.add_child( EigerValueContainer(name="time", access_mode="rw", value="na")) command.add_child( EigerValueContainer(name="buffer_free", access_mode="rw", value="na")) return command
def add_status(state_machine): status = EigerTask("status") state = EigerValueContainer(name="state", access_mode="rw", value=state_machine.get_state) state.add_child( EigerValue(name="critical_values", access_mode="r", value=["na", "error"])) status.add_child(state) return status
def add_config(): config = EigerTask("config") config.add_child( EigerValueContainer(name="name_pattern", access_mode="rw", value="series_$id")) config.add_child( EigerValueContainer(name="compression_enabled", access_mode="rw", value=True)) config.add_child( EigerValueContainer(name="nimages_per_file", access_mode="rw", value=1000)) config.add_child( EigerValueContainer( name="mode", access_mode="rw", value="enabled", allowed_values=["enabled", "disabled"], )) return config
def add_command(): command = EigerTask("command") initialize = EigerCommand("initialize") command.add_child(initialize) return command
def add_config(): config = EigerTask("config") initialize = EigerValueContainer(name="buffer_size", access_mode="rw", value=100) config.add_child(initialize) return config
def add_status(): command = EigerTask("status") state = EigerValueContainer(name="state", access_mode="rw", value="na") command.add_child(state) return command
def add_config(state_machine): config = EigerTask("config") config.add_child( EigerValueContainer( name="countrate_correction_applied", access_mode="rw", value=True, value_type="bool", )) config.add_child( EigerValueContainer( name="flatfield_correction_applied", access_mode="rw", value=True, value_type="bool", )) config.add_child( EigerValueContainer( name="pixel_mask_applied", access_mode="rw", value=True, value_type="bool", )) config.add_child( EigerValueContainer( name="detector_number", access_mode="r", value="E-02-0100", value_type="string", )) config.add_child( EigerValueContainer(name="count_time", access_mode="rw", value=1.0, unit="s", value_type="float")) config.add_child( EigerValueContainer(name="frame_time", access_mode="rw", value=1.0, unit="s", value_type="float")) config.add_child( EigerValueContainer(name="nimages", access_mode="rw", value=1, value_type="int")) config.add_child( EigerValueContainer(name="ntrigger", access_mode="rw", value=1, value_type="int")) config.add_child( EigerValueContainer( name="trigger_mode", access_mode="rw", value="ints", allowed_values=["ints", "exts"], value_type="string", )) config.add_child( EigerValueContainer( name="auto_summation", access_mode="rw", value=False, value_type="bool", )) config.add_child( EigerValueContainer( name="element", access_mode="rw", value=state_machine.get_element, allowed_values=[el for el in state_machine.ELEMENTS], value_type="string", setter=state_machine.set_element, )) config.add_child( EigerValueContainer( name="photon_energy", access_mode="rw", value=state_machine.get_photon_energy, unit="eV", value_type="float", setter=state_machine.set_photon_energy, )) config.add_child( EigerValueContainer( name="threshold_energy", access_mode="rw", value=state_machine.get_threshold_energy, unit="eV", value_type="float", setter=state_machine.set_threshold_energy, )) config.add_child( EigerValueContainer(name="sensor_material", access_mode="rw", value="Si", value_type="string")) config.add_child( EigerValueContainer( name="sensor_thickness", access_mode="r", value="0.000320", unit="m", value_type="float", )) return config
def test_task_keys(): parameters = ["aaa", "bbb", "ccc"] a = EigerTask("test_abc") for parameter in parameters: a.add_child(EigerValueContainer(name=parameter, access_mode="rw")) assert not set(a.keys.get()) ^ set(parameters + ["keys"])