Skip to main content

Extract photometry from arbitrarily-shaped polygons

Project description

polyphot

(c) Ralf Kotulla

Small repository holding scripts for extracting photometry within arbitrarily shaped polygons.

The main functionality is implemented in the polgon2flux.py script.

What does it do?

in its simplest invocation, it takes user-defined regions in the form of a ds9 region file, and integrates the flux within each polygon. It supports customizable local background subtraction in an annulus of specified width, matching the overall shape of the chosen source polygon, with a customizable buffer zone between source and sky areas. All this can also be done consistently across images (without the need to match the images in pixel-space; polygons should be defined by world-coordinates (Ra & Dec) that are recomputed for each frame. It also supports a mechanism to apply additional image-specific calibrations (e.g. to convert observed fluxes from counts into physical units and, with a specified distance, to luminosities). Optional check-images allow to verify proper functionality, and all results are written to a single, multi-band output file for ease of follow-up processing.

Example polygon

example polygon

In this example, the actual source region is selected by the green, hashed polygon. The sky annulus, separated by some dead space, is shown in the semi-transparent red region further out. Both width of the dead space region and the sky annulus can be freely configured, and sky estimation also includes some iterative sigma-clipping to avoid contamination due to nearby source for more robust results.

Usage and options

polyphot --region=my_regions.reg --output=my_catalog.cat file1.fits:band1 file2.fits:band2

Important command line options:

  • --region region filename for source definition

  • --output filename for output catalog

  • files list of input filenames

Additional, optional command line options

  • --dryrun dry-run

  • --debug output debug output

  • --checkimages generate check-images

  • --deadspace spacing between source aperture and sky perimeter [arcsec]

  • --skywidth size for sky perimeter [arcsec]

  • --merge filename for merged catalogs at the end

  • --nthreads N number of parallel worker threads

  • --distance distance to source in Mpc

  • --calibrate calibration factor (format: filter:factor; e.g.: ha:1.e5e-9)')

  • --gain gain (format: filter:gain; e.g.: ha:1.e5e-9; alternative: filter:!header_key)

  • --distance_to_center if provided, calculate distance between source and center (format: HMS+dms, eg 14:23:45+23:45:56)

Full example call

Below is one example listing a bunch of options, taken from a real-life run for the nearby galaxy IC342:

polyphot \
    --region=regions3.reg \
    wiyn/halpha_continuumsub.fits:ha \
    galex/galex_nearUV.fits:nuv \
    --deadspace=2 \
    --skywidth=3 \
    --distance=3.3 \
    --calibrate nuv:3.38e-28 ha:3.28e-18 \
    --gain ha:!GAIN nuv:4200   \
    --distance_to_center=03:46:48+68:05:47 \
    --output ic342_polyphot.csv

This command extracts photometry for a number of regions in both narrow-band H-alpha and GALEX near-UV data, corrects them for local background using a sky annulus slightly outside of each polygon, calculates the uncertainty of each measurement using the specified gain data, converts all raw integrated counts into physical units and even absolute luminosities, and writes the resulting multi-band catalog to file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polyphot-0.1.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polyphot-0.1.1-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file polyphot-0.1.1.tar.gz.

File metadata

  • Download URL: polyphot-0.1.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for polyphot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 940d2541fc2a530a8e18706ac2fa47573c40b6ecd0af225959b7d0e74cce727f
MD5 7371b2ab80dcf5fbcf7cf586b3f0675f
BLAKE2b-256 d263a4b4efda8c1a4aeff06ac567a28eb8f212de730d0333c218611653506f24

See more details on using hashes here.

File details

Details for the file polyphot-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: polyphot-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for polyphot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cbd0686805498271e68029269c4606ee59b92cf926186342c7764604a64b1c0f
MD5 bb8b07f13ee2fd4e06f37ab83ef4e101
BLAKE2b-256 29460390ac5ae9f8c4df6446beae41a30dd54fea8d695048b4ca884dca2d725b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page