astropy / photutils

Astropy package for source detection and photometry. Maintainer: @larrybradley
https://photutils.readthedocs.io
BSD 3-Clause "New" or "Revised" License
235 stars 132 forks source link

Offset between IRAF and DAOPhotPSFPhotometry #632

Closed Gabriel-p closed 1 week ago

Gabriel-p commented 6 years ago

(I'm sorry for flooding the issues with questions. Please let me know if I should give it a rest)

I'm testing the DAOPhotPSFPhotometry class against IRAF's usual tasks for CCD PSF photometry.

Given an observed frame I first run the IRAF tasks:

  1. detect sources (daofind)
  2. aperture photometry on the sources (phot) to use as initial estimates of the fluxes
  3. creation of the PSF model (nstar , substar , psf)
  4. PSF-fitting (allstar)

I then use the same list of sources (the ones found by daofind) to perform PSF fitting with DAOPhotPSFPhotometry using as psf_model an IntegratedGaussianPRF. I obtain magnitudes using the same zero point and exposure time as done with IRAF. I run this process twice: first fixing the coordinates of the sources in the psf_model, and then fitting them.

What I find is an offset between the differences of the final magnitudes obtained with IRAF and DAOPhotPSFPhotometry in both cases: a ~0.07 overestimation by photutils when using the fixed sources, and a ~0.02 underestimation when the sources are also fitted (the sources are sorted and matched before obtaining the differences).

figure_1

The scatter between the IRAF and photutils magnitudes is understandable, but I don't know what parameter(s) is(are) responsible for causing these offsets.

eteq commented 6 years ago

@Gabriel-p - this is a useful comparison. Do you have the exact syntax required to reproduce this in IRAF, or better yet, pyraf? It might be we want to include this in the docs somewhere. I'm actually interested that it's as close as it is, given how many parameters could be different! With the syntax for the iraf side at least it'll be easier to do a parameter study of what might or might not be behind the differences.

I'm not sure I'd expect it to be that close using the IRAF version of DAOPHOT, as the photutils implementation isn't really a drop-in replacement for that version (rather, at least conceptually, the stand-alone DAOPHOT is closer with allstar). Even then it's not clear it's literally the same because the fitting algorithm might not be the same.

@mirca might have some thoughts, though?

eteq commented 6 years ago

Oh and re:

I'm sorry for flooding the issues with questions. Please let me know if I should give it a rest

Some of these are quite reasonable feature requests or possible issues (e.g. #620, #626). But in generally when you have a question (rather than a specific problem like "this doesn't work" or "this should be added") you'll have better luck trying an environment like the facebook group, the astropy mailing list, or the astropy slack channel (e.g. http://www.astropy.org/help.html).

Admittedly, some are ambiguous - like this particular one might be a code issue, so it's reasonable to ask here, and it might end up getting closed if it turns out there's not a code issue to be addressed.

Gabriel-p commented 6 years ago

Thank you @eteq, I'll try to keep the posts here to actual issues or feature requests from now on.

I'd be happy to repeat the full IRAF (I use Pyraf actually) vs photutils analysis but I'd need some test fits file to work on. That way we can all reproduce the results (also, the fits file I'm working on is part of a not-yet published set and I can't share it for now) Is there some publicly available (preferably crowded) fits frame I could use?

To clarify: I'm fine with the scatter, it's understandable. What I think should be investigated further is the offset. This points to a systematic difference between both analysis that should not (?) occur.

mirca commented 6 years ago

@Gabriel-p might be something to do with the way that IRAF estimates the background level perhaps?

Gabriel-p commented 6 years ago

@mirca I have zero time right now but as soon as I can I'll re-do the test paying attention to this kind of details. Sorry I can't help more at the time.

larrybradley commented 1 week ago

This class no longer exists. Please see the new and improved PSF photometry tools. https://photutils.readthedocs.io/en/latest/psf.html