示例#1
0
def run_shots(args):
    uut = acq400_hapi.Acq400(args.uuts[0])
    acq400_hapi.cleanup.init()

    uut.s0.transient = 'POST=%d SOFT_TRIGGER=%d DEMUX=%d' % \
            (args.post, 1 if args.trg == 'int' else 0, 1 if args.store==0 else 0)

    if args.aochan == 0:
        args.aochan = args.nchan

    for sx in uut.modules:
        uut.modules[sx].trg = '1,1,1' if args.trg == 'int' else '1,0,1'

    if args.files != "":
        work = awg_data.RunsFiles(uut, args.files.split(','), True)
    else:
        work = awg_data.RainbowGen(uut, args.aochan, args.awglen, True)

    store = store_file
    loader = work.load()
    for ii in range(0, args.loop):
        print("shot: %d" % (ii))
        f = next(loader)
        print("Loaded %s" % (f))
        uut.run_oneshot()

        if args.store:
            print("read_chan %d" % (args.post * args.nchan))
            rdata = uut.read_chan(0, args.post * args.nchan)
            store(ii, rdata, args.nchan, args.post)
        if args.wait_user:
            input("hit return to continue")
示例#2
0
def run_shots(args):
    uut = acq400_hapi.Acq400(args.uuts[0])
    acq400_hapi.cleanup.init()
    if args.capture > 0:
        uut.s0.transient = 'POST=%d SOFT_TRIGGER=%d' % \
            (args.post, 1 if args.trg == 'int' else 0)
        shot_controller = acq400_hapi.ShotController([uut])

    for sx in uut.modules:
        uut.modules[sx].trg = '1,1,1' if args.trg == 'int' else '1,0,1'

    if args.files == "@ALLFULLSCALE":
        work = awg_data.AllFullScale(uut, args.nchan, args.awglen)
    elif args.files != "":
        work = awg_data.RunsFiles(uut, args.files.split(','))
    else:
        work = awg_data.RainbowGen(uut, args.nchan, args.awglen)

    for ii in range(0, args.loop):
        print("shot: %d" % (ii))

        for f in work.load():
            print("Loaded %s" % (f))
            if args.capture > 0:
                shot_controller.run_shot(
                    soft_trigger=True if args.trg == 'int' else False)
            else:
                raw_input("hit return when done")
示例#3
0
def run_shots(args):
    uut = acq400_hapi.Acq400(args.uuts[0])
    acq400_hapi.cleanup.init()
    if args.plot:
        plt.ion()

    uut.s0.transient = 'POST=%d SOFT_TRIGGER=%d DEMUX=0' % \
        (args.post, 1 if args.trg == 'int' else 0) 

    if args.aochan == 0:
        args.aochan = args.nchan

    for sx in uut.modules:
        if args.trg == 'int':
            uut.modules[sx].trg = '1,1,1'
        else:
            if args.trg.contains('falling'):
                uut.modules[sx].trg = '1,0,0'
            else:
                uut.modules[sx].trg = '1,0,1'
                
    if args.pulse != None:
        work = awg_data.Pulse(uut, args.aochan, args.awglen, args.pulse.split(','))
    elif args.files != "":
        work = awg_data.RunsFiles(uut, args.files.split(','), run_forever=True)
    else:
        work = awg_data.RainbowGen(uut, args.aochan, args.awglen, run_forever=True)
        # compensate gain ONLY Rainbow Case
        if args.range != "default":
            gain = 10/float(args.range.strip('V'))
            print("setting work.gain {}".format(gain))
            work.gain = gain

    # Set range knobs, valid ALL data sources.
    if args.range != "default":
        for sx in uut.modules:
            print("setting GAIN_ALL {}".format(args.range))
            uut.modules[sx].GAIN_ALL = args.range
            break

    print("args.autorearm {}".format(args.autorearm))

    loader = work.load(autorearm = args.autorearm)
    for ii in range(0, args.loop):
        print("shot: %d" % (ii))
        if ii == 0 or not args.autorearm:
            f = loader.next()
            print("Loaded %s" % (f))
        else:
            if args.autorearm and ii+1 == args.loop:
            # on the final run, drop out of autorearm mode. 
            # the final shot MUST be in ONCE mode so that the DMAC
            # is freed on conclusion
                for sx in uut.modules:
                    if uut.modules[sx].MODEL.startswith('AO'):
                        uut.modules[sx].playloop_oneshot = '1'
                        
        uut.run_oneshot()

        print("read_chan %d" % (args.post*args.nchan))
        rdata = uut.read_chan(0, args.post*args.nchan)
        if args.store:
            pltsup.store_file(ii, rdata, args.nchan, args.post)
        if args.plot > 0 :
            plt.cla()
            plt.title("AI for shot %d %s" % (ii, "persistent plot" if args.plot > 1 else ""))
            pltsup.plot(uut, args, ii, rdata)
        if args.wait_user is not None:
            args.wait_user()