Пример #1
0
def miezescan(echolist, counttime):
    """Iterate over a list of echotimes -> measure one S(Q,t) curve

    echolist: list of echotimes
    counttime: counting time (the **same** for all list entries)
    """
    echotime = session.getDevice('echotime')
    with manualscan(echotime, counttime):
        for etime in echolist:
            move(echotime, etime)
            set_cascade()
            count(counttime)
Пример #2
0
def miezescan(echolist, counttime):
    """Iterate over a list of echotimes -> measure one S(Q,t) curve

    echolist: list of echotimes
    counttime: counting time (the **same** for all list entries)
    """
    # psd_channel.mode = 'tof'
    echotime = session.getDevice('echotime')
    with manualscan(echotime, counttime):
        for etime in echolist:
            setecho(etime)
            count(counttime)
Пример #3
0
def test_manualscan(session):
    mot = session.getDevice('motor')
    c = session.getDevice('coder')
    det = session.getDevice('det')
    mm = session.getDevice('manual')
    mm.maw(0)
    slow_motor = session.getDevice('slow_motor')
    slow_motor.maw(0)

    # normal
    with manualscan(mot, det, t=0.):
        assert mot in session._manualscan._envlist
        for i in range(3):
            mot.maw(i)
            count_result = count()
        assert raises(NicosError, manualscan)

    assert isinstance(count_result, CountResult) and len(count_result) == 5

    # with multistep
    SetEnvironment('slow_motor')
    try:
        with manualscan(mot, c, det, 'manscan', manual=[0, 1], t=0.):
            assert c in session._manualscan._envlist
            for i in range(3):
                mot.maw(i)
                count_result = count()
    finally:
        SetEnvironment()
    dataman = session.experiment.data
    dataset = dataman.getLastScans()[-1]
    assert dataset.info.startswith('manscan')
    # note: here, the env devices given in the command come first
    assert dataset.envvaluelists == [[0., 0., 0.], [0., 0., 0.], [1., 1., 0.],
                                     [1., 1., 0.], [2., 2., 0.], [2., 2., 0.]]

    assert isinstance(count_result, list)
    assert isinstance(count_result[0], CountResult)
Пример #4
0
def freqscan(device, start, step, numsteps):
    """Special scan for finding a resonance.

    Detector must be set to according device (e.g. cbox_0a_coil_rms)
    device: cbox_0a_fg_freq
    start:  starting frequency in Hz
    step:   steps in Hz
    numsteps: number of steps
    """
    with manualscan(device):
        for i in range(numsteps):
            maw(device, start + step * i)
            session.delay(0.2)
            count(1)
Пример #5
0
def _tomo(title, angles, moveables, imgsperangle, *detlist, **preset):

    if moveables is None:
        # TODO: currently, sry is the common name on nectar and antares for the
        # sample rotation (phi - around y axis).  Is this convenience function
        # ok, or should it be omitted and added to the instrument custom?
        moveables = (session.getDevice('sry'), )
    elif isinstance(moveables, Moveable):
        moveables = (moveables, )
    moveables = tuple(moveables)

    session.log.debug('used angles: %r', angles)

    with manualscan(*(moveables + detlist), _title=title) as scan:
        for angle in angles:
            # Move the given movable to the target angle
            try:
                scan.moveDevices(moveables, [angle] * len(moveables))
                # Capture the desired amount of images
                for _ in range(imgsperangle):
                    for i in range(2, -1, -1):
                        try:
                            count(**preset)
                        except NicosError:
                            if not i:
                                raise
                            session.log.warning(
                                'Count failed, try it again.'
                                '%d remaining tries', i)
                            if detlist:
                                reset(*detlist)
                            else:
                                reset(*session.experiment.detectors)
                        else:
                            break
            except SkipPoint:
                pass