ascl_id stringclasses 752
values | repo_url stringclasses 737
values | file_path stringlengths 4 194 | content large_stringlengths 1 1M | language stringclasses 29
values | license_type stringclasses 24
values | size int64 1 1M |
|---|---|---|---|---|---|---|
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | montecarlo_test.py | #!/usr/bin/python
"""
Monte Carlo through a load of random realisations of a model (without MPI).
"""
import numpy as np
from potentials import *
import sys
BASE_SEED = 500
# Get commandline arguments
try:
myid = int(sys.argv[1])
mtype = sys.argv[2]
clambda = True if 't' in str(sys.argv[3]).lower() else F... | Python | MIT | 5,444 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | potentials.py | #!/usr/bin/python
"""
Define various quintessence potentials.
"""
import numpy as np
import scipy.stats
from scipy.misc import factorial
from solve import DEModel
class Polynomial(DEModel):
def __init__(self, N=1, p=1, clambda=0., symmetric=False,
log_prior=False, **kwargs):
"""
... | Python | MIT | 12,727 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | combine_priors.py | #!/usr/bin/python
"""
Make combined histogram of priors.
"""
import numpy as np
#import pylab as P
#import matplotlib.cm as cm
#import cProfile
import sys
NBINS = 500 # No. bins in each direction
WAMAX = 5.
W0MIN = -2.
W0MAX = 1.
fom = float(sys.argv[1])
# Load Fisher matrix for Euclid
pw0 = 19; pwa = 20
covmat = np... | Python | MIT | 3,499 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | plot_dots.py | #!/usr/bin/python
"""
Plot w0-wa for a bunch of models.
"""
import numpy as np
import pylab as P
import matplotlib.cm as cm
import matplotlib.patches
import matplotlib.ticker
import scipy.ndimage
import sys
sys.path.append("/home/phil/oslo/bao21cm/")
import baofisher
colours = [ ['#6B6B6B', '#BDBDBD'],
['#... | Python | MIT | 2,432 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | cut_sample.py | #!/usr/bin/python
"""
Apply cuts to sample and output clean sample set.
"""
import numpy as np
import pylab as P
import matplotlib.cm as cm
import matplotlib.patches
import sys, os
# Get name from commandline
try:
NAME = sys.argv[1]
except:
print "Expected one argument: name (weyl, kac, eft, etc.)"
sys.exi... | Python | MIT | 2,378 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | plot_w0wa.py | #!/usr/bin/python
"""
Plot w0-wa for a bunch of models.
"""
import numpy as np
import pylab as P
import matplotlib.cm as cm
import matplotlib.patches
import matplotlib.ticker
import scipy.ndimage
import sys
sys.path.append("/home/phil/oslo/bao21cm/")
import baofisher
colours = [ ['#6B6B6B', '#BDBDBD'],
['#... | Python | MIT | 7,181 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | calc_relative_entropy.py | #!/usr/bin/python
"""
Calculate relative entropy for a given DE model.
"""
import numpy as np
import pylab as P
NBINS = 1000 # Need high resolution for small FOM
WAMAX = 5. #30. # Prior range on w_a (larger encompasses more of the range of models)
W0MIN = -2.
W0MAX = 1.
THETA = 90. * np.pi/180. # Rotation angle for (w... | Python | MIT | 4,280 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | plot_mosaic.py | #!/usr/bin/python
"""
Plot w0-wa mosaic for a bunch of models.
"""
import numpy as np
import pylab as P
import matplotlib.cm as cm
import matplotlib.patches
import matplotlib.ticker
import scipy.ndimage
import sys
sys.path.append("/home/phil/oslo/bao21cm/")
import baofisher
"""
colours = [ ['#6B6B6B', '#BDBDBD'],
... | Python | MIT | 5,944 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | plot_results.py | #!/usr/bin/python
"""
Plot results of a run.
"""
import numpy as np
import pylab as P
w0, wa, h, ol, om, orad = np.load("values.npy").T
P.subplot(211)
P.plot(w0, wa, 'b.')
P.xlim((-2., 2.))
P.ylim((-20., 20.))
P.xlabel("w0")
P.ylabel("wa")
P.plot([-1.,], [0.,], 'kx')
P.subplot(212)
P.plot(om, ol, 'r.')
P.xlim((0.,... | Python | MIT | 423 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | plot_fnz_density.py | #!/usr/bin/python
"""
Plot w0-wa mosaic for a bunch of models.
"""
import numpy as np
import pylab as P
import matplotlib.cm as cm
import matplotlib.patches
import matplotlib.ticker
i = 0
#root = "data/weyl-lambda"
#root = "data/kac-lambda"
#root = "data/eft-lambda"
#root = "data/mono-lambda"
ax = P.subplot(111)
zz ... | Python | MIT | 1,021 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | process_uncut.py | #!/usr/bin/python
"""
Output dirty sample set (i.e. without cuts applied, but consolidated into one file).
"""
import numpy as np
import pylab as P
import matplotlib.cm as cm
import matplotlib.patches
import sys, os
# Get name from commandline
try:
NAME = sys.argv[1]
except:
print "Expected one argument: name ... | Python | MIT | 1,205 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | montecarlo.py | #!/usr/bin/python
"""
Monte Carlo through a load of random realisations of a model.
"""
import numpy as np
#import pylab as P
from potentials import *
#from mpi4py import MPI
BASE_SEED = 10
NSAMP_PER_WORKER = 1000 # No. of samples to return per worker
# Setup MPI
comm = MPI.COMM_WORLD
myid = comm.Get_rank()
size = ... | Python | MIT | 3,145 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | onerun.py | #!/usr/bin/python
"""
Testing: Do single run and check
"""
import numpy as np
import pylab as P
from potentials import *
np.random.seed(10)
Nsamp = 10
# Setup integrator
X0 = 1e0 # a0 / a_ref (also defined in solve.py)
EFOLDS_BEFORE_EQ = 1e-2
# Define generic priors on potential parameters
m = ShiftSymmEFT2(A=1., cl... | Python | MIT | 1,692 |
[ascl:2105.019] | https://gitlab.com/random-quintessence/random-quintessence | solve.py | #!/usr/bin/python
"""
Integrate Raychaudhuri and Klein-Gordon equation for quintessence model.
"""
import numpy as np
import scipy.integrate
X0 = 1e0 # a0 / a_ref
#EFOLDS_BEFORE_EQ = 1e-2
class DEModel(object):
"""
Class for defining a dark energy model.
"""
def __init__(self, A, zeq=3200., Tcmb=... | Python | MIT | 8,029 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | rapid_antares_stage.py | import traceback
import time
import numpy as np
from astrorapid.classify import Classify
# Reset Tensorflow
from tensorflow.keras import backend as K
K.clear_session()
# Load model from disk
classification = Classify(bcut=True, zcut=None)
def delete_indexes(deleteindexes, *args):
newarrs = []
for arr in a... | Python | MIT | 3,859 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | README.md | # astrorapid
Real-time Automated Photometric IDentification (RAPID) of astronomical transients using deep learning
For full documentation, please go to https://astrorapid.readthedocs.io
# Installation
```bash
pip install astrorapid
```
# Example Usage
```python
from astrorapid.classify import Classify
mjd = [57433... | Markdown | MIT | 3,349 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | read_from_lasair.py | import numpy as np
from collections import OrderedDict
import json
from six.moves.urllib.request import urlopen
from astroquery.irsa_dust import IrsaDust
import astropy.coordinates as coord
import astropy.units as u
from astrorapid.classify import Classify
from astrorapid.helpers import delete_indexes, convert_lists_... | Python | MIT | 48,975 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | requirements.txt | absl-py==0.13.0
astropy==4.2.1
astunparse==1.6.3
cachetools==4.2.2
certifi==2021.5.30
chardet==4.0.0
cycler==0.10.0
Cython==0.29.23
flatbuffers==1.12
gast==0.4.0
google-auth==1.32.1
google-auth-oauthlib==0.4.4
google-pasta==0.2.0
grpcio==1.34.1
h5py==3.1.0
idna==2.10
joblib==1.0.1
Keras==2.4.3
keras-nightly==2.5.0.dev2... | Text | MIT | 1,016 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | setup.py | from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(name='astrorapid',
version='0.2... | Python | MIT | 3,510 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | .github/workflows/build.yml | name: Build and test
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7]
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
... | YAML | MIT | 703 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/__init__.py | from astrorapid.classify import Classify
name = "astrorapid"
| Python | MIT | 62 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/get_custom_data.py | import os
import pickle
import numpy as np
import multiprocessing as mp
from astrorapid.read_snana_fits import read_light_curves_from_snana_fits_files
from astrorapid.process_light_curves import InputLightCurve
def get_custom_data(class_num, data_dir, save_dir, passbands, known_redshift, nprocesses, redo):
"""
... | Python | MIT | 4,806 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/classifier_metrics.py | """
Plot overall classification performance metrics.
"""
import os
import sys
import numpy as np
import itertools
from distutils.spawn import find_executable
from sklearn.metrics import roc_curve, auc
from sklearn.metrics import precision_recall_curve
from sklearn.metrics import f1_score
from sklearn.metrics import av... | Python | MIT | 10,577 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/get_training_data.py | import os
import pickle
import numpy as np
from astrorapid.read_snana_fits import read_light_curves_from_snana_fits_files
from astrorapid.helpers import delete_indexes
from astrorapid.process_light_curves import InputLightCurve
def get_data(get_data_func, class_num, data_dir, save_dir, passbands, known_redshift=True... | Python | MIT | 7,693 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/train_on_ztf_snana_sims.py | import os
import astrorapid.get_training_data
import astrorapid.get_custom_data
from astrorapid.custom_classifier import create_custom_classifier
def main():
""" Train Neural Network classifier """
script_dir = os.path.dirname(os.path.abspath(__file__))
create_custom_classifier(get_data_func=astrorapid.... | Python | MIT | 1,834 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/prepare_training_set.py | import os
from sklearn.model_selection import train_test_split
from tensorflow.keras.utils import to_categorical
import pickle
import multiprocessing as mp
import numpy as np
import copy
from sklearn.utils import shuffle
from astrorapid import helpers
from astrorapid.get_training_data import get_data
from astrorapid.p... | Python | MIT | 22,440 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/plot_metrics.py | import os
import numpy as np
import pandas as pd
from distutils.spawn import find_executable
from scipy.interpolate import interp1d
from tensorflow.keras.utils import to_categorical
from sklearn.metrics import confusion_matrix
from collections import OrderedDict
from astrorapid.classifier_metrics import plot_confusion... | Python | MIT | 27,573 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/classify.py | import os
import numbers
import numpy as np
from collections import OrderedDict
from tensorflow.keras.models import load_model
from pkg_resources import resource_filename
from distutils.spawn import find_executable
from tcn import TCN, tcn_full_summary
from astrorapid.process_light_curves import read_multiple_light_cu... | Python | MIT | 32,499 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/save_ztf_data_from_osc.py | import numpy as np
from collections import OrderedDict
import json
from six.moves.urllib.request import urlopen
from astroquery.irsa_dust import IrsaDust
import astropy.coordinates as coord
import astropy.units as u
import pickle
import urllib.request
from astrorapid.helpers import delete_indexes, convert_lists_to_arr... | Python | MIT | 16,749 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/example.py | from astrorapid.classify import Classify
def main(graph=None, model=None):
"""
Example code to run astrorapid.
Ignore the graph and model parameter inputs unless you wish to do your own multithreading.
(Note: astrorapid already performs its own parallelisation based on a keras and tensorflow backend)... | Python | MIT | 3,930 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/process_light_curves.py | from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.cosmology import WMAP9 as cosmo
import numpy as np
import pandas as pd
from astrorapid import helpers, model_early_lightcurve
from astrorapid.ANTARES_object.LAobject import LAobject
class InputLightCurve(object):
def __init__(se... | Python | MIT | 7,676 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/prepare_arrays.py | import numpy as np
from scipy.interpolate import interp1d
from astrorapid import helpers
# fix random seed for reproducibility
np.random.seed(42)
class PrepareArrays(object):
def __init__(self, passbands=('g', 'r'), contextual_info=('redshift',), nobs=50, mintime=-70, maxtime=80,
timestep=3.0):... | Python | MIT | 5,380 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/helpers.py | import numpy as np
def find_nearest(array, value):
"""
Find the index nearest to a given value.
Adapted from: https://stackoverflow.com/questions/2566412/find-nearest-value-in-numpy-array
"""
array = np.asarray(array)
idx = (np.abs(array - value)).argmin()
return idx
def delete_indexes... | Python | MIT | 2,330 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/neural_network_model.py | import os
import numpy as np
import pickle
from tensorflow.keras.models import Sequential
from tensorflow.keras.models import load_model
from tensorflow.keras.layers import Dense, Input
from tensorflow.keras.layers import LSTM, GRU
from tensorflow.keras.layers import Dropout, BatchNormalization, Activation, TimeDistrib... | Python | MIT | 4,041 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/train_on_ztf_real_data.py | import os
import astrorapid.get_training_data
import astrorapid.get_custom_data
from astrorapid.custom_classifier import create_custom_classifier
def main():
""" Train Neural Network classifier """
script_dir = os.path.dirname(os.path.abspath(__file__))
create_custom_classifier(get_data_func=astrorapid.... | Python | MIT | 2,384 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/prepare_input.py | import numpy as np
from astrorapid.prepare_arrays import PrepareArrays
class PrepareInputArrays(PrepareArrays):
def __init__(self, passbands=('g', 'r'), contextual_info=('redshift',), bcut=True, zcut=None,
nobs=50, mintime=-70, maxtime=80, timestep=3.0):
PrepareArrays.__init__(self, passb... | Python | MIT | 1,964 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/read_snana_fits.py | import numpy as np
import multiprocessing as mp
import pandas as pd
import astropy.io.fits as afits
from collections import OrderedDict
from astrorapid.process_light_curves import InputLightCurve
class GetData(object):
def __init__(self):
""" Get light curves. """
self.phot_fields = ['MJD', 'FLT... | Python | MIT | 7,205 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/custom_classifier.py | import os
from astrorapid.prepare_training_set import PrepareTrainingSetArrays
from astrorapid.plot_metrics import plot_metrics
from astrorapid.neural_network_model import train_model
import astrorapid.get_custom_data
def create_custom_classifier(get_data_func, data_dir, class_nums=(1,2,), class_name_map=None, reread... | Python | MIT | 7,671 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/model_early_lightcurve.py | import numpy as np
from collections import OrderedDict
import copy
try:
import emcee
except ImportError:
print("You will need to install 'emcee' if you wish to train your own classifier on new data.")
def fit_early_lightcurve(outlc, earlytime=10):
"""
Return tsquarize fit to early light curve
"""... | Python | MIT | 6,941 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/fit_gaussian_process.py | import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
import multiprocessing as mp
import celerite
from celerite import terms
from scipy.optimize import minimize
def combined_neg_log_like(params, fluxes, gp_lcs, passbands):
loglike = 0
for pb in passbands:
gp_lcs[pb].set_parameter... | Python | MIT | 5,654 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/ANTARES_object/__init__.py | # -*- coding: UTF-8 -*-
'''
ANTARES_object : class to encapsulate locus aggegated alert data and computed
features
'''
from __future__ import unicode_literals
from .LAobject import LAobject
__author__ = 'Gautham Narayan'
__email__ = 'gsnarayan@gmail.com'
__maintainer__ = 'Gautham Narayan'
__license__ = 'GP... | Python | MIT | 373 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/ANTARES_object/LAobject.py | # -*- coding: UTF-8 -*-
"""
ANTARES Object class specification
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import warnings
import numpy as np
from . import constants
from .features.base import BaseMixin
from astropy.stats import sigma_clip
import extinction
__all__ = ['LAobject'... | Python | MIT | 15,851 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/ANTARES_object/constants.py | GOOD_PHOTFLAG = 4096
BAD_PHOTFLAG = 1024
TRIGGER_PHOTFLAG = 6144
NONDETECT_PHOTFLAG = 0
DEFAULT_ZEROPOINT = 27.5
| Python | MIT | 113 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/ANTARES_object/features/__init__.py | # -*- coding: UTF-8 -*-
'''
Feature definitions for ANTARES
'''
from __future__ import unicode_literals
__author__ = 'Gautham Narayan'
__email__ = 'gsnarayan@gmail.com'
__maintainer__ = 'Gautham Narayan'
__license__ = 'GPLv3'
__version__ = '0.1'
__status__ = 'alpha'
| Python | MIT | 287 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | astrorapid/ANTARES_object/features/base.py | # -*- coding: UTF-8 -*-
"""
Functions for the derivation of base features with LAobjects
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import numpy as np
import astropy.table as at
class BaseMixin(object):
"""
Methods to derive baseline features for LAobjects
"""
... | Python | MIT | 1,678 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | tests/test_plot_metrics.py | import re
from unittest.mock import MagicMock, Mock, patch
import numpy as np
import pytest
from astrorapid.plot_metrics import plot_metrics
def test_plot_metrics(monkeypatch):
"""Test the basic plotting functionality"""
class_names = ('A', 'B')
X_test = np.zeros((500, 50, 4))
y_test = np.zeros((500,... | Python | MIT | 1,328 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | tests/test_classify.py | import pytest
from astrorapid.classify import Classify
| Python | MIT | 57 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | paper_plots/paper_plots_get_data.py | # MAKE DATA
# orig_lc, timesX, y_predict = classify_lasair_light_curves(object_names=[
# 'ZTF18abxftqm', # TDE
# 'ZTF19aadnmgf', # SNIa
# 'ZTF18acmzpbf', # SNIa
# ])
#
# with open('paper_plot_real_data.pickle', 'wb') as f:
# pickle.dump([orig_lc, timesX, y_predict], f)
# PLOT FOR PAPER
import pickle... | Python | MIT | 7,380 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | paper_plots/paper_plots.py | # MAKE DATA
# orig_lc, timesX, y_predict = classify_lasair_light_curves(object_names=[
# 'ZTF18abxftqm', # TDE
# 'ZTF19aadnmgf', # SNIa
# 'ZTF18acmzpbf', # SNIa
# ])
#
# with open('paper_plot_real_data.pickle', 'wb') as f:
# pickle.dump([orig_lc, timesX, y_predict], f)
# PLOT FOR PAPER
import pickle... | Python | MIT | 6,399 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | docs/api.rst | ===
API
===
RAPID has a few important classes and methods.
Classify light curves
---------------------
* :class:`astrorapid.classify.Classify` - Setup light curve classification
* :func:`astrorapid.classify.Classify.get_predictions` - Classify light curves!
Plot classifications
--------------------
* :func:`astror... | reStructuredText | MIT | 1,623 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | docs/conf.py | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | Python | MIT | 5,731 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | docs/readme.rst | .. include:: ../README.md | reStructuredText | MIT | 25 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | docs/installation.rst | ============
Installation
============
Using pip
---------
The easiest and preferred way to install DASH (to ensure the latest stable version) is using pip:
.. code-block:: bash
pip install astrorapid --upgrade
From Source
-----------
Alternatively, the source code can be downloaded from GitHub by running the f... | reStructuredText | MIT | 1,171 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | docs/usage.rst | =====
Usage
=====
Classify Light curves
+++++++++++++++++++++
Use the following example code:
.. code-block:: python
from astrorapid.classify import Classify
# Each light curve should be a tuple in this form. Look at the example code for an example of the input format.
light_curve_info1 = (mjd, flux, f... | reStructuredText | MIT | 8,326 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | docs/example.rst | =======
Example
=======
Example script classifying an example supernova light curve.
.. code-block:: python
from astrorapid.classify import Classify
# Light curve information. It may be easier if this is read from a file and later manipulated into this format.
mjd = [57433.4816, 57436.4815, 57439.4817, ... | reStructuredText | MIT | 3,544 |
[ascl:2003.007] | https://github.com/daniel-muthukrishna/astrorapid | docs/index.rst | .. astrorapid documentation master file, created by
sphinx-quickstart on Tue Jan 22 13:32:33 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
RAPID
=====
RAPID (Real-time Automated Photometric IDentification) can classify multiband photometr... | reStructuredText | MIT | 1,177 |
[ascl:2603.010] | https://github.com/0neyun/RapidGBM | menu.py | import streamlit as st
st.session_state["name"] = 'anonymous'
st.write("# Welcome to HEtools web!")
st.write('Hello %s.' %(st.session_state["name"]))
st.image("pages/image.png", use_column_width=False,\
width=500, \
caption="In Chinese, the word for “rabbit” is pronounced the same as “tools” in Eng... | Python | MIT | 456 |
[ascl:2603.010] | https://github.com/0neyun/RapidGBM | README.md | # RapidGBM
<img align="left" src="https://github.com/user-attachments/assets/05c4d00c-ae6a-44cf-bf41-daa95e63b75b" alt="RapidGBM Logo" width="270"/>
**RapidGBM** is a lightweight, interactive web application and a module of HEtools, designed for rapid preview of Fermi/GBM data. Its core capability is orbit-based visi... | Markdown | MIT | 1,548 |
[ascl:2603.010] | https://github.com/0neyun/RapidGBM | pages/RapidGBM.py | import streamlit as st
import glob, os
import matplotlib.pyplot as plt
import sys
sys.path.append('./base_func')
from RapidGBM_base_func import *
from utils_visits import bump_daily_total
bump_daily_total()
#try:
#if st.session_state["authentication_status"]:
#pass
#except:
#st.switch_page("login.py"... | Python | MIT | 25,737 |
[ascl:2603.010] | https://github.com/0neyun/RapidGBM | base_func/PyXspec_fit_MCMC.py | '''
HEtools Spectral fit module demo
wangyun@pmo.ac.cn
2024.9
'''
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
os.environ["OMP_NUM_THREADS"] = '1'
import numpy as np
import bilby
from astropy.io import fits
import xspec
import matplotlib.pyplot as plt
import corner
from astr... | Python | MIT | 9,465 |
[ascl:2603.010] | https://github.com/0neyun/RapidGBM | base_func/RapidGBM_base_func.py | import glob, os
import math
#import __init__
from astropy.io import fits as pf
import streamlit as st
from gbm.plot import EarthPlot
from gbm.data import TTE
from gbm.binning.unbinned import bin_by_time
from gbm.background import BackgroundFitter
from gbm.background.binned import Polynomial
from gbm.plot import SkyPlo... | Python | MIT | 30,441 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | README.md | [](https://badge.fury.io/py/rapoc)

[](https://pepy.tech/project/rapoc)
[![Documentation Status... | Markdown | BSD-3-Clause | 3,631 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | setup.py | import codecs
import os
from setuptools import setup, find_packages
packages = find_packages(exclude=('tests', 'docs'))
provides = ['rapoc', ]
install_requires = ['astropy',
'matplotlib',
'numpy',
'scipy',
'h5py',
'm... | Python | BSD-3-Clause | 2,045 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | .readthedocs.yaml | # .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py
# Build documentation with MkDocs
#mkdocs:
# configuration: mk... | YAML | BSD-3-Clause | 583 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | CHANGELOG.md | # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [1.0.8] - 2022-10-6
### Added
- forced molecule... | Markdown | BSD-3-Clause | 1,560 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/__about__.py | import os.path
from datetime import date
__all__ = [
'__pkg_name__',
"__title__",
"__summary__",
"__url__",
"__author__",
"__email__",
"__license__",
"__copyright__",
"__branch__",
"__commit__",
"__base_dir__"
]
try:
base_dir = os.path.dirname(os.path.dirname(os.path.a... | Python | BSD-3-Clause | 1,227 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/__init__.py | from .__about__ import (
__author__,
__commit__,
__copyright__,
__email__,
__license__,
__summary__,
__title__,
__pkg_name__,
__url__,
__branch__,
__base_dir__
)
from .__version__ import __version__
__all__ = [
"__author__",
"__commit__",
"__copyright__",
"__... | Python | BSD-3-Clause | 548 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/__version__.py | __version__ = '1.0.8'
| Python | BSD-3-Clause | 22 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/loaders/exoMolFileLoader.py | import astropy.units as u
import h5py
from .loader import FileLoader
class ExoMolFileLoader(FileLoader):
'''
File loader for ExoMol file. It works for opacities file in the `TauREx.h5` format.
These file can be downloaded from `ExoMol website <http://exomol.com/data/data-types/opacity>`_.
Notes
... | Python | BSD-3-Clause | 2,204 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/loaders/dictLoader.py | from astropy import units as u
class DictLoader:
'''
Dict loader class. The dictionary should contain the following information under certain keys:
.. csv-table::
:header: information, default units, supported keys
molecular name, ,"mol"
pressure grid, :math:`Pa`,"p, P, pressure,... | Python | BSD-3-Clause | 5,121 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/loaders/daceFileLoader.py | import astropy.units as u
import numpy as np
import struct
import os
import glob
from .loader import FileLoader
class DACEFileLoader(FileLoader):
'''
File loader for DACE files. It works for opacities files in the binary format.
These files can be downloaded from `DACE website <https://dace.unige.ch/opac... | Python | BSD-3-Clause | 5,034 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/loaders/__init__.py | # from .ciaHitranFileLoader import CiaHitranFileLoader
from .dictLoader import DictLoader
from .exoMolFileLoader import ExoMolFileLoader
from .daceFileLoader import DACEFileLoader | Python | BSD-3-Clause | 179 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/loaders/ciaHitranFileLoader.py | import astropy.units as u
import numpy as np
from taurex.cia.hitrancia import HitranCIA
from .loader import FileLoader
class CiaHitranFileLoader(FileLoader):
'''
File loader for ExoMol file. It works for opacities file in the `TauREx.h5` format.
These file can be downloaded from `ExoMol website <http://e... | Python | BSD-3-Clause | 1,049 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/loaders/loader.py | from abc import abstractmethod
class FileLoader:
'''
Base file loaders class.
'''
def __init__(self, filename, molecule=None):
'''
Parameters
----------
filename: str
data file name
molecule: str
forced molecule name
'''
... | Python | BSD-3-Clause | 2,338 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/models/rosseland.py | import warnings
import astropy.constants as const
import astropy.units as u
import numpy as np
from .model import Model
class Rosseland(Model):
'''
Rosseland model class. This class implements the Rosseland Opacity model:
.. math::
\\frac{1}{k} = \\frac{\\int_{\\nu_1}^{\\nu_2} k_{\\nu}^{-1} u(... | Python | BSD-3-Clause | 4,784 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/models/validation.py | import warnings
import numpy as np
from astropy import units as u
def _validate_inputs_units(p_input, t_input):
'''
It checks the units in input pressure an temperature, and return them into `SI`.
Parameters
----------
p_input: float or np.array
pressure to use for the estimation.
... | Python | BSD-3-Clause | 9,360 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/models/planck.py | import astropy.constants as const
import numpy as np
from .model import Model
class Planck(Model):
'''
Planck model class. This class implements the Planck Opacity model:
.. math::
k = \\frac{\\int_{\\nu_1}^{\\nu_2} k_{\\nu} B_\\nu(T) d\\nu}
{\\int_{\\nu_1}^{\\nu_2} B_\\nu(T) d\\nu}
... | Python | BSD-3-Clause | 4,561 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/models/model.py | import warnings
import astropy.constants as const
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
import os
import rapoc.models
from rapoc.models.utils.validation import validate_inputs, validate_output
class Model:
"""
Base model class.
Attributes
----------
input_... | Python | BSD-3-Clause | 20,710 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/models/rayleigh.py | import astropy.units as u
import numpy as np
import astropy.constants as const
class Rayleigh:
'''
The Rayleigh class estimates the Rayleigh scattering for the indicated atom using the
equations from Chapter 10 of David R. Lide, ed., CRC Handbook of Chemistry and Physics, Internet Version 2005,
`hbcpo... | Python | BSD-3-Clause | 6,339 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/models/__init__.py | from .model import Model
from .planck import Planck
from .rosseland import Rosseland
from .rayleigh import Rayleigh
| Python | BSD-3-Clause | 116 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | rapoc/models/utils/validation.py | import warnings
import numpy as np
from astropy import units as u
def _validate_inputs_units(p_input, t_input):
'''
It checks the units in input pressure an temperature, and return them into `SI`.
Parameters
----------
p_input: float or np.array
pressure to use for the estimation.
... | Python | BSD-3-Clause | 10,002 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/user_guide.rst | =================================
User Guide
=================================
This guide is an instruction manual on the `RAPOC` (Rosseland And Planck Opacity Converter) tool
and how it can be included in one's own code.
For a quickstart, please refer to the python notebook inside the `examples` directory.
If `RAPOC... | reStructuredText | BSD-3-Clause | 11,208 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/requirements.txt | astropy
matplotlib
numpy
scipy
h5py
molmass
tqdm
nbsphinx
sphinx_rtd_theme | Text | BSD-3-Clause | 74 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/index.rst | ===================================================
RAPOC: Rosseland And Planck Opacity Converter
===================================================
.. image:: _static/logo.png
:width: 600
:align: center
Developed by Lorenzo V. Mugnai and Darius Modirrousta-Galian, the RAPOC code is the product of a collaborat... | reStructuredText | BSD-3-Clause | 1,493 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/installation.rst | =======================
Installation & updates
=======================
Installing from Pypi
--------------------
`RAPOC` can be installed from the Pypi repository with the following script::
pip install rapoc
Installing from git
-------------------
`RAPOC` may also be cloned from the main git repository::
g... | reStructuredText | BSD-3-Clause | 1,205 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/conf.py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | Python | BSD-3-Clause | 4,470 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/api/exomol_api.rst | ==============================
ExoMol file loader
==============================
.. autoclass:: rapoc.loaders.ExoMolFileLoader
| reStructuredText | BSD-3-Clause | 129 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/api/dict_loader_api.rst | ==============================
Base file loader
==============================
.. autoclass:: rapoc.loaders.DictLoader
| reStructuredText | BSD-3-Clause | 121 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/api/DACE_api.rst | ==============================
DACE file loader
==============================
.. autoclass:: rapoc.loaders.DACEFileLoader
| reStructuredText | BSD-3-Clause | 125 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/api/index.rst | ==============================
API Guide
==============================
The `RAPOC` code implements a base :class:`~rapoc.models.model.Model` class that loads the input data
(consisting of opacities expressed as a function of a grid of pressures, temperatures and a wavelength range,
and produces the RPO estimates.
From... | reStructuredText | BSD-3-Clause | 2,102 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/api/planck_api.rst | ==============================
Planck Model
==============================
.. autoclass:: rapoc.Planck
| reStructuredText | BSD-3-Clause | 104 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/api/rayleigh_api.rst | ==============================
Rayleigh Model
==============================
.. autoclass:: rapoc.Rayleigh
| reStructuredText | BSD-3-Clause | 110 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/api/model_api.rst | ==============================
Base Model
==============================
.. autoclass:: rapoc.models.model.Model
| reStructuredText | BSD-3-Clause | 115 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/api/rosseland_api.rst | ==============================
Rosseland Model
==============================
.. autoclass:: rapoc.Rosseland
| reStructuredText | BSD-3-Clause | 112 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | docs/source/api/file_loader_api.rst | ==============================
Base file loader
==============================
.. autoclass:: rapoc.loaders.loader.FileLoader
| reStructuredText | BSD-3-Clause | 128 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | tests/test_loader.py | import unittest
import astropy.units as u
import numpy as np
from input import exomol_file, dace_file
from rapoc.loaders import ExoMolFileLoader, DACEFileLoader
class ExoMolLoaderTest(unittest.TestCase):
loaded = ExoMolFileLoader(filename=exomol_file)
mol, mol_mass, pressure_grid, temperature_grid, wavenumb... | Python | BSD-3-Clause | 4,338 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | tests/test_data.py | import unittest
import astropy.units as u
from input import exomol_file, dace_file
from rapoc.models import Rosseland, Planck
class DataTest(unittest.TestCase):
def test_rosseland(self):
ross_exo = Rosseland(input_data=exomol_file)
ross_dace = Rosseland(input_data=dace_file)
T = 1500*u.K... | Python | BSD-3-Clause | 1,272 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | tests/test_rosseland.py | import unittest
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
from input import exomol_file
from rapoc.models import Rosseland
class RosselandTest(unittest.TestCase):
model = Rosseland(input_data=exomol_file)
def test_extract_opacity(self):
k_ext, _ = self.model.extra... | Python | BSD-3-Clause | 3,784 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | tests/input.py | exomol_file = 'test_data/1H2-16O__POKAZATEL__R15000_0.3-50mu.xsec.TauREx.h5'
dace_file = 'test_data/1H2-16O__POKAZATEL_e2b'
| Python | BSD-3-Clause | 124 |
[ascl:2209.016] | https://github.com/exobssim/rapoc-public | tests/test_model.py | import unittest
import astropy.units as u
import numpy as np
from input import exomol_file
from rapoc.models import Model
from rapoc.models.utils.validation import validate_output
data_dict = {'mol': 'H2O',
'pressure': np.array([1.00000000e+00, 2.15443469e+00, 4.64158883e+00, 1.00000000e+01,
... | Python | BSD-3-Clause | 5,272 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.