# astro.main package¶

## astro.main.AstrometricParametersFactory module¶

astro.main.AstrometricParametersFactory.create_AP()

Instantiate AstrometricParameters object.

## astro.main.SubWinStatFactory module¶

astro.main.SubWinStatFactory.create_subwinstat()

Instantiate sub-window statistics object.

## Module contents¶

The Persistent Object Hierarchy

This package contains the persistent object hierarchy for OmegaCAM. This hierarchy reflects the data model for the reduction of multi-CCD optical imaging data.

All persistent objects derive from common.database.DBMain.DBObject, The full hierarchy is (objects marked with * have a make method, see below):

DBObject

+DataObject————–+—————+

+–AssociateList * +–Astrom +–BaseCatalog +–AstrometricCorrection * | | +–AstrometricParameters * | | +–BaseAtmostphericExtinction | +–Catalog * | | | | | | +–AtmostphericExtinction * | | +–PhotSrcCatalog * | | | | | | | +–AtmosphericExtinctionFrames * | +–PhotRefCatalog | | +–AtmostphericExtinctionZerpoint * | | | | +–BaseFrame | +–AtmostphericExtinctionCurve * | | | +–AtmosphericExtinctionCoefficient * | +–BaseFlatFrame | | | | +–Chip | | +–DomeFlatFrame * +–Config | | +–MasterFlatFrame * | | | | +–TwilightFlatFrame * | +–AddImageCalibsConfig | | | +–AplastromConfig | +–BiasFrame * | +–AssociateConfig | +–FringeFrame * | +–AstromConfig | +–IlluminationCorrectionFrame * | +–PreastromConfig | +–NightSkyFlatFrame * | +–PrephotomConfig | +–QuickCheckFrame * | +–MakeSscConfig | +–RawFrame * | +–SextractorConfig | | | | +–SwarpConfig | | +–RawBiasFrame * | | | +–RawDarkFrame * +–DarkCurrent * | | +–RawDomeFlatFrame * +–Filter | | +–RawScienceFrame * +–GAstrometric * | | +–RawTwilightFlatFrame * +–DarkCurrent * | | +–Imstat | +–ReducedScienceFrame * +–Instrument | +–RegriddedBaseFrame +–Lamp | | | +–PhotTransformation | | +–CoaddedRegriddedFrame * +–ReadNoise * | | +–RegriddedFrame * +–SubWinStat * | | | +–ShutterCheckFrame * | +–WeightFrame * | +–GainLinearity * +–IlluminationCorrection * +–PhotometricReport | | | +–PhotometricSkyReport | +–PhotExtinctionCurve +–PhotometricExtinctionReport * +–PhotometricParameters * +–PhotSkyBrightness +–PixelMap | | | +–ColdPixelMap * | +–CosmicMap * | +–HotPixelMap * | +–LinearityMap * | +–SatelliteMap * | +–SaturatedPixelMap * | +–RawFitsData +–SourceList *

Some important objects in this hierarchy are:

DBObject - All objects deriving from DBObjects are persistent. Hence, all
these objects can be committed and retrieved from a database
DataObject - All DataObject objects have associated bulk data (FITS files,
catalogs) which can be stored and retrieved from a central data server
BaseFrame - All objects derived from BaseFrame describe the contents of
associated FITS images and have methods that operate on these images
PixelMap - All PixelMap objects are used to indicate bad pixels, to be
assigned a weight of zero in weight images
Catalog - All Catalog objects describe LDAC catalogs and define methods
that operate on these catalogs
Config - These objects store the contents of the configuration files of
external packages (sextractor, swarp, LDAC)

The key concept in processing data with this datamodel is the notion of ‘make’. All objects in the hierarchy that are marked with an asterisk (*) have a make() method. If the required dependencies of these objects have been filled in, then the object is made by calling make(). For example:

>>> from astro.main BiasFrame import BiasFrame
>>> from astro.main.RawFrame import RawBiasFrame
>>> bias = BiasFrame(pathname='bias.fits')
>>> bias.raw_bias_frames = [RawBiasFrame(pathname='raw_bias1.fits'),
...                         RawBiasFrame(pathname='raw_bias2.fits'),
...                         RawBiasFrame(pathname='raw_bias3.fits')]
>>> bias.make()


will make a new bias object by averaging three raw bias frames, and writing the result to a FITS file named ‘bias.fits’. We can use this object in subsequent processing, for example:

>>> from astro.main.DomeFlatFrame import DomeFlatFrame
>>> from astro.main.RawFrame import RawDomeFlatFrame
>>> dome = DomeFlatFrame(pathname='dome.fits')
>>> dome.bias = bias                       # computed before
>>> dome.raw_domeflat_frames = [RawDomeFlatFrame(pathname='raw_dome1.fits'),
...                             RawDomeFlatFrame(pathname='raw_dome2.fits'),
...                             RawDomeFlatFrame(pathname='raw_dome3.fits')]
>>> dome.make()


Note how this new object tracks its relationship with the objects it depends on. Hence, we know which bias this domeflat used:

>>> print dome.bias.pathname
bias.fits


And we also know which raw biases the bias used that this dome flat used

>>> for frame in dome.bias.raw_bias_frames
...     print frame.pathname


raw_bias1.fits raw_bias2.fits raw_bias3.fits

The dependency hierarchy for a coadded regridded frame (omitting some classes for clarity) looks like:

CoaddedRegriddedFrame | | | +–RegriddedFrame | | | +–AstrometricParameters | | | | | +–GAstrometric | | +–ReducedScienceFrame | | | +–PhotometricParameters | +–ReducedScienceFrame | | | | | +–BiasFrame | | | | | | | +–RawBiasFrame | | | | | +–MasterFlatFrame | | | | | | | +–ColdPixelMap | | | | | | | | | +–DomeFlatFrame | | | | | | | | | | | +–<BiasFrame> | | | | | +–<ColdPixelMap> | | | | | +–HotPixelMap | | | | | | | | | | | | | +–<BiasFrame> | | | | | | | | | | | +–RawDomeFlatFrame | | | | | | | +–<DomeFlatFrame> | | | +–<HotPixelMap> | | | +–NightSkyFlatFrame | | | | +–<BiasFrame> | | | | +–<ColdPixelMap> | | | | +–<HotPixelMap> | | | | +–<MasterFlatFrame> | | | | +–RawScienceFrame | | | | | | | +–TwilightFlatFrame | | | | | | | | | +–<BiasFrame> | | | | +–<ColdPixelMap> | | | | +–<HotPixelMap> | | | | +–RawTwilightFlatFrame | | | | | +–FringeFrame | | | +–<BiasFrame> | | | +–<ColdPixelMap> | | | +–<HotPixelMap> | | | +–<MasterFlatFrame> | | | +–RawScienceFrame | | | | | +–IlluminationCorrectionFrame | | +–RawScienceFrame | | | +–WeightFrame | | | | | +–<ColdPixelMap> | | +–CosmicMap | | | +–<ColdPixelMap> | | | +–<HotPixelMap> | | | +–IlluminationCorrectionFrame | | | +–<MasterFlatFrame> | | | +–<ReducedScienceFrame> | | | +–SaturatedPixelMap | | | | | | | | | +–RawFrame | | | | | +–<HotPixelMap> | | +–IlluminationCorrectionFrame | | +–<MasterFlatFrame> | | +–SatelliteMap | | | | | | | +–<ColdPixelMap> | | | +–<HotPixelMap> | | | +–IlluminationCorrectionFrame | | | +–<MasterFlatFrame> | | | +–<ReducedScienceFrame> | | | +–<SaturatedPixelMap> | | | | | +–<SaturatedPixelMap>

(Objects between <> have been expanded earlier in the tree)

This hierarchy gives a top down view of the processing that needs to be done to produce a CoaddedRegriddedFrame. To produce such an image, one must first produce PhotometricParameters (i.e. photometry), AstrometricParameters (i.e. astrometry), ReducedScienceFrames (de-biased, flat-fielded science images) and the WeightFrame associated with the ReducedScienceFrame. ReducedScienceFrames are made from RawScienceFrames, a BiasFrame, MasterFlatFrame and, depending on filter, FringeFrame. MasterFlatFrame combines DomeFlatFrame, NightSkyFlatFrame and TwilightFlatFrame. DomeFlatFrame is made from RawDomeFlatFrames etc, etc, etc.