View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Replace by fit

mv1612 wrote on Jul 13, 2007

Hi,
I'm fitting single line profiles by gaussians (k keystroke in SPLOT). Now, for a certain reason, after the fitting I need to replace the profile by the fit, not to subtract the fit. I can't find any way to do it. Maybe it's simple... just don't find anything about replacing by the fit, only about subtracting the fit...
Thanks.

Mike Fitzpatrick wrote on Jul 13, 2007

Frank is of course the authority, but a quick idea worth trying (I think anyway) is to use FITPROFS to do the profile fitting and save the fit to an output file. Then you can use e.g. IMEXPR to write a new image using either the non-zero pixels indicating the fitted regions or the pixels from the original spectrum, e.g.

cl> imexpr "(a ? a : b)" newspec.fits a=fitted.fits b=original.fits


The reference image should probably be set to the original spectrum to preserve the WCS. There may also be something clever you could do with SARITH as well.

-Mike

mv1612 wrote on Jul 13, 2007

Thank you, I will try.
Virgil.

mv1612 wrote on Jul 13, 2007

Hi,

Thanks for mentioning FITPROFS, I solved my problem taking the fitting parameters from splot, constructing the gaussian with fitprofs and then doing the spectra manipulation in sarith. Much appreciated.

Now I would have another question. I'm working with WR stars which give emission lines instead of the usual absorbtion lines. I have very often two emission lines that are close and partially blended, or I could have an absorbtion line over an emission line, if my WR star is in a binary. Could I make a fit in IRAF using two gaussians simultaneously? That would ease my work considerably...

Thanks, Virgil.

Mike Fitzpatrick wrote on Jul 13, 2007

See the 'd' command for deblending multiple gaussians. I *think* it will work on emission lines, I'm not sure about deblending a absorption and emission at the same time though.

-Mike

Last post on Jul 13, 2007