Table of Contents

Class: MadrigalCatalogRecord cedar.py

MadrigalCatalogRecord holds all the information in a Cedar catalog record.

Methods   
__init__
__str__
getEndTimeList
getKinst
getModexp
getStartTimeList
getText
getType
setKinst
setModexp
setText
setTimeLists
writeRecord
  __init__ 
__init__ (
        self,
        kinst,
        modexp,
        sYear,
        sMonth,
        sDay,
        sHour,
        sMin,
        sSec,
        sCentisec,
        eYear,
        eMonth,
        eDay,
        eHour,
        eMin,
        eSec,
        eCentisec,
        text,
        madInstObj=None,
        )

__init__ creates a MadrigalCatalogRecord.

Inputs:

kinst - the kind of instrument code. A warning will be raised if not in instTab.txt.

modexp - Code to indicate experimental mode employed. Must be a non-negative integer.

sYear,sMonth,sDay,sHour,sMin,sSec,sCentisec - experiment start time. sCentisec must be 0-99

eYear,eMonth,eDay,eHour,eMin,eSec,eCentisec - experiment end time. eCentisec must be 0-99

text - string containing text in catalog record. Length must be divisible by 80. No linefeeds allowed.

madInstObj - a madrigal.metadata.MadrigalInstrument object. If None, one will be created. Used to verify kinst.

Outputs: None

Returns: None

  __str__ 
__str__ ( self )

returns a string representation of a MadrigalCatalogRecord

  getEndTimeList 
getEndTimeList ( self )

getEndTimeList returns a tuple containing eYear, eMonth, eDay, eHour, eMin, eSec, and eCentisec

Inputs: None

Outputs: a tuple containing eYear, eMonth, eDay, eHour, eMin, eSec, and eCentisec.

  getKinst 
getKinst ( self )

getKinst returns the kind of instrument code (int) for a given catalog record.

Inputs: None

Outputs: the kind of instrument code (int) for a given catalog record.

  getModexp 
getModexp ( self )

getModexp returns the mode of experiment code (int) for a given catalog record.

Inputs: None

Outputs: the mode of experiment code (int) for a given catalog record.

  getStartTimeList 
getStartTimeList ( self )

getStartTimeList returns a tuple containing sYear, sMonth, sDay, sHour, sMin, sSec, and sCentisec

Inputs: None

Outputs: a tuple containing sYear, sMonth, sDay, sHour, sMin, sSec, and sCentisec.

  getText 
getText ( self )

getText returns the catalog text.

Inputs: None

Outputs: the catalog text.

  getType 
getType ( self )

returns the type catalog

  setKinst 
setKinst ( self,  kinst )

setKinst sets the kind of instrument code (int) for a given catalog record.

Inputs: kind of instrument code (integer)

Outputs: None

Affects: sets the kind of instrument code (int) (self.__kinst) for a given catalog record. Prints warning if kinst not found in instTab.txt

  setModexp 
setModexp ( self,  modexp )

setModexp sets the mode of experiment code (int) for a given catalog record.

Inputs: the mode of experiment code (int)

Outputs: None

Affects: sets the mode of experiment code (int) (self.__modexp)

  setText 
setText ( self,  text )

setText sets the catalog text.

Inputs: text: text to be set. Must be length divisible by 80, and not contain line feeds. Also, for now cannot exceed 2^(16) - 80

Outputs: None.

Affects: sets self.__text

Raise TypeError if problem with test

Exceptions   
TypeError, 'text exceeds ability of Cedar format to store'
TypeError, 'text length must be divisible by 80: len is %i' %(len( text ) )
TypeError, 'text must be of type string'
TypeError, 'text must not contain linefeed character'
  setTimeLists 
setTimeLists (
        self,
        sYear,
        sMonth,
        sDay,
        sHour,
        sMin,
        sSec,
        sCentisec,
        eYear,
        eMonth,
        eDay,
        eHour,
        eMin,
        eSec,
        eCentisec,
        )

setTimeList resets start and end times

Inputs:

sYear,sMonth,sDay,sHour,sMin,sSec,sCentisec - experiment start time. sCentisec must be 0-99

eYear,eMonth,eDay,eHour,eMin,eSec,eCentisec - experiment end time. eCentisec must be 0-99

Outputs: None

Affects: sets all time attributes (see code).

Exceptions: Raises ValueError if startTime > endTime

Exceptions   
ValueError, 'Starting time cannot be after ending time'
  writeRecord 
writeRecord (
        self,
        cedarFile,
        format,
        )

writeRecord writes a MadrigalCatalogRecord to an open cedarFile.

Users should not call this method directly. Use MadrigalCedarFile.write to persist data.

Inputs:

cedarFile - pointer to madrec as returned by madrigal._Madrec.madrecOpen

format - a format to save the file in. For now, the allowed values are Madrigal, BlockedBinary, UnblockedBinary, Cbf, and Ascii.

Outputs: None

Affects: writes MadrigalCatalogRecord to cedar file

Exceptions   
IOError, 'error in madrecCreateCatalogRecord'
IOError, 'error in madrecPutNextRec'

Table of Contents

This document was automatically generated on Fri May 30 14:39:57 2008 by HappyDoc version r1_5