예제 #1
0
def test_lima_basler():
    config = beacon_get_config()
    m0 = config.get("bcumot2")
    m0.velocity(360)
    m0.acceleration(720)

    chain = AcquisitionChain()
    nb_points = 4
    emotion_master = SoftwarePositionTriggerMaster(m0,
                                                   0,
                                                   360,
                                                   nb_points,
                                                   time=1)
    tango_host = "lid00limax:20000"
    lima_dev = DeviceProxy("//%s/id00/limaccds/basler_bcu" % tango_host)
    params = {
        "acq_nb_frames": nb_points,
        "acq_expo_time": 10e-3,
        "acq_trigger_mode": "INTERNAL_TRIGGER_MULTI"
    }
    lima_acq_dev = LimaAcquisitionMaster(lima_dev, **params)
    chain.add(emotion_master, lima_acq_dev)

    hdf5_writer = hdf5.Writer(root_path='/tmp')
    toto = Container('test_lima_basler')
    scan = Scan(chain, name='test_acq', parent=toto, writer=hdf5_writer)

    scan.run()
예제 #2
0
def test_hdf5_lima():
    config_xml = """
<config>
  <controller class="mockup">
    <axis name="m0">
      <steps_per_unit value="10000"/>
      <!-- degrees per second -->
      <velocity value="10"/>
      <acceleration value="100"/>
    </axis>
  </controller>
</config>"""

    emotion.load_cfg_fromstring(config_xml)
    m0 = emotion.get_axis("m0")

    chain = AcquisitionChain()
    emotion_master = SoftwarePositionTriggerMaster(m0, 5, 10, 5, time=5)
    lima_dev = DeviceProxy("id30a3/limaccd/simulation")
    params = {
        "acq_nb_frames": 5,
        "acq_expo_time": 3 / 10.0,
        "acq_trigger_mode": "INTERNAL_TRIGGER_MULTI"
    }
    lima_acq_dev = LimaAcquisitionMaster(lima_dev, **params)
    chain.add(emotion_master, lima_acq_dev)

    file_organizer = Hdf5Organizer(root_path='/tmp')
    toto = Container('toto', file_organizer=file_organizer)
    dm = ScanRecorder('test_acq', toto)

    scan = Scan(chain, dm)
    scan.prepare()
    scan.start()
예제 #3
0
def test_lima():
    config_xml = """
<config>
  <controller class="mockup">
    <axis name="m0">
      <steps_per_unit value="10000"/>
      <!-- degrees per second -->
      <velocity value="10"/>
      <acceleration value="100"/>
    </axis>
  </controller>
</config>"""

    emotion.load_cfg_fromstring(config_xml)
    m0 = emotion.get_axis("m0")

    def cb(*args, **kwargs):
        print args, kwargs

    chain = AcquisitionChain()
    emotion_master = SoftwarePositionTriggerMaster(m0, 5, 10, 10, time=5)
    lima_dev = DeviceProxy("id30a3/limaccd/simulation")
    params = {
        "acq_nb_frames": 10,
        "acq_expo_time": 3 / 10.0,
        "acq_trigger_mode": "INTERNAL_TRIGGER_MULTI"
    }
    lima_acq_dev = LimaAcquisitionMaster(lima_dev, **params)
    dispatcher.connect(cb, sender=lima_acq_dev)
    chain.add(emotion_master, lima_acq_dev)
    scan = Scan(chain)
    scan.run()
    m0.wait_move()
    print m0.velocity() == 10
예제 #4
0
def test_mca_continuous_soft_scan(beacon):
    m0 = beacon.get("roby")
    # Get mca
    simu = beacon.get("simu1")
    mca_device = McaAcquisitionDevice(simu, npoints=3, preset_time=0.1)
    # Add counters
    mca_device.add_counters(simu.counters.spectrum.values())
    mca_device.add_counters(simu.counters.realtime.values())
    mca_device.add_counters(simu.counters.events.values())
    # Create chain
    chain = AcquisitionChain()
    chain.add(SoftwarePositionTriggerMaster(m0, 0, 1, 3, time=1.0), mca_device)
    # Run scan
    scan = Scan(chain, 'mca_test', None)
    scan.run()
    # Checks
    assert_data_consistency(scans.get_data(scan), realtime=0.1)
예제 #5
0
def test_sps():
    config_xml = """
<config>
  <controller class="mockup">
    <axis name="m0">
      <steps_per_unit value="10000"/>
      <!-- degrees per second -->
      <velocity value="10"/>
      <acceleration value="100"/>
    </axis>
    <axis name="m1">
      <steps_per_unit value="10000"/>
      <!-- degrees per second -->
      <velocity value="1"/>
      <acceleration value="10"/>
    </axis>
    <axis name="m2">
      <steps_per_unit value="10000"/>
      <!-- degrees per second -->
      <velocity value="10"/>
      <acceleration value="100"/>
    </axis>
  </controller>
</config>"""

    load_cfg_fromstring(config_xml)
    m0 = get_axis("m0")

    chain = AcquisitionChain()
    emotion_master = SoftwarePositionTriggerMaster(m0, 5, 10, 7, time=1)
    c0_dev = TestAcquisitionDevice("c0")
    c1_dev = TestAcquisitionDevice("c1")
    chain.add(emotion_master, c0_dev)
    chain.add(emotion_master, c1_dev)
    chain._tree.show()

    session_cnt = Container('sps_test')
    recorder = ScanRecorder('test_scan', session_cnt)
    scan = Scan(chain, recorder)
    scan.prepare()
    scan.start()
예제 #6
0
def test_emotion_p201():
    config_xml = """
<config>
  <controller class="mockup">
    <axis name="m0">
      <steps_per_unit value="10000"/>
      <!-- degrees per second -->
      <velocity value="10"/>
      <acceleration value="100"/>
    </axis>
  </controller>
</config>"""

    emotion.load_cfg_fromstring(config_xml)
    m0 = emotion.get_axis("m0")
    emotion_master = SoftwarePositionTriggerMaster(m0, 5, 10, 5, time=1)
    chain = AcquisitionChain()

    p201_device = P201()
    p201_device.request_exclusive_access()
    p201_device.set_interrupts()
    p201_device.reset()
    p201_device.software_reset()
    p201_device.reset_FIFO_error_flags()
    p201_device.set_clock(Clock.CLK_100_MHz)
    p201_master = P201AcquisitionMaster(p201_device,
                                        nb_points=10,
                                        acq_expo_time=1e-3)
    p201_counters = P201AcquisitionDevice(p201_device,
                                          nb_points=10,
                                          acq_expo_time=1e-3,
                                          channels={
                                              "c0": 1,
                                              "c1": 2
                                          })
    chain.add(emotion_master, p201_master)
    chain.add(p201_master, p201_counters)
    chain._tree.show()
    scan = Scan(chain)
    scan.run()
예제 #7
0
def test_emotion_master():
    config_xml = """
<config>
  <controller class="mockup">
    <axis name="m0">
      <steps_per_unit value="10000"/>
      <!-- degrees per second -->
      <velocity value="10"/>
      <acceleration value="100"/>
    </axis>
  </controller>
</config>"""

    emotion.load_cfg_fromstring(config_xml)
    m0 = emotion.get_axis("m0")

    chain = AcquisitionChain()
    emotion_master = SoftwarePositionTriggerMaster(m0, 5, 10, 7)
    test_acq_dev = TestAcquisitionDevice("c0", 0)
    chain.add(emotion_master, test_acq_dev)
    scan = Scan(chain)
    scan.run()
예제 #8
0
def test_step_cont():
    config_xml = """
<config>
  <controller class="mockup">
    <axis name="m0">
      <steps_per_unit value="10000"/>
      <!-- degrees per second -->
      <velocity value="10"/>
      <acceleration value="100"/>
    </axis>
    <axis name="m1">
      <steps_per_unit value="10000"/>
      <!-- degrees per second -->
      <velocity value="1"/>
      <acceleration value="10"/>
    </axis>
    <axis name="m2">
      <steps_per_unit value="10000"/>
      <!-- degrees per second -->
      <velocity value="10"/>
      <acceleration value="100"/>
    </axis>
  </controller>
</config>"""

    load_cfg_fromstring(config_xml)
    m0 = get_axis("m0")
    m1 = get_axis("m1")
    m2 = get_axis("m2")

    ascan = AcquisitionChain(parallel_prepare=True)
    ascan_mot = LinearStepTriggerMaster(11, m0, 10, 20)
    timer = SoftwareTimerMaster(0.1)
    ascan.add(ascan_mot, timer)
    test_acq_dev = TestAcquisitionDevice("timer_test",
                                         2,
                                         prepare_once=True,
                                         start_once=True)
    ascan.add(timer, test_acq_dev)
    test2_acq_dev = TestAcquisitionDevice("timer_test2",
                                          2,
                                          prepare_once=True,
                                          start_once=True)
    ascan.add(timer, test2_acq_dev)
    step_scan = Container('step_scan')
    scan = Scan(chain)
    scan.run()

    chain = AcquisitionChain(parallel_prepare=True)

    step_master = MeshStepTriggerMaster(m1,
                                        -2,
                                        2,
                                        5,
                                        m2,
                                        -5,
                                        5,
                                        3,
                                        backnforth=True)
    emotion_master = SoftwarePositionTriggerMaster(m0, 5, 10, 7, time=1)
    chain.add(step_master, emotion_master)
    chain.add(emotion_master, test_acq_dev)
    scan = Scan(chain, name='super_zap_image', parent=step_scan)
    scan.run()

    print "next scan"
    chain = AcquisitionChain()
    emotion_master = SoftwarePositionTriggerMaster(m0, 5, 10, 7)
    test_acq_dev = TestAcquisitionDevice("super_mario", 0)
    chain.add(emotion_master, test_acq_dev)
    scan = Scan(chain, name='soft_zapline', parent=step_scan)
    scan.run()