User config with sphot_config.toml
Sphot is configured via a TOML file (sphot_config.toml) placed in the working directory. If a key is omitted, the value from the bundled default (sphot/default_config.toml) is used. Below is the full default config, followed by per-block reference tables.
[prep]
filters = ['F555W', 'F814W', 'F090W', 'F150W', 'F160W', 'F277W']
PSF_file = 'PSFdata.h5'
blur_psf = {} # empty: calibrator bootstrap picks per-filter blur
custom_initial_crop = 1
sigma_guess = 10
auto_crop = true
auto_crop_factor = 8 # cutout half-axis in σ of best-fit Gaussian
[core]
base_filter = 'F150W'
iter_basefit = 10
iter_scalefit = 3
fit_complex_model = false
allow_refit = false
mainloop_convergence_atol = 1e-3
mainloop_convergence_patience = 2
mainloop_min_iter = 2
use_dual_annealing = true
use_final_polish = true
[psf-calib]
in_mainloop = false
kernel_family = 'gaussian'
kernel_anchor_K = 30
kernel_fit_skip_on_convergence = false
kernel_skip_threshold = 1e-3
kernel_fit_objective = 'multi_source'
kernel_fit_stamp_half_min = 8
kernel_fit_stamp_half_in_sigmaeff = 3.0
kernel_fit_max_neighbors = 15
kernel_fit_neighbor_pad_pix = 4.0
center_mask_r_in_fwhm = 2.5
scan_method = 'lm'
scan_metric = 'sum_snr'
scan_top_k = 100
fwhm_method = 'empirical'
[psf]
th_min = 5
th_max = 30
th_iter = 10
th_max_consec_empty = 3
bkg_refit_per_iteration = true
bkg_floor_factor = 0.3
ladder_dedup_psfsigma = 0.5
final_refit_method = 'iterative'
final_joint_refit = true
final_refit_xy_bounds = 0.0
final_refit_iterations = 5
final_refit_detect_th = 4.0
final_refit_dedup_psfsigma = 2.0
final_refit_residual_tol = 0.01
final_refit_catastrophic_flux_factor = 20.0
final_refit_fit_shape = [11, 11]
leftover_max_iterations = 3
leftover_detect_k_sigma = 5.0
leftover_dedup_psfsigma = 1.5
leftover_box_size = 3
mask_aper_size_in_r_eff = 3.5
raise_error = false
residual_clip_sigma = 15.0
finder_kwargs = {roundness_range=[-1.0, 1.0], sharpness_range=[0.20, 1.0]}
grouper_separation_in_psfsigma = 2
bkg_sigma_clip = 3.0
bkg_box_size = [10, 10]
bkg_filter_size = [5, 5]
localbkg_bounds_in_psfsigma = [2, 5]
center_mask_r_in_fwhm = 1.5
PSFPhotometry_aperture_radius = 3
PSFPhotometry_fitter_maxiters = 300
PSFPhotometry_fit_shape_in_fwhm = 1.5
modelimg_render_shape = [25, 25]
PSFPhotometry_group_warning_threshold = 10
cuts_pos_err_max = 2
cuts_res_cen_sigma_clip = 3.0
cuts_cfit_sigma_clip = 3.0
cuts_chi2dof_median_factor = 3.0
cuts_pos_diff_median_factor = 2.0
cuts_flux_SNR_min = 1.0
[aperture]
petro = 0.5
center_mask = 4.0
plot = true
isophot_base_filter = 'F150W'
isophot_frac_min = 0.05
isophot_frac_max = 0.95
fit_isophot_to = 'sersic_modelimg'
measure_on = 'psf_sub_data'
error_on = 'psf_sub_data_error'
measure_sky_on = 'residual_masked'
fill_max_nan_frac = 0.7
fill_replace_with = 'median'
PSF_corr_base_filter = 'F090W'
[prep] block — input data and pre-processing
Name |
Type |
Description |
|---|---|---|
|
list[str] |
Filter names to load from the input HDF5 cube (e.g. |
|
str |
Path to the PSF HDF5 file. Per-filter PSFs must be stored at integer-multiple pixel scale relative to the science image. |
|
dict[str, float] |
Per-filter Gaussian blur σ (oversampled px) applied to the library PSF. |
|
float |
Fraction of the input image to crop to before any other prep step. Range |
|
float |
Initial guess for the galaxy Gaussian σ (px), used to seed the auto-crop sizing fit. |
|
bool |
If true, fit a coarse Gaussian to the galaxy and re-crop the cutout to |
|
float |
Cutout half-axis size in units of the best-fit Gaussian σ. |
[core] block — top-level pipeline behaviour
Name |
Type |
Description |
|---|---|---|
|
str |
Filter used for the base 8-parameter Sersic fit. Other filters are scale-fitted against this template. |
|
int |
Max iterations of the basefit main loop (Sersic fit ↔ PSF photometry alternation). |
|
int |
Max iterations of the scalefit main loop for non-base filters. |
|
bool |
If true, allow the optional Sersic + secondary-component complex model. Default |
|
bool |
If true, re-run the basefit Sersic from a perturbed init when the first pass looks degenerate. |
|
float |
Early-stop threshold on the L∞ norm of standardized Sersic-parameter changes between iterations. |
|
int |
Number of consecutive within-atol iterations required before early-stopping. |
|
int |
Hard floor; never early-stop before this many main-loop iterations. |
|
bool |
If true, the iter-1 main-loop Sersic fit runs a short iNM bracket followed by |
|
bool |
If true, run an L-BFGS-B polish on the final Sersic params after the main loop, followed by one PSF photometry pass. |
[psf-calib] block — per-iteration PSF kernel recalibration
Name |
Type |
Description |
|---|---|---|
|
bool |
If true, recalibrate the kernel + matched-filter FWHM on every main-loop iteration. If false, only an initial calibration is performed. |
|
str |
PSF blur kernel family: |
|
int |
Number of brightest anchor sources used in the kernel fit. |
|
bool |
If true, skip the FWHM scan once the kernel parameter L2 distance between iterations falls below |
|
float |
L2 threshold for the above shortcut. |
|
str |
|
|
int |
Minimum stamp half-size (px) when fitting per-source kernel residuals. |
|
float |
Adaptive stamp half-size in units of √( |
|
int |
Max number of neighbour columns folded into each multi-source NNLS stamp. |
|
float |
Search radius beyond the stamp (px) for neighbour candidates. |
|
float |
Calibration centre-mask radius in units of empirical effective PSF FWHM. |
|
str |
FWHM-scan inner photometry: |
|
str |
Bracket-candidate ranking when |
|
int |
Cap DAO detections to the brightest |
|
str |
How to set the matched-filter |
[psf] block — PSF photometry, threshold ladder, refit
Detection ladder and background re-estimation
Name |
Type |
Description |
|---|---|---|
|
float |
Minimum detection threshold (× background σ) for the bottom of the ladder. |
|
float |
Maximum detection threshold; the top of the ladder. |
|
int |
Number of ladder steps from |
|
int |
Stop the ladder early after |
|
bool |
If true, re-estimate the background σ after each successful ladder pass. |
|
float |
Floor on the re-estimated |
|
float |
In-ladder duplicate-source cut radius (× |
Final refit
Name |
Type |
Description |
|---|---|---|
|
str |
|
|
bool |
For |
|
float |
Position bounds (px) for the joint refit. |
|
int |
Max joint-refit iterations. |
|
float |
Leftover-detection threshold (× residual MAD) inside the iterative refit. |
|
float |
Leftover-detection dedup radius (× |
|
float |
Stop refit iterations when residual MAD improves by less than this fraction. |
|
float |
If a source’s flux changes by more than this factor between iterations, mark the refit catastrophic and roll back. |
|
[int, int] |
Joint-refit fit window (px). |
|
int |
For NNLS refit: max number of post-NNLS leftover detection passes. |
|
float |
Leftover detection threshold (× residual σ) for the NNLS leftover loop. |
|
float |
Leftover dedup radius (× |
|
int |
|
Masks, background, and detection knobs
Name |
Type |
Description |
|---|---|---|
|
float |
Sky-mask aperture size in units of the Sersic |
|
bool |
If true, raise on PSF-photometry errors instead of warning and continuing. |
|
float |
Sigma used to clip residual outliers; high default avoids over-masking the Sersic core. |
|
dict |
Passed to |
|
float |
|
|
float |
Sigma used by the 2D |
|
[int, int] |
2D background mesh box size. |
|
[int, int] |
2D background median-filter size. |
|
[float, float] |
Inner/outer annulus radii for |
|
float |
PSF-photometry centre-mask radius (× empirical effective PSF FWHM); hides the Sersic core from PSF detection. |
PSFPhotometry knobs
Name |
Type |
Description |
|---|---|---|
|
float |
Aperture radius (px) used for the initial-flux estimate inside |
|
int |
Max LM iterations per source/group. |
|
float |
Fit-window size in units of FWHM. Internally clamped to |
|
[int, int] |
Render shape (px) for the per-source PSF model image used in the final residual. |
|
int |
Warn when a single |
Quality cuts (post-fit)
Name |
Type |
Description |
|---|---|---|
|
float |
Max fitted x/y error (px). Sources beyond this are discarded. |
|
float |
Sigma clip on residual values at fitted source centres. |
|
float |
Sigma clip on the |
|
float |
Drop sources with |
|
float |
Drop sources whose positional drift between iterations exceeds this factor × the median. |
|
float |
Minimum |
[aperture] block — aperture photometry
Name |
Type |
Description |
|---|---|---|
|
float |
Petrosian fraction used to define the aperture radius. |
|
float |
Aperture centre-mask radius (px); hides the saturated/PSF core from aperture sums. |
|
bool |
If true, generate diagnostic aperture plots. |
|
str |
Filter used as the reference for isophote fitting. |
|
float |
Minimum flux-fraction level fit by |
|
float |
Maximum flux-fraction level. |
|
str |
Image type the isophotes are fit to; usually |
|
str |
Image type aperture flux is measured on, typically |
|
str |
Error image used for aperture-flux uncertainties. |
|
str |
Image type used to estimate the local sky inside the aperture annulus. |
|
float |
Max fraction of NaN pixels permitted inside the aperture before rejecting the measurement. |
|
str |
How to fill NaNs prior to aperture sum: |
|
str |
Filter used as reference for cross-filter PSF-aperture corrections. |