Skip to content
Erin Sheldon edited this page Jan 5, 2016 · 20 revisions

A MEDS file is a FITS file with certain extensions for images data.

The recognized extensions are

  • object_data: A binary table with one row for each coadd object.
  • image_info: A binary table holding information for each image used to create the MEDS file.
  • metadata: Optional binary table holding any metadata the user wants.
  • image_cutouts: An image extension holding the image cutouts.
  • weight_cutouts: Optional image extension holding the weight image cutouts.
  • seg_cutouts: Optional image extension holding the segmentation cutouts.
  • bmask_cutouts: Optional image extension holding the bitmask plane cutouts.

Required extensions are bin bold. More information for each extension is given below

object_data

A binary table with one row for each coadd object. This table aligns exactly row-for-row with the input catalog file. The minimum required entries are

column             type     description
----------------------------------------------------------------------
id                 i8       The id column from the input file
ncutout            i8       number of cutouts for this object
box_size           i8       box size for each cutout
file_id            i8[NMAX] zero-offset id into the file names in the 
                            image_info extension
start_row          i8[NMAX] zero-offset, start of cutout in the 
                            image extensions.
orig_row           f8[NMAX] zero-offset position in original image
orig_col           f8[NMAX] zero-offset position in original image
orig_start_row     i8[NMAX] zero-offset start corner in original image
orig_start_col     i8[NMAX] zero-offset start corner in original image
cutout_row         f8[NMAX] zero-offset position in cutout imag
cutout_col         f8[NMAX] zero-offset position in cutout image
dudrow             f8[NMAX] jacobian of transformation 
dudcol             f8[NMAX] row,col->ra,dec tangent plane (u,v)
dvdrow             f8[NMAX] Note Source Extractor uses y for row
dvdcol             f8[NMAX]

where NMAX greater than or equal to the maximum number of cutouts for any object in the file. The types i8 is an 8-byte integer, and f8 is an 8-byte float. Any other data the users wants can also be included in this extension.

To create this object_data structure when writing MEDS files, use the meds.util.get_meds_output_struct function.

image_info

A binary table holding information for the images used as well as the background and other supplied files. Contains the zeropoints and applied scale factors, and potentially wcs information. The entries returned by meds.util.get_image_info_struct are given below, but note the only required entries are image_path, image_ext, image_id, image_flags,magzp,scale

column           type description
----------------------------------------------------------------------
image_path        SXX path to the image
image_ext          i2 extension for image in file
weight_path       SXX path to the weight image, can be empty
weight_ext         i2 extension for the weight image file
seg_path          SXX path to the segmentation image, can be empty
seg_ext            i2 extension for the seg image file
bmask_path        SXX path to the bitmask image, can be empty
bmask_ext          i2 extension for the seg image file
bkg_path          SXX path to the background image, can be empty
bkg_ext            i2 extension for the background image file
image_id           i8 and id for the image
image_flags        i8 flags for the image
scale              f4 scale to applied to the image and weight maps
position_offset    f8 offset from zero-based image coords and the wcs coords

An optional JSON string representing the WCS information can be supplied.

wcs               SXX JSON string representing the WCS

This string would, for example, be a dictionary representation of a FITS header holding scamp keywords.

Above SXX represents a string of length XX. The i2 and i8 are 2 and 8 integers, and f4 and f8 are 4 and 8 byte floats

Any other data the users wants can also be included in this extension.

To create an image_info structure when writing MEDS files, use the meds.util.get_image_info_struct function.

metadata

Optional binary table holding any metadata the user wants. Typically this is such information as the magnitude zeropoint reference, version of various codes used, etc. The MEDSMaker provided in this repository records the versions of numpy, fitsio and esutil used, at a minimum.

image_cutouts

An image extension holding the image cutouts. The images are background subtracted if a background image is supplied during creation of the file. The images are optionally scaled depending on the input image_info structure.

weight_cutouts

An image extension holding the weight image cutouts. This is typically the inverse variance map.

bmask_cutouts

Optional image extension holding a bitmask describing each pixel.

seg_cutouts

Optional image extension. For sextractor based catalogs this is the segmentation map, but can represent any such binary division of the pixels between objects.