Package gavo :: Package helpers :: Module processing :: Class HeaderProcessor
[frames] | no frames]

Class HeaderProcessor

source code

   object --+    
            |    
FileProcessor --+
                |
               HeaderProcessor

A base for processors doing FITS header manipulations.

The processor builds naked FITS headers alongside the actual files, with an added extension .hdr (or whatever is in the headerExt attribute). The presence of a FITS header indicates that a file has been processed. The headers on the actual FITS files are only replaced if necessary.

The basic flow is: Check if there is a header. If not, call _getNewHeader(srcFile) -> hdr. Store hdr to cache. Insert cached header in the new FITS if it's not there yet.

You have to implement the _getHeader(srcName) -> pyfits header object function. It must raise an exception if it cannot come up with a header. You also have to implement _isProcessed(srcName) -> boolean returning True if you think srcName already has a processed header.

This basic flow is influenced by the following opts attributes:

The idea is that you can:

All this leads to the messy logic. Sorry 'bout this.

Instance Methods
 
commentFilter(self, value)
returns true if the comment value should be preserved.
source code
 
historyFilter(self, value)
returns true if the history item value should be preserved.
source code
 
process(self, srcName) source code

Inherited from FileProcessor: __init__, addClassification, classify, getProductKey, iterIdentifiers, iterJobs, printReport, printTableSize, printVerboseReport, processAll

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods
 
getPrimaryHeader(srcName)
returns the primary header of srcName.
source code
 
addOptions(optParser) source code
Class Variables
  headerExt = ".hdr"
  maxHeaderBlocks = 40
  cardSequence = None
hash(x)
  keepKeys = set(["SIMPLE", "BITPIX", "NAXIS", "NAXIS1", "NAXIS2...

Inherited from FileProcessor: inputsDir

Properties

Inherited from object: __class__

Method Details

commentFilter(self, value)

source code 

returns true if the comment value should be preserved.

You may want to override this.

getPrimaryHeader(srcName)
Static Method

source code 

returns the primary header of srcName.

This is a convenience function for user derived classes.

process(self, srcName)

source code 
Overrides: FileProcessor.process

addOptions(optParser)
Static Method

source code 
Overrides: FileProcessor.addOptions

Class Variable Details

keepKeys

Value:
set(["SIMPLE", "BITPIX", "NAXIS", "NAXIS1", "NAXIS2", "EXTEND", "BZERO\
", "BSCALE"])