Skip to main content

framework for Bayesian, Neural Network based supernova light-curve classification

Project description

Paper DOI arXiv Data DOI

Logo

Build Status

Read the documentation

For the main branch: https://supernnova.readthedocs.io

The paper branch differs slightly from the master. Take a look to "changelog_paper_to_new_branch" or Build the docs for this branch.

Installation

Clone this repository (preferred)

git clone https://github.com/supernnova/supernnova.git

or install pip module (check versioning)

pip install supernnova

Read the paper

Links to the publication: MNRAS,ArXiv. All results quoted in these publications were produced using the branch "paper" which is frozen for reproducibility.

Please include the full citation if you use this material in your research: A Möller and T de Boissière, MNRAS, Volume 491, Issue 3, January 2020, Pages 4277–4293.

Table of contents

  1. Repository overview
  2. Getting Started 0. [Use Poetry in new releases]
    1. With Conda
    2. With Docker
  3. Usage
  4. Reproduce paper
  5. Pipeline Description
  6. Running tests
  7. Build the docs

Repository overview

├── supernnova              --> main module
    ├──data                 --> scripts to create the processed database
    ├──visualization        --> data plotting scripts
    ├──training             --> training scripts
    ├──validation           --> validation scripts
    ├──utils                --> utilities used throughout the module
├── tests                   --> unit tests to check data processing
├── sandbox                 --> WIP scripts

Getting started

With Conda

cd env

# Create conda environment
conda create --name <env> --file <conda_file_of_your_choice>

# Activate conda environment
source activate <env>

With Docker

cd env

# Build docker images
make cpu  # cpu image
make gpu  # gpu image (requires NVIDIA Drivers + nvidia-docker)

# Launch docker container
python launch_docker.py (--use_gpu to run GPU based container)

For more detailed instructions, check the full setup instructions

Usage

When cloning this repository:

# Create data
python run.py --data  --dump_dir tests/dump --raw_dir tests/raw --fits_dir tests/fits

# Train a baseline RNN
python run.py --train_rnn --dump_dir tests/dump

# Train a variational dropout RNN
python run.py --train_rnn --model variational --dump_dir tests/dump

# Train a Bayes By Backprop RNN
python run.py --train_rnn --model bayesian --dump_dir tests/dump

# Train a RandomForest
python run.py --train_rf --dump_dir tests/dump

When using pip, a full example is https://supernnova.readthedocs.io

# Python
import supernnova.conf as conf
from supernnova.data import make_dataset

# get config args
args =  conf.get_args()

# create database
args.data = True            # conf: making new dataset
args.dump_dir = "tests/dump"        # conf: where the dataset will be saved
args.raw_dir = "tests/raw"      # conf: where raw photometry files are saved 
args.fits_dir = "tests/fits"        # conf: where salt2fits are saved 
settings = conf.get_settings(args)  # conf: set settings
make_dataset.make_dataset(settings) # make dataset

Reproduce paper results

Please change to branch paper:

python run_paper.py

General pipeline description

  • Parse raw data in FITS format
  • Create processed database in HDF5 format
  • Train Recurrent Neural Networks (RNN) or Random Forests (RF) to classify photometric lightcurves
  • Validate on test set

Running tests with py.test

PYTHONPATH=$PWD:$PYTHONPATH pytest -W ignore --cov supernnova tests

Build docs

cd docs && make clean && make html && cd ..
firefox docs/_build/html/index.html

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

supernnova-3.0.1.tar.gz (82.4 kB view details)

Uploaded Source

Built Distribution

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

supernnova-3.0.1-py3-none-any.whl (97.7 kB view details)

Uploaded Python 3

File details

Details for the file supernnova-3.0.1.tar.gz.

File metadata

  • Download URL: supernnova-3.0.1.tar.gz
  • Upload date:
  • Size: 82.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-1016-azure

File hashes

Hashes for supernnova-3.0.1.tar.gz
Algorithm Hash digest
SHA256 00171b359d7bfcc00116f9fdb5633fdf2957943544965c4d7e6c79d1aec36c4a
MD5 83c4c9b63be4e2b985271ea0d54ecf99
BLAKE2b-256 735c36b01fc22f191904a9ffa4e772f28b348427d1f7f163b170e592079b612a

See more details on using hashes here.

File details

Details for the file supernnova-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: supernnova-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 97.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-1016-azure

File hashes

Hashes for supernnova-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b764f0b33b6a8e62c708bde21868574ede3915a9b3805234d99d50006514266
MD5 dc77906aaa606a6490f4ee41222990b4
BLAKE2b-256 da86a3a984238539bf11d3a2240eac4fc752fdac5f06bcca3ccc8a3b34ebbd38

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