SpecFANN - Spectroscopic Fitting via Artificial Neural Networks
Project description
SpecFANN 1.0.0
Introduction
SpecFANN (Spectroscopic Fitting via Artificial Neural Networks) is a deep learning based FASTWIND emulator and spectroscopic fitting suite written in Python. Using a series of neural networks trained to emulate individual FASTWIND line profiles, SpecFANN allows the user to very quickly produce forward models for any subset of the ~140 included spectral lines, and allows the user to fit observed spectra using various minimization techniques and samplers. SpecFANN is also built in a flexible way such that if users have thier own trained neural networks, these can be dropped in to replace the provided networks, while still being able to use all of the framework set up here. For details on how the code works, please see the corresponding release paper: (coming soon)
Installation
There are several ways to install SpecFANN, depending on your specific needs.
pip
The easiest way to install SpecFANN is via pip:
pip install specfann
From source
If you prefer, you can install SpecFANN from the source with the following steps:
-
Clone the git repository to create a local copy.
git clone https://github.com/MichaelAbdul-Masih/SpecFANN.git -
Once downloaded, you can perform a local pip install:
cd SpecFANN/ pip install .
Installing the neural network bundles
In addition to the git repository, you will need to download the bundle of neural networks that SpecFANN uses to generates models. These can be downloaded here. Alternatively, we have provided a convenience function that will retrieve the bundles directly from the cloud and store them in the default directory ~/.specfann/bundles/. This can be done by calling the following specfann function:
import specfann
specfann.install_bundle(bundle_name='MW_v1.4', bundle_path = None)
Where bundle_name is the name of the bundle and bundle_path is an optional parameter if you prefer to store the bundle in a location different than the default. For now, two bundles are available corresponding to Milky Way and SMC metallicity: the MW_v1.4.tgz and SMC_v1.0 bundles (~2GB each). While SpecFANN is written in a way where the bundle can be stored in any location, we recommend that to begin, you use the convenience function provided above, however if you wish to set up the bundles manually, you can place the bundle in your preferred directory and untar it there. By default, SpecFANN will look for the MW_v1.4 bundle in the ~/.specfann/bundles/ directory but an alternative bundle and/or bundle file path can be specified later.
mv ~/Downloads/MW_v1.4.tgz ~/.specfann/bundles/.
cd ~/.specfann/bundles/
tar -xvzf MW_v1.4.tgz
Test the Installation
To make sure the installation was successful, ensure you are in the correct python environment, initiate a python instance and run the following commands:
import specfann
s = specfann.single_star()
If there is no error message following the second command, then things should be working properly. If you placed the bundle in a different location than what was recommended above, then in the call to specfann.single_star(), you will need to pass the path to the bundle using the bundle_path = argument:
import specfann
s = specfann.single_star(bundle_path = 'path/to/MW_v1.4')
Getting Started
We've prepared a jupyter notebook that shows the SpecFANN workflow, and what customization options are available to fit your specific science case. This can be found in the SpecFANN_Tutorial.ipynb notebook in the SpecFANN github repository. You will also need the example spectrum in the data folder. We recommend that you start here to learn the basics.
Change Log
1.0.0 - official release of SpecFANN v1.0
- If upgrading from a prerelease version (i.e. v0.X.X), you will need to do a clean install. Please note that specfann saved files from previous versions will not work with v1.0.0. Moving forward we will do our best to ensure backwards compatibility. Important changes will be documented in the Change Log for each new release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file specfann-1.0.0.tar.gz.
File metadata
- Download URL: specfann-1.0.0.tar.gz
- Upload date:
- Size: 51.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6949bc9cd35aeeca8d2acdb6593a53bb321ff05f420a9f704aee5be26aacd02
|
|
| MD5 |
d124a083f8f5e41a20fbf2736f2a0463
|
|
| BLAKE2b-256 |
4e68f8a5a08b98ce2cd56c8b07977b4284639d662a2e7abd54134be935341186
|
File details
Details for the file specfann-1.0.0-py3-none-any.whl.
File metadata
- Download URL: specfann-1.0.0-py3-none-any.whl
- Upload date:
- Size: 54.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d1984ac2bfb5f61b9143e66a5f1c8d75a52f1923f2de009b3cb67f180d4bac6
|
|
| MD5 |
8b2241ca30cbec043f041165520490ee
|
|
| BLAKE2b-256 |
695d4cc68a3a64d26908abe9d44501ec264bed0aa8664c538e57e908c4a79812
|