def __init__(self, vna, channel, cal_unit='', timeout_ms=None): self.vna = vna self.channel = channel self.ports = [] if not cal_unit: cal_unit = vna.cal_units[0] self.cal_unit = vna.cal_unit(cal_unit) if timeout_ms: self.timeout_ms = timeout_ms else: port_count = self.cal_unit.ports number_of_sweeps = 3 * port_count + number_of_thrus(port_count) self.timeout_ms = number_of_sweeps * ( 10 * self.channel.total_sweep_time_ms + 10000) + 5000
def auto_calibrate(self, ports, characterization=''): scpi = "" if type(ports) == dict: scpi = ":SENS{0}:CORR:COLL:AUTO:PORT '{1}',{2}" ports_string = ",".join("{!r},{!r}".format(k,v) for (k,v) in ports.items()) scpi = scpi.format(self.index, characterization, ports_string) else: scpi = ":SENS{0}:CORR:COLL:AUTO '{1}',{2}" ports_string = ",".join(map(str, ports)) scpi = scpi.format(self.index, characterization, ports_string) port_count = len(ports) number_of_sweeps = 3 * port_count + number_of_thrus(port_count) timeout_ms = number_of_sweeps * (10 * self.total_sweep_time_ms + 10000) + 5000 self._vna.write(scpi) self._vna.pause(timeout_ms)
def auto_calibrate(self, ports, characterization=''): scpi = "" if type(ports) == dict: scpi = ":SENS{0}:CORR:COLL:AUTO:PORT '{1}',{2}" ports_string = ",".join("{!r},{!r}".format(k, v) for (k, v) in ports.items()) scpi = scpi.format(self.index, characterization, ports_string) else: scpi = ":SENS{0}:CORR:COLL:AUTO '{1}',{2}" ports_string = ",".join(map(str, ports)) scpi = scpi.format(self.index, characterization, ports_string) port_count = len(ports) number_of_sweeps = 3 * port_count + number_of_thrus(port_count) timeout_ms = number_of_sweeps * (10 * self.total_sweep_time_ms + 10000) + 5000 self._vna.write(scpi) self._vna.pause(timeout_ms)
def auto_calibrate(self, ports, characterization=''): scpi = "" if type(ports) == dict: def format_str(port_items): return "{!r},{!r}".format(*port_items) port_strings = [format_str(items) for items in ports.items()] ports_string = ",".join(port_strings) scpi = ":SENS{0}:CORR:COLL:AUTO:PORT '{1}',{2}" scpi = scpi.format(self.index, characterization, ports_string) else: scpi = ":SENS{0}:CORR:COLL:AUTO '{1}',{2}" ports_string = ",".join(map(str, ports)) scpi = scpi.format(self.index, characterization, ports_string) port_count = len(ports) number_of_sweeps = 3 * port_count + number_of_thrus(port_count) one_sweep_ms = 10 * self.total_sweep_time_ms + 10000 timeout_ms = number_of_sweeps * one_sweep_ms + 5000 self._vna.write(scpi) self._vna.pause(timeout_ms)