fixate.drivers.funcgen package¶
funcgen is the function generator driver.
Use funcgen.open to connect to a connected digital multi meter Functions are dictacted by the metaclass in helper.py
Usage: myfuncgen = funcgen.open() myfuncgen.function(‘sin’, freq=’1kHz’) myfuncgen.function(‘square’, ‘ch2’, amplit=5, offset=2.5, freq=’1kHz’) myfuncgen.output_ch1 = True myfuncgen.output_ch2 = True
functions: function(self, *mode, **mode_params): adv_function(self, *mode, **mode_params): reset(self):
properties: output_ch1 output_ch2 output_ch3 output_ch4
- fixate.drivers.funcgen.open() FuncGen¶
Open is the public api for the dmm driver for discovering and opening a connection to a valid Digital Multimeter :return: A instantiated class connected to a valid funcgen
Submodules¶
fixate.drivers.funcgen.helper module¶
- class fixate.drivers.funcgen.helper.BurstNCycle¶
Bases:
object- burst_period(seconds: float | int)¶
- infinite()¶
- class fixate.drivers.funcgen.helper.ChannelBase¶
Bases:
object- dbm(value: float | int)¶
- duty(value: float | int)¶
- frequency(value: float | int)¶
Set the frequency on the channel :param value: int or float :return:
- offset(value: float | int)¶
- phase(value: float | int)¶
- vpp(value: float | int)¶
- vrms(value: float | int)¶
- class fixate.drivers.funcgen.helper.FuncGen(instrument)¶
Bases:
objectAPI Requirements
Mockable Individually addressable Use the most significant at the front of the function call Add Sync, Sweep and Modulate Add DTMF
Channel Selection >>>fg.channel1 >>>fg.channel2
Waveform Selection >>>fg.channel1.waveform.sin() >>>fg.channel1.waveform.square() >>>fg.channel1.waveform.ramp() # Has Special configurations >>>fg.channel1.waveform.pulse() >>>fg.channel1.waveform.arb() # Has Special configurations >>>fg.channel1.waveform.triangle() # Ramp with 50% symmetry >>>fg.channel1.waveform.noise() # Has Special configurations >>>fg.channel1.waveform.dc() >>>fg.channel1.waveform.prbs() # Has Special configurations
Channel Configuration >>>fg.channel1.frequency(1000) >>>fg.channel1.vpp(282.8e-3) # Configures the amplitude parameter and the units >>>fg.channel1.vrms(100e-3) >>>fg.channel1.dbm(-6.99) >>>fg.channel1.offset(10e-3) # Volts >>>fg.channel1.phase(30) # Degrees >>>fg.channel1.duty(50) # Percent
Channel Activation # >>>fg.channel1.output(True) # >>>fg.channel1.output(False) >>>fg.channel1(True) >>>fg.channel1(False)
Arb Configuration To Be Implemented
Sync Configuration >>>fg.sync.polarity.normal() >>>fg.sync.polarity.inverted() >>>fg.sync.mode.normal() >>>fg.sync.mode.carrier() >>>fg.sync.mode.marker() >>>fg.sync.mode.source(“1”) # Channel to sync to >>>fg.sync(True) >>>fg.sync(False)
Trigger Configuration >>>fg.trigger.source.immediate() >>>fg.trigger.source.external() >>>fg.trigger.source.manual() >>>fg.trigger.source.timer() >>>fg.trigger.delay(1) # Seconds >>>fg.trigger.edge.rising() >>>fg.trigger.edge.falling() # Not Available on External # >>>fg.trigger.out.off() # Default on reset >>>fg.trigger.out(True) >>>fg.trigger.out(False) # Default on reset >>>fg.trigger.out.rising() >>>fg.trigger.out.falling()
Modulate >>>fg.channel1.modulate.am() >>>fg.channel1.modulate.fm() >>>fg.channel1.modulate.pm() >>>fg.channel1.modulate.fsk() >>>fg.channel1.modulate.bpsk() >>>fg.channel1.modulate.sum() Modulate Sources >>>fg.channel1.modulate.source.internal() >>>fg.channel1.modulate.source.external() >>>fg.channel1.modulate.source.channel2() Modulate Activation >>>fg.channel1.modulate(True) >>>fg.channel1.modulate(False) Modulate Options >>>fg.channel1.modulate.am.depth(100) # % >>>fg.channel1.modulate.am.dssc(True) >>>fg.channel1.modulate.am.dssc(False) >>>fg.channel1.modulate.fm.freq_dev(100e3) # Hz >>>fg.channel1.modulate.fm.frequency(100e3) # Hz >>>fg.channel1.modulate.pm.phase_dev(100e3) # Degrees >>>fg.channel1.modulate.fsk.hop_freq(100e3) # Hz >>>fg.channel1.modulate.fsk.rate(100e3) # Hz >>>fg.channel1.modulate.bpsk.phase(100e3) # Hz >>>fg.channel1.modulate.bpsk.rate(100e3) # Hz >>>fg.channel1.modulate.sum.amplitude(100) # % >>>fg.channel1.modulate.sum.freq(100) # Hz
>>>fg.channel1.modulate.shape.sin() >>>fg.channel1.modulate.shape.square() >>>fg.channel1.modulate.shape.triange() >>>fg.channel1.modulate.shape.up_ramp() >>>fg.channel1.modulate.shape.down_ramp() >>>fg.channel1.modulate.shape.noise() >>>fg.channel1.modulate.shape.prbs() >>>fg.channel1.modulate.shape.arb()
Sweep To Be Implemented
Burst >>>fg.channel1.burst(True) >>>fg.channel1.burst(False) >>>fg.channel1.burst.ncycle() >>>fg.channel1.burst.gated() >>>fg.channel1.burst.ncycle.cycles(-1) # -1 for Infinite positive integers for cycle number >>>fg.channel1.burst.ncycle.burst_period(10e-3) # Seconds >>>fg.channel1.burst.gated.positive() >>>fg.channel1.burst.gated.negative() >>>fg.channel1.burst.phase(0) # Degrees
- REGEX_ID = 'FUNCGEN'¶
- adv_function(*mode, **mode_params)¶
- am(frequency, depth, source=None, waveform=None)¶
- Parameters:
frequency – int or float in Hz
depth – int or float in %
waveform – Defaults to sin
- Returns:
- amplitude_ch1(val)¶
- amplitude_ch2(val)¶
- disable_am()¶
- enable_am()¶
- function(waveform, channel=1, frequency=None, amplitude=None, phase=None, delay=None, offset=None, duty_cycle=None, symmetry=None)¶
- abstract get_identity()¶
- abstract local()¶
- property output_ch1¶
- property output_ch2¶
- property output_ch3¶
- property output_ch4¶
- property output_sync¶
- abstract reset()¶
- class fixate.drivers.funcgen.helper.Modulate¶
Bases:
object
- class fixate.drivers.funcgen.helper.ModulateAM¶
Bases:
object- depth(value: float | int)¶
- dssc(value: bool)¶
- class fixate.drivers.funcgen.helper.ModulateBPSK¶
Bases:
object- phase(value: float | int)¶
- rate(value: float | int)¶
- class fixate.drivers.funcgen.helper.ModulateFSK¶
Bases:
object- hop_freq(value: float | int)¶
- rate(value: float | int)¶
- class fixate.drivers.funcgen.helper.ModulateInternal¶
Bases:
object- frequency(value: float | int)¶
- rate(value: float | int)¶
- class fixate.drivers.funcgen.helper.ModulateShape¶
Bases:
object- arb()¶
- down_ramp()¶
- noise()¶
- prbs()¶
- sin()¶
- square()¶
- triangle()¶
- up_ramp()¶
- class fixate.drivers.funcgen.helper.ModulateSource¶
Bases:
object- channel1()¶
- channel2()¶
- external()¶
- class fixate.drivers.funcgen.helper.ModulateSum¶
Bases:
object- modulate_percent(percent: float | int)¶
- class fixate.drivers.funcgen.helper.Sync¶
Bases:
object
- class fixate.drivers.funcgen.helper.SyncMode¶
Bases:
object- carrier()¶
- marker()¶
- normal()¶
- source(channel: str)¶
fixate.drivers.funcgen.keysight_33500b module¶
- class fixate.drivers.funcgen.keysight_33500b.Keysight33500B(instrument)¶
Bases:
FuncGen- INSTR_TYPE = 'VISA'¶
- REGEX_ID = 'Agilent Technologies,335..B'¶
- get_identity() str¶
- Identification string contains four comma separated fields:
Manufacturer name, Model number, Serial number, Revision code
- Returns:
- Identification string is in the following format for the 33500 Series instruments:
- Keysight Technologies,[Model Number],[10-char Serial Number],A.aaa-B.bb-C.cc-DD-EE
A.aaa = Firmware revision B.bb = Front panel FW revision C.cc = Power supply controller FW revision DD = FPGA revision EE = PCBA revision
- init_api()¶
- local()¶
Gives local control back to the instrument Remote control is activated on any other commands set to the device :return:
- prepare_string(func, handler, base_str, *args, **kwargs)¶
- reset()¶
Be aware that the funcgen can have a short period where it sets to 5Vpp 1kHz with the output on for a short period. This could cause issues. Ensure that setup is in a safe state to receive such a signal. :return:
- self_test()¶
- store(store_dict, *args, **kwargs)¶
Store a dictionary of values in TestClass :param kwargs: Dictionary containing the parameters to store :return:
- store_and_execute(params, *args, **kwargs)¶
- store_and_write(params, *args, **kwargs)¶
- write(base_str, *args, **kwargs)¶
fixate.drivers.funcgen.rigol_dg1022 module¶
- class fixate.drivers.funcgen.rigol_dg1022.RigolDG1022(instrument)¶
Bases:
FuncGen- INSTR_TYPE = 'VISA'¶
- REGEX_ID = 'RIGOL TECHNOLOGIES,DG1022'¶
- adv_function(*mode, **mode_params)¶
Exposes the advanced functionality of the function generator. Currently not implemented :param mode: :param mode_params: :return:
- am(frequency, depth, source=None, waveform='SIN')¶
- Parameters:
frequency – int or float in Hz
depth – int or float in %
waveform – Defaults to sin
- Returns:
- property amplitude_ch1¶
- property amplitude_ch2¶
- disable_am()¶
- enable_am()¶
- function(waveform, channel=1, duty_cycle=None, symmetry=None, phase=None, **kwargs)¶
if parameters empty then uses previous set mode The mode and mode parameters are used in mode_build to search recursively through the MODES dictionary to build the visa string necessary for the equipment to interpret the commands. usage function(‘sin’)
- parsed to visa:
‘APPLy:SINusoid’
- function(‘square’, channel=2, amplit=5, offset=2.5, freq=’1kHz’)
- parsed to visa:
‘APPLy:SQUare:CH2 1000, 5, 2.5’ corresponds to a square wave at 1kHz, where the min of the wave is at 0 and the max at 5V
- for more advanced functions that cannot be explained through waveform, amplitude, offset and frequency:
use adv_function.
- get_identity()¶
Query ID character string of instrument, including a field separated by 4 “,”, manufactory, model, serial number and the edition number that consists of numbers and separated by “.” . :return: RIGOL TECHNOLOGIES,DG1022,DG1000000002,00.01.00.04.00
- init_api()¶
- local()¶
Gives local control back to the instrument Remote control is activated on any other commands set to the device :return:
- property output_ch1¶
- property output_ch2¶
- property output_sync¶
- prepare_string(func, handler, base_str, *args, **kwargs)¶
- reset()¶
Be aware that the funcgen can have a short period where it sets to 5Vpp 1kHz with the output on for a short period. This could cause issues. Ensure that setup is in a safe state to receive such a signal. :return:
- retrys_on_timeout = 3¶
- store(store_dict, *args, **kwargs)¶
Store a dictionary of values in TestClass :param kwargs: Dictionary containing the parameters to store :return:
- store_and_execute(params, *args, **kwargs)¶
- store_and_write(params, *args, **kwargs)¶
- sync_output(sync)¶
- Parameters:
sync – True or False
- Returns:
None
- trigger_output(trigger, rising=False, falling=False)¶
- Parameters:
sync – True or False
- Returns:
None
- property verify_values¶
- write(base_str, *args, **kwargs)¶