Oxygen unit conversions¶
[1]:
from pyrotoolbox.parsers import parse
from pyrotoolbox.oxygen import *
Load data¶
[2]:
df, m = parse('datademo4/A_Firesting Pro (4 Channels)_(A Ch.1)_Oxygen.txt')
[3]:
df = df.iloc[80:].copy()
convert input unit (%O2) to hPa¶
[4]:
df['oxygen_hPa'] = i_only_think_in_hpa(df, m)
alternative:¶
[5]:
df['oxygen_hPa_2'] = convert_to_hPa(df['oxygen_%O2'], unit='oxygen_%O2',
temperature=m['settings']['temperature'],
pressure=df['pressure'])
convert hPa to all other oxygen units¶
[6]:
df['oxygen_torr'] = hPa_to_torr(df['oxygen_hPa'])
[7]:
df['oxygen_%O2'] = hPa_to_percentO2(df['oxygen_hPa'], df['pressure'])
[8]:
df['oxygen_%airsat'] = hPa_to_percent_airsat(df['oxygen_hPa'], df['pressure'], temperature=20)
[9]:
df['oxygen_mgL'] = hPa_to_mgL(df['oxygen_hPa'], temperature=20, salinity=7.5)
[10]:
df['oxygen_uM'] = hPa_to_uM(df['oxygen_hPa'], temperature=20, salinity=7.5)
unit conversion mg/L for different environmental conditions¶
Example: user has logged data with a fixed-T setting of 37°C and salinity of 7.5g/L, but the real temperature was 32°C and real salinity was 11g/L.
[11]:
po2 = i_only_think_in_hpa(df, m)
hPa_to_mgL(po2, temperature=32, salinity=11)
[11]:
date_time
2023-04-03 13:16:28.485 0.247168
2023-04-03 13:16:29.486 1.704633
2023-04-03 13:16:30.486 2.777244
2023-04-03 13:16:31.486 3.508465
2023-04-03 13:16:32.486 3.947728
2023-04-03 13:16:33.485 4.229732
2023-04-03 13:16:34.485 4.379028
2023-04-03 13:16:35.485 4.378365
2023-04-03 13:16:36.485 4.379360
2023-04-03 13:16:37.485 4.419836
2023-04-03 13:16:38.485 4.491167
2023-04-03 13:16:39.486 4.563492
2023-04-03 13:16:40.487 4.635486
Name: oxygen_hPa, dtype: float64
[ ]: