Skip to main content

S3Fit: a Simultaneous Spectrum and photometric-SED Fitting code for observation of galaxies

Project description

DOI

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 (or any pip-compatible installer):

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

s3fit-2.2.6.tar.gz (9.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

s3fit-2.2.6-py3-none-any.whl (610.0 kB view details)

Uploaded Python 3

File details

Details for the file s3fit-2.2.6.tar.gz.

File metadata

  • Download URL: s3fit-2.2.6.tar.gz
  • Upload date:
  • Size: 9.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for s3fit-2.2.6.tar.gz
Algorithm Hash digest
SHA256 b6bf481de776c1b132c10d0f7b209f2d7226e032096c23deccd3571edc290f46
MD5 db356c8c497f068dff3d2de6877ff9ec
BLAKE2b-256 98a620f2abd33d71484f0e1d26fe2fb1ebb669cfaaadba79c0d36e3556efc39a

See more details on using hashes here.

Provenance

The following attestation bundles were made for s3fit-2.2.6.tar.gz:

Publisher: release_to_pypi.yml on xychcz/S3Fit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file s3fit-2.2.6-py3-none-any.whl.

File metadata

  • Download URL: s3fit-2.2.6-py3-none-any.whl
  • Upload date:
  • Size: 610.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for s3fit-2.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 657bf04de219ff6f586daa6af458c04d9d4b9157e114bfd84f140d75e2f2b23b
MD5 ff61c111d95bbb1b07eb8b6ac3ed46b5
BLAKE2b-256 d8b372cfb0662f2d22823cbcc9e3ca72ae1dd84a346efdf2178a80d268acbdd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for s3fit-2.2.6-py3-none-any.whl:

Publisher: release_to_pypi.yml on xychcz/S3Fit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page