__author__ = 'infused' import scpi if __name__ == "__main__": host = '192.168.178.56' rp_s = scpi.SCPI(host, None) # rp_s.blink_diode(5, 1) # rp_s.bar_led_graphs(67) # rp_s.continuous_sig_gen('sine', 1000, 1) # rp_s.cont_sig_gen_pulse('sine', 10, 1, 1) rp_s.acq_buff() rp_s.close()
observation_sources = collect_targets(kat, args) if opts.force_siggen and kat.dry_run: user_logger.warning( "The signal generator commands are being used during a dry-run") # Quit early if there are no sources to observe if len(observation_sources.filter(el_limit_deg=opts.horizon)) == 0: user_logger.warning( "No targets are currently visible - please re-run the script later" ) else: # Start capture session, which creates HDF5 file with start_session(kat, **vars(opts)) as session: user_logger.info("Setting up the signal Generator ip:port %s:%i." % (siggen_ip, siggen_port)) if not kat.dry_run or opts.force_siggen: # prevent verifiing script from messing with things and failing to connect sigconn = SCPI.SCPI(siggen_ip, siggen_port) testcon = sigconn.testConnect() else: sigconn = Temp() testcon = False with sigconn as sig: if testcon == False: user_logger.error( 'Test connection to signal generator failed.') else: user_logger.info("Connected to Signal Generator:%s" % (testcon)) sig.reset() user_logger.info("Signal Generator reset") sig.outputOn()
import time import sys import serial import scpi from pylibftdi import Device, USB_PID_LIST, USB_VID_LIST port = sys.argv[1] outfile = sys.argv[2] oszi = scpi.SCPI(port) oszi.set_param_and_check(":TRAC:SOUR", "CH1") oszi.set_param_and_check(":TRAC:FORM", "CSV") #oszi.set_param_and_check(":TRAC:POIN", "MAX"); print oszi.query(":TRAC:DATA?", 5) with open(outfile, "w") as f: f.write(oszi.read(1000000, 2))