Commit ff8c8d86 authored by Rémi's avatar Rémi
Browse files

update last version with nex examples

No related merge requests found
Showing with 83 additions and 26 deletions
+83 -26
...@@ -23,7 +23,7 @@ OHMPI_CONFIG = { ...@@ -23,7 +23,7 @@ OHMPI_CONFIG = {
'board_addresses': {'A': 0x73, 'B': 0x72, 'M': 0x71, 'N': 0x70}, # CHECK IF YOUR BOARDS HAVE THESE ADDRESSES 'board_addresses': {'A': 0x73, 'B': 0x72, 'M': 0x71, 'N': 0x70}, # CHECK IF YOUR BOARDS HAVE THESE ADDRESSES
'settings': 'ohmpi_settings.json', # INSERT YOUR FAVORITE SETTINGS FILE HERE 'settings': 'ohmpi_settings.json', # INSERT YOUR FAVORITE SETTINGS FILE HERE
'board_version': 'mb.2023.0.0',#,'22.10', 'board_version': 'mb.2023.0.0',#,'22.10',
'mcp_board_address': 0x20, 'mcp_board_address': 0x21,
'i2c_mux_address': 2 # 2 if on same bus as the measurement board, 4 if additional bus 'i2c_mux_address': 2 # 2 if on same bus as the measurement board, 4 if additional bus
} # TODO: add a dictionary with INA models and associated gain values } # TODO: add a dictionary with INA models and associated gain values
......
"""
Created on May 23 2023
@author: reclement
Simple quadripole measurement with fullwave graph
"""
import sys
import os
os.chdir("/home/pi/OhmPi")
sys.path.append("/home/pi/OhmPi")
from ohmpi import OhmPi
### Define object from class OhmPi
k = OhmPi(use_mux=True, idps=True)
### Update settings if needed
k.update_settings({"nb_electrodes": 64})
k.update_settings({"injection_duration":0.5})
k.update_settings({"nb_stack": 3})
### Reset mux
k.reset_mux()
### Load Sequence
k.load_sequence('ABMN.txt')
k.run_sequence(tx_volt = 5, strategy = 'constant', autogain=True, duty_cycle = 0.5, best_tx_injtime = 0.150, plot_realtime_fulldata=False)
\ No newline at end of file
"""
Created on May 23 2023
@author: reclement
Simple quadripole measurement with fullwave graph
"""
import os
import numpy as np
import time
import matplotlib.pyplot as plt
os.chdir("/home/pi/OhmPi")
import sys
sys.path.append("/home/pi/OhmPi")
from ohmpi import OhmPi
### Define object from class OhmPi
k = OhmPi(use_mux=True, idps=True)
### Update settings if needed
k.update_settings({"nb_electrodes": 64})
k.update_settings({"injection_duration":0.5})
k.update_settings({"nb_stack": 3})
### Reset mux
k.reset_mux()
### switch_mux_on on the selected quadrupole
k.switch_mux_on([1,4,2,3])
### run_measurement
#to measure Rho and IP duty_cycle=0.5
#to measure only Rho duty cycle = 0.98 , NEVERS WRITE 1
out = k.run_measurement(quad=[1,4,2,3], tx_volt = 10, strategy = 'constant', autogain=True, duty_cycle = 0.5, best_tx_injtime = 0.150)
### switch_mux_off on the selected quadrupole
#k.switch_mux_off([19,22,20,21])
### Save all data on txt file
k.append_and_save('simple_measurement.csv', out)
### Plot de result
data = out['fulldata']
inan = ~np.isnan(data[:,0])
fig, axs = plt.subplots(2, 1, sharex=True)
ax = axs[0]
ax.plot(data[inan,2], data[inan,0], 'r.-', label='current [mA]')
ax.set_ylabel('Current AB [mA]')
ax = axs[1]
ax.plot(data[inan,2], data[inan,1], '.-', label='voltage [mV]')
# ax.plot(data[inan,2], data[inan,3], '.-', label='voltage U0 [mV]')
# ax.plot(data[inan,2], data[inan,4], '.-', label='voltage U2 [mV]')
ax.set_ylabel('Voltage MN [mV]')
ax.set_xlabel('Time [s]')
ax.legend()
plt.grid(True)
plt.show()
import os
import numpy as np
import time
os.chdir("/home/pi/OhmPi")
from ohmpi import OhmPi
### Define object from class OhmPi
k = OhmPi()
### Update settings if needed
k.update_settings({"injection_duration":0.2})
### Set or load sequence
k.sequence = np.array([[1,2,3,4]]) # set numpy array of shape (n,4)
# k.set_sequence('1 2 3 4\n2 3 4 5') # call function set_sequence and pass a string
# k.load_sequence('ABMN.txt') # load sequence from a local file
### Run contact resistance check
# k.rs_check()
### Run sequence
k.run_sequence()
# k.run_sequence_async()
# time.sleep(2)
# k.interrupt()
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment