| |
- numpy.ndarray(builtins.object)
-
- xsArray
class xsArray(numpy.ndarray) |
|
A subclassed numpy array of cross sections with x, p, T, ... attributes added.
Furthermore, some convenience functions are implemented:
* info: print the attributes and the minimum and maximum xs values
* dx: return wavenumber grid point spacing
* grid: return a numpy array with the uniform wavenumber grid
* regrid: return new xsArray with the xs data interpolated to a new grid (same xLimits!)
* __eq__: the equality tests accepts 0.1% differences of pressure and all xs values |
|
- Method resolution order:
- xsArray
- numpy.ndarray
- builtins.object
Methods defined here:
- __array_finalize__(self, obj)
- None.
- __eq__(self, other)
- Compare cross sections including their attributes.
(For p and xs relative differences < 0.1% are seen as 'equal')
- __str__(self)
- Return str(self).
- dx(self)
- Return wavenumber grid point spacing.
- grid(self)
- Setup a uniform, equidistant wavenumber grid.
- info(self)
- regrid(self, newLen, method='l')
- Interpolate cross section to (usually denser) uniform, equidistant wavenumber grid.
- truncate(self, xLimits)
- Return a cross section in a truncated (smaller) wavenumber interval.
Static methods defined here:
- __new__(cls, input_array, xLimits=None, p=None, t=None, molec=None, lineShape=None)
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
Data and other attributes defined here:
- __hash__ = None
Functions |
| |
- ceil(...)
- ceil(x)
Return the ceiling of x as an Integral.
This is the smallest integer >= x.
- xsInfo(xsData)
- Print information on cross sections.
- xsPlot(xsData, nm=False, info='ptm', **kwArgs)
- Plot one or several cross sections.
xsData can be a single xsArray (for one molecule and p,T),
a list of xsArray's (for one molecule and some levels),
or a dictionary of (lists of) xsArray's (for some molecules, p, T).
OPTIONAL ARGUMENTS:
nm flag, default False, otherwise plot cross section(s) vs. wavelength [nm]
info default 'ptm' ==> show pressure, temperature, molecule as legend label;
other choices: 'f' for line shape function, 'n' for array length;
Ignored when label is set explicitely (in kwArgs).
kwArgs is passed directly to semilogy and can be used to set colors, line styles and markers etc.
kwArgs is ignored (cannot be used) in recursive calls with lists or dictionaries of cross sections.
- xsRead(xsFile, commentChar='#', verbose=0)
- Read cross section data from file(s) and return a list of xsArray's.
If xsFile is a list of files or a string including a wildcard (e.g. '*.xs'),
xsRead is called recursively for each file and a dictionary of cross section (lists) is returned.
xsArray: a subclassed numpy array with the cross section 'spectrum'
and attributes p, t, molec, lineShape added.
- xsRead_hitran(file)
- Read one cross section file (Hitran format; one molecule, several p,T pairs).
- xsRead_pickled(xsFile)
- Read one cross section file (python pickle format; one molecule, several p,T pairs).
- xsRead_xy(xsFile, commentChar='#')
- Read one cross section file (xy ascii format; typically one molecule, several p,T pairs).
- xsSave(data, outFile=None, commentChar=None, interpolate=None)
- Save (write) cross section(s) to pickled or ascii (tabular or Hitran) file(s).
data: a single xs, a list of xs of a single molecule for different p,T
or a dictionary of cross section(s) for some molecules (and some p,T)
outFile: if unspecified and data is a single xs, the name is generated using molecular name, p, and T
commentChar: if none (default), save data in numpy pickled file,
if "H" or "h", save data in Hitran (ascii) format,
otherwise (if punctuation character) ascii-tabular
interpolate: if (False or None) and tabular-ascii format, save data in individual files
2, 3, 4 uses the 'self_made' lagrange_regularGrid functions
l uses numpy.interp linear interpolation
q, c uses scipy.interp1d for spline interpolation of second or third order
WARNING: output filename determination is a bit tricky and might not work perfectly for recursive calls.
- xsSave_hitran(crossSections, outFile=None, format='%10.4g')
- Write cross sections (typically a list of xs instances for some p,T) to output (file) using the Hitran format.
- xsSave_pickled(crossSections, outFile=None)
- Write cross sections (typically a list of xs instances for some p,T) to output (file) using Python's pickle module.
|
Data |
| |
__warningregistry__ = {'version': 15, ('\nThe datapath rcparam was deprecated in Matplotl...2.1 and will be removed two minor releases later.', <class 'matplotlib.cbook.deprecation.MatplotlibDeprecationWarning'>, 56): True}
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': {'NumDeg': [1, 1, 1, 2, 2], 'VibFreq': [3374.0, 1974.0, 3289.0, 629.0, 730.0], 'geisa': 48, 'isotopes': ['122'], 'mass': 17.0}, 'C2N2': {'NumDeg': [1, 1, 1, 1, 1], 'VibFreq': [2330, 846, 2158, 503, 234], 'geisa': 29, 'hitran': 48, 'isotopes': ['4224'], 'mass': 52.0}, 'C3H4': {'NumDeg': [1, 1, 1, 1, 1, 2, 2, 2, 2, 2], 'VibFreq': [3334, 2918, 2142, 1382, 931, 3008, 1452, 1053, 633, 328], 'geisa': 40, 'mass': 40.0}, 'C3H8': {'NumDeg': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...], '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': {'NumDeg': [1, 1, 1, 1, 1, 1, 1, 1, 1], 'VibFreq': [3293, 2184, 874, 3329, 2020, 627, 482, 630, 231], 'geisa': 30, 'hitran': 43, 'isotopes': ['221'], 'mass': 50.0}, 'C6H6': {'NumDeg': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], '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}, ...}
punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' |
| |