Skip to content

Commit

Permalink
Merge pull request #23 from steinermg/Issue_15558
Browse files Browse the repository at this point in the history
Issue #15558 - PHSEN and PCO2 battery voltage
  • Loading branch information
steinermg authored Mar 2, 2023
2 parents b1fdf2c + 803f321 commit d39fbb6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
33 changes: 33 additions & 0 deletions ion_functions/data/co2_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,39 @@ def pco2_thermistor(traw, sami_bits):
return therm


def pco2_battery(braw, sami_bits):
"""
Description:
Convert the battery voltage data from counts to volts from the
pCO2 instrument.
Implemented by:
2023-02-23: Mark Steiner. Initial code.
Usage:
volts = pco2_battery_voltage(vraw, sami_bits)
where
volts = converted battery voltage [degC]
braw = raw battery voltage [counts]
sami_bits = number of bits on the SAMI hardware
"""
# reset inputs to arrays
braw = np.atleast_1d(braw)
sami_bits = np.atleast_1d(sami_bits)

# convert raw battery readings from counts to Volts
if sami_bits[0] == 14:
volts = ne.evaluate('braw * 3. / 4000.')
else:
volts = ne.evaluate('braw * 15. / 4096.')
return volts


def pco2_pco2wat(mtype, light, therm, ea434, eb434, ea620, eb620,
calt, cala, calb, calc, a434blank, a620blank):
"""
Expand Down
14 changes: 10 additions & 4 deletions ion_functions/data/ph_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,19 @@ def ph_thermistor(traw, sami_bits):
return therm


def ph_battery(braw):
def ph_battery(braw, sami_bits):
"""
Function to convert the battery voltage from counts to Volts from the pH
instrument.
Function to convert the battery voltage from counts to Volts from the pH instrument.
"""
# reset inputs to arrays
braw = np.atleast_1d(braw)
sami_bits = np.atleast_1d(sami_bits)

# convert raw battery readings from counts to Volts
volts = ne.evaluate('braw * 15. / 4096.')
if sami_bits[0] == 14:
volts = ne.evaluate('braw * 3. / 4000.')
else:
volts = ne.evaluate('braw * 15. / 4096.')
return volts


Expand Down

0 comments on commit d39fbb6

Please sign in to comment.