aton.alias
Description
This module contains common dictionaries to normalise and correct user inputs.
All values can be found in lowercase, to allow comparison with the string.lower() method.
Inverse of an unit X, as in 1/X or X$^{-1}$, is expressed as X1.
See all available options with dict.keys().
Index
units
spatial
experiments
files
boolean
math
Examples
unit = 'Electronvolts'
if unit.lower() in aton.alias.units['eV']:
... do stuff ...
1""" 2# Description 3 4This module contains common dictionaries to normalise and correct user inputs. 5All values can be found in lowercase, to allow comparison with the `string.lower()` method. 6Inverse of an unit X, as in 1/X or X$^{-1}$, is expressed as `X1`. 7See all available options with `dict.keys()`. 8 9 10# Index 11 12`units` 13`spatial` 14`experiments` 15`files` 16`boolean` 17`math` 18 19 20# Examples 21 22```python 23unit = 'Electronvolts' 24if unit.lower() in aton.alias.units['eV']: 25 ... do stuff ... 26``` 27 28--- 29""" 30 31 32units: dict = { 33 'mol' : ['mol', 'mols', 'mole', 'moles'], 34 'g' : ['g', 'gram', 'grams'], 35 'kg' : ['kg', 'kilogram', 'kilograms'], 36 'amu' : ['amu', 'atomicmassunit', 'atomicmassunits'], 37 'eV' : ['eV', 'ev', 'electronvolt', 'electronvolts'], 38 'meV' : ['meV', 'mev', 'millielectronvolt', 'millielectronvolts'], 39 'ueV' : ['ueV', 'uev', 'microelectronvolts', 'mueV', 'muev'], 40 'J' : ['J', 'j', 'joule', 'joules'], 41 'cal' : ['cal', 'calorie', 'calories'], 42 'kcal' : ['kcal', 'kilocalorie', 'kilocalories'], 43 'Ry' : ['Ry', 'ry', 'rydberg', 'rydbergs'], 44 'cm' : ['cm', 'centimeter', 'centimeters'], 45 'cm1' : ['cm^{-1}', 'cm1', 'cm-1', 'cm^-1'], 46 'AA' : ['A', 'AA', 'a', 'aa', 'angstrom', 'angstroms', 'armstrong', 'armstrongs'], 47 'AA1' : ['AA1', 'A1', 'AA-1', 'A-1', 'aa1', 'a1', 'aa-1', 'a-1'], 48 'bohr' : ['bohr', 'bohrs', 'bohrradii'], 49 'm' : ['m', 'meter', 'meters'], 50 'deg' : ['deg', 'degree', 'degrees'], 51 'rad' : ['rad', 'radian', 'radians'], 52 'bar' : ['bar', 'bars'], 53 'kbar' : ['kbar', 'kilobar', 'kilobars'], 54 'Pa' : ['Pa', 'pa', 'pascal', 'pascals'], 55 'GPa' : ['GPa', 'gpa', 'gigapascal', 'gigapascals'], 56 's' : ['s', 'second', 'seconds'], 57 'H' : ['H', 'h', 'hour', 'hours'], 58} 59"""Dict with unit names.""" 60 61 62spatial: dict = { 63 'height' : ['height', 'h'], 64 'area' : ['area', 'a'], 65 'volume' : ['volume', 'vol'], 66 'x' : ['x', 'horizontal', 'h'], 67 'y' : ['y', 'vertical', 'v'], 68 'z' : ['z'], 69} 70"""Dict with different spatial parameters. Values must be compared to `string.lower()`.""" 71 72 73chemical: dict = { 74 'CH3' : ['ch', 'CH', 'ch3', 'CH3', 'methyl'], 75 'NH3' : ['nh', 'NH', 'nh3', 'NH3', 'amine'], 76 'CD3' : ['cd', 'CD', 'cd3', 'CD3', 'deuterated methyl'], 77 'ND3' : ['nd', 'ND', 'nd3', 'ND3', 'deuterated amine'], 78} 79"""Dict with chemical groups.""" 80 81 82experiments: dict = { 83 'ins' : ['ins', 'inelasticneutronscattering', 'inelastic neutron scattering'], 84 'atr' : ['atr', 'ftir', 'attenuatedtotalreflection', 'attenuated total reflection'], 85 'raman' : ['raman'], 86 'qens' : ['qens', 'quasielasticneutronscattering', 'quasielastic neutron scattering', 'quasi elastic neutron scattering'], 87} 88"""Dictionary with the available experiment types. Values must be compared to `string.lower()`.""" 89 90 91files: dict = { 92 'file' : ['file', 'files', 'f', 'filepath', 'file path', 'filename', 'file name'], 93 'dir' : ['dir', 'directory', 'd', 'folder'], 94 'error' : ['error', 'errors', 'e', 'err'], 95 } 96"""Strings related to files. Values must be compared to `string.lower()`.""" 97 98 99boolean: dict = { 100 True : ['yes', 'YES', 'Yes', 'Y', 'y', 'T', 'True', 'TRUE', 't', 'true', 'Si', 'SI', 'si', 'S', 's'], 101 False : ['no', 'NO', 'No', 'N', 'n', 'F', 'False', 'FALSE', 'f', 'false'], 102} 103"""Strings with booleans such as 'yes' / 'no'.""" 104 105 106math: dict = { 107 'sin' : ['sin', 'sen', 'sine', 'seno'], 108 'cos' : ['cos', 'cosine', 'coseno'], 109 'tg' : ['tg', 'tangent', 'tangente'], 110 '0' : ['zero', 'cero', '0'], 111} 112"""Math-related strings."""
units: dict =
{'mol': ['mol', 'mols', 'mole', 'moles'], 'g': ['g', 'gram', 'grams'], 'kg': ['kg', 'kilogram', 'kilograms'], 'amu': ['amu', 'atomicmassunit', 'atomicmassunits'], 'eV': ['eV', 'ev', 'electronvolt', 'electronvolts'], 'meV': ['meV', 'mev', 'millielectronvolt', 'millielectronvolts'], 'ueV': ['ueV', 'uev', 'microelectronvolts', 'mueV', 'muev'], 'J': ['J', 'j', 'joule', 'joules'], 'cal': ['cal', 'calorie', 'calories'], 'kcal': ['kcal', 'kilocalorie', 'kilocalories'], 'Ry': ['Ry', 'ry', 'rydberg', 'rydbergs'], 'cm': ['cm', 'centimeter', 'centimeters'], 'cm1': ['cm^{-1}', 'cm1', 'cm-1', 'cm^-1'], 'AA': ['A', 'AA', 'a', 'aa', 'angstrom', 'angstroms', 'armstrong', 'armstrongs'], 'AA1': ['AA1', 'A1', 'AA-1', 'A-1', 'aa1', 'a1', 'aa-1', 'a-1'], 'bohr': ['bohr', 'bohrs', 'bohrradii'], 'm': ['m', 'meter', 'meters'], 'deg': ['deg', 'degree', 'degrees'], 'rad': ['rad', 'radian', 'radians'], 'bar': ['bar', 'bars'], 'kbar': ['kbar', 'kilobar', 'kilobars'], 'Pa': ['Pa', 'pa', 'pascal', 'pascals'], 'GPa': ['GPa', 'gpa', 'gigapascal', 'gigapascals'], 's': ['s', 'second', 'seconds'], 'H': ['H', 'h', 'hour', 'hours']}
Dict with unit names.
spatial: dict =
{'height': ['height', 'h'], 'area': ['area', 'a'], 'volume': ['volume', 'vol'], 'x': ['x', 'horizontal', 'h'], 'y': ['y', 'vertical', 'v'], 'z': ['z']}
Dict with different spatial parameters. Values must be compared to string.lower().
chemical: dict =
{'CH3': ['ch', 'CH', 'ch3', 'CH3', 'methyl'], 'NH3': ['nh', 'NH', 'nh3', 'NH3', 'amine'], 'CD3': ['cd', 'CD', 'cd3', 'CD3', 'deuterated methyl'], 'ND3': ['nd', 'ND', 'nd3', 'ND3', 'deuterated amine']}
Dict with chemical groups.
experiments: dict =
{'ins': ['ins', 'inelasticneutronscattering', 'inelastic neutron scattering'], 'atr': ['atr', 'ftir', 'attenuatedtotalreflection', 'attenuated total reflection'], 'raman': ['raman'], 'qens': ['qens', 'quasielasticneutronscattering', 'quasielastic neutron scattering', 'quasi elastic neutron scattering']}
Dictionary with the available experiment types. Values must be compared to string.lower().
files: dict =
{'file': ['file', 'files', 'f', 'filepath', 'file path', 'filename', 'file name'], 'dir': ['dir', 'directory', 'd', 'folder'], 'error': ['error', 'errors', 'e', 'err']}
Strings related to files. Values must be compared to string.lower().
boolean: dict =
{True: ['yes', 'YES', 'Yes', 'Y', 'y', 'T', 'True', 'TRUE', 't', 'true', 'Si', 'SI', 'si', 'S', 's'], False: ['no', 'NO', 'No', 'N', 'n', 'F', 'False', 'FALSE', 'f', 'false']}
Strings with booleans such as 'yes' / 'no'.
math: dict =
{'sin': ['sin', 'sen', 'sine', 'seno'], 'cos': ['cos', 'cosine', 'coseno'], 'tg': ['tg', 'tangent', 'tangente'], '0': ['zero', 'cero', '0']}
Math-related strings.