("waveform", "func_waveform"), ("arb_frequency", "arb_frequency"), ("arb_gain", "arb_gain"), ("arb_waveform_handle", "arb_waveform_handle"), ("arb_sequence_handle", "arb_sequence_handle")] def __init__(self, parent): super(ShortCutFreqGen, self).__init__(parent) self.channel_idx = 1 @property def channel_name(self): return list(self.parent.channels.keys())[self.channel_idx - 1] add_sc_fields(ShortCutFreqGen, ShortCutFreqGen._fields) add_sc_fields(ShortCutFreqGen, ShortCutFreqGen._channel_related_fields, 'sc_active_channel') add_sc_fields_enum(ShortCutFreqGen, 'output_mode', 'func', 'arb', 'seq') add_sc_fields_enum(ShortCutFreqGen, 'operation_mode', 'continuous', 'burst') @register_wrapper('IVI-C', 'IviFgen') class IviCFGen(IviCWrapper): _repeated_capabilities = {} def __init__(self, *args, **kwds): super(IviCFGen, self).__init__(*args, **kwds) self.sc = ShortCutFreqGen(self) @property
return self.parent.traces[self.trace_name] def fetch(self): y_trace = self.parent.traces[self.trace_name].fetch_y() if self.parent.frequency.start == self.parent.frequency.stop: x_start = 0 x_stop = self.parent.sweep_coupling.sweep_time else: x_start = self.parent.frequency.start x_stop = self.parent.frequency.stop size = self.parent.traces[self.trace_name].size x_trace = linspace(x_start, x_stop, size, True) return x_trace, y_trace add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._sweep_coupling_fields, "sweep_coupling") add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._acquisition_fields, "acquisition") add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._frequency_fields, "frequency") add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._trace_related_fields, "sc_active_trace") add_sc_fields_enum(ShortCutSpecAn, "detector_type", *choices.spec_an_detector_types._choices) add_sc_fields_enum(ShortCutSpecAn, "tr_type", *choices.spec_an_trace_types._choices) @register_wrapper("IVI-COM", "IviSpecAn") class IviComSpecAn(IviComWrapper): trace_cls = Trace def __init__(self, *args, **kwds): super(IviComSpecAn, self).__init__(*args, **kwds)
_ch_fields = [field[0] for field in _channel_related_fields] def __init__(self, parent): super(ShortCutScope, self).__init__(parent) self.channel_idx = 1 self.channel_idxs = Enum(['select channel'] + parent.channels.keys()) @property def channel_name(self): return self.parent.channels.keys()[self.channel_idx - 1] def fetch(self): return self.parent.measurements[self.channel_name].fetch_waveform() add_sc_fields(ShortCutScope, ShortCutScope._acquisition_fields, 'acquisition') add_sc_fields(ShortCutScope, ShortCutScope._channel_related_fields, 'sc_active_channel') add_sc_fields_enum(ShortCutScope, 'ch_coupling', *choices.scope_couplings._choices) add_sc_fields_enum(ShortCutScope, 'sample_mode', *choices.scope_sample_modes._choices) add_sc_fields_enum(ShortCutScope, 'acquisition_type', *choices.scope_acquisition_types._choices) @register_wrapper('IVI-COM', 'IviScope') class IviComScope(IviComWrapper): _repeated_capabilities = {} measurement_cls = Measurement channel_cls = Channel
("waveform", "func_waveform"), ("arb_frequency", "arb_frequency"), ("arb_gain", "arb_gain"), ("arb_waveform_handle", "arb_waveform_handle"), ("arb_sequence_handle", "arb_sequence_handle")] def __init__(self, parent): super(ShortCutFreqGen, self).__init__(parent) self.channel_idx = 1 @property def channel_name(self): return self.parent.channels.keys()[self.channel_idx-1] add_sc_fields(ShortCutFreqGen, ShortCutFreqGen._fields) add_sc_fields(ShortCutFreqGen, ShortCutFreqGen._channel_related_fields, 'sc_active_channel') add_sc_fields_enum(ShortCutFreqGen, 'output_mode', 'func', 'arb', 'seq') add_sc_fields_enum(ShortCutFreqGen, 'operation_mode', 'continuous', 'burst') @register_wrapper('IVI-C', 'IviFgen') class IviCFGen(IviCWrapper): _repeated_capabilities = {} def __init__(self, *args, **kwds): super(IviCFGen, self).__init__(*args, **kwds) self.sc = ShortCutFreqGen(self) @property
return self.parent.traces[self.trace_name] def fetch(self): y_trace = self.parent.traces[self.trace_name].fetch_y() if self.parent.frequency.start == self.parent.frequency.stop: x_start = 0 x_stop = self.parent.sweep_coupling.sweep_time else: x_start = self.parent.frequency.start x_stop = self.parent.frequency.stop size = self.parent.traces[self.trace_name].size x_trace = linspace(x_start, x_stop, size, True) return x_trace, y_trace add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._sweep_coupling_fields, 'sweep_coupling') add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._acquisition_fields, 'acquisition') add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._frequency_fields, 'frequency') add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._trace_related_fields, 'sc_active_trace') add_sc_fields_enum(ShortCutSpecAn, 'detector_type', *choices.spec_an_detector_types._choices) add_sc_fields_enum(ShortCutSpecAn, 'tr_type', *choices.spec_an_trace_types._choices) @register_wrapper('IVI-COM', 'IviSpecAn') class IviComSpecAn(IviComWrapper): trace_cls = Trace
_ch_fields = [field[0] for field in _channel_related_fields] def __init__(self, parent): super(ShortCutScope, self).__init__(parent) self.channel_idx = 1 self.channel_idxs = Enum(['select channel'] + parent.channels.keys()) @property def channel_name(self): return self.parent.channels.keys()[self.channel_idx - 1] def fetch(self): return self.parent.channels[self.channel_name].fetch_waveform() add_sc_fields(ShortCutScope, ShortCutScope._fields_direct) add_sc_fields(ShortCutScope, ShortCutScope._channel_related_fields, 'sc_active_channel') add_sc_fields_enum(ShortCutScope, 'ch_coupling', *choices.scope_couplings._choices) add_sc_fields_enum(ShortCutScope, 'sample_mode', *choices.scope_sample_modes._choices) add_sc_fields_enum(ShortCutScope, 'acquisition_type', *choices.scope_acquisition_types._choices) @register_wrapper('IVI-C', 'IviScope') class IviCScope(IviCWrapper): _repeated_capabilities = {} def __init__(self, *args, **kwds):
def create_measurement(self, input_port=2, output_port=1): self.active_measurement.create(input_port, output_port) def fetch(self, format="formatted"): if format not in ("formatted", "complex"): raise ValueError("Expected format either formatted or complex!") if format == "complex": y_curve = self.active_measurement.fetch_complex() else: y_curve = self.active_measurement.fetch_formatted() x_curve = self.active_measurement.fetch_x() return x_curve, y_curve add_sc_fields(ShortCutNA, ShortCutNA._channel_related_fields, 'sc_active_channel') add_sc_fields(ShortCutNA, ShortCutNA._measurement_related_fields, 'sc_active_measurement') add_sc_fields(ShortCutNA, ShortCutNA._stimulus_range_fields, 'sc_active_stimulus_range') add_sc_fields_enum(ShortCutNA, 'sweep_type', *choices.na_sweep_types._choices) add_sc_fields_enum(ShortCutNA, 'format', *choices.na_formats._choices) class Channel(object): measurement_cls = Measurement def __init__(self, name, parent): self.name = name self.parent = parent
return self.parent.traces[self.trace_name] def fetch(self): y_trace = self.parent.traces[self.trace_name].fetch_y() if self.parent.frequency.start==self.parent.frequency.stop: x_start = 0 x_stop = self.parent.sweep_coupling.sweep_time else: x_start = self.parent.frequency.start x_stop = self.parent.frequency.stop size = self.parent.traces[self.trace_name].size x_trace = linspace(x_start, x_stop, size, True) return x_trace, y_trace add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._sweep_coupling_fields, 'sweep_coupling') add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._acquisition_fields, 'acquisition') add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._frequency_fields, 'frequency') add_sc_fields(ShortCutSpecAn, ShortCutSpecAn._trace_related_fields, 'sc_active_trace') add_sc_fields_enum(ShortCutSpecAn, 'detector_type', *choices.spec_an_detector_types._choices) add_sc_fields_enum(ShortCutSpecAn, 'tr_type', *choices.spec_an_trace_types._choices)
_fields = [field[0] for field in _fields_direct] _ch_fields = [field[0] for field in _channel_related_fields] def __init__(self, parent): super(ShortCutScope, self).__init__(parent) self.channel_idx = 1 self.channel_idxs = Enum(['select channel'] + parent.channels.keys()) @property def channel_name(self): return self.parent.channels.keys()[self.channel_idx-1] def fetch(self): return self.parent.channels[self.channel_name].fetch_waveform() add_sc_fields(ShortCutScope, ShortCutScope._fields_direct) add_sc_fields(ShortCutScope, ShortCutScope._channel_related_fields, 'sc_active_channel') add_sc_fields_enum(ShortCutScope, 'ch_coupling', *choices.scope_couplings._choices) add_sc_fields_enum(ShortCutScope, 'sample_mode', *choices.scope_sample_modes._choices) add_sc_fields_enum(ShortCutScope, 'acquisition_type', *choices.scope_acquisition_types._choices) @register_wrapper('IVI-C', 'IviScope') class IviCScope(IviCWrapper): _repeated_capabilities = {} def __init__(self, *args, **kwds): super(IviCScope, self).__init__(*args, **kwds) self.sc = ShortCutScope(self)
self.active_measurement.create(input_port, output_port) def fetch(self,format="formatted"): if format not in ("formatted","complex"): raise ValueError("Expected format either formatted or complex!") if format == "complex": y_curve = self.active_measurement.fetch_complex() else: y_curve = self.active_measurement.fetch_formatted() x_curve = self.active_measurement.fetch_x() return x_curve, y_curve add_sc_fields(ShortCutNA, ShortCutNA._channel_related_fields, 'sc_active_channel') add_sc_fields(ShortCutNA, ShortCutNA._measurement_related_fields, 'sc_active_measurement') add_sc_fields(ShortCutNA, ShortCutNA._stimulus_range_fields, 'sc_active_stimulus_range') add_sc_fields_enum(ShortCutNA, 'sweep_type', *choices.na_sweep_types._choices) add_sc_fields_enum(ShortCutNA, 'format', *choices.na_formats._choices) class Channel(object): measurement_cls = Measurement def __init__(self, name, parent): self.name = name
_fields = [field[0] for field in _acquisition_fields] _ch_fields = [field[0] for field in _channel_related_fields] def __init__(self, parent): super(ShortCutScope, self).__init__(parent) self.channel_idx = 1 self.channel_idxs = Enum(['select channel'] + parent.channels.keys()) @property def channel_name(self): return self.parent.channels.keys()[self.channel_idx-1] def fetch(self): return self.parent.measurements[self.channel_name].fetch_waveform() add_sc_fields(ShortCutScope, ShortCutScope._acquisition_fields, 'acquisition') add_sc_fields(ShortCutScope, ShortCutScope._channel_related_fields, 'sc_active_channel') add_sc_fields_enum(ShortCutScope, 'ch_coupling', *choices.scope_couplings._choices) add_sc_fields_enum(ShortCutScope, 'sample_mode', *choices.scope_sample_modes._choices) add_sc_fields_enum(ShortCutScope, 'acquisition_type', *choices.scope_acquisition_types._choices) @register_wrapper('IVI-COM', 'IviScope') class IviComScope(IviComWrapper): _repeated_capabilities = {} measurement_cls = Measurement channel_cls = Channel def __init__(self, *args, **kwds): super(IviComScope, self).__init__(*args, **kwds)