Beispiel #1
0
def rotatebench(angle=0.0,delaydet=1):
    a1=0
    a1+=gen.get_pv("IN:LARMOR:CAEN:hv0:0:8:status")
    a1+=gen.get_pv("IN:LARMOR:CAEN:hv0:0:9:status")
    a1+=gen.get_pv("IN:LARMOR:CAEN:hv0:0:10:status")
    a1+=gen.get_pv("IN:LARMOR:CAEN:hv0:0:11:status")
    if(a1>0):
        print "The detector is not turned off"
        print "Not attempting Move"
        return
    else:
        print "The detector is off"
       
    if(angle >= -0.5):
        gen.cset(benchlift=1)
        print "Lifting Bench (20s)"
        sleep(20)
        a1=gen.get_pv("IN:LARMOR:BENCH:STATUS")

        if(a1==1):
            print "Rotating Bench"
            gen.cset(bench_rot=angle)
            waitfor_move()
            print "Lowering Bench (20s)"
            gen.cset(benchlift=0)
            sleep(20)
        else:
            print "Bench failed to lift"
            print "Move not attempted"
Beispiel #2
0
 def __init__(self, block, unit):
     blocks = g.get_blocks()
     if block not in blocks:
         new_name = [
             name for name in blocks
             if name and name.lower() == block.lower()
         ]
         if new_name:
             block = new_name[0]
         else:
             raise RuntimeError("Unknown block {}.".format(block))
     Motion.__init__(
         self,
         lambda: g.cget(block)["value"],
         lambda x: g.cset(block, x),
         block,
         unit=unit,
         # Workarounds until a better solution to get fields
         # from blocks is implemented in IBEX. Note that IBEX
         # blocks must point at AXIS:MTR rather than AXIS for
         # this to work.
         velocity_getter=lambda: g.get_pv("CS:SB:{}.VELO".format(block),
                                          is_local=True),
         velocity_setter=lambda vel: g.set_pv(
             "CS:SB:{}.VELO".format(block), vel, is_local=True),
         tolerance_getter=lambda: g.get_pv("CS:SB:{}.RDBD".format(block),
                                           is_local=True),
     )
Beispiel #3
0
def pv_motion(pv_str, name):
    """Create a motion object around a PV string."""
    return Motion(
        lambda: g.get_pv(pv_str),
        lambda x: g.set_pv(pv_str, x),
        name,
        unit=g.get_pv(pv_str + ".EGU"),
        velocity_getter=lambda: g.get_pv("{}.VELO".format(pv_str)),
        velocity_setter=lambda x: g.set_pv("{}.VELO".format(pv_str), x),
        tolerance_getter=lambda: g.get_pv("{}.RDBD".format(pv_str)))
Beispiel #4
0
 def get_units(motion):
     """Get the physical measurement units associated with a block name."""
     pv_name = g.adv.get_pv_from_block(motion)
     if "." in pv_name:
         # Remove any headers
         pv_name = pv_name.split(".")[0]
     unit_name = pv_name + ".EGU"
     # pylint: disable=protected-access
     if getattr(g, "__api").pv_exists(unit_name):
         return g.get_pv(unit_name)
     return ""