def setUp(self):
        self.process = Process("Process")
        self.context = Context(self.process)
        pmac_block = make_block_creator(__file__,
                                        "test_pmac_manager_block.yaml")
        self.child = self.create_child_block(pmac_block,
                                             self.process,
                                             mri_prefix="PMAC",
                                             config_dir="/tmp")
        # These are the child blocks we are interested in
        self.child_x = self.process.get_controller("BL45P-ML-STAGE-01:X")
        # self.child_y = self.process.get_controller(
        #    "BL45P-ML-STAGE-01:Y")
        self.child_cs1 = self.process.get_controller("PMAC:CS1")
        self.child_traj = self.process.get_controller("PMAC:TRAJ")
        self.child_status = self.process.get_controller("PMAC:STATUS")

        # CS1 needs to have the right port otherwise we will error
        self.set_attributes(self.child_cs1, port="CS1")
        self.o = BeamSelectorPart(
            name="beamSelector",
            mri="PMAC",
            selectorAxis="x",
            tomoAngle=0,
            diffAngle=0.5,
            moveTime=0.5,
        )
        self.context.set_notify_dispatch_request(
            self.o.notify_dispatch_request)
        self.process.start()

        pass
示例#2
0
 def test_make_block(self):
     with patch("malcolm.yamlutil.open",
                mock_open(read_data=block_yaml),
                create=True) as m:
         block_creator = make_block_creator("/tmp/__init__.py",
                                            "block.yaml")
     assert block_creator.__name__ == "block"
     m.assert_called_once_with("/tmp/block.yaml")
     process = Mock()
     controller = block_creator(process, dict(something="blah"))
     process.add_controller.assert_called_once_with("some_mri", controller)
     assert len(controller.parts) == 1
     self.assertIsInstance(controller.parts["scannable"], StringPart)
     assert controller.parts["scannable"].params.initialValue == ("blah")
示例#3
0
 def test_make_block(self):
     with patch("malcolm.yamlutil.open",
                mock_open(read_data=block_yaml),
                create=True) as m:
         block_creator = make_block_creator("/tmp/__init__.py",
                                            "block.yaml")
     assert block_creator.__name__ == "block"
     m.assert_called_once_with("/tmp/block.yaml")
     controllers = block_creator(something="blah")
     assert len(controllers) == 1
     parts = controllers[0].parts
     assert len(parts) == 1
     self.assertIsInstance(parts["scannable"], StringPart)
     assert parts["scannable"].attr.value == "blah"
示例#4
0
    def test_make_block(self):
        yaml = """
- parameters.string:
    name: something
    description: my description

- controllers.DefaultController:
    mri: boo

- parts.builtin.StringPart:
    name: scannable
    description: Scannable name for motor
    initialValue: $(something)
"""
        block_creator = make_block_creator(yaml)
        process = Mock()
        blocks = block_creator(process, dict(something="blah"))
        self.assertEquals(len(blocks), 1)
        block, controller = process.add_block.call_args[0]
        self.assertEquals(len(controller.parts), 1)
        self.assertIsInstance(controller.parts["scannable"], StringPart)
        self.assertEqual(controller.parts["scannable"].params.initialValue,
                         "blah")
示例#5
0
from malcolm.yamlutil import make_block_creator, check_yaml_names

pandablocks_manager_block = make_block_creator(
    __file__, "pandablocks_manager_block.yaml")

__all__ = check_yaml_names(globals())
示例#6
0
from malcolm.yamlutil import make_block_creator, check_yaml_names

pva_server_block = make_block_creator(__file__, "pva_server_block.yaml")
pva_client_block = make_block_creator(__file__, "pva_client_block.yaml")

__all__ = check_yaml_names(globals())
示例#7
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

andor_driver_block = make_block_creator(__file__, "andor_driver_block.yaml")

andor_runnable_block = make_block_creator(__file__,
                                          "andor_runnable_block.yaml")

__all__ = check_yaml_names(globals())
示例#8
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

compound_motor_block = make_block_creator(__file__,
                                          "compound_motor_block.yaml")
cs_block = make_block_creator(__file__, "cs_block.yaml")
pmac_status_block = make_block_creator(__file__, "pmac_status_block.yaml")
pmac_trajectory_block = make_block_creator(__file__,
                                           "pmac_trajectory_block.yaml")
raw_motor_block = make_block_creator(__file__, "raw_motor_block.yaml")

__all__ = check_yaml_names(globals())
示例#9
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

web_server_block = make_block_creator(__file__, "web_server_block.yaml")
websocket_client_block = make_block_creator(__file__,
                                            "websocket_client_block.yaml")

__all__ = check_yaml_names(globals())
示例#10
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

eiger_driver_block = make_block_creator(__file__, "eiger_driver_block.yaml")
eiger_runnable_block = make_block_creator(__file__,
                                          "eiger_runnable_block.yaml")

__all__ = check_yaml_names(globals())
示例#11
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

tetrAMM_driver_block = make_block_creator(__file__,
                                          "tetrAMM_driver_block.yaml")
tetrAMM_runnable_block = make_block_creator(__file__,
                                            "tetrAMM_runnable_block.yaml")

__all__ = check_yaml_names(globals())
示例#12
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

ethercat_driver_block = make_block_creator(__file__, "ethercat_driver_block.yaml")
ethercat_continuous_runnable_block = make_block_creator(
    __file__, "ethercat_continuous_runnable_block.yaml"
)
ethercat_hardware_runnable_block = make_block_creator(
    __file__, "ethercat_hardware_runnable_block.yaml"
)

__all__ = check_yaml_names(globals())
示例#13
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

aravisGigE_driver_block = make_block_creator(__file__,
                                             "aravisGigE_driver_block.yaml")
aravisGigE_runnable_block = make_block_creator(
    __file__, "aravisGigE_runnable_block.yaml")
aravisGigE_manager_block = make_block_creator(__file__,
                                              "aravisGigE_manager_block.yaml")

__all__ = check_yaml_names(globals())
示例#14
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

counter_block = make_block_creator(__file__, "counter_block.yaml")
hello_block = make_block_creator(__file__, "hello_block.yaml")
motion_block = make_block_creator(__file__, "motion_block.yaml")
detector_block = make_block_creator(__file__, "detector_block.yaml")
scan_1det_block = make_block_creator(__file__, "scan_1det_block.yaml")
scan_2det_block = make_block_creator(__file__, "scan_2det_block.yaml")

__all__ = check_yaml_names(globals())
示例#15
0
from malcolm.yamlutil import make_block_creator, check_yaml_names

profiling_web_server_block = make_block_creator(
    __file__, "profiling_web_server_block.yaml")

__all__ = check_yaml_names(globals())
示例#16
0
from malcolm.yamlutil import make_block_creator, check_yaml_names

merlin_driver_block = make_block_creator(
    __file__, "merlin_driver_block.yaml")

merlin_runnable_block = make_block_creator(
    __file__, "merlin_runnable_block.yaml")

__all__ = check_yaml_names(globals())
示例#17
0
from malcolm.yamlutil import make_block_creator, check_yaml_names

detector_block = make_block_creator(__file__, "detector_block.yaml")
scan_block = make_block_creator(__file__, "scan_block.yaml")
scan_block_no_detector = make_block_creator(__file__,
                                            "scan_block_no_detector.yaml")
motion_block = make_block_creator(__file__, "motion_block.yaml")
sim_motor_block = make_block_creator(__file__, "sim_motor_block.yaml")

__all__ = check_yaml_names(globals())
示例#18
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

dummy_block = make_block_creator(__file__, "dummy_block.yaml")

__all__ = check_yaml_names(globals())
示例#19
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

shutter_block = make_block_creator(__file__, "shutter_block.yaml")
scan_runner_block = make_block_creator(__file__, "scan_runner_block.yaml")
attribute_block = make_block_creator(__file__, "attribute_block.yaml")
directory_monitor_block = make_block_creator(__file__, "directory_monitor_block.yaml")

__all__ = check_yaml_names(globals())
示例#20
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

ADPilatus_driver_block = make_block_creator(__file__,
                                            "ADPilatus_driver_block.yaml")
ADPilatus_runnable_block = make_block_creator(__file__,
                                              "ADPilatus_runnable_block.yaml")

__all__ = check_yaml_names(globals())
    def setUp(self):
        self.process = Process("Process")
        self.context = Context(self.process)

        # Create a fake PandA
        self.panda = ManagerController("PANDA", "/tmp", use_git=False)
        self.busses = PositionsPart("busses")
        self.panda.add_part(self.busses)

        # Make 2 sequencers we can prod
        self.seq_parts = {}
        for i in (1, 2):
            controller = BasicController("PANDA:SEQ%d" % i)
            self.seq_parts[i] = SequencerPart("part")
            controller.add_part(self.seq_parts[i])
            self.process.add_controller(controller)
            self.panda.add_part(
                ChildPart(
                    "SEQ%d" % i,
                    "PANDA:SEQ%d" % i,
                    initial_visibility=True,
                    stateful=False,
                ))
        self.child_seq1 = self.process.get_controller("PANDA:SEQ1")
        self.child_seq2 = self.process.get_controller("PANDA:SEQ2")

        # And an srgate
        controller = BasicController("PANDA:SRGATE1")
        self.gate_part = GatePart("part")
        controller.add_part(self.gate_part)
        self.process.add_controller(controller)
        self.panda.add_part(
            ChildPart("SRGATE1",
                      "PANDA:SRGATE1",
                      initial_visibility=True,
                      stateful=False))
        self.process.add_controller(self.panda)

        # And the PMAC
        pmac_block = make_block_creator(
            os.path.join(os.path.dirname(__file__), "..", "test_pmac", "blah"),
            "test_pmac_manager_block.yaml",
        )
        self.config_dir = tmp_dir("config_dir")
        self.pmac = self.create_child_block(
            pmac_block,
            self.process,
            mri_prefix="PMAC",
            config_dir=self.config_dir.value,
        )
        # These are the motors we are interested in
        self.child_x = self.process.get_controller("BL45P-ML-STAGE-01:X")
        self.child_y = self.process.get_controller("BL45P-ML-STAGE-01:Y")
        self.child_cs1 = self.process.get_controller("PMAC:CS1")
        # CS1 needs to have the right port otherwise we will error
        self.set_attributes(self.child_cs1, port="CS1")

        # Make the child block holding panda and pmac mri
        self.child = self.create_child_block(
            panda_seq_trigger_block,
            self.process,
            mri="SCAN:PCOMP",
            panda="PANDA",
            pmac="PMAC",
        )

        # And our part under test
        self.o = PandASeqTriggerPart("pcomp", "SCAN:PCOMP")

        # Now start the process off and tell the panda which sequencer tables
        # to use
        self.process.start()
        exports = ExportTable.from_rows([
            ("SEQ1.table", "seqTableA"),
            ("SEQ2.table", "seqTableB"),
            ("SRGATE1.forceSet", "seqSetEnable"),
            ("SRGATE1.forceReset", "seqReset"),
        ])
        self.panda.set_exports(exports)
示例#22
0
from malcolm.yamlutil import make_block_creator, check_yaml_names

xmap_detector_driver_block = make_block_creator(
    __file__, "xmap_detector_driver_block.yaml")

xmap_detector_manager_block = make_block_creator(
    __file__, "xmap_detector_manager_block.yaml")

__all__ = check_yaml_names(globals())
示例#23
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

ADAndor3_driver_block = make_block_creator(__file__, "ADAndor3_driver_block.yaml")
ADAndor3_runnable_block = make_block_creator(__file__, "ADAndor3_runnable_block.yaml")

__all__ = check_yaml_names(globals())
示例#24
0
from malcolm.yamlutil import make_block_creator, check_yaml_names

hdf_writer_block = make_block_creator(__file__, "hdf_writer_block.yaml")
position_labeller_block = make_block_creator(__file__,
                                             "position_labeller_block.yaml")
stats_plugin_block = make_block_creator(__file__, "stats_plugin_block.yaml")

__all__ = check_yaml_names(globals())
示例#25
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

xspress3_driver_block = make_block_creator(__file__,
                                           "xspress3_driver_block.yaml")
xspress3_dtc_block = make_block_creator(__file__, "xspress3_dtc_block.yaml")
xspress3_runnable_block = make_block_creator(__file__,
                                             "xspress3_runnable_block.yaml")

__all__ = check_yaml_names(globals())
示例#26
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

odin_driver_block = make_block_creator(__file__, "odin_driver_block.yaml")

odin_runnable_block = make_block_creator(__file__, "odin_runnable_block.yaml")

odin_writer_block = make_block_creator(__file__, "odin_writer_block.yaml")

__all__ = check_yaml_names(globals())
示例#27
0
from malcolm.yamlutil import make_block_creator, check_yaml_names

xspress3_detector_driver_block = make_block_creator(
    __file__, "xspress3_detector_driver_block.yaml")

xspress3_detector_manager_block = make_block_creator(
    __file__, "xspress3_detector_manager_block.yaml")

__all__ = check_yaml_names(globals())
示例#28
0
from malcolm.yamlutil import check_yaml_names, make_block_creator

pco_driver_block = make_block_creator(__file__, "pco_driver_block.yaml")
pco_runnable_block = make_block_creator(__file__, "pco_runnable_block.yaml")

__all__ = check_yaml_names(globals())
    def setUp(self):

        self.process = Process("Process")
        self.context = Context(self.process)

        # Create a fake PandA
        self.panda = ManagerController("PANDA", "/tmp", use_git=False)
        self.busses = PositionsPart("busses")
        self.panda.add_part(self.busses)
        self.process.add_controller(self.panda)

        # TODO: Add axes to the positions table

        # And the PMAC
        pmac_block = make_block_creator(
            os.path.join(os.path.dirname(__file__), "..", "test_pmac", "blah"),
            "test_pmac_manager_block.yaml",
        )
        self.config_dir = tmp_dir("config_dir")
        self.pmac = self.create_child_block(
            pmac_block,
            self.process,
            mri_prefix="PMAC",
            config_dir=self.config_dir.value,
        )
        # These are the motors we are interested in
        self.child_x = self.process.get_controller("BL45P-ML-STAGE-01:X")
        self.child_y = self.process.get_controller("BL45P-ML-STAGE-01:Y")
        # Set up port and kinematics on CS1
        self.child_cs1 = self.process.get_controller("PMAC:CS1")
        self.set_attributes(self.child_cs1, port="CS1")
        self.set_attributes(self.child_cs1, qVariables="Q22=12345 Q23=999")
        self.set_attributes(self.child_cs1,
                            forwardKinematic="Q1=P1+10 Q5=Q22+4 Q7=8+4 RET ")
        # Set up variables on CS1
        self.child_status = self.process.get_controller("PMAC:STATUS")
        self.set_attributes(self.child_status, iVariables="I12=3")
        self.set_attributes(self.child_status, pVariables="")
        self.set_attributes(self.child_status, mVariables="M45=1 M42=561")

        # Make the child block holding panda and pmac mri
        self.child = self.create_child_block(
            panda_kinematicssavu_block,
            self.process,
            mri="SCAN:KINSAV",
            panda="PANDA",
            pmac="PMAC",
        )

        self.o = KinematicsSavuPart(name="kinsav",
                                    mri="SCAN:KINSAV",
                                    cs_port="CS1",
                                    cs_mri_suffix="CS1")
        self.context.set_notify_dispatch_request(
            self.o.notify_dispatch_request)
        self.process.start()
        self.set_attributes(self.pmac)

        self.completed_steps = 0
        # goal for these is 3000, 2000, True
        cols, rows, alternate = 3000, 2000, False
        self.steps_to_do = cols * rows
        xs = LineGenerator("x", "mm", 0.0, 0.1, cols, alternate=alternate)
        ys = LineGenerator("y", "mm", 0.0, 0.1, rows)
        self.generator = CompoundGenerator([ys, xs], [], [], 0.1)
        self.generator.prepare()
示例#30
0
from malcolm.yamlutil import make_block_creator, check_yaml_names

reframe_plugin_block = make_block_creator(__file__,
                                          "reframe_plugin_block.yaml")

__all__ = check_yaml_names(globals())