pyAFS: A Python implementation for Alpha-shape Fitting to Spectrum (AFS) algorithm
pyAFS is a Python package that offers a third-party implementation of the Alpha-shape Fitting to Spectrum (AFS) algorithm.
Originally developed in R by Xu et. al. (2019), AFS provides a data-driven method for continuum fitting and spectrum normalisation.
The original R implementation can be found on GitHub.
Please note that pyAFS is independently developed and maintained.
For any bugs or issues related to pyAFS, please report them in this repository.
If you find this package useful, please consider citing the original paper:
@ARTICLE{2019AJ....157..243X,
author = {{Xu}, Xin and {Cisewski-Kehe}, Jessi and {Davis}, Allen B. and {Fischer}, Debra A. and {Brewer}, John M.},
title = "{Modeling the Echelle Spectra Continuum with Alpha Shapes and Local Regression Fitting}",
journal = {\aj},
keywords = {instrumentation: spectrographs, methods: data analysis, methods: statistical, techniques: radial velocities, techniques: spectroscopic, Astrophysics - Instrumentation and Methods for Astrophysics},
year = 2019,
month = jun,
volume = {157},
number = {6},
eid = {243},
pages = {243},
doi = {10.3847/1538-3881/ab1b47},
archivePrefix = {arXiv},
eprint = {1904.10065},
primaryClass = {astro-ph.IM},
adsurl = {https://ui.adsabs.harvard.edu/abs/2019AJ....157..243X},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
Installation
To install pyAFS, you can use pip:
pip install pyafs-astro
Alternatively, you can clone this repository and install the package locally:
git clone https://github.com/fengshun124/pyAFS.git
cd pyAFS
pip install .
Dependencies
pyAFS requires Python 3.10 or later, as well as the following packages:
numpy
pandas
alphashape
loess
scipy
shapely
matplotlib
Usage
A simple example of using afs is shown below:
import pandas as pd
from pyafs import afs
# load the spectrum data
data = pd.read_csv('spectrum.csv')
# normalise the spectrum
normalised_flux = afs(data['wavelength'], data['flux'])
A more detailed example can be found in the example notebook.
Metadata
Release files for pyafs-astro 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyafs_astro-0.2.0.tar.gz | 24.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyafs_astro-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 54.5 kB
Release files / pyafs_astro-0.2.0.tar.gz
| Download URL | pyafs_astro-0.2.0.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f46645357ac69427fc96017920a199b6d012ef4b2c90a79cf644dcd69962dd64
|
|
BLAKE2b-256 checksum How to use checksums |
3d09cf96db02054f9e190a28c82d80f28b5b2b81120177e9750a969fd994f6c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.13.9 Linux/6.17.5-200.fc42.x86_64
|
Release files / pyafs_astro-0.2.0-py3-none-any.whl
| Download URL | pyafs_astro-0.2.0-py3-none-any.whl |
|---|---|
| Size | 30.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5b0c1b525d17abc33857d611cb8a31ae9ab4cc518f2e24c5982dae19ca023c7
|
|
BLAKE2b-256 checksum How to use checksums |
5b3ae3859a2138bcebff5495e38f20d605d4419b195c05fa7399d93c0beb5410
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.13.9 Linux/6.17.5-200.fc42.x86_64
|