stdpipe.photometry_iraf module¶
Aperture photometry using PyRAF DAOPHOT routines.
This module provides photometry functionality compatible with stdpipe.photometry but using IRAF/DAOPHOT tasks for aperture photometry measurements.
- stdpipe.photometry_iraf.measure_objects(obj, image, aper=3, bkgann=None, fwhm=None, mask=None, bg=None, err=None, gain=None, bg_size=64, sn=None, centroid_iter=0, keep_negative=True, get_bg=False, _workdir=None, _tmpdir=None, verbose=False)[source]¶
Aperture photometry at the positions of already detected objects using PyRAF DAOPHOT.
This function provides similar behavior to
stdpipe.photometry.measure_objects()but uses IRAF DAOPHOT tasks for photometry measurements.It will estimate and subtract the background unless external background estimation (
bg) is provided, and use user-provided noise map (err) if requested.If the
maskis provided, it will set 0x200 bit in objectflagsif at least one of aperture pixels is masked.The results may optionally be filtered to drop the detections with low signal to noise ratio if
snparameter is set and positive. It will also filter out the events with negative flux.Note: Requires PyRAF and IRAF to be installed and properly configured.
- Parameters:
- objastropy.table.Table
Initial object detections to be measured. Must have ‘x’ and ‘y’ columns.
- imagenumpy.ndarray
Input image as a 2D NumPy array.
- aperfloat
Circular aperture radius in pixels for flux measurement.
- bkganntuple of float or None
Background annulus as (inner_radius, outer_radius) for local background estimation. If not set, global background model is used instead.
- fwhmfloat or None
If provided,
aperandbkgannare measured in units of FWHM.- masknumpy.ndarray or None
Boolean image mask (True values will be masked).
- bgnumpy.ndarray or None
Background image to subtract instead of automatically computed one.
- errnumpy.ndarray or None
Image noise map to use instead of automatically computed one.
- gainfloat or None
Image gain in e/ADU, used for photometry error estimation.
- bg_sizeint
Background grid size in pixels for global background estimation.
- snfloat or None
Minimal S/N ratio. If set, measurements with magnitude errors exceeding 1/sn will be discarded.
- centroid_iterint
Number of centroiding iterations before photometry (not implemented for IRAF backend).
- keep_negativebool
If False, measurements with negative fluxes will be discarded.
- get_bgbool
If True, also return estimated background and background noise images.
- _workdirstr or None
Directory for temporary files. If None, a temporary directory is created.
- _tmpdirstr or None
Parent directory for temporary directory creation if _workdir is None.
- verbosebool or callable
Whether to show verbose messages. May be boolean or a print-like function.
- Returns:
- astropy.table.Table
Copy of original table with
flux,fluxerr,magandmagerrcolumns replaced with measured values. Ifget_bg=True, returns a tuple of (table, background, background_error).
- Raises:
- ImportError
If PyRAF is not available.
- RuntimeError
If DAOPHOT task fails.
- stdpipe.photometry_iraf.measure_objects_psf(obj, image, fwhm=None, psf_stars=None, n_psf_stars=20, mask=None, bg=None, err=None, gain=None, bg_size=64, sn=None, psfrad=None, fitrad=None, psf_function='auto', psf_varorder=0, keep_negative=True, get_bg=False, _workdir=None, _tmpdir=None, verbose=False)[source]¶
PSF photometry using IRAF DAOPHOT (psf + allstar tasks).
This function performs PSF photometry using the full DAOPHOT workflow: 1. Select PSF stars (or use provided psf_stars) 2. Build PSF model using DAOPHOT psf task 3. Fit all sources using DAOPHOT allstar task 4. Return results in stdpipe format with quality metrics
The PSF model is built automatically from bright, isolated stars in the image. If psf_stars is provided, those specific stars will be used instead of automatic selection.
Note: Requires PyRAF and IRAF to be installed and properly configured.
- Parameters:
- objastropy.table.Table
Initial object detections. Must have ‘x’ and ‘y’ columns. Should also have ‘flux’ or ‘mag’ for PSF star selection.
- imagenumpy.ndarray
Input image as a 2D NumPy array.
- fwhmfloat
FWHM in pixels (required for PSF building and fitting).
- psf_starsarray-like or None
Indices of objects to use as PSF stars. If None, stars are selected automatically.
- n_psf_starsint
Number of PSF stars to select automatically.
- masknumpy.ndarray or None
Boolean image mask (True values will be masked).
- bgnumpy.ndarray or None
Background image to subtract instead of automatically computed one.
- errnumpy.ndarray or None
Image noise map.
- gainfloat or None
Image gain in e/ADU.
- bg_sizeint
Background grid size in pixels.
- snfloat or None
Minimal S/N ratio for output filtering.
- psfradfloat or None
PSF radius in pixels (default: 3*fwhm). Sets how far the PSF extends.
- fitradfloat or None
Fitting radius in pixels (default: fwhm). Sets how many pixels to use for fitting each star.
- psf_functionstr
PSF function type: ‘auto’, ‘gauss’, ‘moffat15’, ‘moffat25’, ‘lorentz’, ‘penny1’, or ‘penny2’.
- psf_varorderint
PSF variability order: 0=constant, 1=linear, 2=quadratic.
- keep_negativebool
If False, discard measurements with negative fluxes.
- get_bgbool
If True, also return background and error images.
- _workdirstr or None
Working directory for temporary files.
- _tmpdirstr or None
Parent directory for temporary directory creation.
- verbosebool or callable
Verbose output.
- Returns:
- astropy.table.Table
Table with PSF photometry results including flux, mag, x_psf, y_psf, qfit_psf, cfit_psf, flags_psf columns. If
get_bg=True, returns a tuple of (table, background, background_error).
- Raises:
- ImportError
If PyRAF is not available.
- ValueError
If required parameters are missing.
- RuntimeError
If DAOPHOT tasks fail.