Table of Contents

Class: MadrigalHeaderRecord cedar.py

MadrigalHeaderRecord holds all the information in a Cedar header record.

Methods   
__init__
__str__
getEndTimeList
getJpar
getKindat
getKinst
getMpar
getStartTimeList
getText
getType
setJpar
setKindat
setKinst
setMpar
setText
setTimeLists
writeRecord
  __init__ 
__init__ (
        self,
        kinst,
        kindat,
        sYear,
        sMonth,
        sDay,
        sHour,
        sMin,
        sSec,
        sCentisec,
        eYear,
        eMonth,
        eDay,
        eHour,
        eMin,
        eSec,
        eCentisec,
        jpar,
        mpar,
        text,
        madInstObj=None,
        )

__init__ creates a MadrigalCatalogRecord.

Inputs:

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

kindat - kind of data code. 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

jpar - the number of 1d parameters in the following data records

mpar - the number of 2d parameters in the following data records

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 MadrigalHeaderRecord

  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.

  getJpar 
getJpar ( self )

returns the number of one-dimensional parameters in the associated data records.

  getKindat 
getKindat ( self )

getKindat returns the kind of data code (int) for a given header record.

Inputs: None

Outputs: the kind of data code (int) for a given header record.

  getKinst 
getKinst ( self )

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

Inputs: None

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

  getMpar 
getMpar ( self )

returns the number of two-dimensional parameters in the associated data records.

  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 header text.

Inputs: None

Outputs: the header text.

  getType 
getType ( self )

returns the type header

  setJpar 
setJpar ( self,  jpar )

set the number of one-dimensional parameters in the associated data records.

Must not be negative.

Exceptions   
TypeError, 'jpar must not be less than 0'
  setKindat 
setKindat ( self,  kindat )

setKindat sets the mode of kind of data code (int) for a given header record.

Inputs: the kind of data code (int)

Outputs: None

Affects: sets the kind of data code (int) (self.__kindat)

Exceptions: Raises ValueError if kindat less than 0

Exceptions   
ValueError, 'kindat must not be less than 0, not %i' %( self.__kindat )
  setKinst 
setKinst ( self,  kinst )

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

Inputs: kind of instrument code (integer)

Outputs: None

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

  setMpar 
setMpar ( self,  mpar )

set the number of two-dimensional parameters in the associated data records.

Must not be negative.

Exceptions   
TypeError, 'mpar must not be less than 0'
  setText 
setText ( self,  text )

setText sets the header text.

Inputs: text: text to be set. Must be length divisible by 80, and not contain line feeds. For now, must not exceed 2^16 - 80 bytes to be able to be handled by Cedar format.

Outputs: None.

Affects: sets self.__text

Raises TypeError if problem with text

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 MadrigalHeaderRecord 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 MadrigalHeaderRecord to cedar file

Exceptions   
IOError, 'error in madrecCreateHeaderRecord'
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