gemini_logo

Requirements for a General Python Mosaicing

Mark Simpson, Nelson Zarate and Kathleen Labrie.

Data Processing Software Group

 

V1.0 – May 22 2012

 

Revision History

V1.0 – May 7 2012   Nelson Zarate

 

 

Document Purpose

To present Use Cases and requirements for a generic mosaicing task in Python.

 

Intended Audience

The intended audience are the project managers and developers working on the Pipeline Project.

 

 

 

Glossary

mosaic              The output mosaiced data. The data may or may not have been transformed. This output mosaic is a numpy ndarray.

block                 A pre-determined subsection of the mosaic. This is a numpy ndarray that can be composed of more than one smaller ndarrays, i.e., a block of blocks.

tiling                  The act of mosaicing one or more blocks without transforming.

transforming    The act of interpolating blocks from one coordinate system to another to create the mosaic, if required.

 

Astronomical instrumentation terms:

 

detector            One or more arrays. It is equivalent to the mosaic. For example, the GMOS detector comprises of 3 arrays, and the GSAOI detector comprises of 4 arrays.

array                  One or more amplifiers. An array describes a CCD, e.g., 1 of the 3 optical CCDs that form the GMOS detector, or an infrared array, e.g., 1 of the 4 infrared arrays that form the GSAOI detector.

amplifier           A designated area of an array read out by a specific electronic amplifier. For example, when using GMOS in 6-amp mode, each array composes of 2 amplifiers. Within a FITS file an amplifier would be contained within its own pixel data (IMAGE) extension.

 

Use Cases

Generic tiling of blocks

 

á  Any number of blocks can be tiled without transforming. The IRAF tasks imtile, imjoin and iminsert perform similar functions. For example, the 2 amplifiers that form an array in data taken using GMOS in 6-amp mode can be tiled to create a block, which in this example is equivalent to a GMOS array.

 

Create a mosaic from any number of IMAGE extensions in an MEF file.

 

á  Any number of IMAGE extensions (blocks) can be mosaiced with or without transforming. The GEMINI IRAF tasks gmosaic and gamosaic perform similar functions. For example, in data taken using GMOS in 6-amp mode, the 6 IMAGE extensions (amplifiers) can be mosaiced to form a mosaic, which in this example is equivalent to the GMOS detector.  Specific uses are:

o   displaying temporary images with or without transforming

o   preparation for stacking

o   preparation for cutting into spectroscopic MOS slits data

o   calculating statistics. For example:

¤  scaling

¤  normalization

¤  cleaning of bad pixels with median sky

 

 

Requirements

Broad requirements:

 

The implementation of the mosaic code should be constructed in layers, e.g., multiple classes and functions within modules, such that code can be exported and specific requirements can be interchanged or overridden, if required. The mosaic code should work in the RS, yet there should be a portable section of code that only works on ndarrays and other Python types, i.e., is not dependant on AD or understands the concept of FITS files.

 

Specific requirements:

 

1.    A standardized naming convention

á      Clearly document all terms used, their meaning and where they applied.

á      Refer to these terms when naming attributes and methods.

2.    The  mosaicing class shall instantiate an object from a supported AstroData object.

         DONE: AT-mosaic-1

3.    Mosaic, with or without transforming, all IMAGE extensions that are contained within the ad.

á      IMAGE extensions with the same EXTNAME will be assumed to be part of the same mosaic. This includes the case where EXTNAME is "".

      DONE: AT-mosaicAD-3

4.    The mosaic should be returned to the user in one of two formats:

á      its native ndarray, or

      DONE: AT-mosaicAD-2

á      an ad containing the mosaiced pixel data and associated header information with the same EXTNAME as the constituent IMAGE extensionsÕ EXTNAME. [There are other factors to consider when returning the mosaic in this format, such as BINTABLEs – see point 7]

     DONE: AT-mosaicAD-3

5.    If requested, only IMAGE extensions with a specific EXTNAME can be mosaiced and returned to the user, e.g., create a mosaic of only the ÒDQÓ pixel data extensions.

         DONE: AT-mosaicAD-2

6.    If requested, a specific block can be mosaiced and returned to the user, e.g., create a mosaic of 1 (i.e., 2 amplifiers) of the 3 arrays in GMOS 6-amp data. 

 DONE: AT-mosaicAD-7

7.    Unless specifically requested not to, when returning a mosaic as an ad, all associated BINTABLEs should be merged accordingly.

á      A user should be able to specify which BINTABLEs to return

             DONE: AT-mosaicAD-3

á      A user should be able to specify that only BINTABLEs be returned, i.e., no pixel data

á      as a BINTABLE

   DONE: Not done. Bintables can only be returned in

                 AstroData objects.

á      as an ad

     DONE: AT-mosaicAD-3. Yes, but only one BINTABLE                                    at a time.

á      Any duplicate rows in the merged table (e.g., the same source) must be removed

 DONE: AT-mosaicAD-3

á      The X and Y pixel coordinates of sources must be updated in an appropriate manner

á      The output X and Y pixel coordinates will be determined using the output WCS

     DONE: AT-mosaicAD-3

á      In the case of GSAOI, where the adaptive optics will introduce distortions that will make method i. inappropriate, use the transformation matrices to determine the output X and Y pixel coordinates

     DONE: Not yet implemented

á      The original X and Y pixel coordinates should be stored in separate column names.

      DONE: Not yet implemented.

á      If merging the tables in the RS scientific context, a warning should be given both to the log and in the output BINTABLE that the source positions may no longer be accurate

      DONE: Not yet implemented

8.    Update the output WCS if returned as an ad.

                         DONE: AT-mosaicAD-6

á      This could include updating a ÔtransformÕ object. A 'transform' object is an already instantiated mosaicing class object which can be reused to avoid initialization overhead.

             DONE: Not yet implemented

9.    Allow the choice of an interpolator (and interpolation method)

                              DONE: AT-mosaicAD-8

á      Flux should be conserved during and after transforming

             DONE: AT-mosaicAD-10

á      Areas of the mosaic that contain no data should be replaced with an appropriate value. For example:

       DONE: AT-mosaicAD-2. Only 0 for data and 1 for no-    data

á      the median sky value can be used as the replacement value for GMOS imaging data

   DONE: Not yet implemented

á      a special bit value can be used in the DQ

   DONE: Not yet implemented

á      or simply use NaN

      DONE: Not yet implemented

 

á       Store the areas of the mosaic that contain no data in a separate ndarray

         DONE: Not yet implemented