Mspire::Isotope
mspire library that can retrieve (from NIST) and yield element isotope information. Uses Neese biological ratios by default.
Installation
gem install mspire-isotope
Usage
require 'mspire/isotope'
Note: by default Neese biological isotope abundance ratios are used so H, C, N, O, S
have slightly different ratios than straight NIST ratios.
The Isotopes hashed by element
Mspire::Isotope::BY_ELEMENT
carbon_isotopes = Mspire::Isotope::NIST::BY_ELEMENT[:C]
An array of all isotopes
all_isotopes = Mspire::Isotope::ISOTOPES
Only the monoisotopic isotopes
(the monoisotopic isotope is the one with the highest relative abundance)
monoisotopic_isotopes = Mspire::Isotope::ISOTOPES.select(&:mono)
Convenience method for access by element
isotope = Mspire::Isotope[:C]
isotope = Mspire::Isotope[:C].find(&:mono)
Information available
c12 = Mspire::Isotope[:C][0]
c12.atomic_number
c12.element
c12.mass_number
c12.atomic_mass
c12.relative_abundance
c12.average_mass
c12.mono
c13 = Mspire::Isotope[:C][1]
...
Only use NIST data
by_element_hash = Mspire::Isotope::NIST::BY_ELEMENT
isotope_array = Mspire::Isotope::NIST::ISOTOPES
What about the convenience method? You set which element_hash you are using:
Mspire::Isotope[:C][0].relative_abundance
Mspire::Isotope.element_hash = Mspire::Isotope::NIST::BY_ELEMENT
Mspire::Isotope[:C][0].relative_abundance