bkloppenborg / liboi

OpenCL Interferometry Library

Home Page:https://github.com/bkloppenborg/liboi/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add WCS information to exported FITS images

bkloppenborg opened this issue · comments

Adding WCS code to the saved FITS images seems fairly easy. Fabien indicates it would be something like this:

    // Write keywords to get WCS to work //
  fits_write_key_dbl(fptr, "CDELT1", -scale, 3, "Milli-arcsecs per pixel", status);
  fits_write_key_dbl(fptr, "CDELT2", scale, 3, "Milli-arcsecs per pixel", status);
  fits_write_key_dbl(fptr, "CRVAL1", 0.0, 3, "X-coordinate of ref pixel", status);
  fits_write_key_dbl(fptr, "CRVAL2", 0.0, 3, "Y-coordinate of ref pixel", status);
  fits_write_key_lng(fptr, "CRPIX1", naxes[0]/2, "Ref pixel in X", status);
  fits_write_key_lng(fptr, "CRPIX2", naxes[1]/2, "Ref pixel in Y", status);
  fits_write_key_str(fptr, "CTYPE1", "RA",  "Name of X-coordinate", status);
  fits_write_key_str(fptr, "CTYPE2", "DEC", "Name of Y-coordinate", status);
  fits_write_key_str(fptr, "CUNIT1", "mas", "Unit of X-coordinate", status);
  fits_write_key_str(fptr, "CUNIT2", "mas", "Unit of Y-coordinate", status);

What is not clear is whether or not the scale needs to be in mas/pixel or rad/pixel.