BYOST (Build Your Own Spectral Template)#

Using Principal Component analysis (PCA) and Gaussian Process Regression (GPR) to build a spectral template based on two conditions (such as time and light-curve-shape parameter). This work is initially developped to construct the NIR spectral template of type Ia supernovae using the data obtained by CSP-II, see our publication for details.

But it does NOT need to be limited to spectroscopic data, you can use this for other modeling purposes as long as the dataset and attached conditions show correlations (all value need to be finite). The major process is:

  • Apply PCA on the dataset to reduce the dimension to a small subspace

  • Moeling the subspace (PC projection values) dependence on the given conditons using GPR

  • Inverse PCA transformation using the predicted PC from GPR given disired condition

Installation#

Option 1 — install with pip (for users):

pip install BYOST

Option 2 — install from source with uv:

git clone https://github.com/DeerWhale/BYOST.git
cd BYOST
uv sync

Use uv run python (or uv run pytest) to run commands in the project environment. For tests and docs: uv sync --extra dev.

Quick guide#

1. General useage of this packge#

For general useage of the this packge, please see the documentation page.

2. NIR spectral template for Type Ia Supernovae from Lu et al. 2023#

The Lu et al. 2023 NIR template building blocks ship with the package (BYOST/files/NIR_template_buildingblocks.h5). No extra download is required:

from BYOST.template import get_Lu2023_NIR_template

epoch = 10   # rest-frame days since B-band maximum
sBV = 0.9    # color stretch

wave, flux = get_Lu2023_NIR_template(epoch, sBV)
# wave: wavelength in Angstroms; flux: template flux (arbitrary units)

epoch and sBV must be single numbers (not lists). Optional keyword GPR_score_threshold (default 0.2) controls which principal components are included in the reconstruction.

Citations#

If you used this package for your research work, please kindly cite our paper, much appriciated! :)