S3Fit: a Simultaneous Spectrum and photometric-SED Fitting code for observation of galaxies
Project description
S3Fit
S3Fit: a Simultaneous Spectrum and photometric-SED Fitting code for observation of galaxies
S3Fit is a Python-based tool for analyzing observational data of galaxies. It offers powerful capabilities for decomposing spectroscopic data by supporting multiple continuum and emission line models with multiple components, making it well-suited for complex systems with mixed contributions from Active Galactic Nuclei (AGNs) and their host galaxies. By simultaneously fitting the spectrum and multi-band photometric Spectral Energy Distribution (SED), S3Fit improves constraints on continuum model properties, which may be poorly determined when fitting spectral data alone due to its limited wavelength coverage. With an optimized fitting strategy, S3Fit efficiently derives the best-fit solution for dozens of model parameters. Additionally, it provides an extensible and user-friendly framework, allowing users to modify model configurations and incorporate new model components as needed.
Features of S3Fit
- Easy switch between pure spectral fitting and joint spectrum+SED fitting modes.
- Support for flexible combination of multiple stellar populations with different star formation histories (SFH).
- Support for flexible combination of multiple emission line components.
- Support for AGN continuum models across UV/optical and IR wavelength ranges.
- User-friendly functions for outputting and visualizing fitting results.
- Highly extensible framework, allowing users to add new features such as new SFH functions, emission lines, and custom model types.
Fitting strategy
The full fitting pipeline of S3Fit is shown in the following flowchart, with a detailed description of the fitting strategy in manuals.
An example of the fitting result of S3Fit is shown in the following plots (and details in this paper).
Usage
Please find guides in manuals for basic and advanced usages of this code. Examples of the usage of S3Fit are provided in example1 and example2
Installation
You can install S3Fit with pip:
pip install s3fit
S3Fit mainly depends on several most widely utilized repositories for science calculation, scipy, numpy, and astropy.
The core requirement of S3Fit is the two functions least_squares and lsq_linear in scipy.optimize
(please read the
fitting strategy for details).
A strong dependency of S3Fit on these repositories is not expected.
joblib is required to run fitting in multithreading (from v2.3).
It is optional to run S3Fit with PyNeb,
which is used to calculate intrinsic flux ratios of emission lines:
pip install s3fit[pyneb]
Dependencies:
python >= 3.10
scipy >= 1.12.0
numpy >= 1.26.4
astropy >= 6.0.0
joblib >= 1.5.2
matplotlib >= 3.9.1
pyneb >= 1.1.23 (optional)
Future updating
- Add ISM dust and synchrotron models (you may also add them or other models by yourself following the advanced usage manual).
- Add iron pseudo continuum templates and Balmer continuum of type-1 AGN (supported in v2.3).
- Absorption lines (supported in v2.3).
Citation
If you would like to use S3Fit, please cite with the following BibTeX code:
@software{2025ascl.soft03024C,
author = {{Chen}, Xiaoyang},
title = "{S3Fit: Simultaneous Spectrum and photometric-SED Fitting code for galaxy observations}",
howpublished = {Astrophysics Source Code Library, record ascl:2503.024},
year = 2025,
month = mar,
eid = {ascl:2503.024},
adsurl = {https://ui.adsabs.harvard.edu/abs/2025ascl.soft03024C},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
Reference
S3Fit uses the Single Stellar Population (SSP) library HR-pyPopStar (paper). Please download the HR-pyPopStar library and run the converting code to create the SSP models used for S3Fit. You may also want to download an example of the converted SSP model for test in this link.
S3Fit uses the SKIRTor (paper1, paper2) AGN torus model. Please download the SKIRTor library and run the converting code to create the torus models used for S3Fit. Example of this library is also provided in model libraries for a test of S3Fit, which contains the templates with a fixed dust density gradient in radial (p = 1) and angular direction (q = 0.5). Please refer to SKIRTor website for details of the model parameters.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file s3fit-2.2.5.tar.gz.
File metadata
- Download URL: s3fit-2.2.5.tar.gz
- Upload date:
- Size: 8.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfec1bb4c63843b028b41a7c367307ead199baa5e8c24907aaf77689d254e50d
|
|
| MD5 |
307a63b8170ffbf93e695c4631a69a89
|
|
| BLAKE2b-256 |
53be9295aff36f5d458b4d4ec4793b567e4007a44fa6f9fd67f590e6fa6fdd6f
|
Provenance
The following attestation bundles were made for s3fit-2.2.5.tar.gz:
Publisher:
release_to_pypi.yml on xychcz/S3Fit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
s3fit-2.2.5.tar.gz -
Subject digest:
cfec1bb4c63843b028b41a7c367307ead199baa5e8c24907aaf77689d254e50d - Sigstore transparency entry: 768300543
- Sigstore integration time:
-
Permalink:
xychcz/S3Fit@07c48664c41893123d8371b643ab09e0a3ac6e6a -
Branch / Tag:
refs/tags/v2.2.5 - Owner: https://github.com/xychcz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release_to_pypi.yml@07c48664c41893123d8371b643ab09e0a3ac6e6a -
Trigger Event:
release
-
Statement type:
File details
Details for the file s3fit-2.2.5-py3-none-any.whl.
File metadata
- Download URL: s3fit-2.2.5-py3-none-any.whl
- Upload date:
- Size: 86.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bf0e97cc565ef972afb28b29e5b986e3650c97dc835079b27cca112816841e6
|
|
| MD5 |
06d358993a4f46d001dc23b6387627b0
|
|
| BLAKE2b-256 |
3c2fdf0da6ed3d3d8739eb75db0b8b4f2b72972497b74cefb1d9224d9e088378
|
Provenance
The following attestation bundles were made for s3fit-2.2.5-py3-none-any.whl:
Publisher:
release_to_pypi.yml on xychcz/S3Fit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
s3fit-2.2.5-py3-none-any.whl -
Subject digest:
9bf0e97cc565ef972afb28b29e5b986e3650c97dc835079b27cca112816841e6 - Sigstore transparency entry: 768300545
- Sigstore integration time:
-
Permalink:
xychcz/S3Fit@07c48664c41893123d8371b643ab09e0a3ac6e6a -
Branch / Tag:
refs/tags/v2.2.5 - Owner: https://github.com/xychcz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release_to_pypi.yml@07c48664c41893123d8371b643ab09e0a3ac6e6a -
Trigger Event:
release
-
Statement type: