PHOTfun: Crowded-Field Photometry Tool
- PHOTfun is a Python-based astronomical software package for crowded-field PSF photometry and IFU spectral extraction, enabling deblended stellar spectra reconstruction.
- It integrates DAOPHOT-II/ALLSTAR routines via a user-friendly GUI, automating source detection, PSF modeling, and master catalog generation on MUSE data.
- Its local sky subtraction approach significantly improves spectral quality in crowded Galactic bulge fields, facilitating accurate radial-velocity measurements.
PHOTfun is a Python-based, GUI-driven astronomical software package for crowded-field point-spread-function photometry and spectral extraction from integral-field-unit datacubes. In the literature, its clearest and most fully documented realization is in MUSE-based studies of the Milky Way bulge, where it serves as a front-end to DAOPHOT-II/ALLSTAR and, through its PHOTcube extension, reconstructs deblended one-dimensional stellar spectra from MUSE datacubes prior to radial-velocity analysis (Quezada et al., 8 Sep 2025). Its practical niche is the regime in which severe crowding and extinction make simple aperture extraction inadequate, especially in fields close to the Galactic plane.
1. Definition and scientific role
PHOTfun sits between reduced imaging or IFU products and downstream kinematic inference. In the bulge-mapping workflow described in "New kinematic map of the Milky Way bulge" (Quezada et al., 8 Sep 2025), raw MUSE exposures are first reduced into datacubes and broad-band field-of-view images; PHOTfun then performs source detection, PSF modelling, PSF photometry, master-catalog generation, and color-magnitude-diagram construction on the FoV images, while PHOTcube applies the same PSF formalism slice-by-slice to the datacube in order to reconstruct stellar spectra. Radial velocities are then derived separately from the Ca II triplet region, and only after that step are Markov Chain Monte Carlo methods used to model bulge and foreground components.
This positioning is important conceptually. PHOTfun is not itself a radial-velocity code, a dynamical-model fitter, or an MCMC engine. Its function is upstream and infrastructural: it supplies clean, deblended stellar photometry and spectra in observational regimes where classical aperture extraction would strongly blend adjacent stars and therefore corrupt subsequent spectroscopy and kinematics (Quezada et al., 8 Sep 2025).
2. Software architecture and dependencies
PHOTfun is implemented as a Python package with a GUI built using Shiny, and it encapsulates DAOPHOT-II/ALLSTAR through a Docker container for installation and platform portability (Quezada et al., 8 Sep 2025). Rather than re-implementing crowded-field photometry, it orchestrates established DAOPHOT-II routines and exposes their parameters interactively.
| Component | Function | Underlying basis |
|---|---|---|
| PHOTfun | Image-based PSF photometry, source catalogs, CMDs | DAOPHOT-II/ALLSTAR via GUI |
| PHOTcube | IFU datacube slicing and spectral reconstruction | Slice-by-slice PSF fitting |
| Interoperability layer | Visualization and table exchange | SAMP with TOPCAT and DS9 |
The DAOPHOT/ALLSTAR modules explicitly used are FIND, PICK, PHOT, PSF, SUBTRACT, DAOMATCH, and ALLSTAR (Quezada et al., 8 Sep 2025). PHOTfun automates the invocation of these routines while retaining GUI-level parameter control. This means that PHOTfun should be understood as an orchestration and usability layer around mature crowded-field photometry software rather than as an independent photometric kernel.
Its inputs are of two types. First, it operates on 2D FITS images, in this case the MUSE pipeline FoV images generated in white light and in the V-Johnson, R-Cousins, and I-Cousins bands. Second, through PHOTcube it operates on 3D IFU datacubes, specifically MUSE WFM-AO-N cubes covering roughly $4800$–$9300$ Å with at $8000$ Å (Quezada et al., 8 Sep 2025).
A common misconception is that PHOTfun requires an external astrometric or photometric reference catalog. In the documented workflow it does not: all PSF photometry is purely image-based, and for datacubes the master catalog is built internally from the MUSE white-light FoV image (Quezada et al., 8 Sep 2025).
3. Extraction methodology
The extraction pipeline begins on the white-light FoV image. PHOTfun uses FIND to generate an initial source list, which becomes the master target list. It then uses PICK to identify candidate PSF stars, after which the GUI exposes an interactive PSF-star selection panel showing, for each candidate, a pixel cutout and one-dimensional light profiles along several angular directions. Stars with asymmetric profiles or nearby contaminants can be rejected manually, and the curated PSF-star list is passed to DAOPHOT’s PSF routine to build the field PSF model (Quezada et al., 8 Sep 2025).
PHOTcube applies that master list and PSF model to the datacube. The cube is sliced along wavelength into monochromatic images; for each slice, ALLSTAR performs simultaneous PSF-fitting photometry for all objects in the master list. This is the core deblending step: overlapping stellar profiles are fit jointly, with flux assigned according to the PSF model and source positions. For each star and each wavelength slice, ALLSTAR returns an instrumental magnitude and magnitude error. PHOTcube concatenates these monochromatic magnitudes and converts them to fluxes through
Magnitude errors are propagated into flux errors, yielding an uncertainty spectrum for each star, and the signal-to-noise ratio is computed as the mean SNR per spectral pixel, with defined as flux divided by its associated uncertainty (Quezada et al., 8 Sep 2025).
A central methodological distinction from PampelMUSE concerns sky subtraction. PampelMUSE relies on the MUSE pipeline’s global sky subtraction through a master sky spectrum, whereas PHOTfun uses DAOPHOT-II’s local sky measurement in an annulus around each star on every monochromatic slice. In the comparison presented in (Quezada et al., 8 Sep 2025), this local-sky approach yields markedly smoother spectra in wavelength regions affected by strong OH residuals, especially relevant near the Ca II triplet.
4. Interface design and operational workflow
The GUI exposes the full DAOPHOT workflow in an interactive sequence. It supports FITS image loading, preview visualization with detected-source overlays, and parameterized execution of FIND, PICK, PHOT, PSF, SUBTRACT, DAOMATCH, and ALLSTAR (Quezada et al., 8 Sep 2025). One tab is dedicated to PHOTcube, where users load a MUSE datacube, configure slicing and photometry parameters, launch slice-by-slice extraction, and monitor intermediate products.
This interface design has methodological consequences. In severely crowded bulge fields, PSF-star selection is not a trivial preprocessing step but a major source of extraction quality control. The GUI therefore makes PSF-star vetting explicit rather than implicit. The integrated SAMP support further allows PHOTfun to communicate with TOPCAT and DS9 for image inspection and table analysis, which places it in a familiar VO-style ecosystem (Quezada et al., 8 Sep 2025).
The software is also optimized around a simplifying but operationally useful assumption: the PSF model derived from the white-light FoV image is reused across all monochromatic slices. For MUSE WFM-AO data this is treated as a reasonable approximation because the PSF changes slowly with wavelength compared with spatial variability. A plausible implication is that PHOTfun’s efficiency comes partly from this decision, but the same assumption also defines one of its principal limitations.
5. Use in Galactic bulge kinematic mapping
Within the bulge study, PHOTfun and PHOTcube were used on nine new MUSE fields: three inner fields within approximately $150$ pc of the Galactic center and six outer fields (Quezada et al., 8 Sep 2025). The extraction totals reported are $1873$, $1707$, and $9300$0 stars in the three inner fields, and $9300$1–$9300$2 stars per outer field, amounting to approximately $9300$3 extracted MUSE spectra in that work alone. These data were combined with four MUSE fields from Valenti et al. (2018), thirty GIBS FLAMES fields, and fourteen APOGEE-selected regions, yielding fifty-seven bulge pointings and approximately $9300$4 stars with radial velocities (Quezada et al., 8 Sep 2025).
PHOTfun’s output enters the subsequent analysis through Ca II triplet normalization and cross-correlation against synthetic templates. Foreground disk contamination is then modelled downstream with PyMC through a two-component Gaussian mixture,
$9300$5
with disk parameters fixed from a disk-selected CMD subsample and bulge parameters inferred from the posterior (Quezada et al., 8 Sep 2025). PHOTfun is therefore a prerequisite for, but not part of, the statistical separation of kinematic components.
The resulting maps confirm cylindrical rotation of the bulge and show a more boxy morphology in the velocity-dispersion distribution while preserving a well-defined central peak (Quezada et al., 8 Sep 2025). In this setting, PHOTfun is best understood as enabling infrastructure for crowded-field IFU spectroscopy in regions where slit or fibre spectroscopy would be severely limited by source density.
6. Validation, limitations, and nomenclature
The most direct validation reported is a head-to-head comparison with PampelMUSE on the same bulge field (Quezada et al., 8 Sep 2025). For bright stars, both pipelines yield essentially identical continua and absorption features. For faint stars, the overall spectral morphology remains similar, but PHOTfun shows fewer residual features around sky lines. In blank-sky regions, spectra extracted with PHOTfun are markedly flatter around OH lines than spectra extracted with PampelMUSE, consistent with the difference between local and global sky subtraction.
The observational design of the inner MUSE fields targeted dwarfs about one magnitude below the bulge main-sequence turnoff, at $9300$6, to reach $9300$7 in the CaT region (Quezada et al., 8 Sep 2025). Radial-velocity uncertainties were estimated using the empirical relation adopted from Valenti et al. (2018),
$9300$8
with $9300$9 used as representative of bulge dwarfs and giants (Quezada et al., 8 Sep 2025).
Its principal limitations are also explicit. PHOTcube assumes PSF stability with wavelength; performance can degrade in extremely crowded regions or when the master catalog and PSF-star set are suboptimal; low-SNR spectra remain noisy enough that a visual rejection of 0–1 of the faintest stars was required after inspection of cross-correlation functions and templates; and local sky subtraction depends on the existence of usable sky annuli free of unresolved stars and strong nebulosity (Quezada et al., 8 Sep 2025). None of these caveats negate the documented use case, but they define the boundary conditions under which the package should be interpreted.
The name has a second, looser usage in the supplied literature. In "Leveraging Photometry for Deconfusion of Directly Imaged Multi-Planet Systems" (Hasler et al., 10 Oct 2025), “PHOTfun” is used informally for a photometry-based ranking module that augments an astrometric “deconfuser” by evaluating orbit hypotheses with reflected-light brightness models and detector likelihoods. This is distinct from the released MUSE/DAOPHOT software package. This suggests that “PHOTfun” has begun to function as a broader shorthand for photometry-augmented inference modules, but the documented public software bearing that name is the crowded-field photometry and IFU-extraction package described in (Quezada et al., 8 Sep 2025).
PHOTfun is publicly available through GitHub and PyPI, with the repository and package locations explicitly given in the literature (Quezada et al., 8 Sep 2025). As described there, it is applicable not only to MUSE FoV images and datacubes but, in principle, to any FITS image set and to IFU datacubes for which a master list and approximately wavelength-stable PSF can be defined.