示例#1
0
def MAIN(msg):
    try:
        adjust = [1, 2][int(args.level_only)]
        if util.iftask_setup(adjust, bws[0], ifs[0], dcms):
            return
        main_loop()
    finally:
        # final timestamp
        sys.stdout.write(
            time.strftime('# %Y%m%d %H:%M:%S HST\n', time.localtime()))
        sys.stdout.flush()
        # retune the receiver to get settings back to nominal
        util.tune(cart, agilent, photonics, lo_ghz)
        drama.Exit('MAIN done')
示例#2
0
def MAIN(msg):
    # TODO obey/kick check
    try:
        if_arg = [1,2][int(args.level_only)]
        if util.iftask_setup(if_arg, 1000, 6, dcms):
            return
        
        dbm_sweep()
        
    finally:
        # final timestamp
        sys.stdout.write(time.strftime('# %Y%m%d %H:%M:%S HST\n', time.localtime()))
        sys.stdout.flush()
        agilent.set_dbm(agilent.safe_dbm)
        photonics.set_attenuation(photonics.max_att) if photonics else None
        drama.Exit('MAIN done')
示例#3
0
def main_loop():
    for bw_mhz in bws:
        if util.iftask_set_bw(bw_mhz):
            return

        for if_ghz in ifs:
            lo2_mhz = if_ghz * 1e3 + 2500
            if bw_mhz == 250:
                lo2_mhz += 125
            if util.iftask_set_lo2(lo2_mhz):
                return

            for lo_ghz in los:

                if not util.tune(cart, agilent, photonics, lo_ghz):
                    logging.error('failed to tune to %.3f ghz', lo_ghz)
                    continue
                # level only (won't actually set bw/lo2)
                if util.iftask_setup(2, bw_mhz, if_ghz, dcms):
                    return
                att = util.iftask_get_att(dcms)
                if not att:
                    return
                hotp = util.iftask_get_tp2(dcms)
                if not hotp:
                    return
                # collect values into a row
                r = [0.0] * (hot_p_index + len(powers))
                r[0] = lo_ghz
                r[1] = if_ghz
                r[2] = bw_mhz
                for j in range(len(powers)):
                    r[att_index + j] = att[j]
                    r[hot_p_index + j] = hotp[j]
                # write out the row
                sys.stdout.write(' '.join('%g' % x for x in r) + '\n')
                sys.stdout.flush()