Skip to main content

Spectral energy distribution construction and analysis tools

Project description

sedkit

Powered by Astropy Build Status Coverage Status Documentation Status

Introduction

sedkit is a collection of pure Python modules for simple SED construction and analysis. Users can create individual SEDs or SED catalogs from spectra and/or photometry and calculate fundamental parameters (fbol, Mbol, Lbol, Teff, mass, log(g)) using the methods presented in Filippazzo et al. (2015).

Installation

Install via PyPI with

pip install sedkit

or via conda with

git clone https://github.com/hover2pi/sedkit.git
cd sedkit
conda env create -f env/environment-3.11.yml --force
conda activate sedkit
python setup.py install

Demo

An SED can be constructed by importing and initializing an SED object.

from sedkit import SED
trap1 = SED(name='Trappist-1')

The name argument triggers a lookup in the Simbad database for meta, astrometric, and spectral type data. Interstellar reddening is calculated when possible.

Photometry can be added manually...

trap1.add_photometry('Johnson.V', 18.798, 0.082, '2006AJ....132.1234C')
trap1.add_photometry('Cousins.R', 16.466, 0.065, '2006AJ....132.1234C')
trap1.add_photometry('Cousins.I', 14.024, 0.115, '2006AJ....132.1234C')

...and/or retrieved from Vizier catalogs with built-in methods.

trap1.find_2MASS()
trap1.find_WISE()

Spectrum arrays or ASCII/FITS files can also be added to the SED data.

from pkg_resources import resource_filename
spec_file = resource_filename('sedkit', 'data/Trappist-1_NIR.fits')
import astropy.units as u
trap1.add_spectrum_file(spec_file, wave_units=u.um, flux_units=u.erg/u.s/q.cm**2/u.AA)

Other data which may affect the calculated and inferred fundamantal parameters can be set at any time.

trap1.spectral_type = 'M8', '2006AJ....132.1234C'
trap1.age = 7.6*u.Gyr, 2.2*u.Gyr, '2017ApJ...845..110B'
trap1.radius = 0.121*u.R_sun, 0.003*u.R_sun, '2021PSJ.....2....1A'

Results can be calculated at any time by checking the results property.

trap1.results
param value unc units
name Trappist-1 -- --
ra 346.6223683333333 -- --
dec -5.0413974999999995 -- --
age 7.6 2.2 Gyr
Lbol 2.24e+30 6.49e+28 erg / s
Lbol_sun -3.23 0.013 --
Mbol 12.836 0.031 --
SpT M8V -- --
Teff 2581 37 K
fbol 1.21e-10 3.49e-12 erg / (cm2 s)
logg 5.281466666666667 0.005382456140353042 --
mass 0.0921333333333333 0.0013456140350877333 solMass
mbol 13.308 0.031 --
membership -- -- --
parallax 80.4512 0.12110000103712082 mas
radius 0.121 0.003 solRad
reddening 9.259104263037443e-05 -- --
spectral_type 68.0 0.5 --

A variety of evolutionary model grids can be used to infer fundamental parameters,

trap1.evo_model = 'DUSTY00'
trap1.infer_mass()

A variety of atmospheric model grids can be fit to the data with or without MCMC analysis,

from sedkit import BTSettl
trap1.fit_modelgrid(BTSettl(), mcmc=True)

And any arbitrary atlas of models can be applied as well.

from sedkit import SpexPrismLibrary
trap1.fit_modelgrid(SpexPrismLibrary())

Inspect the SED at any time with the interactive plotting method.

trap1.plot(integral=True, best_fit=True)

References for all data can be accessed via the refs attribute.

Entire catalogs of SED objects can also be created and their properties can be arbitrarily compared and analyzed with the sedkit.catalog.Catalog() object.

Please read the full documentation for details on this functionality and much more.

Documentation

Full documentation for the latest build can be found on ReadTheDocs.

The package also contains detailed Jupyter notebooks highlighting the core functionality of its primary classes, including

If you use or reference this software, please cite Filippazzo et al. (submitted to PASP)

Licensed

This project is Copyright (c) Joe Filippazzo and licensed under the terms of the BSD 3-Clause license. See the licenses folder for more information.

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

sedkit-2.0.3.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

sedkit-2.0.3-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

Details for the file sedkit-2.0.3.tar.gz.

File metadata

  • Download URL: sedkit-2.0.3.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sedkit-2.0.3.tar.gz
Algorithm Hash digest
SHA256 9adb71fc28854e4badf2fc0bceff428c8c2fb2e288718acd3aa1ffb78e01e569
MD5 85ecfb6508eaff45948e01fcfb9ecf13
BLAKE2b-256 945bab43ecb8ee9bafa64cab313cc2c0ebb6075831af3d13e41d3c2c58a7abd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for sedkit-2.0.3.tar.gz:

Publisher: publish_pypi.yml on BDNYC/sedkit

Attestations:

File details

Details for the file sedkit-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: sedkit-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sedkit-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bc1f3c2052825306ed790ed04c4eee7c53843b28fcea6d9ecd7355d66e6a5f73
MD5 c21a191ddc5bf977120a03bc7fd28582
BLAKE2b-256 95ccc322da740884f67f4220647b3b32313bc35bf7081ec49edd73ac4a322111

See more details on using hashes here.

Provenance

The following attestation bundles were made for sedkit-2.0.3-py3-none-any.whl:

Publisher: publish_pypi.yml on BDNYC/sedkit

Attestations:

Supported by

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