sources = ["moon", "casa"] freqs = range(2000, 8001, 1500) ants = ['2a', '2b', '2e', '3l', '1f', '5c', '4k', '4g'] NINTS = 15 NONOFFS = 4 for source in sources: for freq in freqs: for antn, ant in enumerate(ants): for onoff_n, onoff in enumerate(["on", "off"] * NONOFFS): print "Pointing to %s at %.1f MHz" % (source, freq) if onoff == "on": print "Observing %s at %.2f MHz with Antenna %s" % ( source, freq, ant) ata_control.point(source, freq) elif onoff == "off": print "Observing %s at %.2f MHz with Antenna %s (Offset 10)" % ( source, freq, ant) ata_control.point(source, freq, 10, 0) #os.system("/home/sonata/dev/agilent_sa_gpib/save_spec_automate.py /home/sonata/data/%s_%s_%.2f &" % (source, onoff, freq)) ata_control.set_rf_switch(0, antn) ata_control.set_rf_switch(1, antn) proc = Popen([ "python", "take_spec_data.py", "snap1", "/home/sonata/dev/ata_snap/snap_adc5g_spec/outputs/snap_adc5g_spec_2018-06-23_1048.fpg", "-n", "%d" % NINTS, "-a", ant, "-c", "%s_%s%d_ant_%s_%.2f" % (source, onoff, onoff_n, ant, freq) ]) proc.wait()
POL = "x" NSCANS = 300 ATTEN = 15 tn = telnetlib.Telnet(HOST, PORT) def newSpec(channel): tn.write('TRAC:DATA? TRACE1\n') spec = tn.read_until('\n') spec_list = spec.split(',') spec_list = [float(i) for i in spec_list] return spec_list for ANTN, ANT in enumerate(ANTS): ata_control.set_rf_switch(0, ANTN + 1) output_file = "stability_test_%s_%s_%d.pkl" % (ANT, POL, time.time()) spec_out = [] stats_out = [] for atten in range(NSCANS): ata_control.set_pam_atten(ANT, POL, ATTEN) time.sleep(1) stats_out += [ata_control.get_pam_status(ANT)] spec_out += [newSpec(1)] time.sleep(2) with open(output_file, "w") as fh: pickle.dump({'stats': stats_out, 'spec': spec_out}, fh)