| Title: | Calculate MIMS Dissolved Gas Concentrations Without Getting a Headache |
|---|---|
| Description: | Calculate dissolved gas concentrations from raw MIMS (Membrane Inlet Mass Spectrometer) signal data. Use mimsy() on a formatted CSV file to return dissolved gas concentrations (mg and microMole) of N2, O2, Ar based on gas solubility at temperature, pressure, and salinity. See references Benson and Krause (1984), Garcia and Gordon (1992), Stull (1947), and Hamme and Emerson (2004) for more information. Easily save the output to a nicely-formatted multi-tab 'Excel' workbook with mimsy.save(). Supports dual-temperature standard calibration for dual-bath MIMS setups. |
| Authors: | Michelle Catherine Kelly [aut, cre], Kevin Nevorski [ctb], Amy M. Marcarelli [ctb] |
| Maintainer: | Michelle Catherine Kelly <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.6.5 |
| Built: | 2026-09-21 21:32:46 UTC |
| Source: | https://github.com/michelleckelly/mimsy |
Calculate argon gas concentrations at saturation given water temperature, atmospheric pressure, and salinity
arsat(temp, pressure, pressUnits, salinity = 0, outUnits)arsat(temp, pressure, pressUnits, salinity = 0, outUnits)
temp |
Water temperature in degrees C |
pressure |
Barometric pressure, where 'pressUnits' denotes units |
pressUnits |
Units of barometric pressure, must be "atm", "hPa", "Torr", "psi", "bar", "inHg", or "mmHg" |
salinity |
Water salinity in units of per mille. Default is 0. |
outUnits |
Preferred units for output, must be "mg/L" or "umol/L" |
A numeric vector
Hamme, R. C., & Emerson, S. R. (2004). The solubility of neon, nitrogen and argon in distilled water and seawater. Deep Sea Research Part I: Oceanographic Research Papers, 51(11), 1517–1528. https://doi.org/10.1016/j.dsr.2004.06.009
arsat(temp = 25, pressure = 29.8, pressUnits = "inHg", outUnits = "mg/L")arsat(temp = 25, pressure = 29.8, pressUnits = "inHg", outUnits = "mg/L")
Calculate water density at temperatures between 0 and 40 degC
h2odensity(temp)h2odensity(temp)
temp |
Water temperature in degrees C |
A numeric vector in units of kg/m3
Tanaka, M., Girard, G., Davis, R., Peuto, A., & Bignell, N. (2001). Recommended table for the density of water between 0 C and 40 C based on recent experimental reports. Metrologia, 38(4), 301–309. https://doi.org/10.1088/0026-1394/38/4/3
mimsy Calculate MIMS dissolved gas concentrationsReturn dissolved gas concentrations in units of micromole and milligram from membrane inlet mass spectrometer (MIMS) signal data
mimsy(data, baromet.press, units, bg.correct = FALSE, tz = Sys.timezone())mimsy(data, baromet.press, units, bg.correct = FALSE, tz = Sys.timezone())
data |
the dataframe of MIMS data |
baromet.press |
the ambient barometric pressure while samples processed on the MIMS. Can be a vector, if more than one reading was taken. |
units |
the units of barometric pressure. Must be one of "atm", "hPa", "psi", "bar", or "Torr". |
bg.correct |
If 'FALSE' (default), no background correction is applied. If 'TRUE', background correction is applied. |
tz |
a character string that specifies which time zone to parse the date with. Defaults to the user's current time zone setting. The string must be a time zone that is recognized by the user's OS. |
a list, containing 5 dataframes:
‘$results' displays a summarized output, containing just identification columns (such as the user’s input of 'Label' or 'Project') and calculated concentration values (ex. 'N2_uMol' and 'N2_mg' for the concentration of dissolved dinitrogen gas, in microMoles and milligrams, respectively). '$results' only contains sample results, but see '$results.full' below for results from both samples and standards.
‘$solubility.Concentrations' displays the calculated concentrations (microMole / kg) of oxygen, nitrogen, and argon gas in water at specific temperature, pressure, and salinity. Row names correspond to 'std.temps'. See Garcia and Gordon (1992, Eqn. 8) for further information on oxygen saturation concentration calculations and the equations used herein. See Hamme and Emerson (2004, Table 4, and Eq. 1, 2) for the expansion of Garcia and Gordon’s methods for use with calculating nitrogen and argon saturation concentrations.
'$calibration.Factors' are computed by taking the solubility concentrations at standard temperature divided by the average MIMS signal reading of each 'Group' at said temperature. These values will then be used internally to calculate the calibration curve, and are made available to the user for transparency.
'$calibration.DriftCorrection' is a data frame containing the slopes and intercepts of the calibration curve for each dissolved gas (ex. 'calslope_28' for the slope of the dinitrogen calibration curve), and the drift corrected slope and intercept values (ex. 'DRIFT.calslope_28') which take into account the machine drift due to time that occurs in-between standard readings. These drift values are computed by taking the slope between successive calibration (slope or intercept) values. These values are used internally, and are made available to the user for transparency.
'$results.full' is a data frame that contains the entire output from 'mimsy()', including results from both standards and samples, the initial MIMS signal data and signal ratios, the calibration curve correction factors for each reading (ex. 'INTERPOLATED.calfactor_28'), and the final concentration values.
Garcia, H., and L. Gordon (1992), Oxygen solubility in seawater: Better fitting equations, Limnology and Oceanography, 37(6).
Benson, B. B. & Krause, D. (1984). The concentration and isotopic fractionation of oxygen dissolved in freshwater and seawater in equilibrium with the atmosphere. Limnology and Oceanography, 29(3), 620-632. doi:10.4319/lo.1984.29.3.0620
Stull, D. R. (1947). Vapor Pressure of Pure Substances. Organic and Inorganic Compounds. Industrial & Engineering Chemistry, 39(4), 517-540. doi: 10.1021/ie50448a022
Hamme, R. C. & Emerson, S. R. (2004). The solubility of neon, nitrogen and argon in distilled water and seawater, Deep-Sea Research I, 51(11), 1517-1528.
data <- read.csv(file = system.file("extdata", "data.csv", package = "mimsy"), header = TRUE, stringsAsFactors = FALSE) results <- mimsy(data, baromet.press = 981.2, units = 'hPa')data <- read.csv(file = system.file("extdata", "data.csv", package = "mimsy"), header = TRUE, stringsAsFactors = FALSE) results <- mimsy(data, baromet.press = 981.2, units = 'hPa')
mimsy.save Save output to an Excel workbookEasily save the full output of the 'mimsy' calculation function to a nicely-formatted, multi-tab Excel .xlsx file.
mimsy.save(x, file)mimsy.save(x, file)
x |
object to be written to file, the output of 'mimsy' function |
file |
desired file name with .xlsx ending. Example: "mimsyCalculations.xlsx" |
Outputs an excel workbook to the user's working directory
data <- read.csv(file = system.file("extdata", "data.csv", package = "mimsy"), header = TRUE, stringsAsFactors = FALSE) results <- mimsy(data, baromet.press = 981.2, units = 'hPa') mimsy.save(results, file = file.path(tempdir(), "results.xlsx"))data <- read.csv(file = system.file("extdata", "data.csv", package = "mimsy"), header = TRUE, stringsAsFactors = FALSE) results <- mimsy(data, baromet.press = 981.2, units = 'hPa') mimsy.save(results, file = file.path(tempdir(), "results.xlsx"))
Calculate mass concentrations in mg/L given molar concentrations in umol/L
molar_to_mass(species, value, inUnits = "umol/L", outUnits = "mg/L")molar_to_mass(species, value, inUnits = "umol/L", outUnits = "mg/L")
species |
Molecule, must be "N2", "O2", or "Ar" |
value |
Concentration of molecule, numeric value |
inUnits |
Units of molecule concentration, default is "umol/L" |
outUnits |
Desired units for output, must be "mg/L", "g/L", or "ug/L". default is "mg/L" |
A numeric vector
molar_to_mass(species = "N2", value = 12.1, inUnits = "umol/L", outUnits = "mg/L")molar_to_mass(species = "N2", value = 12.1, inUnits = "umol/L", outUnits = "mg/L")
Calculate dinitrogen gas concentrations at saturation given water temperature, atmospheric pressure, and salinity
n2sat(temp, pressure, pressUnits, salinity = 0, outUnits = "mg/L")n2sat(temp, pressure, pressUnits, salinity = 0, outUnits = "mg/L")
temp |
Water temperature in degrees C |
pressure |
Barometric pressure, where 'pressUnits' denotes units |
pressUnits |
Units of barometric pressure, must be "atm", "hPa", "Torr", "psi", "bar", "inHg", or "mmHg" |
salinity |
Water salinity in units of per mille. Default is 0. |
outUnits |
Preferred units for output, must be "mg/L" or "umol/L" |
A numeric vector
Hamme, R. C., & Emerson, S. R. (2004). The solubility of neon, nitrogen and argon in distilled water and seawater. Deep Sea Research Part I: Oceanographic Research Papers, 51(11), 1517–1528. https://doi.org/10.1016/j.dsr.2004.06.009
n2sat(temp = 25, pressure = 29.8, pressUnits = "inHg", outUnits = "mg/L")n2sat(temp = 25, pressure = 29.8, pressUnits = "inHg", outUnits = "mg/L")
Calculate dissolved oxygen concentrations at saturation given water temperature, atmospheric pressure, and salinity
o2sat(temp, pressure, pressUnits, salinity = 0, outUnits)o2sat(temp, pressure, pressUnits, salinity = 0, outUnits)
temp |
Water temperature in degrees C |
pressure |
Barometric pressure, where 'pressUnits' denotes units |
pressUnits |
Units of barometric pressure, must be "atm", "hPa", "Torr", "psi", "bar", "inHg", or "mmHg" |
salinity |
Water salinity in units of per mille. Default is 0. |
outUnits |
Preferred units for output, must be "mg/L" or "umol/L" |
A numeric vector
Garcia, H. E., & Gordon, L. I. (1992). Oxygen solubility in seawater: Better fitting equations. Limnology and Oceanography, 37(6), 1307–1312. https://doi.org/10.4319/lo.1992.37.6.1307
o2sat(temp = 25, pressure = 29.8, pressUnits = "inHg", outUnits = "mg/L")o2sat(temp = 25, pressure = 29.8, pressUnits = "inHg", outUnits = "mg/L")
Correct barometric pressure for vapor pressure of water
pressureCorrection(temp, barpress_atm)pressureCorrection(temp, barpress_atm)
temp |
Water temperature in degrees C |
barpress_atm |
Barometric pressure in atm |
Barometric pressure corrected for water vapor pressure