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:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/posterior.py
from .likelihood import Likelihood import numpy as np import dill as pickle import radvel class Posterior(Likelihood): """Posterior object Posterior object to be sent to the fitting routines. It is essentially the same as the Likelihood object, but priors are applied here. Args: likelihood...
Python
MIT
8,517
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/nested_sampling.py
import os import shutil from typing import Optional import h5py import numpy as np from pandas import DataFrame, read_hdf from radvel.posterior import Posterior def _run_dynesty( post: Posterior, output_dir: Optional[str] = None, sampler_type: str = "static", proceed: bool = False, sampler_kwar...
Python
MIT
19,002
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/report.py
import numpy as np import pandas as pd import subprocess import os import tempfile import shutil from operator import itemgetter from jinja2 import Environment, PackageLoader, select_autoescape import radvel env = Environment(loader=PackageLoader('radvel', 'templates')) print_basis = 'per tc tp e w k' units = { ...
Python
MIT
18,042
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/fitting.py
import warnings import scipy.optimize import numpy as np import copy import collections import itertools import radvel.likelihood ALPHABET = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] def maxlike_fitting(post, verbos...
Python
MIT
14,826
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/model.py
import numpy as np from collections import OrderedDict from radvel import kepler from radvel.basis import Basis texdict = { 'per': 'P', 'logper': '\\ln{P}', 'logk': '\\ln{K}', 'tc': 'T\\rm{conj}', 'secosw': '\\sqrt{e}\\cos{\\omega}', 'sesinw': '\\sqrt{e}\\sin{\\omega}', 'ecosw': 'e\\cos{\...
Python
MIT
12,768
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/utils.py
import os import sys from decimal import Decimal from contextlib import contextmanager import warnings import numpy as np from datetime import datetime, timedelta from astropy import constants as c from astropy import units as u import radvel from scipy.optimize import root # Normalization. # RV m/s of a 1.0 Jupiter...
Python
MIT
20,162
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/cli.py
""" Command Line Interface """ import os from argparse import ArgumentParser import radvel.driver from radvel.nested_sampling import BACKENDS def main(): psr = ArgumentParser( description="RadVel: The Radial Velocity Toolkit", prog='RadVel' ) psr.add_argument('--version', act...
Python
MIT
12,716
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/basis.py
import warnings import numpy as np import pandas as pd from collections import OrderedDict from radvel.orbit import timeperi_to_timetrans, timetrans_to_timeperi import radvel.model BASIS_NAMES = ['per tp e w k', # The synth basis 'per tc secosw sesinw logk', 'per tc secosw sesinw k', ...
Python
MIT
34,047
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/mcmc.py
import time import curses import sys import os import multiprocess as mp import pandas as pd import numpy as np import emcee import h5py from radvel import utils import radvel class StateVars(object): def __init__(self): self.oac = 0 self.autosamples = [] self.automean = [] sel...
Python
MIT
25,836
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/gp.py
import sys import radvel import scipy from scipy import spatial import abc import numpy as np import warnings # implemented kernels & examples of their associated hyperparameters KERNELS = { "SqExp": ['gp_length', 'gp_amp'], "Per": ['gp_per', 'gp_length', 'gp_amp'], "QuasiPer": ['gp_per', 'gp_perlength', '...
Python
MIT
17,043
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/tests/test_api.py
import sys import copy import time import types # pytest is now the test runner, but we don't need to import it in test files import radvel import radvel.driver from radvel.nested_sampling import BACKENDS import numpy as np import scipy import radvel.prior class _args(types.SimpleNamespace): outputdir = '/tmp/' ...
Python
MIT
20,434
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/tests/test_cli.py
import subprocess import sys import radvel import radvel.cli def _run_cmd(cmd): p = subprocess.Popen(cmd.split()) p.wait() status = p.poll() out,stderr = p.communicate() return (status, out) def test_help(): """ Test command-line install """ cmd = 'radvel --help' stat,o...
Python
MIT
672
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/tests/test_coverage.py
""" Additional tests to improve code coverage for gp, likelihood, and mcmc modules. """ import copy import numpy as np import pytest import importlib import radvel import radvel.gp import radvel.likelihood # radvel.__init__ does `from .mcmc import *` which shadows the module # with the mcmc function. Import the actua...
Python
MIT
19,856
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/tests/test_nb.py
import os import sys from glob import glob # pytest is now the test runner, but we don't need to import it in test files import nbformat from nbconvert.preprocessors import ExecutePreprocessor def test_notebook(): """ Run though a single notebook tutorial """ # Test just one notebook to avoid pytest ...
Python
MIT
1,165
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/templates/tab_params.tex
\begin{deluxetable}{lrrr} \tablecaption{ {{ title }} } \tablehead{ \colhead{Parameter} & \colhead{Credible Interval} & \colhead{Maximum Likelihood} & \colhead{Units} } \startdata \sidehead{\bf{Modified MCMC Step Parameters}} {% for row in fitting_basis_rows %} {{ row }} \\ {% endfor %} \hline \sidehead{\bf...
LaTeX
MIT
685
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/templates/fig_corner.tex
{# Template to define the radvel multipanel plot #} \begin{figure*}[!h] \centering {# quotes and tildes needed to render the curly braces around infile with nospaces #} {{'\\includegraphics[height=8.0in,width=6.0in,keepaspectratio]{'~infile~'}'}} \caption{Posterior distributions for all free parameters.} \end{figure*}...
LaTeX
MIT
321
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/templates/tab_crit.tex
\begin{deluxetable}{lrrr} \tablecaption{ {{ title }} } \tablehead{ \colhead{Criterion} & \colhead{Final Value} } \startdata {% for row in rows %} {{ row }} \\ {% endfor %} \enddata \end{deluxetable}
LaTeX
MIT
204
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/templates/tab_rv.tex
\begin{deluxetable}{lrrc} \tablecaption{ {{ title }} } \tablehead{ \colhead{Time} & \colhead{RV} & \colhead{RV Unc.} & \colhead{Inst.} \\ \colhead{(JD)} & \colhead{(m s$^{-1}$)} & \colhead{(m s$^{-1}$)} & \colhead{} } \startdata {% for row in rows %} {{ row }} \\ {% endfor %} \tablecomments{ {{ ...
LaTeX
MIT
357
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/templates/tab_prior_summary.tex
\begin{deluxetable}{l} \tablecaption{ {{ title }} } \tablehead{} \startdata {% for row in rows %} {{ row }} \\ {% endfor %} \enddata \end{deluxetable}
LaTeX
MIT
153
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/templates/fig_rv_multipanel.tex
{# Template to define the radvel multipanel plot #} \begin{figure*}[!h] \centering {# quotes and tildes needed to render the curly braces around infile with nospaces #} {{'\\includegraphics[height=8.0in,width=6.0in,keepaspectratio]{'~infile~'}'}} \caption{ Best-fit {{ report.num_planets }}-planet Keplerian orbital mo...
LaTeX
MIT
1,188
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/templates/tab_derived.tex
\begin{deluxetable}{lrrr} \tablecaption{ {{ title }} } \tablehead{ \colhead{Parameter} & \colhead{Credible Interval} & \colhead{Maximum Likelihood} & \colhead{Units} } \startdata {% for row in derived_rows %} {{ row }} \\ {% endfor %} \enddata \end{deluxetable}
LaTeX
MIT
271
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/templates/fig_corner_derived_pars.tex
{# Template to define the radvel multipanel plot #} \begin{figure*}[!h] \centering {# quotes and tildes needed to render the curly braces around infile with nospaces #} {{'\\includegraphics[height=8.0in,width=6.0in,keepaspectratio]{'~infile~'}'}} \caption{Posterior distributions for all derived parameters.} \end{figur...
LaTeX
MIT
324
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/templates/tab_comparison.tex
{{ coldefs }} \tablecaption{Model Comparison} {{ head }} \startdata {% for row in rows %} {{ row }} \\ {% endfor %} \enddata \label{tab:comp} \end{deluxetable*}
LaTeX
MIT
163
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/templates/report.tex
\documentclass{emulateapj} \usepackage{graphicx,textcomp,fancyhdr,hyperref} \begin{document} \pagestyle{fancy} \pagenumbering{gobble} \chead{Summary of \texttt{RadVel} results for {{ report.starname_tex }} } % Model comparison table {{ tab_comparison }} % Table of best fit parameters {{ tab_params }} % Table of deri...
LaTeX
MIT
808
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/plot/__init__.py
import numpy as np import matplotlib # matplotlib.use('agg') from matplotlib import pyplot as pl from matplotlib.cm import nipy_spectral from matplotlib import rcParams from matplotlib.offsetbox import AnchoredText latex = { 'ms': r'm s$^{\mathregular{-1}}$', 'BJDTDB': r'BJD$_{\mathregular{TDB}}$' } telfmts_d...
Python
MIT
5,328
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/plot/mcmc_plots.py
import numpy as np import corner from matplotlib.backends.backend_pdf import PdfPages from matplotlib import pyplot as pl from matplotlib import rcParams from radvel import plot """ Module for plotting results of MCMC analysis, including: - trend plot - autocorrelation plot - corner plot of fitted paramet...
Python
MIT
9,111
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
radvel/plot/orbit_plots.py
import warnings import numpy as np import pandas as pd from matplotlib import rcParams, gridspec from matplotlib import pyplot as pl from matplotlib.ticker import MaxNLocator from astropy.time import Time import copy import radvel from radvel import plot from radvel.plot import mcmc_plots from radvel.utils import t_t...
Python
MIT
33,881
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
example_planets/k2-131_celerite.py
import numpy as np import pandas as pd import os import radvel # This setup file is provided to illustrate how to set up a config # file for use with Dan Foreman-Mackey's `celerite` package. # Data from Dai+ 2017 instnames = ['harps-n', 'pfs'] # no spaces in instrument names data = pd.read_csv(os.path.join(radvel.DA...
Python
MIT
2,595
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
example_planets/k2-131.py
import numpy as np import pandas as pd import os import radvel """ This config file uses Gaussian Process (GP) regression to model stellar activity. Don't start here. Make sure you understand how RadVel works using the basic configuration files (radvel/example_planets/epic203771098.py and radvel/example_planets/HD164...
Python
MIT
5,423
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
example_planets/HD164922.py
# Example Keplerian fit configuration file # Required packages for setup import os import pandas as pd import numpy as np import radvel N_PLANETS = 2 # Define global planetary system and dataset parameters starname = 'HD164922' nplanets = N_PLANETS # number of planets in the system if nplanets != 2: starname ...
Python
MIT
5,058
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
example_planets/epic203771098.py
# Example Keplerian fit configuration file # Required packages for setup import os import pandas as pd import numpy as np import radvel # Define global planetary system and dataset parameters starname = 'epic203771098' nplanets = 2 # number of planets in the system instnames = ['j'] # list of instrument names. ...
Python
MIT
4,096
[ascl:1801.012]
https://github.com/California-Planet-Search/radvel
.github/workflows/ci.yml
name: CI on: push: branches: - main - master - next-release - github-actions pull_request: branches: - main - master - next-release release: types: [published] jobs: test: runs-on: ubuntu-latest strategy: fail-fast: false matrix: ...
YAML
MIT
3,938
[ascl:1902.008]
https://github.com/Goobley/Radynversion
Inn2.py
import torch from torch import nn import numpy as np from FrEIA.framework import InputNode, OutputNode, Node, ReversibleGraphNet from FrEIA.modules import rev_multiplicative_layer, permute_layer from .loss import mse, mse_tv, mmd_multiscale_on from scipy.interpolate import interp1d from copy import deepcopy from it...
Python
MIT
28,047
[ascl:1902.008]
https://github.com/Goobley/Radynversion
README.md
## Radynversion: Learning to Invert a Solar Flare Atmosphere with Invertible Neural Networks This repository contains the code for Radynversion, an Invertible Neural Network (INN) based tool that infers solar atmospheric properties during a solar flare, based on a model trained on RADYN simulations (references not lim...
Markdown
MIT
3,758
[ascl:1902.008]
https://github.com/Goobley/Radynversion
ExportSimpleLineBlobForTraining.py
import os os.environ['CDF_LIB'] = '/usr/local/cdf/lib' import radynpy.RadynCdfLoader as RadynCdfLoader import numpy as np from scipy.signal import savgol_filter from scipy.interpolate import interp1d import matplotlib.pyplot as plt import torch import pickle from tqdm import tqdm from concurrent.futures import ProcessP...
Python
MIT
7,629
[ascl:1902.008]
https://github.com/Goobley/Radynversion
__init__.py
from .Inn2 import * from .loss import * from .utils import *
Python
MIT
61
[ascl:1902.008]
https://github.com/Goobley/Radynversion
Radynversion.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Radynversion Training Notebook\n", "\n", "This notebook is used to train the Radynversion neural network. It requires the following packages:\n", "\n", "`numpy`\n", "\n", "`scipy`\n", "\n", "`matplotl...
Jupyter Notebook
MIT
293,591
[ascl:1902.008]
https://github.com/Goobley/Radynversion
loss.py
import torch def mse(inp, target): return torch.mean((inp - target)**2) def tv_chan(inp, target): l = inp.shape[-1]-1 tvIn = torch.sum(torch.abs(inp[:, :, 1:] - inp[:, :, :-1]), dim=2) tvTarget = torch.sum(torch.abs(target[:, :, 1:] - target[:, :, :-1]), dim=2) return torch.mean(torch.abs(tvTarget...
Python
MIT
2,482
[ascl:1902.008]
https://github.com/Goobley/Radynversion
utils.py
from .Inn2 import RadynversionNet import os import numpy as np from scipy.interpolate import interp1d import torch import matplotlib.pyplot as plt import matplotlib as mpl from matplotlib.colors import PowerNorm,LinearSegmentedColormap import matplotlib.ticker __all__ = ["create_model","obs_files","interp_to_radyn_gri...
Python
MIT
15,131
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
CHANGELOG.md
# Changelog All notable changes to `light-curve-python` 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] ### Added -- ### Changed -- ### Deprec...
Markdown
Unknown
30,854
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
README.md
# `light-curve` processing toolbox for Python A Python wrapper for the [`light-curve-feature`](https://github.com/light-curve/light-curve-feature) and [`light-curve-dmdt`](https://github.com/light-curve/light-curve-dmdt) Rust crates, providing high-performance time-series feature extraction for astrophysics. [![PyPI ...
Markdown
Unknown
44,241
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
.pre-commit-config.yaml
# See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: trailing-whitespace # trims trailing whitespace - id: end-of-file-fixer # ensures that a file is either em...
YAML
Unknown
2,109
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
CLAUDE.md
# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview `light-curve-python` is a hybrid Rust/Python package for time-series feature extraction in astrophysics. It wraps the `light-curve-feature` and `light-curve-dmdt` Rust crates via PyO...
Markdown
Unknown
3,843
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
.github/dependabot.yml
# To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-update...
YAML
Unknown
642
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
.github/copilot-instructions.md
# GitHub Copilot Instructions for light-curve-python ## Project Overview `light-curve-python` is a high-performance Python package for time-series feature extraction, particularly for astrophysical light curves. It's a hybrid Rust/Python project that wraps the [ `light-curve-feature`](https://github.com/light-curve/l...
Markdown
Unknown
8,014
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
.github/workflows/publish.yml
name: Publish Python packages on: push: tags: push: pull_request: repository_dispatch: workflow_dispatch: jobs: check-version: name: Check the tag corresponds to the crate version runs-on: ubuntu-slim steps: - uses: actions/checkout@v6 - name: Set up Rust toolchain u...
YAML
Unknown
5,929
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
.github/workflows/test.yml
name: Test on: [ push, pull_request, workflow_dispatch ] jobs: py_build_deps: outputs: output: ${{ steps.extract_from_toml.outputs.output }} runs-on: ubuntu-slim defaults: run: working-directory: light-curve steps: - uses: actions/checkout@v6 with: subm...
YAML
Unknown
6,781
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/README.md
# `light-curve` processing toolbox for Python A Python wrapper for the [`light-curve-feature`](https://github.com/light-curve/light-curve-feature) and [`light-curve-dmdt`](https://github.com/light-curve/light-curve-dmdt) Rust crates, providing high-performance time-series feature extraction for astrophysics. [![PyPI ...
Markdown
Unknown
44,241
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/Cargo.toml
[package] name = "light-curve-python" version = "0.12.0" authors = [ "Konstantin Malanchev <hombit@gmail.com>", "Anastasia Lavrukhina <lavrukhina.ad@gmail.com>", "Sergey Karpov", "Etienne Russeil", ] description = "Feature extractor from noisy time series" readme = "README.md" repository = "https://gith...
TOML
Unknown
1,869
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/pyproject.toml
[build-system] requires = ["maturin>=1.0,<2.0"] build-backend = "maturin" [project] name = "light-curve" dependencies = ["numpy"] requires-python = ">=3.10" classifiers = [ "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming ...
TOML
Unknown
6,958
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/__init__.py
# Import all Python features from .light_curve_py import * # Hide Python features with Rust equivalents from .light_curve_ext import * # Hide Rust Extractor with universal Python Extractor from .light_curve_py import Extractor from .light_curve_ext import __version__
Python
Unknown
271
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_ext.py
from .light_curve import * # A hack to bypass the lack of package support in PyO3 # https://github.com/PyO3/pyo3/issues/1517#issuecomment-808664021 def __register_submodules(): import sys sys.modules["light_curve.light_curve_ext.ln_prior"] = ln_prior __register_submodules() def feature_from_json(s: str) ...
Python
Unknown
445
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/minuit_lsq.py
"""Re-implementation of iminuit.cost.LeastSquares with an arbitrary data format""" from typing import Callable, Dict, Tuple import numpy as np try: from iminuit import Minuit except ImportError: LeastSquares = None else: # Following https://iminuit.readthedocs.io/en/stable/notebooks/generic_least_squares...
Python
Unknown
896
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/__init__.py
from .features.adnormal import * from .features.amplitude import * from .features.beyondnstd import * from .features.bins import * from .features.color_of_median import * from .features.cusum import * from .features.eta import * from .features.etae import * from .features.excvar import * from .features.extractor import...
Python
Unknown
1,144
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/dataclass_field.py
import sys if sys.version_info >= (3, 10): from dataclasses import field as dataclass_field else: from dataclasses import field as _field def dataclass_field(*, kw_only, **kwargs): return _field(**kwargs) __all__ = ["dataclass_field"]
Python
Unknown
259
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/warnings.py
import warnings class ExperimentalWarning(UserWarning): pass def warn_experimental(msg): warnings.warn(msg, category=ExperimentalWarning, stacklevel=2) def mark_experimental(f, msg=None): def inner(f): message = msg if message is None: full_name = f"{f.__module__}.{f.__clas...
Python
Unknown
596
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/minuit_ml.py
"""Maximum-likelihood based cost function""" from typing import Callable, Dict, Tuple import numpy as np try: from iminuit import Minuit from scipy.special import erf except ImportError: MaximumLikelihood = None else: class MaximumLikelihood: errordef = Minuit.LIKELIHOOD def __init_...
Python
Unknown
3,030
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/pdiffmperc.py
from dataclasses import dataclass import numpy as np from ..dataclass_field import dataclass_field from ._base import BaseSingleBandFeature @dataclass() class PercentDifferenceMagnitudePercentile(BaseSingleBandFeature): quantile: float = dataclass_field(default=0.25, kw_only=True) def _eval_single_band(sel...
Python
Unknown
829
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/skew.py
from ._base import BaseSingleBandFeature class Skew(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): try: from scipy.stats import skew except ImportError: raise ImportError("scipy is required for Skew feature, please install it") return skew(m...
Python
Unknown
420
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/beyondnstd.py
from dataclasses import dataclass import numpy as np from ._base import BaseSingleBandFeature @dataclass() class BeyondNStd(BaseSingleBandFeature): nstd: float = 1.0 def _eval_single_band(self, t, m, sigma=None): mean = np.mean(m) std = np.std(m, ddof=1) return np.count_nonzero(np.a...
Python
Unknown
453
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/percampl.py
import numpy as np from ._base import BaseSingleBandFeature class PercentAmplitude(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): median = np.median(m) return np.max((np.max(m) - median, median - np.min(m))) @property def size_single_band(self): return 1 ...
Python
Unknown
353
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/eta.py
import numpy as np from ._base import BaseSingleBandFeature class Eta(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): n = len(m) m_std = np.var(m, ddof=1) m_sum = np.sum((m[1:] - m[:-1]) ** 2) return m_sum / ((n - 1) * m_std) @property def size_sing...
Python
Unknown
373
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/extractor.py
from dataclasses import dataclass from typing import Collection, Union import numpy as np from light_curve.light_curve_ext import Extractor as _RustExtractor from light_curve.light_curve_ext import _FeatureEvaluator as _RustBaseFeature from ..dataclass_field import dataclass_field from ._base import BaseSingleBandFe...
Python
Unknown
1,395
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/magnpratio.py
from dataclasses import dataclass from ..dataclass_field import dataclass_field from ._base import BaseSingleBandFeature @dataclass() class MagnitudePercentageRatio(BaseSingleBandFeature): quantile_numerator: float = dataclass_field(default=0.4, kw_only=True) quantile_denominator: float = dataclass_field(def...
Python
Unknown
967
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/color_of_median.py
from dataclasses import dataclass from ._base import BaseMultiBandFeature from .median import Median @dataclass() class ColorOfMedian(BaseMultiBandFeature): """Difference of median magnitudes in two bands.""" blue_band: str red_band: str @property def is_band_required(self) -> bool: ret...
Python
Unknown
826
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/_base.py
from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Optional, Sequence import numpy as np from light_curve.light_curve_py.dataclass_field import dataclass_field from light_curve.light_curve_py.warnings import mark_experimental @dataclass class BaseMultiBandFeature(ABC): @pro...
Python
Unknown
5,564
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/stdev.py
import numpy as np from ._base import BaseSingleBandFeature class StandardDeviation(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): return np.std(m, ddof=1) @property def size_single_band(self): return 1 __all__ = ("StandardDeviation",)
Python
Unknown
294
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/median.py
import numpy as np from ._base import BaseSingleBandFeature class Median(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): return np.median(m) @property def size_single_band(self): return 1 __all__ = ("Median",)
Python
Unknown
267
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/excvar.py
import numpy as np from ._base import BaseSingleBandFeature class ExcessVariance(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): m_mean = np.mean(m) d_mean = np.mean(np.power(sigma, 2)) m_std = np.std(m, ddof=1) return (m_std**2 - d_mean) / m_mean**2 @p...
Python
Unknown
409
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/stetsonk.py
import numpy as np from ._base import BaseSingleBandFeature class StetsonK(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): m_mean = np.average(m, weights=np.power(sigma, -2)) numerator = np.sum(np.abs((m - m_mean) / sigma)) chisq = np.sum(((m - m_mean) / sigma) ** 2...
Python
Unknown
463
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/mean.py
import numpy as np from ._base import BaseSingleBandFeature class Mean(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): return np.mean(m) @property def size_single_band(self): return 1 __all__ = ("Mean",)
Python
Unknown
261
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/otsusplit.py
import numpy as np from ._base import BaseSingleBandFeature class OtsuSplit(BaseSingleBandFeature): """Otsu threshholding algorithm Difference of subset means, standard deviation of the lower subset, standard deviation of the upper subset and lower-to-all observation count ratio for two subsets of magni...
Python
Unknown
2,685
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/linfit.py
import numpy as np from ._base import BaseSingleBandFeature from ._lstsq import least_squares class LinearFit(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): n = len(t) slope, chi2 = least_squares(t, m, sigma) red_chi2 = chi2 / (n - 2) weighted_t2 = np.av...
Python
Unknown
662
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/roms.py
import numpy as np from ._base import BaseSingleBandFeature class Roms(BaseSingleBandFeature): r"""Robust median statistic $$ \frac1{N-1} \sum_{i=0}^{N-1} \frac{|m_i - \mathrm{median}(m_i)|}{\sigma_i} $$ For non-variable data, it should be less than one. - Depends on: **magnitude**, **error...
Python
Unknown
747
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/kurtosis.py
import numpy as np from ._base import BaseSingleBandFeature class Kurtosis(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): n = len(m) m_mean = np.mean(m) m_st = np.std(m, ddof=1) ** 4 m_sum = sum(np.power(m - m_mean, 4)) return (n * (n + 1) * m_sum) ...
Python
Unknown
520
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/adnormal.py
from ._base import BaseSingleBandFeature class AndersonDarlingNormal(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): try: from scipy.stats import anderson except ImportError: raise ImportError("scipy is required for AndersonDarlingNormal feature, plea...
Python
Unknown
522
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/ptp_var.py
import numpy as np from ._base import BaseSingleBandFeature class PeakToPeakVar(BaseSingleBandFeature): r"""Peak-to-peak variation $$ \frac{(m_i - \sigma_i)_\text{max} - (m_i + \sigma_i)_\text{min}} {(m_i - \sigma_i)_\text{max} + (m_i + \sigma_i)_\text{min}} $$ Input m must be non-negative (...
Python
Unknown
1,056
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/etae.py
import numpy as np from ._base import BaseSingleBandFeature class EtaE(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): n = len(m) m_std = np.var(m, ddof=1) m_sum = np.sum(((m[1:] - m[:-1]) / (t[1:] - t[:-1])) ** 2) return m_sum * (t[n - 1] - t[0]) ** 2 / ((n...
Python
Unknown
426
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/intpercrange.py
from dataclasses import dataclass from ..dataclass_field import dataclass_field from ._base import BaseSingleBandFeature @dataclass() class InterPercentileRange(BaseSingleBandFeature): quantile: float = dataclass_field(default=0.25, kw_only=True) def _eval_single_band(self, t, m, sigma=None): try: ...
Python
Unknown
720
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/cusum.py
import numpy as np from ._base import BaseSingleBandFeature class Cusum(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): m_mean = np.mean(m) m_std = np.std(m, ddof=1) m_new = np.cumsum(m - m_mean) result = m_new / (len(m) * m_std) return np.ptp(result...
Python
Unknown
409
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/medbufrperc.py
from dataclasses import dataclass import numpy as np from ..dataclass_field import dataclass_field from ._base import BaseSingleBandFeature @dataclass() class MedianBufferRangePercentage(BaseSingleBandFeature): quantile: float = dataclass_field(default=0.1, kw_only=True) def _eval_single_band(self, t, m, s...
Python
Unknown
578
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/lintrend.py
import numpy as np from ._base import BaseSingleBandFeature from ._lstsq import least_squares class LinearTrend(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): n = len(t) slope, chi2 = least_squares(t, m, None) red_chi2 = chi2 / (n - 2) sxx = np.var(t, ddo...
Python
Unknown
499
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/weightmean.py
import numpy as np from ._base import BaseSingleBandFeature class WeightedMean(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): return np.average(m, weights=np.power(sigma, -2)) @property def size_single_band(self): return 1 __all__ = ("WeightedMean",)
Python
Unknown
309
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/bins.py
from dataclasses import dataclass import numpy as np from ..dataclass_field import dataclass_field from ._base_meta import BaseMetaSingleBandFeature @dataclass() class Bins(BaseMetaSingleBandFeature): window: float = dataclass_field(default=1.0, kw_only=True) offset: float = dataclass_field(default=0.0, kw_...
Python
Unknown
1,337
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/medabsdev.py
import numpy as np from ._base import BaseSingleBandFeature class MedianAbsoluteDeviation(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): return np.median((np.abs(m - np.median(m)))) @property def size_single_band(self): return 1 __all__ = ("MedianAbsoluteDeviati...
Python
Unknown
326
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/redchi2.py
import numpy as np from ._base import BaseSingleBandFeature class ReducedChi2(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): n = len(m) weights = sigma**-2 m_wmean = np.average(m, weights=weights) s = (m - m_wmean) ** 2 * weights return np.sum(s) / ...
Python
Unknown
421
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/maxslope.py
import numpy as np from ._base import BaseSingleBandFeature class MaximumSlope(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): m_span = np.subtract(m[1:], m[:-1]) t_span = np.subtract(t[1:], t[:-1]) div = np.abs(np.divide(m_span, t_span)) return np.amax(div)...
Python
Unknown
415
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/flux_n_not_det_before_fd.py
from dataclasses import dataclass from typing import Tuple import numpy as np from ..dataclass_field import dataclass_field from ._base import BaseSingleBandFeature @dataclass() class FluxNNotDetBeforeFd(BaseSingleBandFeature): """Number of non-detections before the first detection for measurements of the flux....
Python
Unknown
2,172
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/magnitude_n_not_det_before_fd.py
from dataclasses import dataclass from typing import Tuple import numpy as np from ..dataclass_field import dataclass_field from ._base import BaseSingleBandFeature @dataclass() class MagnitudeNNotDetBeforeFd(BaseSingleBandFeature): """Number of non detections before the first detection for measurements of the ...
Python
Unknown
2,267
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/_base_meta.py
from abc import abstractmethod from dataclasses import dataclass, field from typing import Collection, Union from light_curve.light_curve_ext import Extractor as _RustExtractor from light_curve.light_curve_ext import _FeatureEvaluator as _RustBaseFeature from ..dataclass_field import dataclass_field from ._base impor...
Python
Unknown
1,485
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/_lstsq.py
import numpy as np def least_squares(t, m, sigma): if t.size < 3: raise ValueError("Time series must have at least 3 points") A = np.vstack([t, np.ones(len(t))]).T if sigma is not None: w = np.diag(1 / sigma) A = np.dot(w, A) m = np.dot(w, m.T) (slope, _), residuals,...
Python
Unknown
391
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/amplitude.py
import numpy as np from ._base import BaseSingleBandFeature class Amplitude(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): return 0.5 * np.ptp(m) @property def size_single_band(self): return 1 __all__ = ("Amplitude",)
Python
Unknown
276
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/meanvar.py
import numpy as np from ._base import BaseSingleBandFeature class MeanVariance(BaseSingleBandFeature): def _eval_single_band(self, t, m, sigma=None): return np.std(m, ddof=1) / np.mean(m) @property def size_single_band(self): return 1 __all__ = ("MeanVariance",)
Python
Unknown
297
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/rainbow/__init__.py
from .generic import *
Python
Unknown
23
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/rainbow/_base.py
from abc import abstractmethod from dataclasses import dataclass from typing import Dict, List, Tuple import numpy as np from light_curve.light_curve_py.dataclass_field import dataclass_field from light_curve.light_curve_py.features._base import BaseMultiBandFeature from light_curve.light_curve_py.features.rainbow._b...
Python
Unknown
15,212
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/rainbow/_bands.py
from typing import Any, Dict import numpy as np from numpy.typing import ArrayLike, NDArray class Bands: """Monochromatic passbands for Rainbow fit.""" @property def names(self) -> NDArray: """Names of the bands""" return self._names.copy() @property def index(self) -> NDArray[i...
Python
Unknown
1,948
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/rainbow/generic.py
from dataclasses import dataclass from typing import Dict, List, Tuple, Union from light_curve.light_curve_py.dataclass_field import dataclass_field from light_curve.light_curve_py.features.rainbow._base import BaseRainbowFit from .bolometric import BaseBolometricTerm, bolometric_terms from .temperature import BaseTe...
Python
Unknown
5,326
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/rainbow/_parameters.py
from enum import IntEnum from typing import Iterable, List import numpy as np from light_curve.light_curve_py.features.rainbow._bands import Bands __all__ = ["create_parameters_class"] def baseline_parameter_name(band: str) -> str: return f"baseline_{band}" def baseline_band_name(name: str) -> str: if na...
Python
Unknown
2,675
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/rainbow/temperature.py
from abc import abstractmethod from dataclasses import dataclass from typing import Dict, List, Union import numpy as np __all__ = ["temperature_terms", "BaseTemperatureTerm", "ConstantTemperatureTerm", "SigmoidTemperatureTerm"] @dataclass() class BaseTemperatureTerm: """Bolometric term for the Rainbow""" ...
Python
Unknown
6,167
[ascl:2312.019]
https://github.com/light-curve/light-curve-python
light-curve/light_curve/light_curve_py/features/rainbow/bolometric.py
import math from abc import abstractmethod from dataclasses import dataclass from typing import Dict, List, Union import numpy as np __all__ = [ "bolometric_terms", "BaseBolometricTerm", "SigmoidBolometricTerm", "BazinBolometricTerm", "LinexpBolometricTerm", "DoublexpBolometricTerm", ] @data...
Python
Unknown
10,742