Package ComboCode :: Package cc :: Package tools :: Package readers :: Module SpectroscopyReader :: Class SpectroscopyReader
[hide private]
[frames] | no frames]

Class SpectroscopyReader

source code


The SpectroscopyReader class.

Inherits from the Reader class, and thus functions much like a dictionary.

SpectroscopyReader functions primarily as an intermediary class between Reader and MolReader/CollisReader, both classes that make heavy use of transition based indexing, and does relate to upper and lower level indices.

Typically not used stand-alone. Refer to MolReader and CollisReader for practical uses. Both classes make use of this parent class' methods.

Instance Methods [hide private]
new empty dictionary

__init__(self, fn, *args, **kwargs)
Initialize an SpectroscopyReader object.
source code
float/int/array
get(self, ptype, prop, index=None)
Return a property for a given type of property possibly for a given index.
source code
int/array
getTI(self, itype, lup=None, llow=None)
Return the indices of the transitions read from the molecular spectroscopy data or from the collisional rate data.
source code
array
getTUpper(self, index=None, itype='trans')
Return the indices of the upper states of the <nline> included transitions.
source code
array
getTLower(self, index=None, itype='trans')
Return the indices of the lower states of the <nline> included transitions.
source code

Inherited from cc.tools.readers.Reader.Reader: getFile, readFile

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, __sizeof__, clear, copy, fromkeys, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, fn, *args, **kwargs)
(Constructor)

source code 

Initialize an SpectroscopyReader object.

Additional args & kwargs passed to __init__ are passed to dict __init__.

Parameters:
  • fn (str) - The filename of the file that is being read.
Returns:
new empty dictionary

Overrides: object.__init__

get(self, ptype, prop, index=None)

source code 

Return a property for a given type of property possibly for a given index.

In case a single value is requested via index, the property value is extracted from the array.

Parameters:
  • ptype (str) - The type of property. 'coll_trans', 'trans' or 'level'.
  • prop (str) - The property itself. eg 'energy' for level, or 'lup' for trans, or 'rates' for coll_trans.
  • index (int/array) - The index. In case of default, all are returned. Can be any array-like object that includes indices

    (default: None)

Returns: float/int/array
The property sorted by property type index, or a single element
Overrides: dict.get

getTI(self, itype, lup=None, llow=None)

source code 

Return the indices of the transitions read from the molecular spectroscopy data or from the collisional rate data.

A specific index (or array of indices) can be requested by specifying the lower and upper level index.

Multiple lup and/or llow can be given in one go to make a selection of indices.

Parameters:
  • itype (str) - The type of index. MolReader needs this to be 'trans'. CollisReader needs this to be 'coll_trans'.
  • lup (int/array) - The index of the upper energy level in the transition. If both this and llow are None, all transition indices are returned.

    (default: None)

  • llow (int/array) - The index of the lower energy level in the transition. If both this and lup are None, all transition indices are returned.

    (default: None)

Returns: int/array
The transition indices. A single integer if both lup and llow were single integers.

getTUpper(self, index=None, itype='trans')

source code 

Return the indices of the upper states of the <nline> included transitions.

These are NOT the quantum numbers! Especially for CO-type molecules, the J-level is equal to level_index-1.

In case a single upper level is requested via index, the level index is extracted from the array.

Parameters:
  • index (int/array) - The index. In case of default, all are returned. Can be any array-like object that includes indices

    (default: None)

  • itype (str) - The type of index. Default is for MolReader. CollisReader needs this to be 'coll_trans'.

    (default: 'trans')

Returns: array
The upper level indices/x ordered by transition index.

getTLower(self, index=None, itype='trans')

source code 

Return the indices of the lower states of the <nline> included transitions.

These are NOT the quantum numbers! Especially for CO-type molecules, the J-level is equal to level_index-1.

In case a single lower level is requested via index, the level index is extracted from the array.

Parameters:
  • index (int/array) - The index. In case of default, all are returned. Can be any array-like object that includes indices

    (default: None)

  • itype (str) - The type of index. Default is for MolReader. CollisReader needs this to be 'coll_trans'.

    (default: 'trans')

Returns: array
The lower level indices/x ordered by transition index.