Exemplo n.º 1
0
    def test_group_creation(self):
        # group creation
        mymot1 = get_axis("mymot1")
        mymot2 = get_axis("mymot2")
        mygrp = Group(mymot1, mymot2)

        self.assertTrue(mygrp)
Exemplo n.º 2
0
    def test_group_creation(self):
        # group creation
        mymot1 = get_axis("mymot1")
        mymot2= get_axis("mymot2")
        mygrp = Group(mymot1, mymot2)

        self.assertTrue(mygrp)
Exemplo n.º 3
0
def finalize():

    mymot1 = get_axis("mymot1")
    mymot1.stop()
    mymot2 = get_axis("mymot2")
    mymot2.stop()

    # needed to stop threads of Deep module
    #mymot1.controller.log_level(bliss.common.log.INFO)
    mymot1.controller.finalize()
Exemplo n.º 4
0
def finalize():

    mymot1 = get_axis("mymot1")
    mymot1.stop()
    mymot2 = get_axis("mymot2")
    mymot2.stop()

    # needed to stop threads of Deep module
    #mymot1.controller.log_level(bliss.common.log.INFO)
    mymot1.controller.finalize()
Exemplo n.º 5
0
    def test_group_get_position(self):
        # group creation
        mymot1 = get_axis("mymot1")
        mymot2= get_axis("mymot2")
        mygrp = Group(mymot1, mymot2)

        #mymot1.controller.log_level(3)
        pos_list = mygrp.position()
        #mymot1.controller.log_level(3)
        for axis in pos_list:
            self.assertEqual(axis.position(), pos_list[axis])
Exemplo n.º 6
0
    def test_group_get_position(self):
        # group creation
        mymot1 = get_axis("mymot1")
        mymot2 = get_axis("mymot2")
        mygrp = Group(mymot1, mymot2)

        #mymot1.controller.log_level(3)
        pos_list = mygrp.position()
        #mymot1.controller.log_level(3)
        for axis in pos_list:
            self.assertEqual(axis.position(), pos_list[axis])
Exemplo n.º 7
0
    def test_group_move(self):
        # group creation
        mymot1 = get_axis("mymot1")
        mymot2= get_axis("mymot2")
        mygrp = Group(mymot1, mymot2)

        pos_list = mygrp.position()
        pos_list[mymot1] += 0.1

        # waits for the end of motions
        mygrp.move(pos_list) 
        self.assertEqual(mygrp.state(), "READY")
Exemplo n.º 8
0
    def test_group_move(self):
        # group creation
        mymot1 = get_axis("mymot1")
        mymot2 = get_axis("mymot2")
        mygrp = Group(mymot1, mymot2)

        pos_list = mygrp.position()
        pos_list[mymot1] += 0.1

        # waits for the end of motions
        mygrp.move(pos_list)
        self.assertEqual(mygrp.state(), "READY")
Exemplo n.º 9
0
    def test_group_stop(self):
        # group creation
        mymot1 = get_axis("mymot1")
        mymot2= get_axis("mymot2")
        mygrp = Group(mymot1, mymot2)

        pos_list = mygrp.position()
        pos_list[mymot1] -= 0.1

        # non blocking call
        mygrp.move(pos_list, wait=False) 

        # waits for the end of motions
        mygrp.stop() 
        self.assertEqual(mygrp.state(), "READY")
Exemplo n.º 10
0
    def test_group_stop(self):
        # group creation
        mymot1 = get_axis("mymot1")
        mymot2 = get_axis("mymot2")
        mygrp = Group(mymot1, mymot2)

        pos_list = mygrp.position()
        pos_list[mymot1] -= 0.1

        # non blocking call
        mygrp.move(pos_list, wait=False)

        # waits for the end of motions
        mygrp.stop()
        self.assertEqual(mygrp.state(), "READY")
Exemplo n.º 11
0
 def _update_refs(self):
     for tag, axis_list in self._tagged.iteritems():
         for i, axis in enumerate(axis_list):
             if not isinstance(axis, AxisRef):
                 continue
             referenced_axis = get_axis(axis.name)
             self.axes[axis.name] = referenced_axis
             axis_list[i] = referenced_axis
             referenced_axis.controller._tagged.setdefault(tag, []).append(referenced_axis)
Exemplo n.º 12
0
    def init(self): 
        self.motorState = BlissMotor.NOTINITIALIZED
        self.username = self.motor_name

        set_backend("beacon")

        self.motor = get_axis(self.motor_name)
        self.connect(self.motor, "position", self.positionChanged)
        self.connect(self.motor, "state", self.updateState)
        self.connect(self.motor, "move_done", self._move_done)
Exemplo n.º 13
0
    def init(self):
        self.motorState = BlissMotor.NOTINITIALIZED
        self.username = self.motor_name

        set_backend("beacon")

        self.motor = get_axis(self.motor_name)
        self.connect(self.motor, "position", self.positionChanged)
        self.connect(self.motor, "state", self.updateState)
        self.connect(self.motor, "move_done", self._move_done)
Exemplo n.º 14
0
    def test_mulitple_moves(self):
        mymot1 = get_axis("mymot1")
        mymot2 = get_axis("mymot2")

        def task_cyclic(mot):
            while True:
                mot.position()
                gevent.sleep(0.1)

        #mymot1.controller.log_level(bliss.common.log.INFO)

        # launch several greenlets
        mymot1.move(mymot1.position() + 1000, wait=False)
        gevent.sleep(0.1)
        mymot2.move(mymot2.position() - 1000, wait=False)

        task = gevent.spawn(task_cyclic, mymot2)
        for i in range(10):
            mymot1.position()
            mymot2.position()

        mymot1.stop()
        self.assertEqual(mymot1.state(), "READY")
        mymot1.move(mymot1.position() - 1000, wait=False)
        for i in range(10):
            mymot1.position()
            mymot2.position()
            gevent.sleep(0.1)

        mymot1.stop()
        mymot2.stop()
        self.assertEqual(mymot1.state(), "READY")
        self.assertEqual(mymot2.state(), "READY")

        #mymot1.controller.log_level(bliss.common.log.ERROR)
        
        task.kill()
        task.join()
Exemplo n.º 15
0
    def test_mulitple_moves(self):
        mymot1 = get_axis("mymot1")
        mymot2 = get_axis("mymot2")

        def task_cyclic(mot):
            while True:
                mot.position()
                gevent.sleep(0.1)

        #mymot1.controller.log_level(bliss.common.log.INFO)

        # launch several greenlets
        mymot1.move(mymot1.position() + 1000, wait=False)
        gevent.sleep(0.1)
        mymot2.move(mymot2.position() - 1000, wait=False)

        task = gevent.spawn(task_cyclic, mymot2)
        for i in range(10):
            mymot1.position()
            mymot2.position()

        mymot1.stop()
        self.assertEqual(mymot1.state(), "READY")
        mymot1.move(mymot1.position() - 1000, wait=False)
        for i in range(10):
            mymot1.position()
            mymot2.position()
            gevent.sleep(0.1)

        mymot1.stop()
        mymot2.stop()
        self.assertEqual(mymot1.state(), "READY")
        self.assertEqual(mymot2.state(), "READY")

        #mymot1.controller.log_level(bliss.common.log.ERROR)

        task.kill()
        task.join()
Exemplo n.º 16
0
    def test_axis_home_search(self):
        # launch a never ending motion as there is no home signal.
        # WARINING: check with icepapcms that the concerned axis an home 
        # signal configured (for instance "Lim+") because the default 
        # icepapcms configuration is "None" which will make the test fails.
        mymot1 = get_axis("mymot1")
        mymot1.home(wait=False)

        # give time to motor to start
        gevent.sleep(0.1)
        self.assertEqual(mymot1.state(), 'MOVING')

        # stop the never ending motion
        mymot1.stop()

        # wait for the motor stop
        while mymot1.state() == 'MOVING':
            gevent.sleep(0.1)
Exemplo n.º 17
0
    def test_axis_limit_search(self):
        mymot1 = get_axis("mymot1")
        # test both search senses
        for sense in [-1, 1]:

            # launch a never ending motion as there is no limitswitch 
            mymot1.hw_limit(sense, wait=False)

            # give time to motor to start
            gevent.sleep(0.1)
            self.assertEqual(mymot1.state(), 'MOVING')
    
            # stop the never ending motion
            mymot1.stop()

            # wait for the motor stop
            while mymot1.state() == 'MOVING':
                gevent.sleep(0.1)
Exemplo n.º 18
0
    def test_axis_limit_search(self):
        mymot1 = get_axis("mymot1")
        # test both search senses
        for sense in [-1, 1]:

            # launch a never ending motion as there is no limitswitch
            mymot1.hw_limit(sense, wait=False)

            # give time to motor to start
            gevent.sleep(0.1)
            self.assertEqual(mymot1.state(), 'MOVING')

            # stop the never ending motion
            mymot1.stop()

            # wait for the motor stop
            while mymot1.state() == 'MOVING':
                gevent.sleep(0.1)
Exemplo n.º 19
0
    def test_axis_home_search(self):
        # launch a never ending motion as there is no home signal.
        # WARINING: check with icepapcms that the concerned axis an home
        # signal configured (for instance "Lim+") because the default
        # icepapcms configuration is "None" which will make the test fails.
        mymot1 = get_axis("mymot1")
        mymot1.home(wait=False)

        # give time to motor to start
        gevent.sleep(0.1)
        self.assertEqual(mymot1.state(), 'MOVING')

        # stop the never ending motion
        mymot1.stop()

        # wait for the motor stop
        while mymot1.state() == 'MOVING':
            gevent.sleep(0.1)
Exemplo n.º 20
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()
Exemplo n.º 21
0
 def test_axis_set_velocity(self):
     mymot1 = get_axis("mymot1")
     vel = 5
     mymot1.velocity(vel)
     self.assertEqual(mymot1.velocity(), vel)
Exemplo n.º 22
0
 def test_axis_get_velocity(self):
     mymot1 = get_axis("mymot1")
     vel = mymot1.velocity()
Exemplo n.º 23
0
 def test_axis_stop(self):
     mymot1 = get_axis("mymot1")
     mymot1.stop()
Exemplo n.º 24
0
 def test_axis_get_acctime(self):
     mymot1 = get_axis("mymot1")
     acc = mymot1.acctime()
Exemplo n.º 25
0
 def test_axis_move_backlash(self):
     mymot1 = get_axis("mymot1")
     pos = mymot1.position()
     mymot1.move(pos - 0.1)
Exemplo n.º 26
0
 def test_axis_stop(self):
     mymot1 = get_axis("mymot1")
     mymot1.stop()
Exemplo n.º 27
0
 def test_axis_set_acctime(self):
     mymot1 = get_axis("mymot1")
     acc = 0.250
     self.assertEqual(mymot1.acctime(acc), acc)
Exemplo n.º 28
0
 def test_axis_move_backlash(self):
     mymot1 = get_axis("mymot1")
     pos = mymot1.position()
     mymot1.move(pos - 0.1)
Exemplo n.º 29
0
 def test_axis_get_velocity(self):
     mymot1 = get_axis("mymot1")
     vel = mymot1.velocity()
Exemplo n.º 30
0
 def test_axis_rmove(self):
     mymot1 = get_axis("mymot1")
     mymot1.rmove(0.1)
Exemplo n.º 31
0
 def test_axis_set_velocity(self):
     mymot1 = get_axis("mymot1")
     vel = 5
     mymot1.velocity(vel)
     self.assertEqual(mymot1.velocity(), vel)
Exemplo n.º 32
0
 def test_axis_set_velocity_error(self):
     mymot1 = get_axis("mymot1")
     vel = 5000
     self.assertRaises(Exception, mymot1.velocity, vel)
Exemplo n.º 33
0
 def test_axis_set_velocity_error(self):
     mymot1 = get_axis("mymot1")
     vel = 5000
     self.assertRaises(Exception, mymot1.velocity, vel)
Exemplo n.º 34
0
 def test_axis_get_acctime(self):
     mymot1 = get_axis("mymot1")
     acc = mymot1.acctime()
Exemplo n.º 35
0
 def test_axis_get_id(self):
     mymot1 = get_axis("mymot1")
     self.assertTrue(
         re.match(
             r"[a-f0-9A-F]{4}.[a-f0-9A-F]{4}.[a-f0-9A-F]{4}",
             mymot1.get_id()))
Exemplo n.º 36
0
 def test_axis_state(self):
     mymot1 = get_axis("mymot1")
     mymot1.state()
Exemplo n.º 37
0
 def test_axis_get_position(self):
     mymot1 = get_axis("mymot1")
     pos = mymot1.position()
Exemplo n.º 38
0
 def test_axis_move(self):
     mymot1 = get_axis("mymot1")
     pos = mymot1.position()
     mymot1.move(pos + 0.1)  # waits for the end of motion
Exemplo n.º 39
0
 def test_axis_move(self):
     mymot1 = get_axis("mymot1")
     pos = mymot1.position()
     mymot1.move(pos + 0.1) # waits for the end of motion
Exemplo n.º 40
0
 def test_axis_rmove(self):
     mymot1 = get_axis("mymot1")
     mymot1.rmove(0.1)
Exemplo n.º 41
0
 def test_axis_set_acctime(self):
     mymot1 = get_axis("mymot1")
     acc = 0.250
     self.assertEqual(mymot1.acctime(acc), acc)
Exemplo n.º 42
0
 def test_axis_creation(self):
     mymot1 = get_axis("mymot1")
     self.assertTrue(mymot1)
Exemplo n.º 43
0
 def test_axis_get_position(self):
     mymot1 = get_axis("mymot1")
     pos = mymot1.position()
Exemplo n.º 44
0
 def test_axis_set_position(self):
     mymot1 = get_axis("mymot1")
     pos = 2.0  # given in mm
     self.assertEqual(mymot1.position(pos), pos)
Exemplo n.º 45
0
 def test_axis_set_position(self):
     mymot1 = get_axis("mymot1")
     pos = 2.0  # given in mm
     self.assertEqual(mymot1.position(pos), pos)
Exemplo n.º 46
0
 def test_axis_creation(self):
     mymot1 = get_axis("mymot1")
     self.assertTrue(mymot1)
Exemplo n.º 47
0
 def test_axis_get_id(self):
     mymot1 = get_axis("mymot1")
     self.assertTrue(
         re.match(r"[a-f0-9A-F]{4}.[a-f0-9A-F]{4}.[a-f0-9A-F]{4}",
                  mymot1.get_id()))
Exemplo n.º 48
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()
Exemplo n.º 49
0
 def test_axis_state(self):
     mymot1 = get_axis("mymot1")
     mymot1.state()