higstract
index
/users/schrei_f/src/py4CAtS/lite/src/higstract.py

higstract
 
higstract (extract/grep/select) line parameters from a spectroscopic data base file
 
usage:
higstract  [options]  line_parameter_database
 
command line options:
  -h            help
 --help         help extended
  -c   char(s)  comment character used in output file (default #)
  -o   file     output file (default: standard output, see last note of extended help)
 
  -f   string   output format:  original or simple lists (position vs strengths etc)
                                default "vSEan" (see notes of extended help)
  -i   integer  isotope name (e.g. 4 or 162 for heavy water HDO, the fourth most abundant isotope)
  -m   string   molecule name  (one molecule only!)
                "main" to save only lines of the main molecules (ignore trace gases)
  -S   float    minimum line strength to accept
  -x   interval lower and upper end of spectral (default: wavenumber) range (comma separated pair without blanks)
  -X   string   unit used for setting spectral range with -x option (does not affect output listing!)
                (default: "cm-1",  other choices: "Hz", "MHz", "GHz", "THz", "mue", "nm")
 
NOTE:  to avoid name clashes with numpy's extract function,
       this module and its the 'main' function have been renamed to 'higstract'
       (short for HItran-GeiSa-exTRACT)
 
For more information use
higstract --help

 
Functions
       
check_database_file(lineFile)
Check command line argument supplied to higstract.
core_parameters(lines, dataFile)
Given a list of data base records (one entry per transition)
return numpy structured array with the most important spectrocopic line parameters.
higstract(lineFile, xLimits=None, molecule=None, isotope=None, strMin=0.0, xUnit='cm-1', format='vSEasni', verbose=False)
HItran GeiSa exTRACT line data (position, strength, width, ...) from spectroscopic line parameter data file.
RETURN  a list of extracted lines in the original format (one list entry for each data record)
OR      a dictionary of numpy structured arrays with the core parameters (by molecule).
 
Parameters:
-----------
lineFile    string      a name uniquely identifying the database
xLimits     Interval    pair of wavenumbers/frequencies/wavelengths
                        (default al wavenumbers, also see xUnit)
molecule    string      species to be selected (default: 'all')
                        'main' returns the first 7 Hitran/Geisa molecules H2O, CO2, O3, N2O, CH4, CO, O2
isotope     string      the isotope ID as used by hitran, e.g. '162' for HDO
                        or
            int         1=most abundant (e.g. 4 for HDO)
                        default:  all isotopes
strMin      float       strength of weakest line to be accepted (default: 0.0)
xUnit       string      "cm-1" (default) | mue | nm | Hz | kHz | MHz| GHz | THz
                        (only relevant for xLimits, does not change units of returned line positions)
format      string      a combination of letters indicating the core line parameters
 
RETURNS:
--------
EITHER      a dictionary of 'lineArray', a subclassed structured numpy array of core line parameters,
OR          a single 'lineArray, if only a single molecule is to be extracted,
OR          a list of all lines accepted, i.e. a string (record) for each line in the original format.
 
At least a spectral range (xLimits) OR a molecule (name) has to be specified.
Currently Hitran, Geisa, and SAO formats are supported.
 
NOTE:  main function called 'higstract' (short for HItranGeiSaexTRACT)
       to avoid a name clash with numpy's extract function
save_lines_core(dictOfLineLists, outFile='', format='vSEan', mainOnly=False, commentChar='#')
Save a dictionary of line arrays (structured numpy arrays with attributes) to files, molecule by molecule.
save_lines_orig(lineList, lineFile, outFile=None, format='', mainOnly=False, commentChar='#')
Save Hitran|Geisa lines extracted in original format.
split_molecules(lineList, dataFile)
Given the list of database records extracted from Hitran/Geisa, distribute the entries in separate lists for each molecule.
write_lines_xy(data, outFile, job=None, commentChar='#')
Print 'core' line parameters, i.e., positions vs strengths, and optionally energies, airWidths, tempExponents.

 
Data
        mainMolecules = ['H2O', 'CO2', 'O3', 'N2O', 'CH4', 'CO', 'O2']
molecules = {'BrO': {'NumDeg': [1], 'TempExpGL': 0.5, 'TempExpQR': 1.0, 'VibFreq': [500.0], 'isotopes': ['69', '61'], 'mass': 95.0}, 'C2H2': {'NumDeg': [1, 1, 1, 2, 2], 'TempExpGL': 0.75, 'TempExpQR': 1.0, 'VibFreq': [3374.0, 1974.0, 3289.0, 629.0, 730.0], 'geisa': 24, 'hitran': 26, 'isotopes': ['1221', '1231', '1222'], 'mass': 26.03, 'sao': 26}, 'C2H4': {'NumDeg': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 'TempExpGL': 0.5, 'TempExpQR': 1.5, 'VibFreq': [3026, 1625, 1342, 1023, 3103, 1236, 949, 943, 3106, 826, 2989, 1444], 'geisa': 25, 'hitran': 38, 'isotopes': ['221', '311'], 'mass': 28.0}, 'C2H6': {'NumDeg': [1, 1, 1, 1, 1, 1, 2, 1, 2], 'TempExpGL': 0.75, 'TempExpQR': 1.9, 'VibFreq': [2899.0, 1375.0, 993.0, 275.0, 2954.0, 1379.0, 2994.0, 1486.0, 822.0], 'geisa': 22, 'hitran': 27, 'isotopes': ['1221', '1231'], 'mass': 30.07, 'sao': 27}, 'C2HD': {'geisa': 48, 'isotopes': ['122'], 'mass': 17.0}, 'C2N2': {'VibFreq': [2330, 846, 2158, 503, 234], 'geisa': 29, 'hitran': 48, 'isotopes': ['4224'], 'mass': 52.0}, 'C3H4': {'geisa': 40, 'mass': 40.0}, 'C3H8': {'VibFreq': [2977, 2962, 2887, 1476, 1462, 1392, 1158, 869, 369, 2967, 1451, 1278, 940, 216, 2968, 2887, 1464, 1378, 1338, 1054, ...], 'geisa': 28, 'isotopes': ['221'], 'mass': 44.0}, 'C4H2': {'VibFreq': [3293, 2184, 874, 3329, 2020, 627, 482, 630, 231], 'geisa': 30, 'hitran': 43, 'isotopes': ['221'], 'mass': 50.0}, 'C6H6': {'VibFreq': [3062, 992, 1326, 673, 3068, 1010, 995, 703, 1310, 1150, 849, 3063, 1486, 1038, 3047, 1596, 1178, 606, 975, 410], 'geisa': 47, 'isotopes': ['266'], 'mass': 78.0}, ...}
more_help = '\n\n OUTPUT FORMAT:\n * "simple lists" --- for..., CO2, O3, N2O, CH4, CO, O2, but no trace gases\n'