Package 'mimsy'

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

Help Index


Calculate argon gas concentrations at saturation given water temperature, atmospheric pressure, and salinity

Description

Calculate argon gas concentrations at saturation given water temperature, atmospheric pressure, and salinity

Usage

arsat(temp, pressure, pressUnits, salinity = 0, outUnits)

Arguments

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"

Value

A numeric vector

References

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

Examples

arsat(temp = 25, pressure = 29.8, pressUnits = "inHg", outUnits = "mg/L")

Calculate water density at temperatures between 0 and 40 degC

Description

Calculate water density at temperatures between 0 and 40 degC

Usage

h2odensity(temp)

Arguments

temp

Water temperature in degrees C

Value

A numeric vector in units of kg/m3

References

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 concentrations

Description

Return dissolved gas concentrations in units of micromole and milligram from membrane inlet mass spectrometer (MIMS) signal data

Usage

mimsy(data, baromet.press, units, bg.correct = FALSE, tz = Sys.timezone())

Arguments

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.

Value

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.

References

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.

Examples

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 workbook

Description

Easily save the full output of the 'mimsy' calculation function to a nicely-formatted, multi-tab Excel .xlsx file.

Usage

mimsy.save(x, file)

Arguments

x

object to be written to file, the output of 'mimsy' function

file

desired file name with .xlsx ending. Example: "mimsyCalculations.xlsx"

Value

Outputs an excel workbook to the user's working directory

Examples

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

Description

Calculate mass concentrations in mg/L given molar concentrations in umol/L

Usage

molar_to_mass(species, value, inUnits = "umol/L", outUnits = "mg/L")

Arguments

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"

Value

A numeric vector

Examples

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

Description

Calculate dinitrogen gas concentrations at saturation given water temperature, atmospheric pressure, and salinity

Usage

n2sat(temp, pressure, pressUnits, salinity = 0, outUnits = "mg/L")

Arguments

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"

Value

A numeric vector

References

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

Examples

n2sat(temp = 25, pressure = 29.8, pressUnits = "inHg", outUnits = "mg/L")

Calculate dissolved oxygen concentrations at saturation given water temperature, atmospheric pressure, and salinity

Description

Calculate dissolved oxygen concentrations at saturation given water temperature, atmospheric pressure, and salinity

Usage

o2sat(temp, pressure, pressUnits, salinity = 0, outUnits)

Arguments

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"

Value

A numeric vector

References

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

Examples

o2sat(temp = 25, pressure = 29.8, pressUnits = "inHg", outUnits = "mg/L")

Correct barometric pressure for vapor pressure of water

Description

Correct barometric pressure for vapor pressure of water

Usage

pressureCorrection(temp, barpress_atm)

Arguments

temp

Water temperature in degrees C

barpress_atm

Barometric pressure in atm

Value

Barometric pressure corrected for water vapor pressure