API reference
created on January 6, 2020. Updates dec 2022. Hardware: Licensed under CERN-OHL-S v2 or any later version Software: Licensed under the GNU General Public License v3.0 Ohmpi.py is a program to control a low-cost and open hardware resistivity meter OhmPi that has been developed by Rémi CLEMENT (INRAE), Vivien DUBOIS (INRAE), Hélène GUYARD (IGE), Nicolas FORQUET (INRAE), Yannick FARGIER (IFSTTAR) Olivier KAUFMANN (UMONS), Arnaud WATLET (UMONS) and Guillaume BLANCHY (FNRS/ULiege).
- class ohmpi.OhmPi(settings=None, sequence=None, use_mux=False, mqtt=True, onpi=None, idps=False)
OhmPi class.
- static append_and_save(filename: str, last_measurement: dict, cmd_id=None)
Appends and saves the last measurement dict.
- Parameters:
- filenamestr
filename to save the last measurement dataframe
- last_measurementdict
Last measurement taken in the form of a python dictionary
- cmd_idstr, optional
Unique command identifier
- get_data(survey_names=None, cmd_id=None)
Get available data.
- Parameters:
- survey_nameslist of str, optional
List of filenames already available from the html interface. So their content won’t be returned again. Only files not in the list will be read.
- cmd_idstr, optional
Unique command identifier
- interrupt(cmd_id=None)
Interrupts the acquisition
- Parameters:
- cmd_idstr, optional
Unique command identifier
- load_sequence(filename: str, cmd_id=None)
Reads quadrupole sequence from file.
- Parameters:
- filenamestr
Path of the .csv or .txt file with A, B, M and N electrodes. Electrode index start at 1.
- cmd_idstr, optional
Unique command identifier
- Returns:
- sequencenumpy.array
Array of shape (number quadrupoles * 4).
- quit(cmd_id=None)
Quits OhmPi
- Parameters:
- cmd_idstr, optional
Unique command identifier
- remove_data(cmd_id=None)
Remove all data in the data folder
- Parameters:
- cmd_idstr, optional
Unique command identifier
- reset_mux(cmd_id=None)
Switches off all multiplexer relays.
- Parameters:
- cmd_idstr, optional
Unique command identifier
- restart(cmd_id=None)
Restarts the Raspberry Pi
- Parameters:
- cmd_idstr, optional
Unique command identifier
- rs_check(tx_volt=12.0, cmd_id=None)
Checks contact resistances
- Parameters:
- tx_voltfloat
Voltage of the injection
- cmd_idstr, optional
Unique command identifier
- run_measurement(quad=None, nb_stack=None, injection_duration=None, autogain=True, strategy='constant', tx_volt=5, best_tx_injtime=0.1, cmd_id=None)
Measures on a quadrupole and returns transfer resistance.
- Parameters:
- quaditerable (list of int)
Quadrupole to measure, just for labelling. Only switch_mux_on/off really create the route to the electrodes.
- nb_stackint, optional
Number of stacks. A stacl is considered two half-cycles (one positive, one negative).
- injection_durationint, optional
Injection time in seconds.
- autogainbool, optional
If True, will adapt the gain of the ADS1115 to maximize the resolution of the reading.
- strategystr, optional
(V3.0 only) If we search for best voltage (tx_volt == 0), we can choose vmax strategy : find the highest voltage that stays in the range For a constant value, just set the tx_volt.
- tx_voltfloat, optional
(V3.0 only) If specified, voltage will be imposed. If 0, we will look for the best voltage. If the best Tx cannot be found, no measurement will be taken and values will be NaN.
- best_tx_injtimefloat, optional
(V3.0 only) Injection time in seconds used for finding the best voltage.
- cmd_idstr, optional
Unique command identifier
- run_multiple_sequences(cmd_id=None, sequence_delay=None, nb_meas=None, **kwargs)
- Runs multiple sequences in a separate thread for monitoring mode.
Can be stopped by ‘OhmPi.interrupt()’. Additional arguments are passed to run_measurement().
- Parameters:
- cmd_idstr, optional
Unique command identifier
- sequence_delayint, optional
Number of seconds at which the sequence must be started from each others.
- nb_measint, optional
Number of time the sequence must be repeated.
- kwargsdict, optional
See help(k.run_measurement) for more info.
- run_sequence(cmd_id=None, **kwargs)
- Runs sequence synchronously (=blocking on main thread).
Additional arguments are passed to run_measurement().
- Parameters:
- cmd_idstr, optional
Unique command identifier
- run_sequence_async(cmd_id=None, **kwargs)
- Runs the sequence in a separate thread. Can be stopped by ‘OhmPi.interrupt()’.
Additional arguments are passed to run_measurement().
- Parameters:
- cmd_idstr, optional
Unique command identifier
- property sequence
Gets sequence
- set_sequence(sequence=None, cmd_id=None)
Sets the sequence to acquire
- Parameters:
- sequencelist, str
sequence of quadrupoles
- cmd_id: str, optional
Unique command identifier
- switch_mux_off(quadrupole, cmd_id=None)
Switches off multiplexer relays for given quadrupole.
- Parameters:
- cmd_idstr, optional
Unique command identifier
- quadrupolelist of 4 int
List of 4 integers representing the electrode numbers.
- switch_mux_on(quadrupole, cmd_id=None)
Switches on multiplexer relays for given quadrupole.
- Parameters:
- cmd_idstr, optional
Unique command identifier
- quadrupolelist of 4 int
List of 4 integers representing the electrode numbers.
- test_mux(activation_time=1.0, address=112)
Interactive method to test the multiplexer.
- Parameters:
- activation_timefloat, optional
Time in seconds during which the relays are activated.
- addresshex, optional
Address of the multiplexer board to test (e.g. 0x70, 0x71, …).
- update_settings(settings: str, cmd_id=None)
Updates acquisition settings from a json file or dictionary. Parameters can be:
nb_electrodes (number of electrode used, if 4, no MUX needed)
injection_duration (in seconds)
nb_meas (total number of times the sequence will be run)
sequence_delay (delay in second between each sequence run)
nb_stack (number of stack for each quadrupole measurement)
export_path (path where to export the data, timestamp will be added to filename)
- Parameters:
- settingsstr, dict
Path to the .json settings file or dictionary of settings.
- cmd_idstr, optional
Unique command identifier