[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[task #15128] TPV and SIP keywords when WCS distortions are necessary

From: Mohammad Akhlaghi
Subject: [task #15128] TPV and SIP keywords when WCS distortions are necessary
Date: Fri, 15 May 2020 19:32:01 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0

Follow-up Comment #5, task #15128 (project gnuastro):

This is great progress Sachin, nice work!

You can see my recommendation on the structure of the 'main' function below.
In short, you should move all your internal steps/functions into a high-level
'gal_wcs_tpv_to_sip' (which only takes the WCS structure and modifies it
internally). After control comes back into 'main', you just read the image
data, add the WCS sructure to it and write it.

In short, you need to look closer into the wcsprm structure and see what parts
to change, so later when WCSLIB is writing the WCS-related keywords into the
FITS image, it writes the newly added SIP structure and there is no more TPV

About the 'rval' issue, what is the most reasonable situation? I don't have
time to look into the details of that implementation, but given all the things
you have read and also their own coding, you should be able to identify the
expected behavior ;-). Ultimately, you can just finish the implementation and
see the effect of changing it in practice ;-).

gal_wcs_tpv_to_sip(struct wcsprm *wcs)
  # This is where you can start the work:
  # Independent of the input/output filenames and HDUs and etc.
  # This task is only inside the input WCS structure ;-).

  /* The only input should be the filename and HDU. */
  char *outfile="test-sip.fits";
  char *infile="test-pv.fits", *inhdu="1";

  /* The outputs. */
  int nwcs;
  gal_data_t *out=NULL;
  struct wcsprm *wcs=NULL;

  /* Read the WCS from the input. */
  wcs=gal_wcs_read(infile, inhdu, 0, 0, &nwcs);

  /* Define this function above to contain all your work, only taking
     the WCS structure as input. */

  /* Read the data of the input file. */
  out=gal_fits_img_read(infile, inhdu, -1, 1);

  /* Put the modified WCS into the 'out' dataset, then write the
     output dataset. */
  gal_fits_img_write(out, outfile, NULL, NULL);

  /* Clean up and return. */
  return EXIT_SUCCESS;


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]