[](https://travis-ci.org/andycasey/AnniesLasso)
[](https://coveralls.io/github/andycasey/AnniesLasso?branch=refactor)
[](https://scrutinizer-ci.com/g/andycasey/AnniesLasso/?branch=refactor)
[](https://github.com/andycasey/AnniesLasso/blob/refactor/LICENSE)
[See the documentation.](#)
## Authors
- **Andy Casey** (Cambridge) (Monash)
- **David W. Hogg** (NYU) (MPIA) (SCDA)
- **Melissa K. Ness** (MPIA)
- **Hans-Walter Rix** (MPIA)
- **Anna Y. Q. Ho** (Caltech)
- **Gerry Gilmore** (Cambridge)
## License
**Copyright 2017 the authors**.
The code in this repository is released under the open-source **MIT License**.
See the file `LICENSE` for more details.
## Installation
To install:
``
pip install https://github.com/andycasey/AnniesLasso/archive/refactor.zip
``
## Getting Started
Let us assume that you have rest-frame continuum-normalized spectra for a set of
stars for which the stellar parameters and chemical abundances (which we will
collectively call *labels*) are known with high fidelity. The labels for those
stars (and the locations of the spectrum fluxes and inverse variances) are
assumed to be stored in a table. In this example all stars are assumed to be
sampled on the same wavelength (dispersion) scale.
Here we will create and train a 3-label (effective temperature, surface gravity,
metallicity) quadratic (e.g., `Teff^2`) model:
````python
import numpy as np
from astropy.table import Table
import AnniesLasso as tc
# Load the table containing the training set labels, and the spectra.
training_set = Table.read("training_set_labels.fits")
# Here we will assume that the flux and inverse variance arrays are stored in
# different ASCII files. The end goal is just to produce flux and inverse
# variance arrays of shape (N_stars, N_pixels).
normalized_flux = np.array([np.loadtxt(star["flux_filename"]) for star in training_set])
normalized_ivar = np.array([np.loadtxt(star["ivar_filename"]) for star in training_set])
# Providing the dispersion to the model is optional, but handy later on.
dispersion = np.loadtxt("common_wavelengths.txt")
# Create the model that will run in parallel using all available cores.
model = tc.CannonModel(training_set, normalized_flux, normalized_ivar,
dispersion=dispersion, threads=-1)
# Specify the complexity of the model:
model.vectorizer = tc.vectorizer.NormalizedPolynomialVectorizer(labelled_set,
tc.vectorizer.polynomial.terminator(("TEFF", "LOGG", "FEH"), 2))
# Train the model!
model.train()
````
You can follow this example further in the complete [Getting Started](#) tutorial.
Metadata
Release files for the-cannon 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| the-cannon-0.2.6.tar.gz | 25.5 kB | Without provenance | Details for the-cannon-0.2.6.tar.gz |
Release files / the-cannon-0.2.6.tar.gz
| Download URL | the-cannon-0.2.6.tar.gz |
|---|---|
| Size | 25.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
727178f1be58cd3c0781dee23755053faee2a93d71eb3be4f80849ddcfc1f4ef
|
|
BLAKE2b-256 checksum How to use checksums |
662916938507e570d73c2242e8b46bb1854f00d7704675b73277ee5d3bd753d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for the-cannon 0.2.6
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.