0

I've been using IRAF Starfinder from the photutils package to identify sources from a fits image, or rather from the 2D array extracted from a fits image. The identificaiton of the sources seems to be working pretty well, and I get an astropy table with all the usual parameters. However, I'm looking to simply get the total counts of the sources (total count meaning the sum of the values of the pixels within the radius of the source). I realise the radius also isn't defined here, but some factor of the FWHM should suffice here. The flux parameter seems to be the closest thing to what I want, but in the documentation it describes this as the object flux calculated as the peak density in the convolved image divided by the detection threshold, which isn't what I'm after. Is there an easy way to do this? I'm very new to these packages and this form of analysis in general, so apologies if this is an obvious/silly question. Thank you for your time!

Cal
  • 1

1 Answers1

0

You're asking for aperture photometry. Check out the examples on this page:

https://photutils.readthedocs.io/en/stable/detection.html

They start with the catalog, like the one you have in hand (source positions), and create a set of circular apertures with radius r=4:

>>> apertures = CircularAperture(positions, r=4.)

Once created, you can use the apertures to extract sums, etc. as per https://photutils.readthedocs.io/en/stable/aperture.html#performing-aperture-photometry:

>>> phot_table = aperture_photometry(data, aperture)
keflavich
  • 18,278
  • 20
  • 86
  • 118
  • Thank you so much for your response! I've since employed something pretty much identical to this. The reason I was hoping for some in-built photometric functionality was as the catalogue includes some measure of the dimension of the sources (FWHM here), and 'apertures' doesn't allow for different radii for different sources. I'm concerned that using this technique will give me innacurate estimates by assigning one radii to all sources. I'm aware I could have a few radii for all sources using other packages, but not a specific radius for each source. – Cal Dec 14 '20 at 11:03
  • OK, for varying aperture size, see the discussion here: https://github.com/astropy/photutils/issues/748. The conclusion is, in brief, use regions (https://github.com/astropy/regions/) instead of photutils, if I understand correctly. – keflavich Dec 14 '20 at 15:12
  • Hi again, thanks for the response. The discussion seems to say there isn't a way to do it in photutils, as you say, and to use do_photometry, which also doesn't seem to support this functionality. Regarding regions, it says in the documentation 'A Region object can only represent one region, not an array (a.k.a. vector or list) of regions', which seems to be the same problem all over again. I think I may just use the one aperture at this stage, as using an array seems to be more hassle than it's worth. Thanks again for all your help though – Cal Dec 15 '20 at 11:49
  • I ended up doing it sort of manually: `sums = [] for x in range(len(radiiarray)): apertures = CircularAperture(positionsarray[x], r=float(radiiarray[x])) photTable = aperture_photometry(croppedarray, apertures) sums.append(photTable['aperture_sum'])` – Cal Dec 15 '20 at 12:56