pswarp

(Up to the IPP Description Page)

pswarp invocation (single input exposure set):

pswarp -file input.fits output skycell                    : input.fits must define the astrometry of the input pixels, skycell defines target astrometry.
pswarp -file input.fits -astrom astrom.cmf output skycell : astrom.cmf defines astrometry for input.fits

pswarp invocation (multiple inputs):

pswarp -input file.mcd output skycell                     : input files are defined in the file.mdc 

Example of input.mdc:

INPUT MULTI

INPUT METADATA
  INPUT     STR   RINGS.V3.skycell.1314.011.stk.1033022.fits   # signal image filename
  MASK      STR   RINGS.V3.skycell.1314.011.stk.1033022.mask.fits   # signal image filename
  VARIANCE  STR   RINGS.V3.skycell.1314.011.stk.1033022.wt.fits   # signal image filename
END

INPUT METADATA
  INPUT     STR   RINGS.V3.skycell.1314.012.stk.1033023.fits   # signal image filename
  MASK      STR   RINGS.V3.skycell.1314.012.stk.1033023.mask.fits   # signal image filename
  VARIANCE  STR   RINGS.V3.skycell.1314.012.stk.1033023.wt.fits   # signal image filename
END

pswarp outline

  • generic initializations
  • pswarpArguments : parse the command line arguments
  • pswarpParseCamera : examine the input files and skycell, construct containers for the outputs (do not yet generate pixels)
  • pswarpOptions : set various options which may depend on the camera and command line arguments
  • pswarpDefineLayout : load astrometry information (headers only), determine the overlaps between the inputs and the outputs, generate the output pixels
  • pswarpLoop : loop over inputs & outputs, warp the inputs into the outputs, transform the input sources (if any), measure the new PSF model, convert input metadata to output metadata values
  • pswarpLoopBackground : equivalent to pswarpLoop, transform the background models
  • pswarpCleanup : write the outputs to disk, free memory

NOTE: as of 2013.05.09 there has been a substantial re-work of pswarp to enable 'inverse warping', that is to say warping from skycells to the original focal plane. This modification drove a few specific changes:

  • the output format may now represent a full FPA output file (with chips and cells, etc).
  • there may now be multiple input 'exposures' (more accurately: file sets) so that a group of skycells can be warped to a single output image
  • the astrometric relationships / overlaps are calculated up front (in pswarpDefineLayout) before any pixels are loaded. This is necessary to avoid generating the output pixels in (for example) a full GPC1 FPA if only a few of the output pixels are needed.
  • the input files may now be specified in a metadata config file as illustrated above (similar to the inputs to ppStack & psphotStack).

There are effectively 3 modes of operation : chip-to-warp (the traditional mode), chip-to-chip, and warp-to-chip.


Message from EAM regarding pswarp modifications:

i'm about to check a set of changes into the trunk related to pswarp. the changes are driven by the goal of warping stack skycells back onto the exposures. to do this, I needed to make some significant changes to the pswarp structure. I hopefully have cleaned up the code organization somewhat to make it easier to read in the process.

Two major changes relate to the input and output data sources.

First, the output target may now be any of our camera formats : in theory, it should be able to warp to any chip-level multi-extension or even multi-file output. the output astrometry is defined by a cmf/smf style file, or any other image with WCS elements. If the config system does not recognize the format of the output header, it will define it to be a skycell for the input camera.

Second, multiple input images may now be specified. It has always been possible to warp from multiple inputs of the same exposure, but now I've added the option to warp from multiple 'exposures'. This is necessary because all skycells are defined to be equivalent to an 'exposure', and in order to populate more than a small fraction of an input exposure, it is necessary to supply at least a few skycells. The multiple input exposures are specified by using an input mdc file (like ppStack or psphotStack) and identifying it to pswarp with "-input foo.mdc". The -file / -list options are still valid, but mutually exclusive with -input.

Note that in multiple exposure mode, the background model and sources are not currently transformed as there was too much ambiguity for me to deal with at this time. Also, the covariances and averaged metadata may more be calculated correctly (though the output WCS astrometry *is* calculated and populated correctly).

Also note that in mutliple exposure mode, there is no attempt to rationally combine information from different exposures into the same pixels. that starts to look like ppStack, and is beyond the scope of this work. Instead, I used the simple rule that the first non-NAN value generated for an output pixel is kept.

To make these changes, and to be efficient, I changed the way the code determines the transformations. It now first loads the astrometric header information of both source and target, determines which of the output chips will be overlapped by any of the input chips, then generates only those output pixels. Only as it does the warping process does it read in the input pixels and input sources. After all inputs have been warped, it then generates the output PSF model.

I've put together a set of tests and minimal test scripts at ~ipp/ippc18/warptest.20130407.