repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
PROTES
PROTES-main/calc/opti/opti_optimatt.py
import numpy as np from opti import Opti try: import teneva with_teneva = True except Exception as e: with_teneva = False class OptiOptimatt(Opti): def __init__(self, name='optimatt', *args, **kwargs): super().__init__(name, *args, **kwargs) def opts(self, dr_max=2): self.opts_d...
763
22.875
65
py
PROTES
PROTES-main/calc/opti/opti_opo.py
import numpy as np from opti import Opti try: import nevergrad as ng with_ng = True except Exception as e: with_ng = False class OptiOPO(Opti): def __init__(self, name='opo', *args, **kwargs): super().__init__(name, *args, **kwargs) def _init(self): if not with_ng: s...
453
18.73913
52
py
PROTES
PROTES-main/calc/opti/__init__.py
from .opti import Opti from .opti_nb import OptiNB from .opti_opo import OptiOPO from .opti_optimatt import OptiOptimatt from .opti_portfolio import OptiPortfolio from .opti_pso import OptiPSO from .opti_protes import OptiProtes from .opti_spsa import OptiSPSA from .opti_ttopt import OptiTTOpt
295
28.6
41
py
PROTES
PROTES-main/calc/opti/opti_spsa.py
import numpy as np from opti import Opti try: import nevergrad as ng with_ng = True except Exception as e: with_ng = False class OptiSPSA(Opti): def __init__(self, name='spsa', *args, **kwargs): super().__init__(name, *args, **kwargs) def _init(self): if not with_ng: ...
449
18.565217
53
py
PROTES
PROTES-main/animation/animate.py
import numpy as np import os import sys from protes import animation def func_build_ackley(n): """Ackley function. See https://www.sfu.ca/~ssurjano/ackley.html.""" d = 2 # Dimension a = -32.768 # Grid lower bound b = +32.768 # Grid upper bound par_a = 20. #...
3,182
29.028302
79
py
DeblendingStarfields
DeblendingStarfields-master/setup.py
import setuptools setuptools.setup( name='DeblendingStarfieldsDevRunjingLiu120', version='0.0.1', author='Runjing Liu', author_email='[email protected]', packages=['deblending_runjingdev'], url='https://github.com/Runjing-Liu120/DeblendingStarfields', description='A package to reprod...
486
33.785714
95
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/flux_utils.py
import torch import numpy as np from torch import nn from torch import optim import deblending_runjingdev.utils as utils from deblending_runjingdev.simulated_datasets_lib import plot_one_star from deblending_runjingdev.wake_lib import PlanarBackground class FluxEstimator(nn.Module): def __init__(self, observed_i...
6,185
34.348571
104
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/image_utils.py
import torch from torch import nn import deblending_runjingdev.utils as utils from deblending_runjingdev.which_device import device # This function copied from # https://gist.github.com/dem123456789/23f18fd78ac8da9615c347905e64fc78 def _extract_patches_2d(img,patch_shape,step=[1.0,1.0],batch_first=False): patch...
8,377
42.409326
126
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/daophot_catalog_lib.py
import torch import numpy as np from deblending_runjingdev.which_device import device from deblending_runjingdev.sdss_dataset_lib import convert_mag_to_nmgy from deblending_runjingdev.image_statistics_lib import get_locs_error def load_daophot_results(data_file, nelec_per_nmgy, ...
2,859
38.178082
96
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/utils.py
import torch import numpy as np from torch.distributions import normal, categorical from deblending_runjingdev.which_device import device # Functions to work with n_stars def get_is_on_from_n_stars(n_stars, max_stars): assert len(n_stars.shape) == 1 batchsize = len(n_stars) is_on_array = torch.zeros((ba...
2,374
29.448718
95
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/starnet_lib.py
import torch import torch.nn as nn import numpy as np import deblending_runjingdev.image_utils as image_utils import deblending_runjingdev.utils as utils from deblending_runjingdev.which_device import device from itertools import product from torch.distributions import poisson class Flatten(nn.Module): def fo...
18,839
40.045752
130
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/elbo_lib.py
import torch import numpy as np import time from torch import nn import deblending_runjingdev.starnet_lib as starnet_lib from deblending_runjingdev.which_device import device def get_neg_elbo(simulator, full_image, locs, fluxes, n_stars, \ log_q_locs, log_q_fluxes, log_q_n_stars, ...
8,194
40.180905
107
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/wake_lib.py
import torch import torch.nn as nn from torch import optim import numpy as np from deblending_runjingdev.simulated_datasets_lib import _get_mgrid, plot_multiple_stars from deblending_runjingdev.psf_transform_lib import PowerLawPSF import deblending_runjingdev.utils from deblending_runjingdev.which_device import devic...
18,610
36.147705
109
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/plotting_utils.py
import matplotlib.pyplot as plt import torch import numpy as np import deblending_runjingdev.image_utils as image_utils from deblending_runjingdev.which_device import device def plot_image(fig, image, true_locs = None, estimated_locs = None, vmin = None, vmax = None, a...
4,500
35.593496
84
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/sdss_dataset_lib.py
import pathlib import os import pickle import numpy as np from scipy.interpolate import RegularGridInterpolator import scipy.stats as stats import torch from torch.utils.data import Dataset from astropy.io import fits from astropy.wcs import WCS import matplotlib.pyplot as plt from deblending_runjingdev.simulated_d...
10,043
37.482759
110
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/psf_transform_lib.py
import torch import torch.nn as nn from torch.nn.functional import unfold, softmax, pad from astropy.io import fits import deblending_runjingdev.image_utils as image_utils from deblending_runjingdev.utils import eval_normal_logprob from deblending_runjingdev.simulated_datasets_lib import _get_mgrid, plot_multiple_st...
6,346
32.582011
101
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/simulated_datasets_lib.py
import numpy as np import scipy.stats as stats import torch from torch.utils.data import Dataset, DataLoader import torch import torch.nn.functional as F import deblending_runjingdev.utils as utils from deblending_runjingdev.which_device import device def _trim_psf(psf, slen): # crop the psf to length slen x sl...
10,604
30.751497
98
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/image_statistics_lib.py
import torch import numpy as np from deblending_runjingdev.sdss_dataset_lib import convert_nmgy_to_mag from deblending_runjingdev.which_device import device def filter_params(locs, fluxes, slen, pad = 5): assert len(locs.shape) == 2 if fluxes is not None: assert len(fluxes.shape) == 1 assert ...
5,243
35.416667
97
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/sleep_lib.py
import torch import numpy as np import math import time from torch.distributions import normal from torch.nn import CrossEntropyLoss import deblending_runjingdev.utils as utils import deblending_runjingdev.elbo_lib as elbo_lib from deblending_runjingdev.which_device import device from itertools import permutations...
9,800
37.136187
127
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/__init__.py
0
0
0
py
DeblendingStarfields
DeblendingStarfields-master/deblending_runjingdev/which_device.py
import torch device = torch.device("cuda:6" if torch.cuda.is_available() else "cpu") # device = 'cpu'
102
24.75
71
py
DeblendingStarfields
DeblendingStarfields-master/experiments_sparse_field/sparse_field_lib.py
import numpy as np import torch import fitsio from astropy.io import fits from astropy.wcs import WCS import deblending_runjingdev.sdss_dataset_lib as sdss_dataset_lib from deblending_runjingdev.sdss_dataset_lib import _get_mgrid2 def load_data(catalog_file = '../coadd_field_catalog_runjing_liu.fit', ...
2,936
33.151163
90
py
DeblendingStarfields
DeblendingStarfields-master/experiments_sparse_field/train_sleep-sparse_field.py
import numpy as np import torch import torch.optim as optim from deblending_runjingdev import simulated_datasets_lib from deblending_runjingdev import starnet_lib from deblending_runjingdev import sleep_lib from deblending_runjingdev import psf_transform_lib from deblending_runjingdev import wake_lib import json im...
4,469
29.827586
87
py
DeblendingStarfields
DeblendingStarfields-master/experiments_m2/train_wake_sleep.py
import numpy as np import torch import torch.optim as optim import deblending_runjingdev.sdss_dataset_lib as sdss_dataset_lib import deblending_runjingdev.simulated_datasets_lib as simulated_datasets_lib import deblending_runjingdev.starnet_lib as starnet_lib import deblending_runjingdev.sleep_lib as sleep_lib from d...
7,431
33.567442
112
py
DeblendingStarfields
DeblendingStarfields-master/experiments_m2/train_sleep.py
import numpy as np import torch import torch.optim as optim import deblending_runjingdev.simulated_datasets_lib as simulated_datasets_lib import deblending_runjingdev.sdss_dataset_lib as sdss_dataset_lib import deblending_runjingdev.starnet_lib as starnet_lib import deblending_runjingdev.sleep_lib as sleep_lib import...
3,978
28.474074
89
py
DeblendingStarfields
DeblendingStarfields-master/experiments_deblending/train_encoder.py
import numpy as np import torch import torch.optim as optim import deblending_runjingdev.simulated_datasets_lib as simulated_datasets_lib import deblending_runjingdev.starnet_lib as starnet_lib import deblending_runjingdev.sleep_lib as sleep_lib import deblending_runjingdev.psf_transform_lib as psf_transform_lib imp...
3,330
25.862903
89
py
DeblendingStarfields
DeblendingStarfields-master/experiments_elbo_vs_sleep/train_elbo.py
import numpy as np import torch import torch.optim as optim import deblending_runjingdev.elbo_lib as elbo_lib import deblending_runjingdev.simulated_datasets_lib as simulated_datasets_lib import deblending_runjingdev.starnet_lib as starnet_lib import deblending_runjingdev.psf_transform_lib as psf_transform_lib impor...
5,869
30.55914
90
py
DeblendingStarfields
DeblendingStarfields-master/experiments_elbo_vs_sleep/train_elbo-Copy1.py
import numpy as np import torch import torch.optim as optim import deblending_runjingdev.elbo_lib as elbo_lib import deblending_runjingdev.simulated_datasets_lib as simulated_datasets_lib import deblending_runjingdev.starnet_lib as starnet_lib import deblending_runjingdev.psf_transform_lib as psf_transform_lib impor...
5,279
33.509804
100
py
DeblendingStarfields
DeblendingStarfields-master/experiments_elbo_vs_sleep/simulate_test_images.py
import numpy as np import torch import json import matplotlib.pyplot as plt import deblending_runjingdev.simulated_datasets_lib as simulated_datasets_lib import deblending_runjingdev.psf_transform_lib as psf_transform_lib from deblending_runjingdev.which_device import device np.random.seed(65765) _ = torch.manual_...
3,256
29.439252
97
py
DeblendingStarfields
DeblendingStarfields-master/experiments_elbo_vs_sleep/train_sleep.py
import numpy as np import torch import torch.optim as optim import deblending_runjingdev.simulated_datasets_lib as simulated_datasets_lib import deblending_runjingdev.starnet_lib as starnet_lib import deblending_runjingdev.sleep_lib as sleep_lib import deblending_runjingdev.psf_transform_lib as psf_transform_lib impo...
4,752
26.316092
89
py
DeblendingStarfields
DeblendingStarfields-master/blip_wrapper/performance_eval.py
import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches mag_vec = np.concatenate((np.array([15]), np.arange(19, 22.2, 0.4), np.array([100]))) MAG_CONST = 2.5 def convert_nmgy_to_mag(nmgy): return 22.5 - MAG_CONST * np.log10(nmgy) def filter_params(locs, fluxes, sle...
8,448
23.923304
93
py
lightkurve
lightkurve-main/src/lightkurve/utils.py
"""This module provides various helper functions.""" import logging import sys import os import warnings from functools import wraps import matplotlib.pyplot as plt from matplotlib.colors import LogNorm import numpy as np from tqdm import tqdm import astropy from astropy.utils.data import download_file from astropy.u...
26,156
31.292593
106
py
lightkurve
lightkurve-main/src/lightkurve/lightcurve.py
"""Defines LightCurve, KeplerLightCurve, and TessLightCurve.""" import os import datetime import logging import warnings import collections from collections.abc import Sequence import numpy as np from scipy.signal import savgol_filter from scipy.interpolate import interp1d import matplotlib from matplotlib import pypl...
138,768
39.754479
140
py
lightkurve
lightkurve-main/src/lightkurve/units.py
"""Define custom AstroPy units commonly used by the Kepler/TESS community.""" from astropy import units as u __all__ = ["ppt", "ppm"] ppt = u.def_unit(["ppt", "parts per thousand"], u.Unit(1e-3)) ppm = u.def_unit(["ppm", "parts per million"], u.Unit(1e-6)) u.add_enabled_units([ppt, ppm])
291
31.444444
77
py
lightkurve
lightkurve-main/src/lightkurve/interact.py
"""Provides tools for interactive visualizations. Example use ----------- The functions in this module are used to create Bokeh-based visualization widgets. For example, the following code will create an interactive visualization widget showing the pixel data and a lightcurve:: # SN 2018 oh Supernova example ...
53,474
37.471223
145
py
lightkurve
lightkurve-main/src/lightkurve/lightcurvefile.py
"""DEPRECATED: `LightCurveFile` classes were removed in Lightkurve v2.0 in favor of only having `LightCurve` classes. To minimize breaking code, we retain the `LightCurveFile` classes here as wrappers around the new `LightCurve` objects, but will remove these wrappers in a future version.. """ from . import LightCurve...
470
41.818182
74
py
lightkurve
lightkurve-main/src/lightkurve/time.py
"""Adds the BKJD and BTJD time format for use by Astropy's `Time` object. Caution: AstroPy time objects make a distinction between a time's format (e.g. ISO, JD, MJD) and its scale (e.g. UTC, TDB). This can be confusing because the acronym "BTJD" refers both to a format (TJD) and to a scale (TDB). Note: the classes ...
1,509
31.12766
82
py
lightkurve
lightkurve-main/src/lightkurve/version.py
# It is important to store the version number in a separate file # so that we can read it from setup.py without importing the package __version__ = "2.4.1dev"
159
39
68
py
lightkurve
lightkurve-main/src/lightkurve/interact_bls.py
"""This module provides helper functions for the `LightCurve.interact_bls()` feature.""" import logging import warnings import numpy as np from astropy.convolution import convolve, Box1DKernel from astropy.time import Time, TimeDelta from astropy.timeseries import BoxLeastSquares import astropy.units as u from .utils...
37,534
36.348259
202
py
lightkurve
lightkurve-main/src/lightkurve/targetpixelfile.py
"""Defines TargetPixelFile, KeplerTargetPixelFile, and TessTargetPixelFile.""" from __future__ import division import datetime import os import warnings import logging import collections from astropy.io import fits from astropy.io.fits import Undefined, BinTableHDU from astropy.nddata import Cutout2D from astropy.ta...
115,945
38.981379
143
py
lightkurve
lightkurve-main/src/lightkurve/periodogram.py
"""Defines the Periodogram class and associated tools.""" from __future__ import division, print_function import copy import logging import math import re import warnings import numpy as np from matplotlib import pyplot as plt import astropy from astropy.table import Table from astropy import units as u from astropy...
53,767
39.487952
106
py
lightkurve
lightkurve-main/src/lightkurve/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import os PACKAGEDIR = os.path.abspath(os.path.dirname(__file__)) MPLSTYLE = "{}/data/lightkurve.mplstyle".format(PACKAGEDIR) """Lightkurve's stylesheet for matplotlib. It is useful for users who create their own figures and want th...
3,896
31.747899
117
py
lightkurve
lightkurve-main/src/lightkurve/search.py
"""Defines tools to retrieve Kepler data from the archive at MAST.""" from __future__ import division import glob import logging import os import re import warnings import numpy as np from astropy import units as u from astropy.coordinates import SkyCoord from astropy.io import ascii from astropy.table import Row, Ta...
56,015
39.328294
185
py
lightkurve
lightkurve-main/src/lightkurve/collections.py
"""Defines collections of data products.""" import warnings import matplotlib import matplotlib.pyplot as plt import numpy as np from astropy.table import vstack from astropy.utils.decorators import deprecated from . import MPLSTYLE from .targetpixelfile import TargetPixelFile from .utils import LightkurveWarning, L...
11,762
36.945161
136
py
lightkurve
lightkurve-main/src/lightkurve/convenience.py
from __future__ import division, print_function import numpy as np from .lightcurve import LightCurve __all__ = ["estimate_cdpp"] def estimate_cdpp(flux, **kwargs): """A convenience function which wraps LightCurve.estimate_cdpp(). For details on the algorithm used to compute the Combined Differential ...
818
25.419355
83
py
lightkurve
lightkurve-main/src/lightkurve/io/tasoc.py
"""TESS Asteroseismic Science Operations Center - https://tasoc.dk TESS Data For Asteroseismology Lightcurves - https://archive.stsci.edu/hlsp/tasoc Data provided with this release have been extracted using the TASOC Photometry pipeline. The TASOC pipeline used to generate the data is open source and available...
1,421
38.5
103
py
lightkurve
lightkurve-main/src/lightkurve/io/tglc.py
"""Reader for TGLC light curve files. Details can be found at https://archive.stsci.edu/hlsp/tglc """ import numpy as np from astropy import units as u from ..lightcurve import TessLightCurve from ..utils import TessQualityFlags from .generic import read_generic_lightcurve def read_tglc_lightcurve( filename, flu...
3,971
39.948454
122
py
lightkurve
lightkurve-main/src/lightkurve/io/kepseismic.py
"""Reader function for KEPSEISMIC community light curve products.""" from ..lightcurve import KeplerLightCurve from .generic import read_generic_lightcurve def read_kepseismic_lightcurve(filename, **kwargs): """Read a KEPSEISMIC light curve file. More information: https://archive.stsci.edu/prepds/kepseismic ...
832
24.242424
68
py
lightkurve
lightkurve-main/src/lightkurve/io/k2sff.py
"""Reader function for K2SFF community light curve products.""" from ..lightcurve import KeplerLightCurve from ..utils import validate_method from .generic import read_generic_lightcurve def read_k2sff_lightcurve(filename, ext="BESTAPER", **kwargs): """Read a K2SFF light curve file. More information: https:...
965
27.411765
79
py
lightkurve
lightkurve-main/src/lightkurve/io/detect.py
"""Provides a function to automatically detect Kepler/TESS file types.""" from astropy.io import fits from astropy.io.fits import HDUList __all__ = ["detect_filetype"] def detect_filetype(hdulist: HDUList) -> str: """Returns Kepler and TESS file types given a FITS object. This function will detect the file ...
5,304
32.575949
82
py
lightkurve
lightkurve-main/src/lightkurve/io/everest.py
"""Reader for K2 EVEREST light curves.""" from ..lightcurve import KeplerLightCurve from ..utils import KeplerQualityFlags from .generic import read_generic_lightcurve def read_everest_lightcurve( filename, flux_column="flux", quality_bitmask="default", **kwargs ): """Read an EVEREST light curve file. M...
2,316
35.203125
79
py
lightkurve
lightkurve-main/src/lightkurve/io/qlp.py
"""Reader for MIT Quicklook Pipeline (QLP) light curve files. Website: http://archive.stsci.edu/hlsp/qlp Product description: https://archive.stsci.edu/hlsps/qlp/hlsp_qlp_tess_ffi_all_tess_v1_data-prod-desc.pdf """ from ..lightcurve import TessLightCurve from ..utils import TessQualityFlags from .generic import read_...
2,872
43.890625
123
py
lightkurve
lightkurve-main/src/lightkurve/io/generic.py
"""Read a generic FITS table containing a light curve.""" import logging import warnings from copy import deepcopy from astropy.io import fits from astropy.table import Table from astropy.time import Time from astropy.units import UnitsWarning import numpy as np from ..utils import validate_method from ..lightcurve i...
5,192
38.340909
85
py
lightkurve
lightkurve-main/src/lightkurve/io/cdips.py
"""Reader for A PSF-Based Approach to TESS Cluster Difference Imaging Photometric Survey (CDIPS) light curves Website: https://archive.stsci.edu/hlsp/cdips Product Description: https://archive.stsci.edu/hlsps/cdips/hlsp_cdips_tess_ffi_all_tess_v01_readme.md """ import logging from ..lightcurve import TessLightCurve f...
3,389
39.843373
109
py
lightkurve
lightkurve-main/src/lightkurve/io/eleanor.py
"""Reader for GSFC-ELEANOR-LITE light curve files. Details can be found at https://archive.stsci.edu/hlsp/eleanor and https://archive.stsci.edu/hlsp/gsfc-eleanor-lite """ from ..lightcurve import TessLightCurve from ..utils import TessQualityFlags from astropy import units as u from .generic import read_generic_lightc...
6,004
43.481481
132
py
lightkurve
lightkurve-main/src/lightkurve/io/pathos.py
"""Reader for A PSF-Based Approach to TESS High Quality Data Of Stellar Clusters (PATHOS) light curve files. Website: https://archive.stsci.edu/hlsp/pathos A product description file wasn't obvious on the MAST website """ from ..lightcurve import TessLightCurve from ..utils import TessQualityFlags from .generic impor...
2,439
36.538462
108
py
lightkurve
lightkurve-main/src/lightkurve/io/__init__.py
"""The .io sub-package provides functions for reading data.""" from astropy.io import registry from .. import LightCurve from . import ( cdips, eleanor, everest, k2sff, kepler, kepseismic, pathos, qlp, tasoc, tess, tglc, ) from .detect import * from .read import * __all__ =...
1,462
33.833333
84
py
lightkurve
lightkurve-main/src/lightkurve/io/tess.py
"""Reader for official TESS light curve FITS files produced by the Ames SPOC pipeline.""" from ..lightcurve import TessLightCurve from ..utils import TessQualityFlags from .generic import read_generic_lightcurve def read_tess_lightcurve( filename, flux_column="pdcsap_flux", quality_bitmask="default" ): """Re...
1,985
39.530612
89
py
lightkurve
lightkurve-main/src/lightkurve/io/read.py
"""Functions for reading light curve data.""" import logging from astropy.io import fits from astropy.utils import deprecated from ..lightcurve import KeplerLightCurve, TessLightCurve from ..utils import LightkurveDeprecationWarning, LightkurveError from .detect import detect_filetype log = logging.getLogger(__name_...
5,788
40.35
181
py
lightkurve
lightkurve-main/src/lightkurve/io/kepler.py
"""Reader for official Kepler light curve FITS files produced by the Ames pipeline.""" from ..lightcurve import KeplerLightCurve from ..utils import KeplerQualityFlags from .generic import read_generic_lightcurve def read_kepler_lightcurve( filename, flux_column="pdcsap_flux", quality_bitmask="default" ): ""...
2,196
38.945455
89
py
lightkurve
lightkurve-main/src/lightkurve/config/__init__.py
import os import warnings import astropy.config as astropyconfig ROOTNAME = 'lightkurve' class ConfigNamespace(astropyconfig.ConfigNamespace): rootname = ROOTNAME class ConfigItem(astropyconfig.ConfigItem): rootname = ROOTNAME def get_config_dir(): """ Determines the package configuration direc...
4,091
31.47619
116
py
lightkurve
lightkurve-main/src/lightkurve/correctors/pldcorrector.py
"""Defines a `PLDCorrector` class which provides a simple way to correct a light curve by utilizing the pixel time series data contained within the target's own Target Pixel File. `PLDCorrector` builds upon `RegressionCorrector` by correlating the light curve against a design matrix composed of the following elements:...
22,759
38.929825
134
py
lightkurve
lightkurve-main/src/lightkurve/correctors/sffcorrector.py
"""Defines the `SFFCorrector` class. `SFFCorrector` enables systematics to be removed from light curves using the Self Flat-Fielding (SFF) method described in Vanderburg and Johnson (2014). """ import logging import warnings import pandas as pd import numpy as np import matplotlib.pyplot as plt from astropy.modeling...
18,054
34.471513
112
py
lightkurve
lightkurve-main/src/lightkurve/correctors/cbvcorrector.py
"""Defines Corrector classes that utilize Kepler/K2/TESS Cotrending Basis Vectors. """ import logging import copy import requests import urllib.request import glob import os import warnings from astropy.io import fits as pyfits from astropy.table import Table from astropy.time import Time from astropy.timeseries impor...
79,354
39.281726
112
py
lightkurve
lightkurve-main/src/lightkurve/correctors/metrics.py
"""Metrics to assess under- and over-fitting of systematic noise. This module provides two metrics, `overfit_metric_lombscargle` and `underfit_metric_neighbors`, which enable users to assess whether the noise in a systematics-corrected light curve has been under- or over-fitted. These features were contributed by Jef...
18,295
38.010661
141
py
lightkurve
lightkurve-main/src/lightkurve/correctors/__init__.py
"""This sub-package defines classes which help remove instrument systematics or variability from time series photometry data. Classes provided by this package should inherit from an abstract `Corrector` class, which provides three key methods:: Corrector(**data_required): .correct(**options) -> Returns a ...
762
35.333333
85
py
lightkurve
lightkurve-main/src/lightkurve/correctors/regressioncorrector.py
"""Defines `RegressionCorrector` to solve large linear regression problems with user-defined Gaussian priors in a fast, analytical way. """ import logging import warnings from astropy.stats import sigma_clip from astropy import units as u from astropy.utils.exceptions import AstropyUserWarning from astropy.utils.maske...
16,667
38.035129
169
py
lightkurve
lightkurve-main/src/lightkurve/correctors/corrector.py
"""Implements the abstract `Corrector` base class. """ from abc import ABC, abstractmethod import matplotlib import numpy as np from .. import LightCurve from .metrics import overfit_metric_lombscargle, underfit_metric_neighbors class Corrector(ABC): """Abstract base class documenting the required structure of ...
5,460
34.461039
96
py
lightkurve
lightkurve-main/src/lightkurve/correctors/designmatrix.py
"""Defines design matrix objects to aid linear regression problems. Specifically, this module adds the `DesignMatrix`, `DesignMatrixCollection`, `SparseDesignMatrix`, and `SparseDesignMatrixCollection` classes which are design to work with the `RegressionCorrector` class. """ from copy import deepcopy import warnings ...
34,995
34.207243
118
py
lightkurve
lightkurve-main/src/lightkurve/prf/tpfmodel.py
"""Provides tools to model a Kepler image for PRF photometry fitting. Examples -------- %matplotlib inline import numpy as np from lightkurve import KeplerTargetPixelFile, LightCurve from lightkurve.prf import StarPrior, BackgroundPrior, FocusPrior, MotionPrior, TPFModel, PRFPhotometry from oktopus import GaussianPrio...
29,717
33.880282
106
py
lightkurve
lightkurve-main/src/lightkurve/prf/prfmodel.py
"""Provides callable models of the Kepler Pixel Response Function (PRF).""" from __future__ import division, print_function import math from astropy.io import fits as pyfits import numpy as np import scipy import scipy.interpolate from ..utils import channel_to_module_output, plot_image __all__ = ["KeplerPRF", "Si...
12,737
33.334232
97
py
lightkurve
lightkurve-main/src/lightkurve/prf/__init__.py
from .prfmodel import * from .tpfmodel import *
48
15.333333
23
py
lightkurve
lightkurve-main/src/lightkurve/seismology/stellar_estimators.py
"""Functions to estimate stellar parameters (radius, mass, logg) using asteroseismic scaling relations. """ from uncertainties import ufloat, umath from astropy import units as u from astropy import constants as const from .utils import SeismologyQuantity __all__ = ["estimate_radius", "estimate_mass", "estimate_logg...
10,895
39.962406
89
py
lightkurve
lightkurve-main/src/lightkurve/seismology/deltanu_estimators.py
"""Helper functions for estimating deltanu from periodograms.""" from __future__ import division, print_function import numpy as np from scipy.signal import find_peaks from matplotlib import pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes from astropy import units as u from .utils import S...
10,981
34.086262
88
py
lightkurve
lightkurve-main/src/lightkurve/seismology/core.py
"""Defines the Seismology class.""" import logging import warnings import numpy as np from matplotlib import pyplot as plt from scipy.signal import find_peaks from astropy import units as u from astropy.units import cds from .. import MPLSTYLE from . import utils, stellar_estimators from ..periodogram import SNRPeri...
38,459
40.533477
124
py
lightkurve
lightkurve-main/src/lightkurve/seismology/utils.py
"""Generic classes and functions which aid the asteroseismology features.""" import numpy as np import copy from astropy import units as u from astropy.units import Quantity __all__ = ["SeismologyQuantity"] class SeismologyQuantity(Quantity): """Holds an asteroseismic value including its unit, error, and estimat...
5,796
36.4
93
py
lightkurve
lightkurve-main/src/lightkurve/seismology/numax_estimators.py
"""Helper functions for estimating numax from periodograms.""" import numpy as np from matplotlib import pyplot as plt from astropy.convolution import convolve, Gaussian1DKernel from astropy import units as u from .. import MPLSTYLE from . import utils from .utils import SeismologyQuantity __all__ = ["estimate_numax...
12,338
36.966154
88
py
lightkurve
lightkurve-main/src/lightkurve/seismology/__init__.py
"""The `lightkurve.seismology` sub-package provides classes and functions for quick-look asteroseismic analyses.""" # Do not export the modules in this subpackage to the root namespace, important # because `lightkurve.utils` collides with `lightkurve.seismology.utils`. __all__ = [ "Seismology", "SeismologyQuan...
653
26.25
79
py
lightkurve
lightkurve-main/tests/test_interact_bls.py
"""Tests the features of the lightkurve.interact_bls module.""" import pytest from astropy.timeseries import BoxLeastSquares import astropy.units as u import numpy as np from lightkurve.lightcurve import KeplerLightCurve, TessLightCurve from .test_lightcurve import KEPLER10, TESS_SIM bad_optional_imports = False try...
4,603
35.539683
114
py
lightkurve
lightkurve-main/tests/test_targetpixelfile.py
import collections import os import tempfile import warnings import matplotlib.pyplot as plt import numpy as np from numpy.testing import assert_array_equal import pytest from astropy.utils.data import get_pkg_data_filename from astropy.io.fits.verify import VerifyWarning from astropy.coordinates import SkyCoord from...
33,035
36.583618
159
py
lightkurve
lightkurve-main/tests/conftest.py
import os import tempfile import pytest def pytest_runtest_setup(item): r"""Our tests will often run in headless virtual environments. For this reason, we enforce the use of matplotlib's robust Agg backend, because it does not require a graphical display. This avoids errors such as: c:\hoste...
2,138
33.5
100
py
lightkurve
lightkurve-main/tests/test_interact.py
"""Tests the features of the lightkurve.interact module.""" import warnings from astropy.utils.data import get_pkg_data_filename import numpy as np from numpy.testing import assert_array_equal import pytest from lightkurve import LightkurveWarning, LightkurveError from lightkurve.search import search_targetpixelfile ...
12,240
39.39934
121
py
lightkurve
lightkurve-main/tests/test_correctors.py
import pytest @pytest.mark.remote_data def test_to_corrector(): """Does the tpf.to_corrector('pld') convenience method work?""" from lightkurve import KeplerTargetPixelFile from .test_targetpixelfile import TABBY_TPF tpf = KeplerTargetPixelFile(TABBY_TPF) lc = tpf.to_corrector("pld").correct() ...
359
26.692308
67
py
lightkurve
lightkurve-main/tests/test_lightcurve.py
from astropy.io import fits as pyfits from astropy.utils.data import get_pkg_data_filename from astropy.utils.masked import Masked from astropy import units as u from astropy.table import Table, Column, MaskedColumn from astropy.time import Time, TimeDelta from astropy.timeseries import aggregate_downsample import mat...
74,521
37.021429
117
py
lightkurve
lightkurve-main/tests/test_synthetic_data.py
"""Use synthetic data to verify lightkurve detrending and signal recovery. """ from __future__ import division, print_function from astropy.utils.data import get_pkg_data_filename from astropy.stats.bls import BoxLeastSquares import numpy as np import pytest from scipy import stats from lightkurve.targetpixelfile im...
8,818
32.660305
87
py
lightkurve
lightkurve-main/tests/test_search.py
"""Test features of lightkurve that interact with the data archive at MAST. Note: if you have the `pytest-remotedata` package installed, then tests flagged with the `@pytest.mark.remote_data` decorator below will only run if the `--remote-data` argument is passed to py.test. This allows tests to pass if no internet c...
24,606
38.817152
119
py
lightkurve
lightkurve-main/tests/test_conf.py
from astropy.utils.data import get_pkg_data_filename import os from pathlib import Path import shutil import tempfile import lightkurve as lk def test_read_conf_from_file(): """Sanity test to ensure lightkurve per-user config is in the expected location.""" # assert the default config assert [] == lk.c...
2,226
34.349206
98
py
lightkurve
lightkurve-main/tests/test_collections.py
import warnings import pytest from astropy import units as u from astropy.utils.data import get_pkg_data_filename from astropy.utils.masked import Masked import matplotlib.pyplot as plt import numpy as np from numpy.testing import assert_array_equal from lightkurve.lightcurve import LightCurve, KeplerLightCurve, Tess...
13,286
31.328467
99
py
lightkurve
lightkurve-main/tests/__init__.py
import os # Where is the test data located? TESTROOT = os.path.abspath(os.path.dirname(__file__)) TESTDATA = os.path.join(TESTROOT, "data")
141
22.666667
53
py
lightkurve
lightkurve-main/tests/test_time.py
from astropy.time import Time import numpy as np def test_bkjd(): """Tests for the Barycentric Kepler Julian Date (BKJD) time format.""" # Sanity checks t0 = Time(0, format="bkjd") assert t0.format == "bkjd" assert t0.scale == "tdb" assert t0.iso == "2009-01-01 12:00:00.000" def test_btjd():...
1,239
39
109
py
lightkurve
lightkurve-main/tests/test_periodogram.py
import sys import pytest import numpy as np import matplotlib.pyplot as plt from numpy.testing import assert_almost_equal, assert_array_equal from astropy import units as u from astropy.time import Time from astropy.stats.bls import BoxLeastSquares from astropy.utils.masked import Masked from lightkurve.lightcurve i...
15,371
32.933775
145
py
lightkurve
lightkurve-main/tests/test_units.py
import pytest import lightkurve as lk # necessary to enable the units tested below from astropy import units as u from .io.test_tasoc import TEST_TIC_ID def test_custom_units(): """Are ppt, ppm, and percent enabled AstroPy units?""" u.Unit("ppt") # custom unit defined in lightkurve.units u.Unit("ppm...
699
30.818182
78
py
lightkurve
lightkurve-main/tests/test_utils.py
import pytest import warnings import numpy as np from numpy.testing import assert_almost_equal, assert_array_equal from lightkurve.utils import KeplerQualityFlags, TessQualityFlags from lightkurve.utils import module_output_to_channel, channel_to_module_output from lightkurve.utils import LightkurveWarning from light...
6,830
34.952632
86
py
lightkurve
lightkurve-main/tests/test_convenience.py
from __future__ import division, print_function import numpy as np from numpy.testing import assert_almost_equal from lightkurve.lightcurve import LightCurve from lightkurve.convenience import estimate_cdpp def test_cdpp(): """Tests the estimate_cdpp() convenience function which wraps `LightCurve.estimate_c...
510
30.9375
65
py
lightkurve
lightkurve-main/tests/io/test_detect.py
import os from astropy.io import fits from lightkurve import PACKAGEDIR from lightkurve.io import detect_filetype from .. import TESTDATA def test_detect_filetype(): """Can we detect the correct filetype?""" k2_path = os.path.join(TESTDATA, "test-tpf-star.fits") tess_path = os.path.join(TESTDATA, "tess...
506
28.823529
81
py
lightkurve
lightkurve-main/tests/io/test_everest.py
import pytest from lightkurve import search_lightcurve @pytest.mark.remote_data def test_search_everest(): """Can we search and download an EVEREST light curve?""" search = search_lightcurve("GJ 9827", author="EVEREST", campaign=12) assert len(search) == 1 assert search.table["author"][0] == "EVEREST...
429
27.666667
72
py
lightkurve
lightkurve-main/tests/io/test_k2sff.py
import pytest from astropy.io import fits import numpy as np from numpy.testing import assert_array_equal from lightkurve.io.k2sff import read_k2sff_lightcurve from lightkurve import search_lightcurve @pytest.mark.remote_data def test_read_k2sff(): """Can we read K2SFF files?""" url = "http://archive.stsci....
1,568
34.659091
126
py
lightkurve
lightkurve-main/tests/io/test_kepseismic.py
import pytest from astropy.io import fits import numpy as np from lightkurve.io.kepseismic import read_kepseismic_lightcurve from lightkurve.io.detect import detect_filetype @pytest.mark.remote_data def test_detect_kepseismic(): """Can we detect the correct format for KEPSEISMIC files?""" url = "https://arch...
1,014
31.741935
155
py
lightkurve
lightkurve-main/tests/io/test_cdips.py
import pytest from astropy.io import fits import numpy as np from numpy.testing import assert_array_equal from lightkurve import search_lightcurve from lightkurve.io.cdips import read_cdips_lightcurve from lightkurve.io.detect import detect_filetype TEST_TIC_ID = 104669918 TEST_FIT_URL = "https://mast.stsci.edu/api/...
2,117
33.16129
182
py
lightkurve
lightkurve-main/tests/io/test_tglc.py
import numpy as np import pytest from astropy.io import fits from numpy.testing import assert_array_equal from lightkurve import search_lightcurve from lightkurve.io.detect import detect_filetype from lightkurve.io.tglc import read_tglc_lightcurve @pytest.mark.remote_data def test_tglc(): """Can we read in TGLC ...
1,499
37.461538
191
py