Starkiller removes stellar contamination from integral field unit (IFU) spectroscopic datacubes. It works by:
- Fetching a source catalogue (Gaia DR3 by default) for the observed field
- Extracting PSF-photometry spectra for each star in the cube
- Matching each spectrum to a stellar model (CK or ESO library) accounting for interstellar extinction
- Normalising the best-matching model to catalogue photometry (Gaia G by default)
- Injecting each modelled star into a synthetic scene cube using the measured PSF
- Applying a secondary flux correction to calibration sources
- Subtracting the synthetic scene from the input cube to produce a differenced FITS file
PSFs can be trailed (for non-sidereal tracking), Moffat or Gaussian, and can be constructed from the data itself. Satellite streaks can also be detected and removed.
pip install git+https://github.com/CheerfulUser/starkiller.gitRequirements: Python ≥ 3.8, NumPy < 2.0 (the pysynphot and extinction dependencies are compiled against NumPy 1.x and will fail to import under NumPy 2.x).
from starkiller import starkiller
ifu = starkiller(
file='path/to/cube.fits',
cal_maglim=20, # brightest mag limit for PSF calibration stars
run=True,
)from starkiller import starkiller
ifu = starkiller(
file='path/to/cube.fits',
trail=False, # no trailing — sidereal tracking
numcores=7,
savepath='output/',
spec_catalog='ck+', # extended CK model grid (recommended for faint stars)
psf_profile='gaussian',
cal_maglim=18,
model_maglim=25,
psf_preference='data', # build PSF from bright calibration stars in the cube
)Set fuzzy=True to detect and mask any extended emission before PSF fitting, preventing it from contaminating the stellar models.
from starkiller import starkiller
ifu = starkiller(
file='path/to/cube.fits',
trail=False,
fuzzy=True, # mask extended emission (nebula, galaxy) before PSF fitting
psf_preference='data',
spec_catalog='ck+',
)from starkiller import starkiller
ifu = starkiller(
file='path/to/cube.fits',
spec_catalog='ck',
savepath='output/',
satellite=True, # detect and model satellite streaks
)The satellite spectrum is modelled as a highly-extincted solar spectrum and subtracted, recovering the underlying source.
| Parameter | Default | Description |
|---|---|---|
trail |
True |
Estimate and model trailing angle. Set False for sidereal data. |
cal_maglim |
18 |
Faint magnitude limit for PSF calibration stars. |
model_maglim |
25 |
Faint magnitude limit for stars included in the scene model. |
spec_catalog |
'ck' |
Stellar spectral library: 'ck' (Castelli-Kurucz), 'ck+' (extended), 'eso'. |
psf_profile |
'gaussian' |
PSF profile shape: 'gaussian' or 'moffat'. |
psf_preference |
'data' |
Build PSF from 'data' (calibration stars in cube) or 'model' (analytic). |
fuzzy |
False |
Mask extended sources (nebulae, galaxies) before PSF fitting. |
satellite |
False |
Detect and subtract satellite streaks. |
numcores |
5 |
Number of CPU cores for parallel spectral fitting. |
wavelength_sol |
'air' |
Wavelength frame: 'air' or 'vacuum'. |
background |
False |
If True, subtract a 2D sky background before modelling. |
After a run the starkiller object exposes the key products as attributes:
ifu = starkiller('cube.fits', run=True)
ifu.diff_cube # differenced cube (stars removed)
ifu.scene # synthetic star scene that was subtracted
ifu.ebvs # E(B-V) extinction values per star
ifu.cat # source catalogue used (pandas DataFrame)
ifu.psf # fitted PSF objectExtinction values can be used directly for further analysis:
The differenced cube is saved as a FITS file with four extensions:
| Extension | Contents |
|---|---|
| 0 | Primary HDU (copy of input header) |
| 1 | Differenced cube (input − scene) |
| 2 | Error cube |
| 3 | Binary table of fitted PSF parameters |
The WCS from the input cube is preserved in all image extensions.
For single broad-band images (rather than IFU cubes), use starkiller_image:
from starkiller import starkiller_image
img = starkiller_image(
image=data_array,
wcs=wcs_object,
ref_filter='r',
cal_maglim=[16, 20],
model_maglim=25,
run=True,
)Starkiller was developed for the MUSE 2I/Borisov dataset to recover observations that would otherwise have been unusable due to stellar contamination. See Deam et al. 2026 for details.
The starkiller method is described in Ridden-Harper et al. 2025 (The Astronomical Journal, 169, 148).
If you use starkiller, please cite the Zenodo release using the DOI badge at the top of this page.
- Simultaneous PSF fitting for overlapping/crowded sources is not yet implemented.
- Very long trails that extend beyond the detector edges may cause the WCS matching and PSF fitting to struggle. Setting
fuzzy=Truecan help in these cases.





