View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

How does onedspec interpolate a spec to other dispersion?

Eduardo Fernandez del Peloso wrote on Jul 06, 2010

Hi everyone.

I am trying to develop a routine to combine spectra, like IRAF's scombine, but coded in C. First I need to understand how ondespec interpolates a spectrum to the dispersion of another one. I have found a previous post where Frank Valdes explains this (http://iraf.net/phpBB2/viewtopic.php?t=61782), but I have failed to understand it... :(

I would appreciate the help of anyony here, including, of course, Dr. Valdes.. :wink:

There are a number of things I did not understand in the explanation:

- The interpolation function is fit to the whole spectrum? I do not believe so. I believe that what happens is the following:
If the interp parameter is set to poly5, a 5th order polynomial is set to groups of 6 points, and we vary these 6 points. So points 1 through 6 would be fit, then points 2 thorugh 7, then 3 through 8, etc.
This way we can be sure that the function can "go through each pixel center so it is exact at the integer coordinates but is an estimate between pixels"

- The explanation says that "Then for each output wavelength pixel (actually the two edges of the output pixel) the dispersion function is inverted to find the pixel coordinates in the input spectrum."

What is the "ouput"? Is it the second spectrum (the one being interpolated), or is it the result of the SARITH or SCOMBINE taskl?

What is meant by "two edges of the output pixel"?

- What is the "input"?

- What are the "computed fractional limits"?

Well, it can be seen that I am pretty lost here. Simply answering the above questions probably would not help me much.
It would be very kind if someone could explain the process in more detail, perhaps with some aids, like a graph or a fluxogram.

Thanks.

Mike Fitzpatrick wrote on Jul 06, 2010

Frank is away this week but may respond when he returns. It might help to have a look at the 1-D image interpolator specification doc at $iraf/math/iminterp/doc/im1dinterp.spc This should give you a better idea of how the fit is evaluated.

As for your questions: 'input' refers to the input image being interpolated, 'output' refers to the output interpolated image. By 'two edges'...Consider a dispersion that is 100 Angstroms per pixel and you are interpolating a value that is someplace within that pixel (e.g. the left edge of the pixel is 5000A, the right edge is 5100A, you want the value at 5062A). The 'fractional values' are then how much of that 100A-wide pixel contribute to a specific value.

Hope this helps.

Eduardo Fernandez del Peloso wrote on Jul 06, 2010

Thank you, Fitz!

I have managed to correctly implement the interpolation in C. I have compared my results with those from running the noao.onedspec.scombine IRAF task, and they are almost identical. I believe the tiny differences can be caused by rounding.

Now my next steps are to implement weighted averages and sigclip...

Cheers,
Eduardo.

Last post on Jul 06, 2010