Commit d95fd50f authored by Clement Remi's avatar Clement Remi
Browse files

adding auto gain function, to optimise I and Vmn measures

Showing with 13 additions and 0 deletions
+13 -0
...@@ -89,6 +89,19 @@ def read_quad(filename, nb_elec): ...@@ -89,6 +89,19 @@ def read_quad(filename, nb_elec):
else: else:
return output return output
def gain_auto(channel):
gain=2/3
if ((abs(channel.voltage)<2.040) and (abs(channel.voltage)>=1.023)):
gain=2
elif ((abs(channel.voltage)<1.023) and (abs(channel.voltage)>=0.508)):
gain=4
elif ((abs(channel.voltage)<0.508) and (abs(channel.voltage)>=0.250)):
gain=8
elif abs(channel.voltage)<0.256:
gain=16
#print(gain)
return gain
# perform a measurement # perform a measurement
def run_measurement(nb_stack, injection_deltat, Rref, coefp0, coefp1, coefp2, coefp3, elec_array): def run_measurement(nb_stack, injection_deltat, Rref, coefp0, coefp1, coefp2, coefp3, elec_array):
i2c = busio.I2C(board.SCL, board.SDA) # I2C protocol setup i2c = busio.I2C(board.SCL, board.SDA) # I2C protocol setup
......
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