Configuration

Contents

Configuration#

class jaxqsofit.config.FitConfig(observation, spectroscopy, psf_photometry=None, preprocessing=<factory>, continuum=<factory>, host=<factory>, lines=<factory>, inference=<factory>, output=<factory>, prior_config=None)[source]#

Bases: object

Top-level configuration bundle for one JAXQSOFit spectral fit.

Parameters:
observation: Observation#
spectroscopy: SpectroscopyData#
psf_photometry: PSFPhotometryData | None = None#
preprocessing: PreprocessingConfig#
continuum: ContinuumConfig#
host: HostConfig#
lines: LineConfig#
inference: InferenceConfig#
output: OutputConfig#
prior_config: PriorConfig | None = None#
validate()[source]#

Validate required nested data payloads.

Return type:

None

to_dict()[source]#

Convert the dataclass tree into a plain dictionary.

Return type:

dict[str, Any]

__init__(observation, spectroscopy, psf_photometry=None, preprocessing=<factory>, continuum=<factory>, host=<factory>, lines=<factory>, inference=<factory>, output=<factory>, prior_config=None)#
Parameters:
Return type:

None

class jaxqsofit.config.Observation(object_id='result', redshift=0.0, ra=None, dec=None, apply_mw_deredden=True)[source]#

Bases: object

Observation-level metadata for one quasar spectrum.

Parameters:
  • object_id (str)

  • redshift (float)

  • ra (float | None)

  • dec (float | None)

  • apply_mw_deredden (bool)

object_id: str = 'result'#
redshift: float = 0.0#
ra: float | None = None#
dec: float | None = None#
apply_mw_deredden: bool = True#
__init__(object_id='result', redshift=0.0, ra=None, dec=None, apply_mw_deredden=True)#
Parameters:
  • object_id (str)

  • redshift (float)

  • ra (float | None)

  • dec (float | None)

  • apply_mw_deredden (bool)

Return type:

None

class jaxqsofit.config.SpectroscopyData(wave_obs, fluxes, errors=None, wavelength_dispersion=None, mask=None)[source]#

Bases: object

Observed spectral measurements on an observed-frame wavelength grid.

Parameters:
  • wave_obs (Sequence[float])

  • fluxes (Sequence[float])

  • errors (Sequence[float] | float | None)

  • wavelength_dispersion (Sequence[float] | None)

  • mask (Sequence[bool] | None)

wave_obs: Sequence[float]#
fluxes: Sequence[float]#
errors: Sequence[float] | float | None = None#
wavelength_dispersion: Sequence[float] | None = None#
mask: Sequence[bool] | None = None#
validate()[source]#

Validate spectroscopy payload array lengths.

Return type:

None

__init__(wave_obs, fluxes, errors=None, wavelength_dispersion=None, mask=None)#
Parameters:
  • wave_obs (Sequence[float])

  • fluxes (Sequence[float])

  • errors (Sequence[float] | float | None)

  • wavelength_dispersion (Sequence[float] | None)

  • mask (Sequence[bool] | None)

Return type:

None

class jaxqsofit.config.PSFPhotometryData(magnitudes, magnitude_errors, filter_names=('u', 'g', 'r', 'i', 'z'))[source]#

Bases: object

Optional PSF-aperture photometry used for spectral recalibration.

JAXQSOFit is a spectral fitter, so these data are only used as an extra calibration constraint on the fitted spectrum. Use bands whose transmission curves overlap the observed spectral wavelength coverage. For full joint spectrum + broadband SED modeling, use jaxsedfit instead.

Parameters:
  • magnitudes (Sequence[float])

  • magnitude_errors (Sequence[float])

  • filter_names (Sequence[str])

magnitudes: Sequence[float]#
magnitude_errors: Sequence[float]#
filter_names: Sequence[str] = ('u', 'g', 'r', 'i', 'z')#
validate()[source]#

Validate PSF photometry vector lengths.

Return type:

None

__init__(magnitudes, magnitude_errors, filter_names=('u', 'g', 'r', 'i', 'z'))#
Parameters:
  • magnitudes (Sequence[float])

  • magnitude_errors (Sequence[float])

  • filter_names (Sequence[str])

Return type:

None

class jaxqsofit.config.PreprocessingConfig(wave_range=None, wave_mask=None, mask_lya_forest=True)[source]#

Bases: object

Spectrum preprocessing options applied before fitting.

Parameters:
  • wave_range (tuple[float, float] | None)

  • wave_mask (Sequence[Sequence[float]] | None)

  • mask_lya_forest (bool)

wave_range: tuple[float, float] | None = None#
wave_mask: Sequence[Sequence[float]] | None = None#
mask_lya_forest: bool = True#
__init__(wave_range=None, wave_mask=None, mask_lya_forest=True)#
Parameters:
  • wave_range (tuple[float, float] | None)

  • wave_mask (Sequence[Sequence[float]] | None)

  • mask_lya_forest (bool)

Return type:

None

class jaxqsofit.config.ContinuumConfig(fit_power_law=True, fit_feii=True, fit_balmer_continuum=False, fit_bal_absorption=False, fit_polynomial_tilt=True, fit_reddening=True, polynomial_order=2)[source]#

Bases: object

Continuum and spectral component switches.

Parameters:
  • fit_power_law (bool)

  • fit_feii (bool)

  • fit_balmer_continuum (bool)

  • fit_bal_absorption (bool)

  • fit_polynomial_tilt (bool)

  • fit_reddening (bool)

  • polynomial_order (int)

fit_power_law: bool = True#
fit_feii: bool = True#
fit_balmer_continuum: bool = False#
fit_bal_absorption: bool = False#
fit_polynomial_tilt: bool = True#
fit_reddening: bool = True#
polynomial_order: int = 2#
__init__(fit_power_law=True, fit_feii=True, fit_balmer_continuum=False, fit_bal_absorption=False, fit_polynomial_tilt=True, fit_reddening=True, polynomial_order=2)#
Parameters:
  • fit_power_law (bool)

  • fit_feii (bool)

  • fit_balmer_continuum (bool)

  • fit_bal_absorption (bool)

  • fit_polynomial_tilt (bool)

  • fit_reddening (bool)

  • polynomial_order (int)

Return type:

None

class jaxqsofit.config.HostConfig(enabled=True, sfh_model='delayed', dsps_ssp_fn='tempdata.h5', age_grid_gyr=(0.01, 0.03, 0.1, 0.3, 1.0, 3.0, 10.0), logzsol_grid=(-1.0, -0.5, 0.0, 0.2))[source]#

Bases: object

Host-galaxy spectral decomposition configuration.

Parameters:
  • enabled (bool)

  • sfh_model (str)

  • dsps_ssp_fn (str)

  • age_grid_gyr (Sequence[float])

  • logzsol_grid (Sequence[float])

enabled: bool = True#
sfh_model: str = 'delayed'#
dsps_ssp_fn: str = 'tempdata.h5'#
age_grid_gyr: Sequence[float] = (0.01, 0.03, 0.1, 0.3, 1.0, 3.0, 10.0)#
logzsol_grid: Sequence[float] = (-1.0, -0.5, 0.0, 0.2)#
__init__(enabled=True, sfh_model='delayed', dsps_ssp_fn='tempdata.h5', age_grid_gyr=(0.01, 0.03, 0.1, 0.3, 1.0, 3.0, 10.0), logzsol_grid=(-1.0, -0.5, 0.0, 0.2))#
Parameters:
  • enabled (bool)

  • sfh_model (str)

  • dsps_ssp_fn (str)

  • age_grid_gyr (Sequence[float])

  • logzsol_grid (Sequence[float])

Return type:

None

class jaxqsofit.config.LineConfig(enabled=True, custom_components=None, custom_line_components=None)[source]#

Bases: object

Emission-line model configuration.

Parameters:
  • enabled (bool)

  • custom_components (Sequence[Any] | None)

  • custom_line_components (Sequence[Any] | None)

enabled: bool = True#
custom_components: Sequence[Any] | None = None#
custom_line_components: Sequence[Any] | None = None#
__init__(enabled=True, custom_components=None, custom_line_components=None)#
Parameters:
  • enabled (bool)

  • custom_components (Sequence[Any] | None)

  • custom_line_components (Sequence[Any] | None)

Return type:

None

class jaxqsofit.config.InferenceConfig(method='optax+nuts', map_steps=600, learning_rate=0.01, num_warmup=50, num_samples=50, num_chains=1, target_accept_prob=0.9, plot_init=False)[source]#

Bases: object

Inference defaults for Optax and NUTS.

Parameters:
  • method (str)

  • map_steps (int)

  • learning_rate (float)

  • num_warmup (int)

  • num_samples (int)

  • num_chains (int)

  • target_accept_prob (float)

  • plot_init (bool)

method: str = 'optax+nuts'#
map_steps: int = 600#
learning_rate: float = 0.01#
num_warmup: int = 50#
num_samples: int = 50#
num_chains: int = 1#
target_accept_prob: float = 0.9#
plot_init: bool = False#
__init__(method='optax+nuts', map_steps=600, learning_rate=0.01, num_warmup=50, num_samples=50, num_chains=1, target_accept_prob=0.9, plot_init=False)#
Parameters:
  • method (str)

  • map_steps (int)

  • learning_rate (float)

  • num_warmup (int)

  • num_samples (int)

  • num_chains (int)

  • target_accept_prob (float)

  • plot_init (bool)

Return type:

None

class jaxqsofit.config.OutputConfig(output_path=None, save_name=None, save_result=True, plot_fig=True, save_fig=True, show_plot=False)[source]#

Bases: object

Plotting and persistence defaults.

Parameters:
  • output_path (str | None)

  • save_name (str | None)

  • save_result (bool)

  • plot_fig (bool)

  • save_fig (bool)

  • show_plot (bool)

output_path: str | None = None#
save_name: str | None = None#
save_result: bool = True#
plot_fig: bool = True#
save_fig: bool = True#
show_plot: bool = False#
__init__(output_path=None, save_name=None, save_result=True, plot_fig=True, save_fig=True, show_plot=False)#
Parameters:
  • output_path (str | None)

  • save_name (str | None)

  • save_result (bool)

  • plot_fig (bool)

  • save_fig (bool)

  • show_plot (bool)

Return type:

None

class jaxqsofit.config.PriorConfig(continuum=<factory>, host=<factory>, lines=<factory>, feii=<factory>, psf=<factory>, overrides=<factory>)[source]#

Bases: MutableMapping[str, Any]

Object-oriented prior configuration with dict-compatible overrides.

Parameters:
continuum: ContinuumPriorConfig#
host: HostPriorConfig#
lines: LinePriorConfig#
feii: FeIIPriorConfig#
psf: PSFPriorConfig#
overrides: dict[str, Any]#
to_mapping()[source]#

Return the flat prior mapping consumed by low-level model code.

Return type:

dict[str, Any]

get(key, default=None)[source]#

Return a prior entry or default from the flat mapping view.

Parameters:
  • key (str)

  • default (Any)

Return type:

Any

setdefault(key, default=None)[source]#

Set and return a low-level override when the key is absent.

Parameters:
  • key (str)

  • default (Any)

Return type:

Any

__init__(continuum=<factory>, host=<factory>, lines=<factory>, feii=<factory>, psf=<factory>, overrides=<factory>)#
Parameters:
Return type:

None

class jaxqsofit.config.ContinuumPriorConfig(power_law_pivot=None, polynomial_pivot=None, output_wavelengths=None, overrides=<factory>)[source]#

Bases: object

Semantic continuum-prior options.

Parameters:
  • power_law_pivot (float | None)

  • polynomial_pivot (float | None)

  • output_wavelengths (Sequence[float] | None)

  • overrides (dict[str, Any])

power_law_pivot: float | None = None#
polynomial_pivot: float | None = None#
output_wavelengths: Sequence[float] | None = None#
overrides: dict[str, Any]#
to_mapping()[source]#

Convert semantic continuum prior settings into model-site keys.

Return type:

dict[str, Any]

__init__(power_law_pivot=None, polynomial_pivot=None, output_wavelengths=None, overrides=<factory>)#
Parameters:
  • power_law_pivot (float | None)

  • polynomial_pivot (float | None)

  • output_wavelengths (Sequence[float] | None)

  • overrides (dict[str, Any])

Return type:

None

class jaxqsofit.config.HostPriorConfig(redshift_weight_enabled=None, overrides=<factory>)[source]#

Bases: object

Semantic host-galaxy prior options.

Parameters:
  • redshift_weight_enabled (bool | None)

  • overrides (dict[str, Any])

redshift_weight_enabled: bool | None = None#
overrides: dict[str, Any]#
to_mapping()[source]#

Convert semantic host prior settings into model-site keys.

Return type:

dict[str, Any]

__init__(redshift_weight_enabled=None, overrides=<factory>)#
Parameters:
  • redshift_weight_enabled (bool | None)

  • overrides (dict[str, Any])

Return type:

None

class jaxqsofit.config.LinePriorConfig(table=None, dmu_scale_mult=None, sig_scale_mult=None, amp_scale_mult=None, overrides=<factory>)[source]#

Bases: object

Semantic emission-line prior options.

Parameters:
  • table (Sequence[Mapping[str, Any]] | None)

  • dmu_scale_mult (float | None)

  • sig_scale_mult (float | None)

  • amp_scale_mult (float | None)

  • overrides (dict[str, Any])

table: Sequence[Mapping[str, Any]] | None = None#
dmu_scale_mult: float | None = None#
sig_scale_mult: float | None = None#
amp_scale_mult: float | None = None#
overrides: dict[str, Any]#
to_mapping()[source]#

Convert semantic emission-line prior settings into model-site keys.

Return type:

dict[str, Any]

__init__(table=None, dmu_scale_mult=None, sig_scale_mult=None, amp_scale_mult=None, overrides=<factory>)#
Parameters:
  • table (Sequence[Mapping[str, Any]] | None)

  • dmu_scale_mult (float | None)

  • sig_scale_mult (float | None)

  • amp_scale_mult (float | None)

  • overrides (dict[str, Any])

Return type:

None

class jaxqsofit.config.FeIIPriorConfig(uv_fwhm=None, optical_fwhm=None, overrides=<factory>)[source]#

Bases: object

Semantic Fe II prior options.

Parameters:
  • uv_fwhm (Mapping[str, Any] | None)

  • optical_fwhm (Mapping[str, Any] | None)

  • overrides (dict[str, Any])

uv_fwhm: Mapping[str, Any] | None = None#
optical_fwhm: Mapping[str, Any] | None = None#
overrides: dict[str, Any]#
to_mapping()[source]#

Convert semantic Fe II prior settings into model-site keys.

Return type:

dict[str, Any]

__init__(uv_fwhm=None, optical_fwhm=None, overrides=<factory>)#
Parameters:
  • uv_fwhm (Mapping[str, Any] | None)

  • optical_fwhm (Mapping[str, Any] | None)

  • overrides (dict[str, Any])

Return type:

None

class jaxqsofit.config.PSFPriorConfig(overrides=<factory>)[source]#

Bases: object

Semantic PSF recalibration prior options.

Parameters:

overrides (dict[str, Any])

overrides: dict[str, Any]#
to_mapping()[source]#

Return low-level PSF recalibration prior overrides.

Return type:

dict[str, Any]

__init__(overrides=<factory>)#
Parameters:

overrides (dict[str, Any])

Return type:

None

jaxqsofit.config.fit_config_from_mapping(data)[source]#

Build a validated FitConfig from a nested mapping.

Parameters:

data (Mapping[str, Any])

Return type:

jaxqsofit.config.FitConfig