fixate.drivers package¶
- class fixate.drivers.Driver¶
Bases:
objectDriver base class for creating self connecting drivers.
connect() is called whenever a public method api call is made and is_connected = False:
def _my_func(self): pass
will not call connect, as it is a private function by convention. Whereas this will:
def my_func(self): pass
Exceptions to this rule are connect(), disconnect() and function strings as can be defined by creating a list called _connect_ignore on the class definition
- connect()¶
Override connect() function, but ensure that self.is_connected is set if connected or an exception occurs if connection could not be established
- disconnect()¶
Override disconnect function, but ensure that self.is_connected is set to False
- is_connected = False¶
- class fixate.drivers.DriverManager(**kwargs)¶
Bases:
objectDriver manager allows for multiple drivers to be collated and managed from a central location. Drivers must be either derived from the driver class or must implement the functions:
def connect(self): # No Parameters def disconnect(self): # No Parameters
and have an attribute:
is_connected (Boolean)
- add_drivers(**kwargs)¶
- Parameters:
kwargs (dict) – kwargs of <id>=<driver>.
- Returns:
None
Example
>>> class MyDmm(Driver): >>> def hello(self): >>> print("World") >>> dm = DriverManager(dmm=MyDmm()) >>> dm.dmm.hello() World
- cleanup_clear()¶
- cleanup_execute()¶
- cleanup_register(func, *args, **kwargs)¶
Registers a cleanup function to be executed on cleanup_execute call. The registered functions are executed in the order they are added via this function. Use cleanup_clear() to remove all the registered cleanup functions
- Parameters:
func – function as directly refrenced. eg. dm.dmm.disconnect
*args – The arguments that should be called with the func
**kwargs – The keyword arguments that should be called with the func
- Returns:
None
- register_initialisation(id, init_funcs)¶
- remove_drivers(*ids)¶
- Parameters:
ids – Drivers to be removed
- Returns:
None
Example
>>> class MyDmm(Driver): >>> def hello(self): >>> print("Hello World") >>> dm = DriverManager(dmm=MyDmm(), dmm2=MyDmm()) >>> dm.dmm.hello() Hello World >>> dm.remove_drivers('dmm', 'dmm2') >>> dm.dmm.hello() AttributeError: 'DriverManager' object has no attribute 'dmm'
- class fixate.drivers.DriverMeta(clsname, bases, dct)¶
Bases:
type
- class fixate.drivers.DriverProtocol(*args, **kwargs)¶
Bases:
Protocol- REGEX_ID: str¶
- get_identity() str¶
Query the instrument for it identity.
For visa instruments, this is generally the results of the idn? command. For other drivers, it can be any meaningful id. Where possible it should include a unique identifier like a serial number.
- exception fixate.drivers.InstrumentNotFoundError¶
Bases:
Exception
- exception fixate.drivers.InstrumentOpenError¶
Bases:
Exception
- fixate.drivers.log_instrument_open(instrument: DriverProtocol) None¶
Subpackages¶
- fixate.drivers.daq package
- fixate.drivers.dmm package
- Digital multimeter driver
open()- Submodules
- fixate.drivers.dmm.fluke_8846a module
Fluke8846AFluke8846A.INSTR_TYPEFluke8846A.REGEX_IDFluke8846A.capacitance()Fluke8846A.continuity()Fluke8846A.current_ac()Fluke8846A.current_dc()Fluke8846A.diode()Fluke8846A.frequency()Fluke8846A.fresistance()Fluke8846A.get_identity()Fluke8846A.get_nplc()Fluke8846A.local()Fluke8846A.measurement()Fluke8846A.measurements()Fluke8846A.min_avg_max()Fluke8846A.modeFluke8846A.period()Fluke8846A.remote()Fluke8846A.reset()Fluke8846A.resistance()Fluke8846A.samplesFluke8846A.set_manual_trigger()Fluke8846A.set_nplc()Fluke8846A.trigger()Fluke8846A.voltage_ac()Fluke8846A.voltage_dc()
- fixate.drivers.dmm.helper module
DMMDMM.MeasurementStatsDMM.REGEX_IDDMM.capacitance()DMM.continuity()DMM.current_ac()DMM.current_dc()DMM.diode()DMM.frequency()DMM.fresistance()DMM.get_identity()DMM.is_connectedDMM.local()DMM.measurement()DMM.nplc()DMM.period()DMM.remote()DMM.reset()DMM.resistance()DMM.set_manual_trigger()DMM.trigger()DMM.voltage_ac()DMM.voltage_dc()
- fixate.drivers.dmm.keithley_6500 module
Keithley6500Keithley6500.INSTR_TYPEKeithley6500.REGEX_IDKeithley6500.capacitance()Keithley6500.continuity()Keithley6500.current_ac()Keithley6500.current_dc()Keithley6500.diode()Keithley6500.displayKeithley6500.frequency()Keithley6500.fresistance()Keithley6500.get_identity()Keithley6500.get_nplc()Keithley6500.local()Keithley6500.measurement()Keithley6500.measurements()Keithley6500.min_avg_max()Keithley6500.modeKeithley6500.period()Keithley6500.remote()Keithley6500.reset()Keithley6500.resistance()Keithley6500.samplesKeithley6500.set_manual_trigger()Keithley6500.set_nplc()Keithley6500.trigger()Keithley6500.voltage_ac()Keithley6500.voltage_dc()
- fixate.drivers.dso package
open()- Submodules
- fixate.drivers.dso.agilent_mso_x module
MSO_X_3000MSO_X_3000.INSTR_TYPEMSO_X_3000.REGEX_IDMSO_X_3000.acquire()MSO_X_3000.auto_scale()MSO_X_3000.digitize()MSO_X_3000.get_identity()MSO_X_3000.load_setup()MSO_X_3000.query()MSO_X_3000.query_after_acquire()MSO_X_3000.query_ascii_value()MSO_X_3000.query_ascii_values()MSO_X_3000.query_binary_values()MSO_X_3000.query_bool()MSO_X_3000.query_value()MSO_X_3000.read_raw()MSO_X_3000.reset()MSO_X_3000.retrys_on_timeoutMSO_X_3000.run()MSO_X_3000.save_setup()MSO_X_3000.single()MSO_X_3000.stop()MSO_X_3000.store()MSO_X_3000.store_and_write()MSO_X_3000.validate_signal()MSO_X_3000.wait_for_acquire()MSO_X_3000.wait_for_trigger()MSO_X_3000.waveform_preamble()MSO_X_3000.waveform_values()MSO_X_3000.write()
- fixate.drivers.dso.helper module
AcquireAcquireModeCallableBoolCallableNoArgsChannelBaseCouplingDSODefineDelayEventsMeasureMeasureAllSourcesMeasureIntervalMeasureIntervalMultipleSourcesMeasureRMSMultiMeasureSourcesMultiSlopesProbeSlopesSourcesChSourcesDigSourcesExtSourcesSpecialSourcesWMemThresholdTimebaseTimebaseModeTrigEdgeTrigLevelTrigModeTrigRejectTrigSourcesTrigSweepTriggerVerticalUnits
- fixate.drivers.funcgen package
open()- Submodules
- fixate.drivers.funcgen.helper module
BurstBurstGatedBurstNCycleChannelBaseCyclesExternalFuncGenFuncGen.REGEX_IDFuncGen.adv_function()FuncGen.am()FuncGen.amplitude_ch1()FuncGen.amplitude_ch2()FuncGen.disable_am()FuncGen.enable_am()FuncGen.function()FuncGen.get_identity()FuncGen.local()FuncGen.output_ch1FuncGen.output_ch2FuncGen.output_ch3FuncGen.output_ch4FuncGen.output_syncFuncGen.reset()
LoadManualModulateModulateAMModulateBPSKModulateFMModulateFSKModulateInternalModulatePMModulateShapeModulateSourceModulateSumSyncSyncModeSyncPolarityTriggerTriggerOutWaveform
- fixate.drivers.funcgen.keysight_33500b module
Keysight33500BKeysight33500B.INSTR_TYPEKeysight33500B.REGEX_IDKeysight33500B.get_identity()Keysight33500B.init_api()Keysight33500B.local()Keysight33500B.prepare_string()Keysight33500B.reset()Keysight33500B.self_test()Keysight33500B.store()Keysight33500B.store_and_execute()Keysight33500B.store_and_write()Keysight33500B.write()
- fixate.drivers.funcgen.rigol_dg1022 module
RigolDG1022RigolDG1022.INSTR_TYPERigolDG1022.REGEX_IDRigolDG1022.adv_function()RigolDG1022.am()RigolDG1022.amplitude_ch1RigolDG1022.amplitude_ch2RigolDG1022.disable_am()RigolDG1022.enable_am()RigolDG1022.function()RigolDG1022.get_identity()RigolDG1022.init_api()RigolDG1022.local()RigolDG1022.output_ch1RigolDG1022.output_ch2RigolDG1022.output_syncRigolDG1022.prepare_string()RigolDG1022.reset()RigolDG1022.retrys_on_timeoutRigolDG1022.store()RigolDG1022.store_and_execute()RigolDG1022.store_and_write()RigolDG1022.sync_output()RigolDG1022.trigger_output()RigolDG1022.verify_valuesRigolDG1022.write()
- fixate.drivers.lcr package
- fixate.drivers.pps package
open()- Submodules
- fixate.drivers.pps.bk_178x module
BK178XPPSInterfacePPSInterface.DATA_BYTEPPSInterface.INSTR_TYPEPPSInterface.PACKET_LENGTHPPSInterface.PARITYPPSInterface.REGEX_IDPPSInterface.STOP_BITPPSInterface.attemptsPPSInterface.baud_ratePPSInterface.com_portPPSInterface.communicate()PPSInterface.connectedPPSInterface.get_identity()PPSInterface.instrument
- fixate.drivers.pps.helper module
- fixate.drivers.pps.siglent_spd_3303X module
SPD3303XSPD3303X.INSTR_TYPESPD3303X.REGEX_IDSPD3303X.current_maxSPD3303X.get_identity()SPD3303X.init_api()SPD3303X.output_ch1SPD3303X.prepare_string()SPD3303X.query_ascii_value()SPD3303X.query_ascii_values()SPD3303X.query_value()SPD3303X.read_terminationSPD3303X.remoteSPD3303X.voltageSPD3303X.voltage_maxSPD3303X.write()SPD3303X.write_half()SPD3303X.write_terminationSPD3303X.write_timer()
Submodules¶
fixate.drivers.ftdi module¶
- class fixate.drivers.ftdi.BIT_MODE¶
Bases:
object- FT_BITMODE_ASYNC_BITBANG = c_ulong(1)¶
- FT_BITMODE_CBUS_BITBANG = c_ulong(32)¶
- FT_BITMODE_FAST_SERIAL = c_ulong(16)¶
- FT_BITMODE_MCU_HOST = c_ulong(8)¶
- FT_BITMODE_MPSSE = c_ulong(2)¶
- FT_BITMODE_RESET = c_ulong(0)¶
- FT_BITMODE_SYNC_BITBANG = c_ulong(4)¶
- FT_BITMODE_SYNC_FIFO = c_ulong(64)¶
- class fixate.drivers.ftdi.FLAGS¶
Bases:
object- FT_OPEN_BY_DESCRIPTION = c_ulong(2)¶
- FT_OPEN_BY_LOCATION = c_ulong(4)¶
- FT_OPEN_BY_SERIAL_NUMBER = c_ulong(1)¶
- exception fixate.drivers.ftdi.FTD2XXError¶
Bases:
FixateError
- class fixate.drivers.ftdi.FTDI2xx(ftdi_description)¶
Bases:
object- INSTR_TYPE = 'FTDI'¶
- property baud_rate¶
- close()¶
- configure_bit_bang(bit_mode, bytes_required, latch_mask=1, clk_mask=2, data_mask=4, invert_mask=0)¶
- Parameters:
bit_mode
bytes_required
latch_mask – CBUS Pin for latch. 1 Default for Relay Matrix
clk_mask – CBUS Pin for clock. 2 Default for Relay Matrix
data_mask – CBUS Pin for data. 4 Default for Relay Matrix
invert_mask –
Mask for inverting. Based on
0b<latch><clock><data>e.g.
0b100Would mean the latch bit is inverted.0b011would mean the clock and data bits are inverted.
- Returns:
- get_cbus_pins()¶
- get_identity() str¶
Return identity string representing connected ftdi object
- property parity¶
- read()¶
- read_raw()¶
- serial_shift_bit_bang(data, bytes_required=None)¶
- property stop_bits¶
- property word_length¶
- write(data, size=None)¶
- write_bit_mode(mask, validate=False)¶
- Parameters:
mask –
value to write for the mask for
BIT_MODE.FT_BITMODE_CBUS_BITBANGupper nibble is input (0) output (1)
lower nibble is pin value low (0) high (1)
- class fixate.drivers.ftdi.FT_DEVICE¶
Bases:
object- FT_DEVICE_100AX = c_ulong(2)¶
- FT_DEVICE_2232C = c_ulong(4)¶
- FT_DEVICE_2232H = c_ulong(6)¶
- FT_DEVICE_232AM = c_ulong(1)¶
- FT_DEVICE_232BM = c_ulong(0)¶
- FT_DEVICE_232H = c_ulong(8)¶
- FT_DEVICE_232R = c_ulong(5)¶
- FT_DEVICE_4232H = c_ulong(7)¶
- FT_DEVICE_UNKNOWN = c_ulong(3)¶
- FT_DEVICE_X_SERIES = c_ulong(9)¶
- class fixate.drivers.ftdi.FT_DEVICE_LIST_INFO_NODE¶
Bases:
Structure- Description¶
Structure/Union member
- Flags¶
Structure/Union member
- ID¶
Structure/Union member
- LocId¶
Structure/Union member
- SerialNumber¶
Structure/Union member
- Type¶
Structure/Union member
- ftHandle¶
Structure/Union member
- fixate.drivers.ftdi.LPDWORD¶
alias of
LP_c_ulong
- class fixate.drivers.ftdi.PARITY¶
Bases:
object- FT_PARITY_EVEN = c_ubyte(2)¶
- FT_PARITY_MARK = c_ubyte(3)¶
- FT_PARITY_NONE = c_ubyte(0)¶
- FT_PARITY_ODD = c_ubyte(1)¶
- FT_PARITY_SPACE = c_ubyte(4)¶
- fixate.drivers.ftdi.PUCHAR¶
alias of
LP_c_ubyte
- class fixate.drivers.ftdi.STOP_BITS¶
Bases:
object- FT_STOP_BITS_1 = c_ubyte(0)¶
- FT_STOP_BITS_2 = c_ubyte(2)¶
- class fixate.drivers.ftdi.WORD_LENGTH¶
Bases:
object- FT_BITS_7 = c_ubyte(7)¶
- FT_BITS_8 = c_ubyte(8)¶
- fixate.drivers.ftdi.check_return(return_code)¶
- fixate.drivers.ftdi.create_device_info_list()¶
- fixate.drivers.ftdi.get_device_info_list()¶
fixate.drivers.handlers module¶
This module implements concrete AddressHandler type, that can be used to implement IO for the fixate.core.switching module.
- class fixate.drivers.handlers.FTDIAddressHandler(pins: Sequence[str], ftdi_description: str)¶
Bases:
PinValueAddressHandlerAn address handler which uses the ftdi driver to control pins.
We create this concrete address handler because we use it most often. FT232 is used to bit-bang to shift register that are control the switching in a jig.
- close() None¶
Optional close method to clean-up resources.
This will be called automatically by the JigDriver for any address handlers passed into the JigDriver when it as created.