Skip to main content

FortesFit

FortesFit is a Python-based multi-component SED (Spectral Energy Distribution) fitting package. It is a set of classes that enable easy management of parameterised SED model libraries. These models serve as building blocks of an additive model that can be fit to an observed SED to constrain the model parameters.

Background

In astronomy, Spectral Energy Distributions (SEDs) are discretely sampled functions of energy that describe the luminous output of an astronomical object. The independent variable is the photon energy of radiation, often represented by frequency or wavelength. The dependent variable is the energy flux from the object, usually represented in energy units such as erg/s or Watts.

SEDs are the fundamental spectral (i.e., energy-dependent) descriptions of astronomical bodies, since electromagnetic radiation is often the only messenger of information available for objects in deep space. An SED may be understood as the emission from various components that add (or absorb) linearly along the line of sight to an astronomical body. Therefore, the main aim of SED analysis is to use an observed SED to identify and constrain the contributions from these different components.

FortesFit distinguishes between SEDs and spectrograms (or spectra). Unlike spectra, which are contiguous and have higher resolution, SEDs are composed of photometric data taken through different filter bands (physical or synthetic). In this context, A filter band describes the response of the astronomical observation (composed of the atmosphere, telescope, instrument, and detector) to the light from the source. Therefore, it encapsulates the actual spectral information inherent in the corresponding photometry from the SED.

Installation and initial setup

The recommended way to install FortesFit is through pip. The latest version can be installed using

pip install fortesfit

You will need to do the following initial setup before you can use FortesFit for your science.

  1. Set an environment variable FORTESFITPATH. This is the directory where all the filters and models will be stored. On Unix systems, you can do this using:
    export FORTESFITPATH="/path/to/your/directory"
    

Note: You will have to do this each time you open a new terminal session. Alternatively, you can automatically set the environment variable upon activation of a specific conda environemt, or add the path to your .bashrc or equivalent.

  1. Create test filters and models:
    python -c "from fortesfit import FortesFit_Init"
    
  2. Run a test script which does an end-to-end fit using the testing setup:
    python -c "from fortesfit import FortesFit_installation_test"
    

Once the setup is successful, the user writes a Python program that incorporates FortesFit classes and functions to set up the data, models, priors, engine, and output for a fit. A typical workflow is given below.

Using FortesFit

Features

  • Full control on filters and models. This makes it easy to add any filters or your own models! You are also free to define the model parameters as you please. However, this can be daunting at first, please refer to examples repository for pre-packaged models.
  • Model dependencies allow users to define quantities derived from the original model parameters. These dependencies can then be used to set priors or even tie together fluxes from different filters.
  • Choice of fitting engine through FortesFit_Preparation module. At present, FortesFit offers an MCMC engine from the EMCEE package, and nested sampling engine MultiNest through PyMultinest. (Note: MultiNest needs to be installed seperately by the user.)
  • Full control on priors by specifying your own prior in form of probability density function.

Basic fitting workflow

A basic FortesFit workflow may look like following

  1. Register filters using the routines in FortesFit_Filters. These will be stored on disk for future projects.
  2. Register models using the routines in FortesFit_ModelManagement. These will also be stored on disk for future use. Filters can be freely added to existing models after registration.
  3. Set up observed SED(s) using routines in FortesFit_Preparation. The photometry is homogenised at this stage using astropy's units functionality.
  4. Initialise priors. FortesFit is unique in astronomical SED fitting codes for its versatile use of priors. These may be specified in the form of a grid or using SciPy's built-in distributions. Parameters without user-defined priors are assigned a default uniform prior. However, parameters that determine the scale of the SED components (for e.g., the luminosity or stellar mass of a template) must have their priors defined.
  5. Set up the fit by combining models and priors using routines in FortesFit_Preparation. This is also the point where the mechanics of the fit (output files, fitting algorithm, etc.) are chosen.
  6. Run the fit using routines in FortesFit_Fitting.
  7. Examin the fit results using routines in FortesFit_Plots and FortesFit_Parsers.

Tutorials, examples and additional resources

A number of resources related to FortesFit can be found in this repository. Some of the things included in the repository are tutorials (in form of jupyter notebooks), demonstrations of advanced features, pre-made models and filters.

Who has used FortesFit?

  • The infra-red SEDs of nearby AGN from 1-1000 um with stellar, AGN and SF-heated dust components (Rosario+ 2017)
  • The mid-far infrared SEDs of a few local AGN with clumpy torus SED models (5-10 parameters) and SF-heated dust.
  • UV to sub-mm SEDs of high-redshift AGN in the KASHz survey.
  • Your project here!

Metadata

Release files for fortesfit 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fortesfit 2.0.0
File Size Uploaded Provenance Actions
fortesfit-2.0.0.tar.gz 50.4 kB Without provenance Details for fortesfit-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fortesfit 2.0.0
File Interpreter ABI Platform Actions
fortesfit-2.0.0-py3-none-any.whl Python 3 none any Details for fortesfit-2.0.0-py3-none-any.whl

Total release size: 109.2 kB

Release files / fortesfit-2.0.0.tar.gz

Download URL fortesfit-2.0.0.tar.gz
Size 50.4 kB
Tags Source
SHA-256 checksum
How to use checksums
23488dff90d16efb3a025b655642d58a864c7c81731b808343bc0a04dda83483
BLAKE2b-256 checksum
How to use checksums
1b3f42d01064496fde54b9fa697bcce3c576ee582f2361b62199e5809fd6b655
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.7

Release files / fortesfit-2.0.0-py3-none-any.whl

Download URL fortesfit-2.0.0-py3-none-any.whl
Size 58.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ccd6ce1376ce0c68bcd4fc32fda07a13d351b7634ec92276bcb1c69b6fbd2f1
BLAKE2b-256 checksum
How to use checksums
b2d8ab1a4f08dbff809d37a5454b8801d42ea1a23f8af477756fee4be9d8878c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.7

Security for fortesfit 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page