hash
stringlengths
64
64
content
stringlengths
0
1.51M
ed880b6c12358d97815ddc921ce5bdc9d43eb8aee307baab5ff6b4c72b6332c2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings from asdf import tagged from asdf.tests.helpers import assert_tree_match from astropy.io.misc.asdf.deprecation import create_asdf_deprecation_warning from astropy.io.misc.asdf.tags.transform.basic import TransformType from astropy.modelin...
33ccbb3fc468d79fda0c199e4510831bd95340826eb21a8607561eba4e58ac1a
# Licensed under a 3-clause BSD style license - see LICENSE.rst from numpy.testing import assert_array_equal from astropy.io.misc.asdf.tags.transform.basic import TransformType from astropy.modeling import powerlaws from . import _parameter_to_value __all__ = [ "PowerLaw1DType", "BrokenPowerLaw1DType", "...
4d4d3764354431f7d24c1b0a5de33fd853081193b0edd95b74f514648a4c903d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import numpy as np from astropy.io.misc.asdf.types import AstropyType from astropy.time import TimeDelta __all__ = ["TimeDeltaType"] allclose_jd = functools.partial(np.allclose, rtol=2.0**-52, atol=0) allclose_jd2 = functools.partial( ...
f97d67c9df228b2be77198934dfc8f0d6e4f90c54fc1893666493dc02689ca6c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from asdf.versioning import AsdfSpec from numpy.testing import assert_array_equal from astropy import time from astropy import units as u from astropy.coordinates import EarthLocation from astropy.io.misc.asdf.types import AstropyAsdfTy...
285574b30979203540c501784f9d983ec09ff98ebd5c78d0568c1b73b283a42f
# Licensed under a 3-clause BSD style license - see LICENSE.rst from asdf.tags.core import NDArrayType from astropy.coordinates.spectral_coordinate import SpectralCoord from astropy.io.misc.asdf.tags.unit.unit import UnitType from astropy.io.misc.asdf.types import AstropyType __all__ = ["SpectralCoordType"] class S...
2ffba6e8c224d1464f6e1335e70752623aed16a6e9cefaf292495676476cbebf
# Licensed under a 3-clause BSD style license - see LICENSE.rst import glob import os import warnings from asdf import tagged import astropy.coordinates import astropy.units as u from astropy.coordinates import ICRS, Angle, Latitude, Longitude from astropy.coordinates.baseframe import frame_transform_graph from astro...
9f26ae34b8c9be4b2d074b94e182b378227165aed2571ecb7f500ba14f60ef58
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates import SkyCoord from astropy.coordinates.tests.helper import skycoord_equal from astropy.io.misc.asdf.types import AstropyType class SkyCoordType(AstropyType): name = "coordinates/skycoord" types = [SkyCoord] version ...
46b8f3a1f6825c622f7690bfd23353e7ac397bde701201ba13caa66951de21cd
import astropy.coordinates.representation import astropy.units as u from astropy.coordinates.representation import BaseRepresentationOrDifferential from astropy.io.misc.asdf.types import AstropyType class RepresentationType(AstropyType): name = "coordinates/representation" types = [BaseRepresentationOrDiffere...
51344132014bdd8b644c9b05268a5210a033eca85ba1fb49dcd3a2ae79f29823
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates import Angle, Latitude, Longitude from astropy.io.misc.asdf.tags.unit.quantity import QuantityType __all__ = ["AngleType", "LatitudeType", "LongitudeType"] class AngleType(QuantityType): name = "coordinates/angle" types ...
7bb57eff27df98c4369c93896952f55383796b38e94b0cf135d04270ffb5c119
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates import EarthLocation from astropy.io.misc.asdf.types import AstropyType class EarthLocationType(AstropyType): name = "coordinates/earthlocation" types = [EarthLocation] version = "1.0.0" @classmethod def to_t...
47d9112ccaae947c535c802c523a61decfc0bac5cc784caa460e7cc240ed5ad8
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np def run_schema_example_test(organization, standard, name, version, check_func=None): import asdf from asdf.schema import load_schema from asdf.tests import helpers from asdf.types import format_tag tag = format_tag...
2bd7b59c38ce1ff3ab4efaab2f4b9847fa3a8f6c717c8f174700ba2719eac6bc
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.io.misc.asdf.types import AstropyType from astropy.units import equivalencies from astropy.units.equivalencies import Equivalency class EquivalencyType(AstropyType): name = "units/equivalency" types = [Equivalency] version = "1.0...
928cf10fc31fc9bf1bac0642da10b7679b93c2704fd0eef5f03f7aaede3825c1
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.io.misc.asdf.types import AstropyAsdfType from astropy.units import Unit, UnitBase class UnitType(AstropyAsdfType): name = "unit/unit" types = ["astropy.units.UnitBase"] requires = ["astropy"] @classmethod def to_tree(cl...
e71ae19de058c132d6b9fbbead09c9d42588cb6f6d26ac0a561051f33e54e613
# Licensed under a 3-clause BSD style license - see LICENSE.rst from asdf.tags.core import NDArrayType from astropy.io.misc.asdf.types import AstropyAsdfType from astropy.units import Quantity class QuantityType(AstropyAsdfType): name = "unit/quantity" types = ["astropy.units.Quantity"] requires = ["astr...
90f3f6bf1047be8d4cfa1fc9b03408f18ce8a035f8c389c05c8ea1107c15d3e3
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") import numpy as np from asdf.tags.core.ndarray import NDArrayType from asdf.tests import helpers from packaging.version import Version import astropy.units as u from astropy import table from astropy.coo...
2d5aa455df1d26f3febbb84f95449201363b0901022aa823ddb1c3d0578b7d3d
import pytest from astropy.io.misc.asdf.tests import ASDF_ENTRY_INSTALLED if not ASDF_ENTRY_INSTALLED: pytest.skip( "The astropy asdf entry points are not installed", allow_module_level=True )
71405244703c9a767d87cc1b3c1a1ea5b4956d3cf295770774c94dd7dcc19c83
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") import os import numpy as np from asdf.tests import helpers from astropy.io import fits from astropy.io.misc.asdf.tags.tests.helpers import run_schema_example_test def test_complex_structure(tmpdir): ...
6902bfecedb1a0097910cf3394c4d54ed98bbd7814bec75a248fc2d84867be16
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree from astropy import units as u from astropy.modeling.models import UnitsMapping def assert_model_roundtrip(model, tmpdir): tree = {"model": model...
49a13af678d6cf49ce6776f45573c1dc9e50f3ebec7228ca9f7ead5311dc7658
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") import warnings import asdf import numpy as np from asdf import AsdfFile, util from asdf.tests import helpers from packaging.version import Version import astropy.units as u from astropy.modeling import...
94d0eea2ce55eddf1f7a72413afce94fea1e6ec4d204cf9f9cea3c7e41422e9e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree from astropy import units as u from astropy.time import Time, TimeDelta @pytest.mark.parametrize("fmt", TimeDelta.FORMATS.keys()) def test_timedelta(...
2ef97d26cbad7e8db5e3dfa65aa78d6a21e387683f6557137fa4f0f9512fc1c2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") import datetime import asdf.schema as asdf_schema import numpy as np from asdf import AsdfFile, tagged, yamlutil from asdf.tests import helpers from astropy import time def _flatten_combiners(schema):...
60cab1942f61d4204142b1f3ff11b826fbf46fdb0ae51763b2c15bcad8cf9f31
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree from astropy import units from astropy.coordinates import FK5, ICRS, Angle, Latitude, Longitude def test_hcrs_basic(tmpdir): ra = Longitude(25, u...
4150e3f21e25320e28971c273bb569ab8c7fc4ed8a08d674a371bf571f50a827
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree from astropy import units as u from astropy.coordinates.angles import Latitude, Longitude from astropy.coordinates.earth import ELLIPSOIDS, EarthLocati...
83499191bc02598a88e35882038fd00482b5a0e959a7e8cb186b9b17f8490109
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy import units as u from astropy.coordinates import FK4, ICRS, Galactic, Longitude, SkyCoord asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree # These tests are cribbed d...
b0a7da3e10aa18e06d9f09a3c15d29321aef32a65ba594e59fa920f0d9f271c3
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree import astropy.units as u from astropy.coordinates import Angle, Latitude, Longitude def test_angle(tmpdir): tree = {"angle": Angle(100, u.deg)}...
5a1dd1dabd0c051701f83c8df28cd64d840b647984cc3d92e94972091f0e75e9
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree from numpy.random import randint, random import astropy.coordinates.representation as r import astropy.units as u from astropy.coordinates import Angle...
643301497829583fa9c3cecf978c746a96eee714f56694e0d83241564fe8eb7b
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy import units as u from astropy.coordinates import ICRS, Galactic, SpectralCoord from astropy.tests.helper import assert_quantity_allclose asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree ...
6620b071c7f4aa5ca087e15c51c8e63a36123c05d3d51362bd09ff79ee8b35ba
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io import pytest asdf = pytest.importorskip("asdf") from asdf.tests import helpers from astropy import units as u # TODO: Implement defunit def test_unit(): yaml = """ unit: !unit/unit-1.0.0 "2.1798721 10-18kg m2 s-2" """ buff ...
5f519be11723ce07716387f1a17436491c77fa6191cccdd8ee72cdb4f5908209
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") import io from asdf.tests import helpers from astropy import units def roundtrip_quantity(yaml, quantity): buff = helpers.yaml_to_asdf(yaml) with asdf.open(buff) as ff: assert (ff.tree...
341aff3019476a3f035bce88f26f27e8ef8c19e76e1cb6a5686566d37c1542c8
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy import units as u from astropy.cosmology import Planck15 from astropy.cosmology.units import with_H0 from astropy.units import equivalencies as eq asdf = pytest.importorskip("asdf", minversion="2.3.0.dev0") from asdf.tests imp...
7dc1449fc36a5fb3873f47a8dc3eaf13ccdbb251449df52cd03ab83e2de723a3
# Licensed under a 3-clause BSD style license - see LICENSE.rst from io import StringIO from astropy.nddata import CCDData from astropy.table import Table def test_table_read_help_fits(): """ Test dynamically created documentation help via the I/O registry for 'fits'. """ out = StringIO() Table....
d0c64ca2c1bc548585b63fc7fd93f30df002a727b4be9d32c5ee132fd888d17b
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test :mod:`astropy.io.registry`. .. todo:: Don't rely on Table for tests """ import os from collections import Counter from copy import deepcopy from io import StringIO import numpy as np import pytest import astropy.units as u from astropy....
1f9ab14f8b4e8092692004c06613b5e8caada0cdc7f2d2fbc66718f7758eb6e7
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest # LOCAL from astropy.io.votable import converters, exceptions, tree def test_reraise(): def fail(): raise RuntimeError("This failed") try: try: fail() except RuntimeError as e: excep...
985f26049d2348bf90536d666c584f01dbc2492cc4f7ea5e8df3e1cedbb031fa
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ A set of tests for the util.py module """ import pytest from astropy.io.votable import util def test_range_list(): assert util.coerce_range_list_param((5,)) == ("5.0", 1) def test_range_list2(): assert util.coerce_range_list_param((5e-7, 8...
333b4f6588c53142594a3ae9798396833d714ef39f836e851917f50e00faf068
# Licensed under a 3-clause BSD style license - see LICENSE.rst # LOCAL from astropy.io.votable import parse from astropy.utils.data import get_pkg_data_filename def test_resource_groups(): # Read the VOTABLE votable = parse(get_pkg_data_filename("data/resource_groups.xml")) resource = votable.resources[...
e97291eb46555b7866d932807e2ab3313f44b1936c4f27993bee13150d650099
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This is a set of regression tests for vo. """ # STDLIB import difflib import gzip import io import pathlib import sys from unittest import mock import numpy as np # THIRD-PARTY import pytest from numpy.testing import assert_array_equal from astropy...
75d5810622dea679def80c5caee240f102bc813b73bd59495220d5b9fb485b32
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.io.votable import ucd def test_none(): assert ucd.check_ucd(None) examples = { "phys.temperature": [("ivoa", "phys.temperature")], "pos.eq.ra;meta.main": [("ivoa", "pos.eq.ra"), ("ivoa", "meta.main")], "meta...
6d7c705b86718b97f9a12e94e97c0a7abf32ae059c58caa93a173d818937a748
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test the conversion to/from astropy.table """ import io import os import pathlib import numpy as np import pytest from astropy.config import reload_config, set_temp_config from astropy.io.votable import conf, from_table, is_votable, tree, validate fr...
63c142487419a1bd1e05e2c7c95970077072b19b6036b1690dbc215197d7e35d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io import pytest from astropy.io.votable import tree from astropy.io.votable.exceptions import W07, W08, W21, W41 from astropy.io.votable.table import parse from astropy.io.votable.tree import Resource, VOTableFile from astropy.utils.data import g...
99bda357d9b7afff1ed44ef041c4b002fd3d6554cc2f71dc2922b728cd92fc3d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io # THIRD-PARTY import numpy as np import pytest from numpy.testing import assert_array_equal # LOCAL from astropy.io.votable import converters, exceptions, tree from astropy.io.votable.table import parse_single_table from astropy.utils.data imp...
3bc2c907d7d1927ea8d8c0f0976ee6869218f576f79443f55453001206cf4395
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains a class to handle a validation result for a single VOTable file. """ # STDLIB import hashlib import http.client import os import pickle import shutil import socket import subprocess import urllib.error import urllib.request import warnings fr...
167b29d73de63071a40fea0b3c4ef8dfae150d0f8d04e8f49351775611aacb58
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Validates a large collection of web-accessible VOTable files, and generates a report as a directory tree of HTML files. """ # STDLIB import os # LOCAL from astropy.utils.data import get_pkg_data_filename from . import html, result __all__ = ["make_...
b76cc9e6005c736c0029e5617032da38ac9c915fae56886b525dc9479484b9fc
# Licensed under a 3-clause BSD style license - see LICENSE.rst from . import main from .main import make_validation_report __doc__ = main.__doc__ del main
346519a3b878733dde72adb8ddc26259517b31c12cc11eac99b6626e62b36b36
# Licensed under a 3-clause BSD style license - see LICENSE.rst # STDLIB import contextlib import os import re from math import ceil from astropy import online_docs_root from astropy.io.votable import exceptions from astropy.utils.xml.writer import XMLWriter, xml_escape html_header = """<?xml version="1.0" encoding=...
3c064907ccf1ba7b51d2bfd5fabbf1e4c8d13509c5ff0023a9596206d270fdb0
# Licensed under a 3-clause BSD style license - see LICENSE.rst from functools import wraps import pytest from astropy.utils.compat.optional_deps import HAS_PYTEST_MPL def figure_test(*args, **kwargs): """ A decorator that defines a figure test. This automatically decorates tests with mpl_image_compar...
9e28bc34148da05fd99f2ba7099370f809642edf73b6344a86664429fccd6154
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .helpers import figure_test
8dfaafdd079b2bed05817d16f9a4a43c45f250c7f96db3b14c5e94039a153db1
import pytest # Renamed these imports so that them being in the namespace will not # cause pytest 3 to discover them as tests and then complain that # they have __init__ defined. from astropy.tests.runner import TestRunner as _TestRunner from astropy.tests.runner import TestRunnerBase as _TestRunnerBase from astropy.t...
40f8bfb3a178da0774af9bdefd38c550917bdc80ef4ffb13e3e07aa17974c6e1
import pytest from astropy import units as u from astropy.tests.helper import assert_quantity_allclose def test_assert_quantity_allclose(): assert_quantity_allclose([1, 2], [1, 2]) assert_quantity_allclose([1, 2] * u.m, [100, 200] * u.cm) assert_quantity_allclose([1, 2] * u.m, [101, 201] * u.cm, atol=2...
8473d623b3d9de5c0c01067c726b3e11aaf5e879bc247c64ed12d4bc19cb6d58
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest # test helper.run_tests function from astropy import test as run_tests # run_tests should raise ValueError when asked to run on a module it can't find def test_module_not_found(): with pytest.raises(ValueError): run_tests(packa...
32a42fde0d336b9e3ba8de59ed92d109ba9abca35e342058feba917408215559
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pkgutil def test_imports(): """ This just imports all modules in astropy, making sure they don't have any dependencies that sneak through """ def onerror(name): # We should raise any legitimate error that occurred, bu...
1b8c12bdb6eb6e6ac9c5728423f22046b8e97c0e349d33e77b33ed85cd8d48fa
from astropy.timeseries.periodograms.base import * from astropy.timeseries.periodograms.bls import * from astropy.timeseries.periodograms.lombscargle import *
8be5d2516d8e6f16a154a265777b04d92ce06a34b3090ee286d4f1822df42d44
import abc import numpy as np from astropy.timeseries.binned import BinnedTimeSeries from astropy.timeseries.sampled import TimeSeries __all__ = ["BasePeriodogram"] class BasePeriodogram: @abc.abstractmethod def __init__(self, t, y, dy=None): pass @classmethod def from_timeseries( ...
2ae93f74f8f3102a027828f44c8e7c44d119f8bfd0a8ecef34e2ae01daa4b6df
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings import numpy as np from astropy.io import fits, registry from astropy.table import MaskedColumn, Table from astropy.time import Time, TimeDelta from astropy.timeseries.sampled import TimeSeries __all__ = ["kepler_fits_reader"] def kepl...
76fa9c76f5b0bb600c45053c1c0d1aa401fa51d8788b57ed6b601cf7ff44981d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from numpy.testing import assert_equal from astropy import units as u from astropy.table import QTable, Table, join, vstack from astropy.time import Time from astropy.timeseries.binned import BinnedTimeSeries from astropy.timeseries.sampled...
dbb0b6dd7140e0fd948e313053ce3807f4f934d40c44dc58b07d8326547210a9
# Licensed under a 3-clause BSD style license - see LICENSE.rst import sys import numpy as np import pytest from numpy.testing import assert_equal from astropy import units as u from astropy.time import Time from astropy.timeseries.downsample import aggregate_downsample, reduceat from astropy.timeseries.sampled impo...
56699bafa0abd5c7f208174199ac7a347d2982c14e22b842b4416e5ad4a82d54
# Licensed under a 3-clause BSD style license - see LICENSE.rst from datetime import datetime import pytest from numpy.testing import assert_allclose, assert_equal from astropy import units as u from astropy.table import Column, Table from astropy.tests.helper import assert_quantity_allclose from astropy.time import...
b3e223ce52673a7577321981e2ca10ddee78320ee332a2c1262bee52dd536d7f
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from numpy.testing import assert_allclose, assert_equal from astropy import units as u from astropy.tests.helper import assert_quantity_allclose from astropy.time import Time, TimeDelta from astropy.timeseries.binned import BinnedTimeSeries...
e4a45b6042203909d8f583238558afcca0ca4c968af1d419f91e7ea6c8ddc964
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ["bls_fast", "bls_slow"] from functools import partial import numpy as np from ._impl import bls_impl def bls_slow(t, y, ivar, period, duration, oversample, use_likelihood): """Compute the periodogram using a brute force reference metho...
86b1ebb67e31fbea30e1ca84b8c6c184c37a8907423331397ce0b86ecdc7e8fc
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ["BoxLeastSquares", "BoxLeastSquaresResults"] import numpy as np from astropy import units from astropy import units as u from astropy.time import Time, TimeDelta from astropy.timeseries.periodograms.base import BasePeriodogram from astropy.ti...
88d9d624a25f88d64f187a074830cad1f0c48e018383faf2f48e2bf0ba97b89e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os from os.path import join import numpy from setuptools import Extension BLS_ROOT = os.path.relpath(os.path.dirname(__file__)) def get_extensions(): ext = Extension( "astropy.timeseries.periodograms.bls._impl", sources=[ ...
e3554d34d18d4a04577f5535a37fef0b27cc57e7cc0af414c947a10bdaa38143
""" Utilities for computing periodogram statistics. This is an internal module; users should access this functionality via the ``false_alarm_probability`` and ``false_alarm_level`` methods of the ``astropy.timeseries.LombScargle`` API. """ from functools import wraps import numpy as np from astropy import units as ...
93239015756ec36e1d684cf3938c60bc61bcdb97bf24cafb97c4f399440e233d
"""Main Lomb-Scargle Implementation""" import numpy as np from astropy import units from astropy import units as u from astropy.time import Time, TimeDelta from astropy.timeseries.periodograms.base import BasePeriodogram from . import _statistics from .implementations import available_methods, lombscargle from .impl...
0cd7fc74b671426ea6f43ef3daf080d3228389193cb6537bc1462aec494a92ec
import numpy as np NORMALIZATIONS = ["standard", "psd", "model", "log"] def compute_chi2_ref(y, dy=None, center_data=True, fit_mean=True): """Compute the reference chi-square for a particular dataset. Note: this is not valid center_data=False and fit_mean=False. Parameters ---------- y : array-...
1530684e80bf7942738fcba0740583f8af3463e59acc7118684d925e3e8676c6
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal from astropy import units as u from astropy.tests.helper import assert_quantity_allclose from astropy.time import Time, TimeDelta from astropy.timeseries.periodogram...
1a626db0ba5d3ef2c28310ab99090e7391922732bbee1e0fa7ee0cf856999178
import numpy as np from .mle import design_matrix def lombscargle_chi2( t, y, dy, frequency, normalization="standard", fit_mean=True, center_data=True, nterms=1, ): """Lomb-Scargle Periodogram This implements a chi-squared-based periodogram, which is relatively slow but u...
197953484a1a5dcc4ba5ad0e973da8137073dce587196fec2d22e527612cf49a
""" Main Lomb-Scargle Implementation The ``lombscargle`` function here is essentially a sophisticated switch statement for the various implementations available in this submodule """ __all__ = ["lombscargle", "available_methods"] import numpy as np from .chi2_impl import lombscargle_chi2 from .cython_impl import lo...
b5d7ba97f1f072640da9519356933e3e7e9d7ebb2e8bb23fdfd4b1cbd1484553
"""Various implementations of the Lomb-Scargle Periodogram""" from .chi2_impl import lombscargle_chi2 from .fast_impl import lombscargle_fast from .fastchi2_impl import lombscargle_fastchi2 from .main import available_methods, lombscargle from .scipy_impl import lombscargle_scipy from .slow_impl import lombscargle_slo...
c381fc947ab952fb2c509401c23fa371c97f7b646e899c0a70fac917df67c258
import numpy as np from .utils import trig_sum def lombscargle_fast( t, y, dy, f0, df, Nf, center_data=True, fit_mean=True, normalization="standard", use_fft=True, trig_sum_kwds=None, ): """Fast Lomb-Scargle Periodogram This implements the Press & Rybicki method [...
83d0d9853f9ccd36f6a73862baf642b179c786e6a817164e66f5a8484e6f0812
import numpy as np def lombscargle_scipy(t, y, frequency, normalization="standard", center_data=True): """Lomb-Scargle Periodogram This is a wrapper of ``scipy.signal.lombscargle`` for computation of the Lomb-Scargle periodogram. This is a relatively fast version of the naive O[N^2] algorithm, but ca...
6c689d5172d1a426bda2df7ce14a597025838796933935ddebd0754fa7fafe37
from math import factorial import numpy as np def bitceil(N): """ Find the bit (i.e. power of 2) immediately greater than or equal to N Note: this works for numbers up to 2 ** 64. Roughly equivalent to int(2 ** np.ceil(np.log2(N))) """ return 1 << int(N - 1).bit_length() def extirpolate(x, ...
62f3ef0efe3964697a3d70c1c676f86a9f3d3e28bda7e62b22ef9faef0df1a99
import numpy as np def lombscargle_slow( t, y, dy, frequency, normalization="standard", fit_mean=True, center_data=True ): """Lomb-Scargle Periodogram This is a pure-python implementation of the original Lomb-Scargle formalism (e.g. [1]_, [2]_), with the addition of the floating mean (e.g. [3]_) ...
79b100b7c201b9cfd6d393545d3cd12750b0e4adca35617cf62315ab3ebd21b1
import numpy as np from .utils import trig_sum def lombscargle_fastchi2( t, y, dy, f0, df, Nf, normalization="standard", fit_mean=True, center_data=True, nterms=1, use_fft=True, trig_sum_kwds=None, ): """Lomb-Scargle Periodogram This implements a fast chi-squa...
e25abff5cdc4d9f544fe29e89d348dfe93eb6e6f64ebb9f3fa0e18e97fe2e51d
import numpy as np def design_matrix(t, frequency, dy=None, bias=True, nterms=1): """Compute the Lomb-Scargle design matrix at the given frequency This is the matrix X such that the periodic model at the given frequency can be expressed :math:`\\hat{y} = X \\theta`. Parameters ---------- t :...
47f398c7205cf62449648d2a455af646ad7e66843ced14f615d8f7e257876718
import numpy as np import pytest from numpy.testing import assert_allclose import astropy.units as u from astropy.timeseries.periodograms.lombscargle import LombScargle from astropy.timeseries.periodograms.lombscargle._statistics import ( METHODS, fap_single, inv_fap_single, ) from astropy.timeseries.perio...
9f50d83a8a9afaf70969aed3e5d211b534edc37933b97bf8b9fc2d489de1338e
import numpy as np import pytest from numpy.testing import assert_allclose from astropy.timeseries.periodograms.lombscargle.core import LombScargle from astropy.timeseries.periodograms.lombscargle.utils import ( compute_chi2_ref, convert_normalization, ) NORMALIZATIONS = ["standard", "model", "log", "psd"] ...
c9609998a7e4cced37bff9377321cee96b02b2f8ce752df123fbc35c2ddf82e4
import numpy as np import pytest from numpy.testing import assert_allclose from astropy import units as u from astropy.tests.helper import assert_quantity_allclose from astropy.time import Time, TimeDelta from astropy.timeseries.periodograms.lombscargle import LombScargle ALL_METHODS = LombScargle.available_methods A...
88c970795d5f769b57fc61d1e53f6e288541f24b18eefd8a7137939da081eb54
import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal from astropy.timeseries.periodograms.lombscargle.implementations.utils import ( bitceil, extirpolate, trig_sum, ) @pytest.mark.parametrize("N", 2 ** np.arange(1, 12)) @pytest.mark.parametrize("offset", [-1, 0, 1]) de...
df343e6da494f06169d5c36b29f539b4c5f9a0b25bb039ae22bb86a06d28278f
import numpy as np import pytest from numpy.testing import assert_allclose from astropy.timeseries.periodograms.lombscargle.implementations.mle import ( design_matrix, periodic_fit, ) @pytest.fixture def t(): rand = np.random.default_rng(42) return 10 * rand.random(10) @pytest.mark.parametrize("fre...
2b439e8f29511589543b285cb2fe5f6e914fa6f217b614d975d4f9d6ab6af0bd
# Licensed under a 3-clause BSD style license - see LICENSE.rst from unittest import mock import pytest from astropy.io.fits import BinTableHDU, HDUList, Header, PrimaryHDU from astropy.timeseries.io.kepler import kepler_fits_reader from astropy.utils.data import get_pkg_data_filename def fake_header(extver, versi...
a9bc321b0593ce46a3d2a7d4d7458d05140db961808955a114513ddd108215d2
import pytest import astropy.constants as const from astropy import astronomical_constants, physical_constants def test_version_match(): pversion = physical_constants.get() refpversion = const.h.__class__.__name__.lower() assert pversion == refpversion aversion = astronomical_constants.get() refa...
0c680475adf40509ead694d191b200fa02460433e838ac39327e964fee5595f0
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy import constants as const from astropy.tests.helper import check_pickling_recovery, pickle_protocol # noqa: F401 originals = [ const.Constant("h_fake", "Not Planck", 0.0, "J s", 0.0, "fakeref", system="si"), const.h, ...
90a4eb22ce46df70f2c9a713cca02e6c44107e9d4e8cdec7492fd3501b61e01a
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import numpy as np import pytest from astropy.constants import Constant from astropy.units import Quantity as Q def test_c(): from astropy.constants.codata2010 import c # c is an exactly defined constant, so it shouldn't be changi...
6a5197153bb6bc5bf23fd01ceaebba730332929b8cd3008a2c6c00e1f276a886
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import pytest from astropy.constants import Constant from astropy.units import Quantity as Q def test_c(): from astropy.constants import c # c is an exactly defined constant, so it shouldn't be changing assert c.value == 2.997...
f3fc4c5c0c1e84463f0fb770d68b83a38bb7373c62a40f22c519e50568fe3bb1
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Comparison functions for `astropy.cosmology.Cosmology`. This module is **NOT** public API. To use these functions, import them from the top-level namespace -- :mod:`astropy.cosmology`. This module will be moved. """ from __future__ import annotations...
e38938de588dabaaf72d8a438fe2d86ad24965610a96daa0bda8860ae7e14ff6
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Functions for `astropy.cosmology`.""" from .comparison import cosmology_equal # _z_at_scalar_value is imported for backards compat from .optimize import _z_at_scalar_value, z_at_value __all__ = ["z_at_value", "cosmology_equal"]
f6f35dfb24c755f31945b957d27d4825e03b9e816550bd9b8dbfba449dfbbe3a
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Convenience functions for `astropy.cosmology`. """ import warnings import numpy as np from astropy.cosmology import units as cu from astropy.cosmology.core import CosmologyError from astropy.units import Quantity from astropy.utils.exceptions import...
075b96c285c75124b306739f2a03782060cdcaf3bf9ffeabb91cc49231d015a3
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The following are private functions, included here **FOR REFERENCE ONLY** since the io registry cannot be displayed. These functions are registered into :meth:`~astropy.cosmology.Cosmology.to_format` and :meth:`~astropy.cosmology.Cosmology.from_format...
3a9b778fe0e9758afdbc84f2b6c67b440dc81d508f2eedc50a9938ef164901eb
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy from collections import defaultdict from astropy.cosmology.connect import convert_registry from astropy.cosmology.core import Cosmology from astropy.table import QTable, Row from .mapping import from_mapping def from_row(row, *, move_to_me...
66a763ad6a24cfd44aa48547e023dac54ce01efba89e80b9b6f81d96f8f87c53
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The following are private functions. These functions are registered into :meth:`~astropy.cosmology.Cosmology.to_format` and :meth:`~astropy.cosmology.Cosmology.from_format` and should only be accessed via these methods. """ from astropy.cosmology.con...
fb1bd98490c6619e59b3ff736b43544f7d6689b2a82431e24c31654e959ef43c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.cosmology.connect import convert_registry from astropy.cosmology.core import Cosmology from astropy.table import Column, QTable, Table from .mapping import to_mapping from .row import from_row from .utils import convert_p...
376017135fed6af3e926e81fa3d00b53ea49c36827abc037fff3a00613099a05
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Read/Write/Interchange methods for `astropy.cosmology`. **NOT public API**. """ # Import to register with the I/O machinery from . import cosmology, ecsv, html, mapping, model, row, table, yaml # noqa: F401
b3905adfeab0c5c999e8b02a45ab6e41bed2ee144127694672215f1787a7d6ae
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The following are private functions, included here **FOR REFERENCE ONLY** since the io registry cannot be displayed. These functions are registered into :meth:`~astropy.cosmology.Cosmology.to_format` and :meth:`~astropy.cosmology.Cosmology.from_format...
7c46f6afe085cfce39bfcf0d8c1dfc9ed5f783e6bd6595d6393c8ecb1c7f1baa
import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology.connect import readwrite_registry from astropy.cosmology.core import Cosmology from astropy.cosmology.parameter import Parameter from astropy.table import QTable from .table import from_table, to_table # Format look-up for conversio...
22ebd57a0010c0ea674ef94f1e09a7000a459b0cfee5ed13a39fc7a0e46c3d69
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The following are private functions, included here **FOR REFERENCE ONLY** since the io registry cannot be displayed. These functions are registered into :meth:`~astropy.cosmology.Cosmology.to_format` and :meth:`~astropy.cosmology.Cosmology.from_format...
3b62e9cfb3a7360af99ad77f64c7e1330933447353ac7230fc37adc43967c06c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.modeling import Parameter as ModelParameter from astropy.table import Column FULLQUALNAME_SUBSTITUTIONS = { "astropy.cosmology.flrw.base.FLRW": "astropy.cosmology.flrw.FLRW", "astropy.cosmology.flrw.lambdacdm.Lamb...
d0156126f15fb8fd21d08ad92751b5e5569c60a2b0cc05f5022edaaf86da41ce
# Licensed under a 3-clause BSD style license - see LICENSE.rst import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology.connect import readwrite_registry from astropy.cosmology.core import Cosmology from astropy.table import QTable from .table import from_table, to_table def read_ecsv(...
d01c27897ae7fd956c3463b457ec4797846e20e929e0ca796f59863bc5df3cb7
# Licensed under a 3-clause BSD style license - see LICENSE.rst from math import inf import numpy as np import pytest from astropy.cosmology.utils import ( aszarr, inf_like, vectorize_if_needed, vectorize_redshift_method, ) from astropy.utils.exceptions import AstropyDeprecationWarning from .test_co...
c909205b362821a556fe8d9c68539d0100a8fb94cfd49835b9f6217dd96c8017
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Configure the tests for :mod:`astropy.cosmology`.""" from astropy.cosmology.tests.helper import clean_registry # noqa: F401 from astropy.tests.helper import pickle_protocol # noqa: F401
6118cbb0b44399a8a9624a48a00044d2f99f7f1c4463c8774d141b5b64cc927d
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.parameter`.""" ############################################################################## # IMPORTS # STDLIB import inspect # THIRD PARTY import numpy as np import pytest # LOCAL import astropy.units as u from as...
0b154335d1ec1a58d0c9fe5377421b6b7efe980c58d777d4d3ec57d2f03065ae
"""Testing :mod:`astropy.cosmology.units`.""" ############################################################################## # IMPORTS import pytest import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology import Planck13, default_cosmology from astropy.tests.helper import assert_quantit...