Skip to main content

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.

Metadata

Release files for polyphot 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polyphot 0.1.1
File Size Uploaded Provenance Actions
polyphot-0.1.1.tar.gz 18.2 kB Without provenance Details for polyphot-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for polyphot 0.1.1
File Interpreter ABI Platform Actions
polyphot-0.1.1-py3-none-any.whl Python 3 none any Details for polyphot-0.1.1-py3-none-any.whl

Total release size: 38.1 kB

Release files / polyphot-0.1.1.tar.gz

Download URL polyphot-0.1.1.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
940d2541fc2a530a8e18706ac2fa47573c40b6ecd0af225959b7d0e74cce727f
BLAKE2b-256 checksum
How to use checksums
d263a4b4efda8c1a4aeff06ac567a28eb8f212de730d0333c218611653506f24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / polyphot-0.1.1-py3-none-any.whl

Download URL polyphot-0.1.1-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbd0686805498271e68029269c4606ee59b92cf926186342c7764604a64b1c0f
BLAKE2b-256 checksum
How to use checksums
29460390ac5ae9f8c4df6446beae41a30dd54fea8d695048b4ca884dca2d725b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4

Security for polyphot 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page