s3fit


Names3fit JSON
Version 2.0.4 PyPI version JSON
download
home_pageNone
SummaryS3Fit: a Simultaneous Spectrum and photometric-SED Fitting code for observation of galaxies
upload_time2025-02-10 05:50:27
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords sed fitting astronomy galaxy spectral fitting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # S<sup>3</sup>Fit
**S<sup>3</sup>Fit**: a <ins>**S**</ins>imultaneous <ins>**S**</ins>pectrum and photometric-<ins>**S**</ins>ED <ins>**Fit**</ins>ting code for observation of galaxies

S<sup>3</sup>Fit 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), 
S<sup>3</sup>Fit 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, 
S<sup>3</sup>Fit 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 S<sup>3</sup>Fit
- 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 S<sup>3</sup>Fit is shown in the following flowchart, 
with a detailed description of the [fitting strategy](https://github.com/xychcz/S3Fit/blob/main/manuals/fitting_strategy.md) in 
[manuals](https://github.com/xychcz/S3Fit/blob/main/manuals/). 
<p align="center"> <img src="https://github.com/user-attachments/assets/658a29b3-a2d8-470a-a08f-e4a045ef3ec3" width="1200">

An example of the fitting result of S<sup>3</sup>Fit is shown in the following plots. 
<p align="center"> <img src="https://github.com/user-attachments/assets/683f5837-d364-4a53-8113-a05d56f9ef5b" width="600">

## Usage
Please find guides in [manuals](https://github.com/xychcz/S3Fit/blob/main/manuals/) 
for [basic](https://github.com/xychcz/S3Fit/blob/main/manuals/basic_usage.md) 
and [advanced](https://github.com/xychcz/S3Fit/blob/main/manuals/advanced_usage.md) usages of this code. 
An example of the usage of S<sup>3</sup>Fit is provided in the 
[example](https://github.com/xychcz/S3Fit/blob/main/example/example.ipynb). 

## Installation

You can install S<sup>3</sup>Fit with [pip](https://pypi.org/project/s3fit/):
```
pip install s3fit
```
S<sup>3</sup>Fit mainly depends on several most widely utilized repositories for science calculation, `scipy`, `numpy`, and `astropy`. 
The core requirement of S<sup>3</sup>Fit is the two functions `least_squares` and `lsq_linear` in `scipy.optimize`
(please read the 
[fitting strategy](https://github.com/xychcz/S3Fit/blob/main/manuals/fitting_strategy.md) for details). 
A strong dependency of S<sup>3</sup>Fit on these repositories is not expected. 
It is optional to run S<sup>3</sup>Fit with [PyNeb](http://research.iac.es/proyecto/PyNeb/), 
which is used to calculate intrinsic flux ratios of emission lines:
```
pip install s3fit[pyneb]
```

The test environment is list as follows. 
```
python = 3.10
scipy = 1.12.0
numpy = 1.26.4
astropy = 6.0.0
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](https://github.com/xychcz/S3Fit/blob/main/manuals/advanced_usage.md) manual).
- Add iron pseudo continuum templates and Balmer continuum of type-1 AGN.
- Test support for absorption lines. 

## Citation
If you would like to use S<sup>3</sup>Fit, please cite the paper [Chen et al. (2025)][1], in which a pure-spectral-fit mode of this code is firstly utilized. 
Please find details of the configuration of star formation history and kinematic parameters of emission lines in the paper. 

## Reference
S<sup>3</sup>Fit uses the Single Stellar Population (SSP) library [HR-pyPopStar][2] ([paper][3]). 
Please download the [HR-pyPopStar library][2] and run the 
[converting code](https://github.com/xychcz/S3Fit/blob/main/model_libraries/convert_popstar_ssp.py) 
to create the SSP models used for S<sup>3</sup>Fit. 
You may also want to download an example of the converted SSP model for test in [this link][7].

S<sup>3</sup>Fit uses the [SKIRTor][4] ([paper1][5], [paper2][6]) AGN torus model. 
Please download the [SKIRTor library][4] and run the 
[converting code](https://github.com/xychcz/S3Fit/blob/main/model_libraries/convert_skirtor_torus.py) 
to create the torus models used for S<sup>3</sup>Fit. 
Example of this library is also provided in 
[model libraries](https://github.com/xychcz/S3Fit/blob/main/model_libraries/) for a test of S<sup>3</sup>Fit, 
which contains the templates with a fixed dust density gradient in radial (p = 1) and angular direction (q = 0.5). 
Please refer to [SKIRTor][4] website for details of the model parameters. 

[1]: <https://iopscience.iop.org/article/10.3847/1538-4357/ad93ab>
[2]: <https://www.fractal-es.com/PopStar/>
[3]: <https://academic.oup.com/mnras/article/506/4/4781/6319511>
[4]: https://sites.google.com/site/skirtorus/sed-library?authuser=0
[5]: http://adsabs.harvard.edu/abs/2012MNRAS.420.2756S
[6]: http://adsabs.harvard.edu/abs/2016MNRAS.458.2288S
[7]: https://drive.google.com/file/d/1JwdBOnl6APwFmadIX8BYLcLyFNZvnuYg/view?usp=share_link


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "s3fit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "SED fitting, astronomy, galaxy, spectral fitting",
    "author": null,
    "author_email": "Xiaoyang Chen <xiaoyang.chen.cz@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/19/88/1479a2b06fa9c65ba3d3660b70eabae383d61fa43eb6353a0139d7d0e67e/s3fit-2.0.4.tar.gz",
    "platform": null,
    "description": "# S<sup>3</sup>Fit\n**S<sup>3</sup>Fit**: a <ins>**S**</ins>imultaneous <ins>**S**</ins>pectrum and photometric-<ins>**S**</ins>ED <ins>**Fit**</ins>ting code for observation of galaxies\n\nS<sup>3</sup>Fit is a Python-based tool for analyzing observational data of galaxies.\nIt offers powerful capabilities for decomposing spectroscopic data \nby supporting multiple continuum and emission line models with multiple components, \nmaking it well-suited for complex systems with mixed contributions \nfrom Active Galactic Nuclei (AGNs) and their host galaxies.\nBy simultaneously fitting the spectrum and multi-band photometric Spectral Energy Distribution (SED), \nS<sup>3</sup>Fit improves constraints on continuum model properties, \nwhich may be poorly determined when fitting spectral data alone due to its limited wavelength coverage.\nWith an optimized fitting strategy, \nS<sup>3</sup>Fit efficiently derives the best-fit solution for dozens of model parameters. \nAdditionally, it provides an extensible and user-friendly framework, \nallowing users to modify model configurations and incorporate new model components as needed.\n\n## Features of S<sup>3</sup>Fit\n- Easy switch between pure spectral fitting and joint spectrum+SED fitting modes.\n- Support for flexible combination of multiple stellar populations with different star formation histories (SFH). \n- Support for flexible combination of multiple emission line components.\n- Support for AGN continuum models across UV/optical and IR wavelength ranges.\n- User-friendly functions for outputting and visualizing fitting results.\n- Highly extensible framework, allowing users to add new features such as new SFH functions, emission lines, and custom model types.\n\n## Fitting strategy\nThe full fitting pipeline of S<sup>3</sup>Fit is shown in the following flowchart, \nwith a detailed description of the [fitting strategy](https://github.com/xychcz/S3Fit/blob/main/manuals/fitting_strategy.md) in \n[manuals](https://github.com/xychcz/S3Fit/blob/main/manuals/). \n<p align=\"center\"> <img src=\"https://github.com/user-attachments/assets/658a29b3-a2d8-470a-a08f-e4a045ef3ec3\" width=\"1200\">\n\nAn example of the fitting result of S<sup>3</sup>Fit is shown in the following plots. \n<p align=\"center\"> <img src=\"https://github.com/user-attachments/assets/683f5837-d364-4a53-8113-a05d56f9ef5b\" width=\"600\">\n\n## Usage\nPlease find guides in [manuals](https://github.com/xychcz/S3Fit/blob/main/manuals/) \nfor [basic](https://github.com/xychcz/S3Fit/blob/main/manuals/basic_usage.md) \nand [advanced](https://github.com/xychcz/S3Fit/blob/main/manuals/advanced_usage.md) usages of this code. \nAn example of the usage of S<sup>3</sup>Fit is provided in the \n[example](https://github.com/xychcz/S3Fit/blob/main/example/example.ipynb). \n\n## Installation\n\nYou can install S<sup>3</sup>Fit with [pip](https://pypi.org/project/s3fit/):\n```\npip install s3fit\n```\nS<sup>3</sup>Fit mainly depends on several most widely utilized repositories for science calculation, `scipy`, `numpy`, and `astropy`. \nThe core requirement of S<sup>3</sup>Fit is the two functions `least_squares` and `lsq_linear` in `scipy.optimize`\n(please read the \n[fitting strategy](https://github.com/xychcz/S3Fit/blob/main/manuals/fitting_strategy.md) for details). \nA strong dependency of S<sup>3</sup>Fit on these repositories is not expected. \nIt is optional to run S<sup>3</sup>Fit with [PyNeb](http://research.iac.es/proyecto/PyNeb/), \nwhich is used to calculate intrinsic flux ratios of emission lines:\n```\npip install s3fit[pyneb]\n```\n\nThe test environment is list as follows. \n```\npython = 3.10\nscipy = 1.12.0\nnumpy = 1.26.4\nastropy = 6.0.0\nmatplotlib = 3.9.1\npyneb = 1.1.23 (optional)\n```\n\n## Future updating\n- Add ISM dust and synchrotron models (you may also add them or other models by yourself following the\n  [advanced usage](https://github.com/xychcz/S3Fit/blob/main/manuals/advanced_usage.md) manual).\n- Add iron pseudo continuum templates and Balmer continuum of type-1 AGN.\n- Test support for absorption lines. \n\n## Citation\nIf you would like to use S<sup>3</sup>Fit, please cite the paper [Chen et al. (2025)][1], in which a pure-spectral-fit mode of this code is firstly utilized. \nPlease find details of the configuration of star formation history and kinematic parameters of emission lines in the paper. \n\n## Reference\nS<sup>3</sup>Fit uses the Single Stellar Population (SSP) library [HR-pyPopStar][2] ([paper][3]). \nPlease download the [HR-pyPopStar library][2] and run the \n[converting code](https://github.com/xychcz/S3Fit/blob/main/model_libraries/convert_popstar_ssp.py) \nto create the SSP models used for S<sup>3</sup>Fit. \nYou may also want to download an example of the converted SSP model for test in [this link][7].\n\nS<sup>3</sup>Fit uses the [SKIRTor][4] ([paper1][5], [paper2][6]) AGN torus model. \nPlease download the [SKIRTor library][4] and run the \n[converting code](https://github.com/xychcz/S3Fit/blob/main/model_libraries/convert_skirtor_torus.py) \nto create the torus models used for S<sup>3</sup>Fit. \nExample of this library is also provided in \n[model libraries](https://github.com/xychcz/S3Fit/blob/main/model_libraries/) for a test of S<sup>3</sup>Fit, \nwhich contains the templates with a fixed dust density gradient in radial (p = 1) and angular direction (q = 0.5). \nPlease refer to [SKIRTor][4] website for details of the model parameters. \n\n[1]: <https://iopscience.iop.org/article/10.3847/1538-4357/ad93ab>\n[2]: <https://www.fractal-es.com/PopStar/>\n[3]: <https://academic.oup.com/mnras/article/506/4/4781/6319511>\n[4]: https://sites.google.com/site/skirtorus/sed-library?authuser=0\n[5]: http://adsabs.harvard.edu/abs/2012MNRAS.420.2756S\n[6]: http://adsabs.harvard.edu/abs/2016MNRAS.458.2288S\n[7]: https://drive.google.com/file/d/1JwdBOnl6APwFmadIX8BYLcLyFNZvnuYg/view?usp=share_link\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "S3Fit: a Simultaneous Spectrum and photometric-SED Fitting code for observation of galaxies",
    "version": "2.0.4",
    "project_urls": {
        "Changelog": "https://github.com/xychcz/S3Fit/releases",
        "Documentation": "https://github.com/xychcz/S3Fit/tree/main/manuals",
        "Homepage": "https://github.com/xychcz",
        "Repository": "https://github.com/xychcz/S3Fit"
    },
    "split_keywords": [
        "sed fitting",
        " astronomy",
        " galaxy",
        " spectral fitting"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b5f1bdfa21f6c33e733fb42dff8186db998182019ea53dedd05ac673ce07eec1",
                "md5": "325ede7b8cc57cd9c3863db26f18deb2",
                "sha256": "33c592d95118b86a8f96248aaba5c37ac6d5da19679aa34cdf4a0a0b04008ba2"
            },
            "downloads": -1,
            "filename": "s3fit-2.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "325ede7b8cc57cd9c3863db26f18deb2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 52702,
            "upload_time": "2025-02-10T05:50:25",
            "upload_time_iso_8601": "2025-02-10T05:50:25.989502Z",
            "url": "https://files.pythonhosted.org/packages/b5/f1/bdfa21f6c33e733fb42dff8186db998182019ea53dedd05ac673ce07eec1/s3fit-2.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "19881479a2b06fa9c65ba3d3660b70eabae383d61fa43eb6353a0139d7d0e67e",
                "md5": "a059575ab614618414854132d7d60cd4",
                "sha256": "75d31947c9cb2ae6a3abbe05292cd63dde900a49cf790898acfff0b668152cf6"
            },
            "downloads": -1,
            "filename": "s3fit-2.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "a059575ab614618414854132d7d60cd4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 4515806,
            "upload_time": "2025-02-10T05:50:27",
            "upload_time_iso_8601": "2025-02-10T05:50:27.840118Z",
            "url": "https://files.pythonhosted.org/packages/19/88/1479a2b06fa9c65ba3d3660b70eabae383d61fa43eb6353a0139d7d0e67e/s3fit-2.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-10 05:50:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xychcz",
    "github_project": "S3Fit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "s3fit"
}
        
Elapsed time: 0.91549s