The Solar-Stellar Spectrograph

[ Home | About | Tech Info & Data | Publications | References ]      [ Site by Jeffrey Hall | Research funded by NSF ]



The Header class handles a generic file header. It inherits Filelink.

This class is generally used in conjunction with an Image class to handle the two components of a typical spectroscopic data file. It allows the header to have any number of fields, with any number of characters per field.

Version History

2008 July 07 - Documentation written.


Data Members

long numFields

long fieldLen

struct pointer[ ] hdr { fields:StrArr(numFields }


Method List





get_field( )

init( )

is_valid( )

read( )




Method Descriptions


PRO cleanup

Calls Filelink::cleanup

Destructor. Clears its history list by calling Filelink::cleanup, and freeing its own hdr pointer. Never call this procedure directly; it is invoked by IDL's Obj_Destroy function.


PRO define

Structure definition. Specifies the contents of the IDL structure instantiated by the Header class. Used by Obj_New; do not invoke directly.


PRO dump_header

Prints the content of the hdr data member to stdout.


PRO dump_stat

Calls Filelink::dump_stat

This is a standard OIL class method. For the Header class, it dumps the current header, followed by the parent Filelink object's data members, to the command output window. The dump will look best if the output font is fixed rather than proportional width.


FUNCTION get_field

argument long num

Calls Root::add_history

Return bool, string field

Returns field num from the object's hdr data member, or FALSE if hdr is invalid. This function can throw two errors to the event history list (if the header is an invalid pointer or if the field number is out of range).



keyword long numFields

keyword long fieldLen

keyword struct _EXTRA

Constructor. The keywords numFields and fieldLen are used to supply initial values for the data members. If they are not set, the members are initialized to 36 and 80, respectively (the size of a single-unit FITS header). Never call this function directly; it is invoked by IDL's Obj_New function.


FUNCTION is_valid

Calls Filelink::add_history, Filelink::is_valid

Return long[3] valid

Each OIL class has an is_valid function that performs class-specific tests on its data members. If all members are found to be valid, however validity is defined for that class, this funtion returns 1. Otherwise, a negative number is returned that contains a bitwise combination of all errors detected. In the case of Header, the error codes are: -1 (header is NULL), -2 (numFields is 0), or -4 (fieldLen is 0). The function returns a three-element array of longs, the first element containing the validity state of the Root, and the second that of the Filelink. A warning is written to the log if the Header is invalid.



Calls Filelink::open_datafile, Filelink::close_datafile, Filelink::modified, Root::add_history

Return bool b

Reads the header from the linked file. Returns TRUE if read successfully and FALSE if there was an error.


PRO set_field

argument long num

argument string value

Calls Root::add_history

Sets the value of field num of the object's hdr data member to value, returning TRUE. It throws an error if the header is null or the field numer is out of range, and returns FALSE.


PRO write

Calls Filelink::open_datafile, Filelink::close_datafile, Filelink::modified, Root::add_history

Return bool b

Writes the header to the linked file. Returns TRUE if read successfully and FALSE if there was an error.


Sample Usage

obj = Obj_New( 'Header', logCodes = !OIL_ALL, f = 'C:\mydir\somefile' )

Obj_Destroy( obj )


[Back to contents]

Supported by grants from the National Science Foundation.
[ Back to my home page | Email me: jch [at] lowell [dot] edu ]
The SSS is publicly funded. Unless explicitly noted otherwise, everything on this site is in the public domain.
If you use or quote our results or images, we appreciate an acknowledgment.
This site is best viewed with Mozilla Firefox.