PyNeb  1.1.2
PyNeb Reference Manua
Observation Class Reference

Inherits object.

Public Member Functions

def __init__
 
def addLine (self, line)
 
def fillObs
 
def addObs
 
def lineLabels (self)
 
def n_lines (self)
 
def n_valid_lines (self)
 
def n_obs (self)
 
def n_obs_origin (self)
 
def getLine
 
def getSortedLines
 
def getUniqueAtoms (self)
 
def readData
 
def getIntens
 
def getError
 
def printIntens
 
def def_EBV
 
def correctData
 
def setAllErrors (self, err_default)
 
def addMonteCarloObs
 

Public Attributes

 log_
 myloggin object More...
 
 calling
 
 lines
 
 names
 
 extinction
 RedCor object. More...
 
 corrected
 

Constructor & Destructor Documentation

def __init__ (   self,
  obsFile = None,
  fileFormat = 'lines_in_cols',
  delimiter = None,
  err_default = 0.10,
  corrected = False,
  errIsRelative = True 
)
Define the observation object, which is a collection of observated intensities of one or more
emission lines for one or more objects, with the corresponding errors.
The observed intensities are read from a file or filled in by the addLine method.
Includes an extinction correction object (pyneb.RedCorr) as Observation.extinction.

Parameters:
    - obsFile       name of the file containing the observations. May be a file object or a file name 
    - fileFormat    lines_in_cols or lines_in_row depending on how the wavelengths are ordered 
                (default: lines_in_cols)
    - delimiter     character separating entries 
    - err_default   default uncertainty assumed on intensities. Will overwrite the error from the file.
    - corrected     Boolean. True if the observed intensities are already corrected from extinction
                (default: False)
    - errIsRelative Boolean. True if the errors are relative to the intensities, False if they
                are in the same unit as the intensity (default: True)

Example:
    Read a file containing corrected intensities:
obs = pn.Observation('obs.dat', corrected = True)
    to obtain a dictionary with the observed  corrected intensities:
i_cor = {label: obs.getLine(label = label).corrIntens for label in obs.lineLabels}

Member Function Documentation

def addLine (   self,
  line 
)
Add a line to an existing observation

Parameters:
    - line    the selected emission line (an instance of EmissionLine)
def addMonteCarloObs (   self,
  N = 0,
  i_obs = None 
)
Adding MonteCarlo random-gauss values of fake observations to an obs object.
The names of the fake observations will be OriginalName-MC-n, n ranging from 0 to N-1

Parameters:
N: number of new observations to be added for each original observation.
i_obs: used in case only a given observations needs to be treated
def addObs (   self,
  name,
  newObsIntens,
  newObsError = None 
)
Add an observation (i.e. a list of intensities corresponding to a new object) to the existing set.

Parameters:
    - name            name of the new observation/object
    - newObsIntens    value(s) of the line intensities. Length must match Observation.n_lines
def correctData (   self,
  line = None,
  normWave = None 
)
Correct the line intensities with the correction computed with the RedCorr class (extinction.py)
The result is stored in line.corrIntens (corrected intensity in absolute units).
def def_EBV (   self,
  label1 = "H1_6563A",
  label2 = "H1_4861A",
  r_theo = 2.85 
)
Define the extinction parameter using the ratio of 2 lines.
Calls extinction.setCorr to set the EBV and cHbeta according to the parameters.
Once this is done, one may call correctData to compute the EmissionLine.corrIntens

Parameters:
    - label1 and label2 [EmissionLine.label] observed line whose intensities are used
    - r_theo [float] theoretical line ratio
def fillObs (   self,
  lineLabel,
  default = np.nan 
)
Create a fake observation of a given line, filled with a given value.
Parameters:
    - lineLabel: the label of the new line. If the label corresponds to an already 
defined observation, nothing is done and a warning is issued.
    - default: the value of the fake observations. Default is np.nan
def getError (   self,
  returnObs = False,
  obsName = None 
)
Return the line intensity error in form of a dictionary with line labels as keys.

Parameters:
    - returnObs  if False (default), prints the corrected values. 
            If True, prints the observed value. 
    - obsName    name of an observation. If not set or None, all the observations are printed
def getIntens (   self,
  returnObs = False,
  obsName = None 
)
Return the line intensities in form of a dictionary with line labels as keys.

Parameters:
    - returnObs  Boolean. If False (default), prints the corrected values. 
            If True, prints the observed value. 
    - obsName    name of an observation. If not set or None, all the observations are printed
def getLine (   self,
  elem = None,
  spec = None,
  wave = None,
  label = None,
  blend = False,
  i = None,
  j = None 
)
Return the lines corresponding to elem-spec-wave or to the label.
def getSortedLines (   self,
  crit = 'atom' 
)
Return a list of lines sorted by atoms or wavelengths.

Parameters:
    - crit   criterion to sort the line list ('atom' [default] or 'wave')
def getUniqueAtoms (   self)
Return a numpy.ndarray of the atoms of the observed lines. If an atom emits 
more than one line, it is returned only once (numpy.unique is applied 
to the list before returning).
def lineLabels (   self)
Property
Array of labels of the lines 
def n_lines (   self)
Property
Number of lines
def n_obs (   self)
Property
Number of observations. If the number of observations varies from one line to the other,
    returns the number of observations for each line as an array.
def n_obs_origin (   self)
Property
Number of observations which are not from MonteCarlo (i.e. without -MC- in the name)
def n_valid_lines (   self)
Property
Number of valid lines (i.e., lines with labels recognized by PyNeb)
def printIntens (   self,
  returnObs = False,
  obsName = None 
)
Print the line intensities.

Parameters:
    - returnObs   if False (default), prints the corrected values. 
            If True, prints the observed value. 
    - obsName     name of an observation. Is unset or None, all the observations are printed
def readData (   self,
  obsFile,
  fileFormat = 'lines_in_cols',
  delimiter = None,
  err_default = 0.10,
  corrected = False,
  errIsRelative = True 
)
Read observational data from an ascii file. The lines can be listed either in columns or in rows
and the observed objects vary in the other direction. The uncertainty on the line intensities
can be read from the file, or a constant relative value can be assumed.
The lines must be identified by a label in PyNeb's format ion_wave (e.g., 'O3_5007'); the list of ions and
corresponding wavelengths can also be found in pn.LINE_LABEL_LIST.
The following optional fields may also be included (without quotes): 'NAME' (object's name, in one string), 
'E(B-V)', 'cHbeta', and 'e' (observational error).

 
Parameters:
    - obsFile        file containing the observations. May be a file object or a string 
    - fileFormat     emission lines vary across columns ('lines_in_cols', default) or 
                across rows ('lines_in_rows'), or across rows with errors in columns 
                ('lines_in_rows_err_cols')m in which case the column label must start with "err"
    - delimiter      field delimiter (default: None)  
    - err_default    default uncertainty on the line intensities
    - corrected      Boolean. True if the observed intensities are already corrected from extinction
                 (default: False)
    - errIsRelative  Boolean. True if the errors are relative to the intensities, False if they
                 are in the same unit as the intensity (default: False)
def setAllErrors (   self,
  err_default 
)
Set the relative uncertainty of all emission lines to a common constant value

Parameters:
    - err_default     default value of the relative uncertainty

Member Data Documentation

calling
corrected
extinction

RedCor object.

lines
log_

myloggin object

names