Skip to main content

A Python implementation of Alpha-shape Fitting to Spectrum (AFS) algorithm

Project description

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.9 or later, as well as the following packages:

numpy
scipy
matplotlib  
pandas
alphashape
shapely
loess

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.

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

pyafs_astro-0.1.0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyafs_astro-0.1.0-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file pyafs_astro-0.1.0.tar.gz.

File metadata

  • Download URL: pyafs_astro-0.1.0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.6.0

File hashes

Hashes for pyafs_astro-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d0bbcc2193b2cba026b7c869433a0d85fcbdb29d4abcb9f866e17e38adb9f2e
MD5 af881cf5d202a5943442bc5660a0f7f5
BLAKE2b-256 e29fb45096fac318866f3dc339ddcc79aba01b29c61132f33c6ca1fc5a3c8ccd

See more details on using hashes here.

File details

Details for the file pyafs_astro-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyafs_astro-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.6.0

File hashes

Hashes for pyafs_astro-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4bb8c3e36b495e6a72a9888276931c74ebfdce42e97d20898b47d99c501dc1a7
MD5 9fd919bd145cb14d037d71f3c00115a2
BLAKE2b-256 24edc5d3d21e4db5a905af2b9bc1d93b97e8c0e146c3c7d06c5466cfdb60eb33

See more details on using hashes here.

Supported by

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