---
title: 'PHOTfun: Crowded-Field Photometry Tool'
url: https://www.emergentmind.com/topics/photfun
type: topic
---

# PHOTfun: Crowded-Field Photometry Tool

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 [2509.06846]. 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" [2509.06846], 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 [2509.06846].

## 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 [2509.06846]. 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** [2509.06846]. 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 \(R \simeq 3100\) at \(8000\) Å [2509.06846].

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 [2509.06846].

## 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 \(20\times20\) 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 [2509.06846].

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

\[
f(\lambda) \propto 10^{-0.4\,m(\lambda)}.
\]

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 \( \mathrm{SNR}(\lambda) \) defined as flux divided by its associated uncertainty [2509.06846].

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 [2509.06846], 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 [2509.06846]. 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 [2509.06846].

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 [2509.06846]. The extraction totals reported are \(1873\), \(1707\), and \(1990\) stars in the three inner fields, and \(386\)–\(945\) stars per outer field, amounting to approximately \(9{,}000+\) 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 \(23{,}000\) stars with radial velocities [2509.06846].

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,

\[
p(v)=f_{\rm disk}\,\mathcal{N}(v\mid\mu_{\rm disk},\sigma_{\rm disk})+
f_{\rm bulge}\,\mathcal{N}(v\mid\mu_{\rm bulge},\sigma_{\rm bulge}),
\]

with disk parameters fixed from a disk-selected CMD subsample and bulge parameters inferred from the posterior [2509.06846]. 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 [2509.06846]. 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 [2509.06846]. 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 \(I \approx 19\), to reach \( \mathrm{SNR} \ge 12 \) in the CaT region [2509.06846]. Radial-velocity uncertainties were estimated using the empirical relation adopted from Valenti et al. (2018),

\[
\ln(\epsilon_{RV}) = 4.624 - 1.023 \ln(S/N) - 0.159\,[\mathrm{Fe/H}] + 0.120\,[\mathrm{Fe/H}]^2,
\]

with \([\mathrm{Fe/H}]=0\) used as representative of bulge dwarfs and giants [2509.06846].

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 \(10\)–\(30\%\) 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 [2509.06846]. 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" [2510.09841], “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 [2509.06846].

PHOTfun is publicly available through GitHub and PyPI, with the repository and package locations explicitly given in the literature [2509.06846]. 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.

Source: https://www.emergentmind.com/topics/photfun