Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweaks to packaging #127

Merged
merged 15 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ target/
.idea/
.idea/*
.vscode/settings.json

sedkit/data/models/atmospheric/spexprismlibrary/index.p
17 changes: 17 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
authors:
- family-names: Filippazzo
given-names: Joseph
orcid: https://orcid.org/0000-0002-0201-8306
- family-names: Alejandro Merchan
given-names: Sherelyn
orcid: https://orcid.org/0000-0003-0548-0093
- family-names: Cruz
given-names: Kelle
orcid: https://orcid.org/0000-0002-1821-0650
cff-version: 1.2.0
doi: 10.5281/zenodo.14014658
repository-code: https://github.com/BDNYC/sedkit/
title: 'sedkit'
type: software
message: "If you use this software, please cite the Zenodo record"
license: BSD-3-Clause
24 changes: 7 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
The MIT License (MIT)
Copyright (c) 2024, Joe Filippazzo, Sherelyn Alejandro Merchan, Kelle Cruz

Copyright (c) 2019 Joe Filippazzo
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 changes: 22 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
[![Build Status](https://github.com/hover2pi/sedkit/actions/workflows/ci.yml/badge.svg)](https://github.com/hover2pi/sedkit/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/hover2pi/sedkit/badge.svg?branch=master&service=github)](https://coveralls.io/github/hover2pi/sedkit?branch=master)
[![Documentation Status](https://readthedocs.org/projects/sedkit/badge/?version=latest)](https://sedkit.readthedocs.io/en/latest/?badge=latest)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14014658.svg)](https://doi.org/10.5281/zenodo.14014658)


## 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 (f<sub>bol</sub>, M<sub>bol</sub>, L<sub>bol</sub>, T<sub>eff</sub>, mass, log(g)) using the methods presented in [Filippazzo et al. (2015)](http://adsabs.harvard.edu/abs/2015ApJ...810..158F).
`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 (f<sub>bol</sub>, M<sub>bol</sub>, L<sub>bol</sub>, T<sub>eff</sub>, mass, log(g)) using the methods presented in [Filippazzo et al. (2015)](http://adsabs.harvard.edu/abs/2015ApJ...810..158F) and described in the documentation: https://sedkit.readthedocs.io/.


## Installation

Install via PyPI with
Install in an environment with Python 3.11 or 3.12.

```
pip install sedkit
```
### Developer Instructions

or via `conda` with
If you plan to modify and/or contribute to the code, clone the repository and then install an editable version of the package and the requirements for running the tests.

```
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
pip install -e ".[test]"
```

## Demo
Expand Down Expand Up @@ -58,7 +58,7 @@ 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)
trap1.add_spectrum_file(spec_file, wave_units=u.um, flux_units=u.erg/u.s/u.cm**2/u.AA)
```

Other data which may affect the calculated and inferred fundamantal parameters can be set at any time.
Expand Down Expand Up @@ -201,20 +201,19 @@ trap1.evo_model = 'DUSTY00'
trap1.infer_mass()
```

<img src="https://github.com/hover2pi/sedkit/blob/master/sedkit/data/figures/Lbol_v_mass.png" height="400">

A variety of atmospheric model grids can be fit to the data with or without MCMC analysis,
<img src="sedkit/data/figures/Lbol_v_mass.png" height="400">

<!-- A variety of atmospheric model grids can be fit to the data with or without MCMC analysis,
```python
from sedkit import BTSettl
trap1.fit_modelgrid(BTSettl(), mcmc=True)
```
``` -->

And any arbitrary atlas of models can be applied as well.
Any arbitrary atlas of models (stored in `data\models\atmospheric`) can be used to fit the data with or without MCMC analysis.

```python
from sedkit import SpexPrismLibrary
trap1.fit_modelgrid(SpexPrismLibrary())
trap1.fit_modelgrid(SpexPrismLibrary(), mcmc=True)
```

Inspect the SED at any time with the interactive plotting method.
Expand All @@ -223,28 +222,22 @@ Inspect the SED at any time with the interactive plotting method.
trap1.plot(integral=True, best_fit=True)
```

<img src="https://github.com/hover2pi/sedkit/blob/master/sedkit/data/figures/sed_plot.png" height="500">
<img src="sedkit/data/figures/sed_plot.png" height="500">

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.

<img src="https://github.com/hover2pi/sedkit/blob/master/sedkit/data/figures/Lbol_v_SpT.png" height="500">
<img src="sedkit/data/figures/Lbol_v_SpT.png" height="500">

Please read the full documentation for details on this functionality and much more.
Please read the [full documentation](https://sedkit.readthedocs.io/en/latest/) for details on this functionality and much more.

## Documentation
## Documentation and Notebooks

Full documentation for the latest build can be found on [ReadTheDocs](https://sedkit.readthedocs.io/en/latest/).
Full documentation is available: https://sedkit.readthedocs.io/.

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

- [sedkit.spectrum.Spectrum](https://github.com/hover2pi/sedkit/blob/master/sedkit/notebooks/working_with_spectra.ipynb)
- [sedkit.sed.SED](https://github.com/hover2pi/sedkit/blob/master/sedkit/notebooks/create_sed.ipynb)
- [sedkit.catalog.Catalog](https://github.com/hover2pi/sedkit/blob/master/sedkit/notebooks/create_catalog.ipynb)

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.
- [sedkit.spectrum.Spectrum](sedkit/notebooks/working_with_spectra.ipynb)
- [sedkit.sed.SED](sedkit/notebooks/create_sed.ipynb)
- [sedkit.catalog.Catalog](sedkit/notebooks/create_catalog.ipynb)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"dill>=0.3.4",
"dustmaps>=1.0.9",
"emcee>=3.1.1",
"numpy>=1.25.1",
"numpy>=2.1.0",
"pandas>=1.3.5",
"scipy>=1.8.0",
"svo-filters>=0.4.4",
Expand Down
Binary file modified sedkit/data/figures/Lbol_v_SpT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sedkit/data/figures/Lbol_v_mass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sedkit/data/figures/sed_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion sedkit/tests/test_isochrone.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
(-4, 4 * q.Gyr, 'Lbol', 'logg', 5.395, 5.36, 5.43), # No xparam and yparam uncertaintiesd
# Young age
((-4, 0.1), (0.4 * q.Gyr, 0.1 * q.Gyr), 'Lbol', 'mass', 0.0515, 0.045, 0.055), # mass with uncertainties
((-4, 0.1), (0.4 * q.Gyr, 0.1 * q.Gyr), 'Lbol', 'logg', 5.08, 5.01, 5.15), # logg with uncertainties
((-4, 0.1), (0.4 * q.Gyr, 0.1 * q.Gyr), 'Lbol', 'logg', 5.085, 5.01, 5.15), # logg with uncertainties
((-4, 0.1), (0.4 * q.Gyr, 0.1 * q.Gyr), 'Lbol', 'radius', 0.105, 0.10, 0.11), # radius with uncertainties
# Old age
((-4, 0.1), (9 * q.Gyr, 0.1 * q.Gyr), 'Lbol', 'mass', 0.074, 0.070, 0.080), # mass with uncertainties
Expand Down
9 changes: 0 additions & 9 deletions source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ Install via PyPI with

pip install sedkit

or via ``conda`` with

.. code::

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

Contents
========
Expand Down
Loading