API reference
- class ohmpi.hardware_system.OhmPiHardware(**kwargs)
OhmPiHardware class.
- Attributes:
- pulses
- pwr_state
- sp
Methods
compute_tx_volt
([pulse_duration, strategy, ...])Estimates best Tx voltage based on different strategies.
Switches off all multiplexer relays.
switch_mux
(electrodes[, roles, state])Switches on multiplexer relays for given quadrupole.
test_mux
([channel, activation_time])Interactive method to test the multiplexer.
vab_square_wave
(vab, cycle_duration[, ...])Performs a Vab injection following a square wave and records full waveform data.
calibrate_rx_bias
last_dev
last_iab
last_iab_dev
last_resistance
last_vmn
last_vmn_dev
select_samples
- compute_tx_volt(pulse_duration=0.1, strategy='vmax', tx_volt=5.0, vab_max=None, iab_max=None, vmn_max=None, vmn_min=None, polarities=(1, -1), delay=0.05, p_max=None, diff_vab_lim=2.5, n_steps=4)
Estimates best Tx voltage based on different strategies. At first a half-cycle is made for a short duration with a fixed known voltage. This gives us Iab and Rab. We also measure Vmn. A constant c = vmn/iab is computed (only depends on geometric factor and ground resistivity, that doesn’t change during a quadrupole). Then depending on the strategy, we compute which vab to inject to reach the minimum/maximum Iab current or min/max Vmn. This function also compute the polarity on Vmn (on which pin of the ADS1115 we need to measure Vmn to get the positive value).
- Parameters:
- pulse_durationfloat, optional
Time in seconds for the pulse used to compute Rab.
- strategystr, optional
Either: - vmax : compute Vab to reach a maximum Iab without exceeding vab_max - vmin : compute Vab to reach at least vmn_min - constant : apply given Vab
- tx_voltfloat, optional
Voltage to apply for guessing the best voltage. 5 V applied by default. If strategy “constant” is chosen, constant voltage to applied is “tx_volt”.
- vab_maxfloat, optional
Maximum injection voltage to apply to tx (used by all strategies)
- vmn_minfloat, optional
Minimum voltage target for rx (used by vmin strategy)
- Returns:
- vabfloat
Proposed Vab according to the given strategy.
- polarity:
Polarity of VMN relative to polarity of VAB
- rabfloat
Resistance between injection electrodes
- reset_mux()
Switches off all multiplexer relays.
- switch_mux(electrodes, roles=None, state='off', **kwargs)
Switches on multiplexer relays for given quadrupole.
- Parameters:
- electrodeslist
List of integers representing the electrode ids.
- roleslist, optional
List of roles of electrodes, optional
- statestr, optional
Either ‘on’ or ‘off’.
- test_mux(channel=None, activation_time=1.0)
Interactive method to test the multiplexer.
- Parameters:
- channeltuple, optional
(electrode_nr, role) to test.
- activation_timefloat, optional
Time in seconds during which the relays are activated.
- vab_square_wave(vab, cycle_duration, sampling_rate=None, cycles=3, polarity=1, duty_cycle=1.0, append=False)
Performs a Vab injection following a square wave and records full waveform data. Calls in function Vab_pulses.
- Parameters:
- vab: float
Injection voltage [V]
- cycle_duration: float
Duration of one cycle within the square wave (in seconds)
- sampling_rate: float, None Default None
Sampling rate for Rx readings
- cycles: integer, Default: 3
Number of cycles
- polarity: 1, 0 , -1
Starting polarity
- duty_cycle: float (0 to 1)
Duty cycle of injection wave
- append: bool, optional
Default: False