chemistry_tools.formulae.iso_dist
Attention
This module has the following additional requirements:
cawdrey>=0.5.0 mathematical>=0.5.1 pyparsing>=2.4.6 tabulate>=0.8.9
These can be installed as follows:
python -m pip install chemistry-tools[formulae]
Isotope Distributions.
Classes:
|
Lookup for sorting isotope distribution output. |
|
An isotope distribution. |
-
enum
IsoDistSort
(value)[source] Bases:
enum_tools.custom_enums.IntEnum
Lookup for sorting isotope distribution output.
- Member Type
Valid values are as follows:
-
Formula
= <IsoDistSort.Formula: 0> Sort the isosope distribution by the formulae.
-
Mass
= <IsoDistSort.Mass: 1> Sort the isotope distribution by the masses.
-
Abundance
= <IsoDistSort.Abundance: 2> Sort the isotope distribution by the abundances.
-
Relative_Abundance
= <IsoDistSort.Relative_Abundance: 3> Sort the isotope distribution by the relative abundances.
-
class
IsotopeDistribution
(formula)[source] Bases:
DataArray
An isotope distribution.
Each composition can be accessed with their hill formulae like a dictionary (e.g.
iso_dict['H[1]2O[16]']
)Attributes:
Methods:
__contains__
(key)Return
key in self
.__eq__
(other)Return
self == other
.__getitem__
(key)Return
self[key]
.__iter__
()Iterates over the dictionary’s keys.
__len__
()Returns the number of keys in the dictionary.
__repr__
()Return a string representation of the
DataArray
.__str__
()Return
str(self)
.as_array
([sort_by, reverse, format_percentage])Returns the isotope distribution data as a list of lists.
as_csv
(*args[, sep])Returns the data as a CSV formatted string.
as_dataframe
(*args, **kwargs)Returns the isotope distribution data as a
pandas.DataFrame
.as_table
(*args, **kwargs)Returns the isotope distribution data as a table using tabulate.
copy
(*args, **kwargs)Return a copy of the
FrozenOrderedDict
.fromkeys
(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get
(k[, default])Return the value for
k
ifk
is in the dictionary, elsedefault
.items
()Returns a set-like object providing a view on the
FrozenOrderedDict
's items.keys
()Returns a set-like object providing a view on the
FrozenOrderedDict
's keys.values
()Returns an object providing a view on the
FrozenOrderedDict
's values.-
__class_getitem__
= <bound method GenericAlias of <class 'chemistry_tools.formulae.iso_dist.IsotopeDistribution'>> Type:
MethodType
-
__getitem__
(key) Return
self[key]
.- Parameters
key (
~KT
)- Return type
~VT
-
as_array
(sort_by=<IsoDistSort.Formula: 0>, reverse=False, format_percentage=True)[source] Returns the isotope distribution data as a list of lists.
- Parameters
- Return type
-
as_csv
(*args, sep=',', **kwargs) Returns the data as a CSV formatted string.
- Parameters
*args – Arguments passed to
as_array()
.sep (
str
) – The separator for the CSV data. Default','
.**kwargs – Additional keyword arguments passed to
as_array()
.
- Return type
-
as_dataframe
(*args, **kwargs) Returns the isotope distribution data as a
pandas.DataFrame
.Any arguments taken by
as_array()
can also be used here.- Return type
-
as_table
(*args, **kwargs) Returns the isotope distribution data as a table using tabulate.
Any arguments taken by
as_array()
can also be used here.Additionally, any valid keyword argument for
tabulate.tabulate()
can be used.- Return type
-
copy
(*args, **kwargs) Return a copy of the
FrozenOrderedDict
.- Parameters
args
kwargs
-
classmethod
fromkeys
(iterable, value=None) Create a new dictionary with keys from iterable and values set to value.
- Return type
FrozenBase
[~KT
,~VT
]
-
get
(k, default=None) Return the value for
k
ifk
is in the dictionary, elsedefault
.- Parameters
k – The key to return the value for.
default – The value to return if
key
is not in the dictionary. DefaultNone
.
-
items
() Returns a set-like object providing a view on the
FrozenOrderedDict
's items.- Return type
AbstractSet
[Tuple
[~KT
,~VT
]]
-
keys
() Returns a set-like object providing a view on the
FrozenOrderedDict
's keys.- Return type
AbstractSet
[~KT
]
-
values
() Returns an object providing a view on the
FrozenOrderedDict
's values.- Return type
ValuesView
[~VT
]
-