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:2406.028] | https://github.com/nikhil-sarin/redback | redback/transient/kilonova.py | import os
from typing import Union
import numpy as np
import redback.get_data.directory
from redback.transient.transient import OpticalTransient
from redback.utils import logger
dirname = os.path.dirname(__file__)
class Kilonova(OpticalTransient):
DATA_MODES = ['flux_density', 'magnitude', 'luminosity', 'flux... | Python | Unknown | 5,620 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/getter.py | import pandas as pd
class DataGetter(object):
""" """
def __init__(self, transient: str, transient_type: str) -> None:
self.transient = transient
self.transient_type = transient_type
def get_data(self) -> pd.DataFrame:
"""Downloads the raw data and produces a processed .csv file.... | Python | Unknown | 1,836 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/__init__.py | from __future__ import annotations
from typing import Union
import urllib
import pandas as pd
from redback.get_data import batse, directory, fermi, getter, konus, lasair, fink, open_data, swift, utils
from redback.get_data.swift import SwiftDataGetter
from redback.get_data.open_data import OpenDataGetter
from redbac... | Python | Unknown | 12,742 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/lasair.py | import os
from typing import Union
import astropy.units as uu
import numpy as np
import pandas as pd
import requests
from astropy.time import Time
import redback
import redback.get_data.directory
import redback.get_data.utils
import redback.redback_errors
from redback.get_data.getter import DataGetter
from redback.ut... | Python | Unknown | 5,444 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/swift.py | from __future__ import annotations
import os
from typing import Union
import urllib
import urllib.request
import astropy.io.ascii
import numpy as np
import pandas as pd
import requests
import redback.get_data.directory
import redback.get_data.utils
import redback.redback_errors
from redback.get_data.getter import GR... | Python | Unknown | 53,902 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/fermi.py |
class FermiDataGetter(object):
def __init__(self) -> None:
raise NotImplementedError()
| Python | Unknown | 101 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/directory.py | from collections import namedtuple
import os
from bilby.core.utils.io import check_directory_exists_and_if_not_mkdir
from redback.get_data.utils import get_batse_trigger_from_grb
from redback.utils import logger
_dirname = os.path.dirname(__file__)
SWIFT_PROMPT_BIN_SIZES = ['1s', '2ms', '8ms', '16ms', '64ms', '256ms... | Python | Unknown | 7,765 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/open_data.py | import os
import re
import sqlite3
from typing import Union
import urllib
import urllib.request
import ssl
import astropy.units as uu
import numpy as np
import pandas as pd
import requests
from astropy.time import Time
import redback
import redback.get_data.directory
import redback.get_data.utils
from redback.get_dat... | Python | Unknown | 7,995 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/fink.py | import os
import io
from typing import Union
import astropy.units as uu
import numpy as np
import pandas as pd
import requests
from astropy.time import Time
import redback
import redback.get_data.directory
import redback.get_data.utils
import redback.redback_errors
from redback.get_data.getter import DataGetter
from ... | Python | Unknown | 5,183 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/batse.py | import os
import urllib
import urllib.request
import astropy.io.fits.hdu
import numpy as np
import pandas as pd
from astropy.io import fits
import redback
from redback.get_data.getter import GRBDataGetter
from redback.get_data.utils import get_batse_trigger_from_grb
from redback.utils import logger
_dirname = os.pat... | Python | Unknown | 5,117 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/utils.py | import os
import pandas as pd
import numpy as np
import astropy.io.ascii
from redback.utils import logger
_dirname = os.path.dirname(__file__)
def get_trigger_number(grb: str) -> str:
"""Gets the trigger number from the GRB table.
:param grb: Telephone number of GRB, e.g., 'GRB140903A' or '140903A' are va... | Python | Unknown | 5,063 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/get_data/konus.py |
class KonusDataGetter(object):
def __init__(self) -> None:
raise NotImplementedError()
| Python | Unknown | 101 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/test_utils/ref_data_utils.py | """A helper function to generate reference data for a given model."""
import numpy as np
from astropy.table import Table
from itertools import product
def make_ref_data(model, param_grid, other_kwargs, filename):
"""Generate reference data for a given model.
Parameters
----------
model : callable
... | Python | Unknown | 2,721 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/tables/summary_general_swift_bat.txt | #####################################################################################
## Column descriptions:
## GRBname: GRB name.
## Trig_ID: Special ID associated with the trigger. The observation ID of the event data used in this analysis is 00"Trid_ID"000. For GRBs found in ground analysis, the ID are associated w... | Text | Unknown | 387,783 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/tables/SGRB_table.txt | GRB Time [UT] Trigger Number BAT RA (J2000) BAT Dec (J2000) BAT T90 [sec] BAT Fluence (15-150 keV) [10^-7 erg/cm^2] BAT Fluence 90% Error (15-150 keV) [10^-7 erg/cm^2] BAT Photon Index (15-150 keV) (PL = simple power-law, CPL = cutoff power-law) XRT RA (J2000) XRT Dec (J2000) XRT Time to First Observation [sec] XRT Ear... | Text | Unknown | 31,574 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/tables/BATSE_trigger_table.txt | 105 GRB910421
106 TGF910422
107 GRB910423
108 GRB910424
109 GRB910425
110 GRB910425
111 GRB910426
114 GRB910427
121 GRB910429
130 GRB910430
133 GRB910501
138 GRB910502
142 GRB910502
143 GRB910503
146 SFL910504
148 GRB910505
151 SFL910506
155 SFL910506
156 SFL910507
157 SFL910507
158 SFL910507
159 SFL910507
160 GRB91050... | Text | Unknown | 61,860 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/tables/GRBs_w_redshift.txt | GRB Time [UT] Trigger Number BAT RA (J2000) BAT Dec (J2000) BAT T90 [sec] BAT Fluence (15-150 keV) [10^-7 erg/cm^2] BAT Fluence 90% Error (15-150 keV) [10^-7 erg/cm^2] BAT Photon Index (15-150 keV) (PL = simple power-law, CPL = cutoff power-law) XRT RA (J2000) XRT Dec (J2000) XRT Time to First Observation [sec] XRT Ear... | Text | Unknown | 126,089 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/tables/csm_table.txt | 0.0,6.0,1.255564,0.906057,2.422657
0.0,6.275862068965517,1.224261,0.916353,1.970811
0.0,6.551724137931035,1.203396,0.924596,1.612987
0.0,6.827586206896552,1.188402,0.931348,1.344976
0.0,7.103448275862069,1.176956,0.936982,1.133469
0.0,7.379310344827586,1.168122,0.941747,0.973674
0.0,7.655172413793103,1.161069,0.945837,... | Text | Unknown | 18,140 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/tables/LGRB_table.txt | GRB Time [UT] Trigger Number BAT RA (J2000) BAT Dec (J2000) BAT T90 [sec] BAT Fluence (15-150 keV) [10^-7 erg/cm^2] BAT Fluence 90% Error (15-150 keV) [10^-7 erg/cm^2] BAT Photon Index (15-150 keV) (PL = simple power-law, CPL = cutoff power-law) XRT RA (J2000) XRT Dec (J2000) XRT Time to First Observation [sec] XRT Ear... | Text | Unknown | 296,342 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/tables/guillochon_tde_data/info.txt | the folder 4-3 contains the dmdes for gamma = 4/3, converted from the dmdts on James Guillochon's blog (http://astrocrash.net/wp-content/uploads/2013/12/dmdts.zip).
Same for folder 5-3 but with gamma = 5/3.
file formatting : first row is energy, second row is dmde
units = cgs | Text | Unknown | 280 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/tables/xsect/README.txt | Cross-section tables, this is a copy from astromodels package, and indirectly XSPEC.
They are used to compute the cross-sections for photoelectric absorption.
The files are in FITS format, and can be read using astropy.io.fits or other FITS readers.
They will be automatically read by the redback package when needed. | Text | Unknown | 317 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/spectral/__init__.py | from redback.spectral.io import read_pha, read_rmf, read_arf, read_lc, OGIPPHASpectrum, OGIPLightCurve
from redback.spectral.response import ResponseMatrix, EffectiveArea
from redback.spectral.dataset import SpectralDataset
from redback.spectral.conversions import mjy_to_photon_flux_per_keV, mjy_to_fnu
__all__ = [
... | Python | Unknown | 545 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/spectral/conversions.py | from __future__ import annotations
import numpy as np
_MJY_TO_FNU = 1e-26 # erg / s / cm^2 / Hz
_PLANCK_ERG_S = 6.62607015e-27 # erg * s
_KEV_TO_HZ = 2.417989e17 # Hz / keV
def mjy_to_fnu(mjy: np.ndarray) -> np.ndarray:
"""
Convert mJy to F_nu in erg/s/cm^2/Hz.
"""
return np.asarray(mjy, dtype=fl... | Python | Unknown | 975 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/spectral/dataset.py | from __future__ import annotations
from dataclasses import dataclass
from typing import Optional
import numpy as np
import matplotlib.pyplot as plt
from redback.utils import logger
from redback.spectral.folding import fold_spectrum
from redback.spectral.conversions import mjy_to_energy_flux_per_keV
from redback.spec... | Python | Unknown | 38,684 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/spectral/folding.py | from __future__ import annotations
import numpy as np
from redback.spectral.conversions import mjy_to_photon_flux_per_keV
from redback.spectral.response import ResponseMatrix, EffectiveArea
def _integrate_photon_flux_per_bin(photon_flux_per_keV: np.ndarray, energy_edges_keV: np.ndarray) -> np.ndarray:
"""
I... | Python | Unknown | 2,631 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/spectral/io.py | from __future__ import annotations
from dataclasses import dataclass
from typing import Optional
import numpy as np
from astropy.io import fits
from redback.utils import logger
@dataclass
class OGIPPHASpectrum:
channel: np.ndarray
counts: np.ndarray
exposure: float
backscale: float
areascal: flo... | Python | Unknown | 7,704 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | redback/spectral/response.py | from __future__ import annotations
from dataclasses import dataclass
import numpy as np
@dataclass
class ResponseMatrix:
e_min: np.ndarray
e_max: np.ndarray
channel: np.ndarray
emin_chan: np.ndarray
emax_chan: np.ndarray
matrix: np.ndarray
@property
def energy_centers(self) -> np.nda... | Python | Unknown | 849 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/priors_test.py | import unittest
import numpy as np
from unittest.mock import patch, MagicMock
import redback.priors as priors
from bilby.core.prior import PriorDict
class TestGetGaussianPriors(unittest.TestCase):
"""Test get_gaussian_priors function"""
def test_get_gaussian_priors_basic(self):
"""Test basic Gaussian... | Python | Unknown | 8,688 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/spectral_template_matcher_test.py | import unittest
import tempfile
import numpy as np
import matplotlib.pyplot as plt
from pathlib import Path
from shutil import rmtree
from unittest.mock import patch, MagicMock, mock_open
import json
from redback.analysis import SpectralTemplateMatcher
from redback.transient.transient import Spectrum
class TestSpect... | Python | Unknown | 118,835 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/test_spectral_io_dataset_likelihoods.py | """
Batch 2 unit tests for redback X-ray spectral fitting code.
Covers:
- TestOGIPIO : redback.spectral.io (read_pha, read_rmf, read_arf, read_lc)
- TestSpectralDataset: redback.spectral.dataset.SpectralDataset
- TestPoissonSpectralLikelihood
- TestWStatSpectralLikelihood
- TestChiSquareSpectralLike... | Python | Unknown | 130,977 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/prompt_models_test.py | import unittest
import numpy as np
from redback.transient_models import prompt_models
class TestGaussianPrompt(unittest.TestCase):
"""Test gaussian_prompt function"""
def test_gaussian_prompt_basic(self):
"""Test basic Gaussian prompt emission"""
times = np.linspace(-5, 5, 100)
amplit... | Python | Unknown | 10,760 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/fireball_models_test.py | import unittest
import numpy as np
from redback.transient_models import fireball_models
class TestPredeceleration(unittest.TestCase):
"""Test predeceleration function"""
def test_predeceleration_basic(self):
"""Test basic predeceleration power law"""
time = np.array([1.0, 2.0, 3.0, 4.0, 5.0])... | Python | Unknown | 5,618 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/model_library_test.py | """
Unit tests for the Redback plugin system and model_library.
"""
import types
import unittest
from unittest.mock import patch, Mock
import redback.model_library as ml
from redback.utils import get_functions_dict
class TestBuiltinModelsLoaded(unittest.TestCase):
"""Built-in model dictionaries are populated at... | Python | Unknown | 10,723 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/analysis_test.py | import os
import unittest
from unittest.mock import MagicMock, patch
from collections import namedtuple
import numpy as np
import matplotlib.pyplot as plt
import bilby
from os import listdir
from os.path import dirname
import pandas as pd
from pathlib import Path
from shutil import rmtree
import shutil
import redback
f... | Python | Unknown | 23,583 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/likelihood_test.py | import bilby.core.prior
import numpy as np
import unittest
from unittest import mock
from redback import likelihoods
class GaussianLikelihoodTest(unittest.TestCase):
def setUp(self):
self.x = np.array([0, 1, 2])
self.y = np.array([0, 1, 2])
self.sigma = 1
def func(x, param_1, pa... | Python | Unknown | 23,835 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/filters_test.py | import unittest
import os
import tempfile
import numpy as np
from astropy.table import Table
from astropy.io import ascii
from unittest.mock import patch, MagicMock, Mock
import redback.filters as filters
import sncosmo
class TestFilterFunctions(unittest.TestCase):
"""Test basic filter functions"""
def test_... | Python | Unknown | 14,222 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/prior_test.py | import unittest
import numpy as np
import bilby
import os
import shutil
from os import listdir
from os.path import dirname
from bilby.core.prior import Constraint, Uniform, LogUniform
import pandas as pd
from pathlib import Path
from shutil import rmtree
import redback
import redback.priors
_dirname = dirname(__file__... | Python | Unknown | 17,811 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/wrappers_test.py | import unittest
from unittest.mock import patch, MagicMock
import redback.wrappers as wrappers
class TestCondJit(unittest.TestCase):
"""Test cond_jit decorator function"""
def test_cond_jit_with_numba_available(self):
"""Test cond_jit when numba is available"""
# Define a simple function to d... | Python | Unknown | 3,965 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/get_data_test.py | import io
import os.path
import shutil
import unittest
from unittest import mock
from unittest.mock import MagicMock, PropertyMock
import numpy as np
import pandas as pd
import requests
import redback
class TestUtils(unittest.TestCase):
def setUp(self) -> None:
pass
def tearDown(self) -> None:
... | Python | Unknown | 85,306 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/constraints_test.py | import unittest
import numpy as np
from unittest.mock import patch, MagicMock
import redback.constraints as constraints
class TestSLSNConstraint(unittest.TestCase):
"""Test slsn_constraint function"""
def test_slsn_constraint_basic(self):
"""Test basic slsn constraint calculation"""
parameter... | Python | Unknown | 12,561 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/test_spectral_core.py | """
Comprehensive unit tests for redback X-ray spectral fitting code.
Covers:
- redback/spectral/conversions.py
- redback/spectral/response.py
- redback/spectral/folding.py
- redback/transient_models/spectral_models.py (high-energy models added in this branch)
"""
from __future__ import annotations
... | Python | Unknown | 36,778 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/vegas_models_test.py | """
Test VegasAfterglow model integration
"""
import pytest
import numpy as np
from unittest.mock import MagicMock, patch, call
import sys
import importlib
class TestVegasModelsWithMocking:
"""Test vegas_models.py with VegasAfterglow mocked"""
def setup_method(self):
"""Set up mocks before each t... | Python | Unknown | 23,995 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/result_test.py | import unittest
import os
import tempfile
import shutil
import numpy as np
import pandas as pd
from unittest.mock import patch, MagicMock, PropertyMock
import bilby.core.prior
from redback import result
from redback.result import RedbackResult, read_in_result
class TestRedbackResult(unittest.TestCase):
"""Test R... | Python | Unknown | 19,648 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/ejecta_relations_test.py | import unittest
import numpy as np
from unittest.mock import patch
import redback.ejecta_relations as ejecta
class TestCalcCompactnessFromLambda(unittest.TestCase):
"""Test calc_compactness_from_lambda function"""
def test_compactness_calculation(self):
"""Test compactness calculation from lambda"""
... | Python | Unknown | 13,527 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/test_learned_models.py | """Ensure that we can load a model"""
import astropy.units as uu
import inspect
import numpy as np
import types
import unittest
from redback.transient_models.learned_models import make_learned_model_callable
class _DummyModel:
"""A dummy model class for testing purposes that generates a
Gaussian-modulated si... | Python | Unknown | 2,701 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/model_test.py | import unittest
import os
from os import listdir
from os.path import dirname
from unittest import mock
from unittest.mock import patch, MagicMock
import astropy.units as uu
from collections import namedtuple
from scipy.interpolate import interp1d
import bilby
import numpy as np
try:
import pytest
PYTEST_AVAILA... | Python | Unknown | 85,512 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/interaction_processes_test.py | import unittest
import numpy as np
from unittest.mock import patch
import redback.interaction_processes as interaction
class TestDiffusion(unittest.TestCase):
"""Test Diffusion class"""
def setUp(self):
self.time = np.array([1.0, 2.0, 3.0, 4.0, 5.0])
self.dense_times = np.linspace(0.5, 10.0, ... | Python | Unknown | 14,032 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/utils_test.py | import unittest
from collections import namedtuple
from unittest.mock import patch, MagicMock
import redback
import numpy as np
import pandas as pd
from astropy import units as u
from astropy.cosmology import FlatLambdaCDM
import redback.utils as utils
from redback.utils import UserCosmology, DataModeSwitch
class Te... | Python | Unknown | 60,036 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/sampler_test.py | import unittest
import tempfile
import numpy as np
from types import SimpleNamespace
from unittest.mock import patch
import bilby
from redback.model_library import all_models_dict
from redback.result import RedbackResult
from redback.transient.afterglow import Afterglow
from redback.transient.prompt import PromptTime... | Python | Unknown | 19,059 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/sed_test.py | import unittest
import numpy as np
from unittest.mock import patch, MagicMock
import astropy.units as uu
import redback.sed as sed
class TestBlackbodyToFluxDensity(unittest.TestCase):
"""Test blackbody_to_flux_density function"""
def test_basic_blackbody(self):
"""Test basic blackbody flux density ca... | Python | Unknown | 18,316 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/transient_test.py | import os
import unittest
from unittest import mock
from unittest.mock import MagicMock, patch
import numpy as np
import pandas as pd
import redback
dirname = os.path.dirname(__file__)
def _george_available():
"""Check if george module is available."""
try:
import george
return True
exce... | Python | Unknown | 91,425 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/gaussianprocess_models_test.py | import unittest
import numpy as np
from redback.transient_models import gaussianprocess_models
class TestCalculateFluxWithLabels(unittest.TestCase):
"""Test the calculate_flux_with_labels function"""
def test_calculate_flux_with_single_label(self):
"""Test with a single label"""
time = np.lin... | Python | Unknown | 6,469 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/simulate_transient_test.py | import unittest
from unittest import mock
from unittest.mock import MagicMock, patch
import numpy as np
import requests
import pandas as pd
from redback.simulate_transients import (SimulateGenericTransient, SimulateOpticalTransient, SimulateFullOpticalSurvey,
make_pointing_table_from_average_cadence, PopulationSynt... | Python | Unknown | 126,482 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/reference_files_test.py | import filecmp
import os
import shutil
import unittest
import requests
import redback
_dirname = os.path.dirname(__file__)
def _network_available():
"""Check if network access is available."""
try:
response = requests.get("https://www.swift.ac.uk/", timeout=5)
return response.status_code != ... | Python | Unknown | 5,691 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/constants_test.py | import unittest
from redback import constants
class TestConstants(unittest.TestCase):
def setUp(self) -> None:
pass
def tearDown(self) -> None:
pass
| Python | Unknown | 178 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/examples_test.py | Python | Unknown | 1 | |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/wrapper_test.py | import unittest
import warnings
from redback.wrappers import cond_jit
class ConditionalJITTest(unittest.TestCase):
def test_wrapper_no_args_implicit(self):
"""Check that we can define a conditional JIT wrapper (with
no arguments) and still evaluate the function."""
with warnings.catch_wa... | Python | Unknown | 1,620 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/photosphere_test.py | import numpy as np
import unittest
import redback
class TestTemperatureFloor(unittest.TestCase):
def setUp(self) -> None:
self.time = np.array([1, 2, 3])
self.luminosity = np.array([1, 2, 3]) * 2e17
self.vej = np.array([1, 2, 3])
self.temperature_floor = 1
self.temperatur... | Python | Unknown | 3,705 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/spectral_models_test.py | import unittest
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_allclose
from redback.transient_models import spectral_models
from redback.analysis import SpectralVelocityFitter
class TestVoigtProfile(unittest.TestCase):
"""Test the Voigt profile function"""
def setUp(self):
... | Python | Unknown | 91,110 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/plotting_test.py | import os
import unittest
from unittest import mock
from unittest.mock import MagicMock, patch, PropertyMock, ANY
import numpy as np
import pandas as pd
import shutil
from redback.transient import Spectrum, Transient
from redback.plotting import (SpecPlotter, IntegratedFluxPlotter, LuminosityOpticalPlotter,
_Filena... | Python | Unknown | 137,946 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/test_on_ref_results.py | """Test the models by comparing them with values on reference data from previous
runs. This is a change detection test to ensure nothing is broken when making
changes to the code."""
import os
import redback
import unittest
from redback.test_utils.ref_data_utils import assert_matches_ref_data
_dirname = os.path.dirn... | Python | Unknown | 923 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/reference_data/GRBData/afterglow/ZTF19aagqkrq_rawdata.json | {
"objectId": "ZTF19aagqkrq",
"objectData": {
"primaryId": 17619594,
"ncand": 35,
"ramean": 162.7990975485714,
"decmean": 5.84203513142857,
"glonmean": 244.15102090296543,
"glatmean": 54.36009400978441,
"classification": "SN",
"annotation": "The transient is possibly associated with ... | JSON | Unknown | 28,926 |
[ascl:2406.028] | https://github.com/nikhil-sarin/redback | test/reference_results/make_afterglow_ref_data.py | """A helper script to generate reference data for the afterglow models.
To regenerate the data run the following command from this directory:
>> python make_afterglow_ref_data.py
"""
import numpy as np
import redback
from redback.test_utils.ref_data_utils import make_ref_data, assert_matches_ref_data
time = np.lins... | Python | Unknown | 1,024 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | setup.py | #!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
#
# Standard imports
#
import glob
import os
import sys
import re
#
# setuptools' sdist command ignores MANIFEST.in
#
from distutils.command.sdist import sdist as Distut... | Python | BSD | 2,768 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | README.rst | ==========
REDMONSTER
==========
Introduction
------------
"Redmonster" is a project to develop a sophisticated and flexible
set of Python utilities for redshift measurement, physical parameter
measurement, and classification of one-dimensional astronomical
spectra.
The code is fully documented in |text|_.
.. _text... | reStructuredText | BSD | 839 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | LICENSE.rst | ==================
redmonster License
==================
All source code and documentation
---------------------------------
Copyright (c) 2010-2016, Adam S. Bolton & Timothy Hutchinson.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that ... | reStructuredText | BSD | 2,009 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/__init__.py | """
redmonster
==========
"Redmonster" is a project to develop a sophisticated and flexible
set of Python utilities for redshift measurement, physical parameter
measurement, and classification of one-dimensional astronomical
spectra.
"""
from ._version import __version__
| Python | BSD | 274 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/_version.py | __version__ = 'v1.2.0'
| Python | BSD | 23 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/_linelist.py | import numpy as np
__linelist__ = {
'OII_1' : 3727.09,
'OII_2' : 3729.88,
'H_theta' : 3798.98,
'H_eta' : 3836.47,
'H_xi' : 3890.16,
'H_epsilon' : 3971.20,
'SII_1' : 4072.30,
'H_delta' : 4102.... | Python | BSD | 864 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/tools/plot_fits.py | # GUI used for quickly plotting BOSS spectra. Also allows overplotting of best-fit template as
# determined by redmonster pipeline. Sort of a redmonster version of plotspec.pro, though currently
# with less bells and whistles.
#
# Tim Hutchinson, University of Utah, April 2014
# Signifcantly updated by TH, October 20... | Python | BSD | 17,358 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/tools/fiber_merge.py | # Combine individual fiber files into plate files for all eBOSS plates
#
# Tim Hutchinson, University of Utah, December 2014
# t.hutchinson@utah.edu
from os import environ, makedirs, getcwd
from os.path import exists, join, basename
from time import gmtime, strftime
import numpy as n
from astropy.io import fits
from... | Python | BSD | 2,359 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/tools/__init__.py | # redmonster/tools/__init__.py
| Python | BSD | 31 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/tools/chi2_merge.py | # Combine individual fiber chi2 files into plate chi2 files for all plates under a given tag.
# fiber_merge.py must be run for each plate BEFORE this can be run.
#
# Tim Hutchinson, University of Utah, February 2015
# t.hutchinson@utah.edu
#import numpy as n
#from astropy.io import fits
from os import environ, makedir... | Python | BSD | 2,270 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/tools/plate_merge.py | from redmonster.datamgr import io2
output = io2.MergeRedmonster()
output.merge_plates2() | Python | BSD | 89 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/datamgr/io2.py | # Write output files after running entirety of redmonster
#
# Tim Hutchinson, University of Utah, August 2014
#
# Edited to reflect changes made to zfitter and zpicker, July 2015
# t.hutchinson@utah.edu
import re
from os import environ, makedirs, getcwd, remove
from os.path import exists, join, basename, splitext
fro... | Python | BSD | 70,155 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/datamgr/sdss.py | #
# redmonster/datamgr/sdss.py
#
# SDSS-specific data interface tools
#
import numpy as n
import matplotlib as m
m.interactive(True)
from matplotlib import pyplot as p
from astropy.io import fits
import os
from redmonster.physics import misc
class SpCFrameAll:
"""
Simultaneous interface to all spCFrame files... | Python | BSD | 3,558 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/datamgr/__init__.py | # redmonster/datamgr/__init__.py
# Expose modules in this package.
#from spec import Spec | Python | BSD | 89 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/datamgr/output.py | # Write redmonster output files
#
# Tim Hutchinson, , University of Utah, April 2014
# t.hutchinson@utah.edu
#
# July 2014 - now probably defunct, replaced by redmonster.datamgr.io.py
class Output:
def __init__(self, spec=None):
if spec: self.set_filenames()
def set_filenames(self):
self.zall... | Python | BSD | 651 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/datamgr/ssp_prep.py | # Prepare Charlie Conroy's SSP templates for use in redmonster
#
# Tim Hutchinson, April 2014
# t.hutchinson@utah.edu
#
# May 2014 - now probably defunct, replaced by redmonster.templates.ssp_ztemplate.py
from os import environ
from os.path import join,exists
from time import gmtime, strftime
import numpy as n
from ... | Python | BSD | 4,547 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/datamgr/spec.py | # Read SDSS spPlate files for use in redmonster
#
# Tim Hutchinson, University of Utah @ IAC, May 2014
# t.hutchinson@utah.edu
from os import environ
from os.path import exists, join, splitext, basename
from math import ceil, floor
import numpy as n
from astropy.io import fits
from astropy.convolution import convolve... | Python | BSD | 7,570 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/datamgr/io.py | # read_ndArch.py
#
# Code for reading ndArch files
#
# bolton@utah@iac 2014mayo
#
import numpy as n
from astropy.io import fits
from os import environ, makedirs, getcwd, remove
from os.path import exists, join, basename
from astropy.io import fits
from time import gmtime, strftime
from glob import iglob
import re
def... | Python | BSD | 29,963 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/physics/zfinder.py | # First pass redshift finder of redmonster. Able to search entire
# parameter-space and redshift-space of models in increments
# of d(loglam)/d(pixel)
#
# Tim Hutchinson, University of Utah @ IAC, May 2014
# t.hutchinson@utah.edu
from __future__ import division
from os import environ, makedirs
from os.path import join... | Python | BSD | 17,458 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/physics/zfitter.py | # Subgrid refinement and error estimation of redshift value found by
# redmonster.physics.zfinder.py .
# Interpolates both between redshift pixel lags and between model parameters.
#
# Tim Hutchinson, University of Utah @ IAC, May 2014
# Significant updates to z_refine() -> z_refine2() by TH, July 2015
# t.hutchinson@u... | Python | BSD | 14,104 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/physics/misc.py | # Collection of miscellaneous functions used in redmonster that have no
# home in other modules
#
# Tim Hutchinson, April-September 2014
# t.hutchinson@utah.edu
import numpy as n
from scipy import linalg
from scipy import special as spc
from scipy import sparse
from redmonster.datamgr.io import write_to_log
# Funct... | Python | BSD | 11,349 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/physics/airtovac.py | #
# airtovac.py
#
"""
Module to enable inter-conversion between air and vacuum wavelengths.
Uses formula from Ciddor 1996, Applied Optics, 35, 1566.
Adapted from vactoair.pro & airtovac.pro (Lindler/Landsman/Schlegel).
This Python implementation by A. Bolton, U. Utah, 2011 March.
The two functions of interest are:
... | Python | BSD | 1,733 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/physics/zpicker.py | # Use chi2 surfaces from zfinder.py to choose and classify objects on each fiber. Each zfind
# argument is the ENTIRE object created by ZFinder for a single template, and each zfit argument
# is the ENTIRE object created by ZFitter for a single template. Zfiti must correspond with
# zfindi. Each 'flag' argument is th... | Python | BSD | 15,650 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/physics/zpicker2.py | # Use chi2 surfaces from zfinder.py to choose and classify objects on each fiber. Each zfind
# argument is the ENTIRE object created by ZFinder for a single template, and each zfit argument
# is the ENTIRE object created by ZFitter for a single template. Zfiti must correspond with
# zfindi. Each 'flag' argument is th... | Python | BSD | 13,524 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/physics/pixelsplines.py | # pixelsplines.py
# Pixel-integrated sline utilities.
# Written by A. Bolton, U. of Utah, 2010-2013.
import numpy as n
from scipy import linalg as la
from scipy import sparse as sp
from scipy import special as sf
def compute_duck_slopes(pixbound, flux):
"""
Compute the slope of the illuminating quadratic... | Python | BSD | 15,555 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/physics/__init__.py | #blah
| Python | BSD | 6 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/physics/grid_spline.py | #
# grid_spline.py
#
# Code for one-dimensional cubic splines on a
# uniform grid, including analytic slope, curvature,
# and extremum evaluation.
#
# Most convenient interface is via GridSpline class,
# which encapsulates the low-level routines.
#
# A. Bolton, U. of Utah, 2010-2014
#
from __future__ import division
i... | Python | BSD | 5,265 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/sandbox/multifit.py | #
# multifit.py
#
# Module of routines for enabling fitting of multiple
# spectra at one time
#
# bolton@utah@iac 2014junio
#
import numpy as n
from redmonster.physics import misc
import copy
from scipy import optimize as opt
from matplotlib import pyplot as p
# These globals almost certainly belong somewhere else:
... | Python | BSD | 26,772 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/sandbox/read_ndArch.py | # read_ndArch.py
#
# Code for reading ndArch files
#
# bolton@utah@iac 2014mayo
#
import numpy as n
from astropy.io import fits
def read_ndArch(fname):
"""
Read in an ndArch archetype file, parsing parameter baselines.
(See ndArch data model document for file details.)
Written by A. Bolton, U. of Uta... | Python | BSD | 4,709 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/sandbox/pixelsplines_demo.py | #
# pixelsplines_demo.py
#
# Script to demonstrate Bolton's "pixelsplines" code.
#
# Meant to be executed incrementally/interactively
# from a Python command line.
#
# bolton@utah2013may
#
# Import statements.
import os
import numpy as n
import matplotlib as m
m.rc('text', usetex=True)
m.use('TkAgg')
m.interactive(Tr... | Python | BSD | 5,791 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/sandbox/example_run.py | from redmonster.application import zfind
plates = [3686]
mjds = [55268]
fiberid = [100,101] #[i for i in xrange(1000)]
templates = ['ndArch-all-CAP-grids.fits', 'ndArch-ssp_em_galaxy-v000.fits',
'ndArch-QSO-V003.fits']
zmin = [-.005,-.01,.4]
zmax = [.005, 1.2, 3.5]
npoly = [4,4,4]
npixstep = [1,2,4]
dest ... | Python | BSD | 749 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/sandbox/dchi2_optimize.py | # Optimize dchi2 threshold in zfitter for best purity/completeness
import numpy as n
import matplotlib.pyplot as p
p.interactive(True)
from redmonster.sandbox import yanny as y
from astropy.io import fits
from redmonster.datamgr import spec, io
from redmonster.physics import zfinder, zfitter, zpicker
from redmonster.p... | Python | BSD | 15,732 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/sandbox/ssp_ztemplate_v00.py | import numpy as n
import matplotlib as m
m.interactive(True)
from matplotlib import pyplot as p
from astropy.io import fits
#from astropy import wcs
import os
#import pixelsplines as pxs
from redmonster.datamgr import io
from redmonster.physics import pixelsplines as pxs
import copy
from redmonster.physics import misc
... | Python | BSD | 7,942 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/sandbox/test_ssp_2014.py | import numpy as n
import matplotlib as m
m.interactive(True)
from matplotlib import pyplot as p
from astropy.io import fits
import os
import pixelsplines as pxs
# Script to test new SSPs from Charlie Conroy, obtained 2014A
#
# Written by A. Bolton, U. of Utah
# Set these environment variables:
# export BOSS_SPECTRO_R... | Python | BSD | 6,916 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/sandbox/sandbox_funcs.py | # sandbox_funcs.py
#
# place to develop functions in sandbox
from scipy import special as spc
import numpy as n
def gaussflux(pixbound, cen, sig):
"""
For monotonically increasing pixel boundaries specified by 'pixbound'
in some abscissa units, consider a Gaussian with unit integrated
amplitude that ... | Python | BSD | 1,002 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/sandbox/yanny.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""Python library for reading & writing yanny files.
yanny is an object-oriented interface to FTCL/yanny data files following
these specifications_.
The format of the returned object is similar to that returned... | Python | BSD | 41,584 |
[ascl:2511.008] | https://github.com/timahutchinson/redmonster | python/redmonster/sandbox/find_lens.py | # Attempt at finding gravitational lenses using chi2 surfaces from zfinder to find superpositions
# of galaxy spectra at different redshifts.
#
# Arguments:
# specobj = data object created by redmonster.datamgr.spec (or a similar user-created object)
# chi2arr = chi**2 surface in shape of (nfiber,npar1,...,nparN,nr... | Python | BSD | 5,327 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.