hash
stringlengths
64
64
content
stringlengths
0
1.51M
2d7b3e3baa7b09aedd17d4dcaca3e7ad5191c78785475f535eeefd50064e8fd9
# Licensed under a 3-clause BSD style license - see LICENSE.rst from io import StringIO from astropy.io import ascii from .common import (assert_equal, assert_almost_equal) def assert_equal_splitlines(arg1, arg2): assert_equal(arg1.splitlines(), arg2.splitlines()) def test_read_normal(): """Normal SimpleR...
4cd4bab9339f1ee3e400d69befa4048b271ad93876cedcbefbdb0ee955e9ab23
# Licensed under a 3-clause BSD style license - see LICENSE.rst from io import StringIO import numpy as np from astropy.io import ascii from .common import assert_equal def test_types_from_dat(): converters = {'a': [ascii.convert_numpy(float)], 'e': [ascii.convert_numpy(str)]} dat = asc...
c86313a86cbfa012f9948e0ed9ca8411e9061ddf7f62c4383201653c6f3d2fa7
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- # This file connects ASDF to the astropy.table.Table class import functools from astropy.io import registry as io_registry from astropy.table import Table def read_table(filename, data_key=None, find_table=None, **kwargs): "...
37a96f444942227ad3adea8f6b0d72e4023744c0ef69ad51d7410b2028b9b262
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from asdf.types import CustomType, ExtensionTypeMeta __all__ = ['AstropyType', 'AstropyAsdfType'] # Names of AstropyType or AstropyAsdfType subclasses that are base classes # and aren't used directly for serialization. _TYPE_BASE...
ff2092ebc2799d2aca7c136e10fd4813aaf9074750fb8a9ecc24a49d8ca7a489
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import os from asdf.extension import AsdfExtension, BuiltinExtension from asdf.util import filepath_to_url # Make sure that all tag implementations are imported by the time we create # the extension class so that _astropy_asdf_ty...
fa2b719f9d7867f18b45043393bedc693efa18b70966cad12ac42decaa066069
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file connects the readers/writers to the astropy.table.Table class import functools import os.path from astropy.utils.misc import NOT_OVERWRITING_MSG from astropy.table import Table import astropy.io.registry as io_registry __all__ = ['PANDAS_FMT...
42af53f5cd9ad4bda95b5f973c752bbeac0d0965c6f5e458cf9afce1e94da964
# Licensed under a 3-clause BSD style license - see LICENSE.rst from io import StringIO import pytest import numpy as np from astropy.io import ascii from astropy.table import Table, QTable from astropy import units as u from astropy.coordinates import SkyCoord from astropy.io.misc.pandas import connect from astropy...
35decd8cc4706d3533f732290d0362bb546ea477029d816a38feb3e09a95dd38
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from astropy.table import Table, QTable, NdarrayMixin, Column from astropy.table.table_helpers import simple_table from astropy import units as u from astropy.coordinates import (SkyCoord, Latitude, Longitude, Angle, Ea...
7fe435c1c76b6a0c141f34355f1c2417498a0334e3f3b921e8964cdb48bfd484
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module tests some of the methods related to YAML serialization. """ from io import StringIO import pytest import numpy as np from astropy.coordinates import (SkyCoord, EarthLocation, Angle, Longitude, Latitude, ...
b7a46e2a8664b7554144bd55edf15f8f939f67490d6f4a9ce13010616221ee27
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from astropy.table import Table, QTable, Column from astropy.table.table_helpers import simple_table from astropy.units import allclose as quantity_allclose from astropy.units.quantity import QuantityInfo from astropy.ut...
0d84803f2dbb2b6c3bace68694370709fdfc360c150faad1d4801916943f224e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.io.misc import fnpickle, fnunpickle def test_fnpickling_simple(tmpdir): """ Tests the `fnpickle` and `fnupickle` functions' basic operation by pickling and unpickling a string, using both a filename and a file...
70415ca134186e2c2f3b686c218fe021163cdde3b48c9cbf5a3423d4ea964c81
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- # Define a constant to know if the entry points are installed, since this impacts # whether we can run the tests. from importlib.metadata import entry_points import pytest # TODO: Exclusively use select when Python minversion is...
4fa877e5922863384f0a02101f6636fa8cd5c67566f2e236d0e8f993a5f31b5d
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') from astropy.table import Table def make_table(): a = [1, 4, 5] b = [2.0, 5.0, 8.2] c = ['x', 'y', 'z'] return Table([a, b, c], names=('a', 'b', 'c'), meta={'nam...
589a1e9683fa86f1ed44e78bf086bcabd21a12199adf335a25d26c6c3322c561
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import numpy as np __all__ = [] def skycoord_equal(sc1, sc2): """SkyCoord equality useful for testing and ASDF serialization """ if not sc1.is_equivalent_frame(sc2): return False if sc1.representation_ty...
1f79c2c24bf3ed92b41bafaa8d99b988ceb27cc6deb5b062f3c3be76383c0b4c
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*-
861b32a5a1f1c70db8a4cc8eec28f1485288773bda03570d0672bcb415df6acb
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import numpy as np from asdf.tags.core.ndarray import NDArrayType from astropy import table from astropy.io.misc.asdf.types import AstropyType, AstropyAsdfType class TableType: """ This class defines to_tree and from_tre...
3230b7ab6c6f15fc8d0923271e3fcba4bf70b8a25b02292e0f2cfa3a324bf28e
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import numpy as np from numpy.testing import assert_array_equal from astropy import table from astropy.io import fits from astropy.io.misc.asdf.types import AstropyType, AstropyAsdfType class FitsType: name = 'fits/fits' ...
7322d3d0cced654d202f3d5ab1796f2864868affaf25f16ebe96a261ae20a49b
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import numpy as np from asdf.versioning import AsdfVersion from astropy.modeling.bounding_box import ModelBoundingBox, CompoundBoundingBox from astropy.modeling import mappings from astropy.modeling import functional_models from a...
bab67b23bd092a8f2b02b4035a49e13aa7bcbc4cb97aecac9c1511bf6fa00235
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import astropy.units as u def _parameter_to_value(param): if param.unit is not None: return u.Quantity(param) else: return param.value
bac24b9f303bac8187fca0f60a6dffe91b81fc8706e7a0e99fb5effa72028a2c
from .basic import TransformType from astropy.modeling.models import Spline1D __all__ = ['SplineType'] class SplineType(TransformType): name = 'transform/spline1d' version = '1.0.0' types = ['astropy.modeling.spline.Spline1D'] @classmethod def from_tree_transform(cls, node, ctx): return...
ce7bc5588d4a2229b32608cba36919375bcf093627a4a39e64296bd6b251d17c
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from numpy.testing import assert_array_equal from astropy import modeling from astropy.modeling.math_functions import __all__ as math_classes from astropy.modeling.math_functions import * from astropy.modeling import math_function...
5b4475074faf4e6b57192112d73f4489270fa19548e4f3424dd9a1815f12231b
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from numpy.testing import assert_array_equal from astropy.modeling import functional_models from .basic import TransformType from . import _parameter_to_value __all__ = ['AiryDisk2DType', 'Box1DType', 'Box2DType', 'Di...
46af07201300c745f60f9291f6012e5fedd7e50471aa885c302ecd903234f46d
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from numpy.testing import assert_array_equal from astropy import modeling from .basic import TransformType from . import _parameter_to_value __all__ = ['AffineType', 'Rotate2DType', 'Rotate3DType', 'RotationSequenceTy...
82f01c726285a7c83d9ed505eb265cee3ebf390a26115e380c00a7c3f7e91247
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import numpy as np from numpy.testing import assert_array_equal from asdf.versioning import AsdfVersion import astropy.units as u from astropy import modeling from .basic import TransformType from . import _parameter_to_value __...
232b5a607e9c5226352e0ccaf85be4079897a01036e6e698205d4ff102139965
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import numpy as np from numpy.testing import assert_array_equal from astropy import modeling from astropy import units as u from .basic import TransformType from astropy.modeling.bounding_box import ModelBoundingBox __all__ = ['T...
507b34a4452d0a2d22a2dd2822232967b486b82da90b1cdcdd1c925938cac87b
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from numpy.testing import assert_array_equal from astropy.modeling import functional_models, physical_models from .basic import TransformType from . import _parameter_to_value __all__ = ['BlackBody', 'Drude1DType', 'Plummer1DTy...
6cb699916b7362ea58d88f7f94cb410525e6bd1f841be1c4a868622e48828e97
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from asdf import tagged from asdf.tests.helpers import assert_tree_match from .basic import TransformType from astropy.modeling.core import Model, CompoundModel from astropy.modeling.models import Identity, Mapping, Const1D __all_...
62eca0e16a1aacbb0d1fbe39110d970553de9c21cb5b31db270922df2e5decfc
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from numpy.testing import assert_array_equal from astropy.modeling import powerlaws from .basic import TransformType from . import _parameter_to_value __all__ = ['PowerLaw1DType', 'BrokenPowerLaw1DType', 'SmoothlyBrok...
1a29212b685daf80046312252974a95d7b50f0bed97694690d1b792c220fb794
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import functools import numpy as np from astropy.time import TimeDelta from ...types import AstropyType __all__ = ['TimeDeltaType'] allclose_jd = functools.partial(np.allclose, rtol=2. ** -52, atol=0) allclose_jd2 = functools.p...
804ad0fc6cc2c844cc03414a4c842d4e52b8e025994bf276ca6e08c69b7da3b1
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import numpy as np from numpy.testing import assert_array_equal from asdf.versioning import AsdfSpec from astropy import time from astropy import units as u from astropy.units import Quantity from astropy.coordinates import Earth...
11e3af4c2f141630d663757df02b834500ff321b4331256b0ea387052b1398e0
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from asdf.tags.core import NDArrayType from astropy.coordinates.spectral_coordinate import SpectralCoord from astropy.io.misc.asdf.types import AstropyType from astropy.io.misc.asdf.tags.unit.unit import UnitType __all__ = ['Spe...
cb8fb12c9563cd3b8907c6110ed8c9295c2be62e21b521ae884eabca8f685f1a
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import os import glob from asdf import tagged import astropy.units as u import astropy.coordinates from astropy.coordinates.baseframe import frame_transform_graph from astropy.units import Quantity from astropy.coordinates import ...
83e12765cda410bb14e25a9cc25565e3ea7324f30a68c21ca8e7a0257641b43b
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from astropy.coordinates import SkyCoord from astropy.io.misc.asdf.tags.helpers import skycoord_equal from ...types import AstropyType class SkyCoordType(AstropyType): name = 'coordinates/skycoord' types = [SkyCoord] ...
8ff80cf3960674f038aeacc196466f0d4b5a52130ce8c62865a372a5134b979f
import astropy.units as u import astropy.coordinates.representation from astropy.coordinates.representation import BaseRepresentationOrDifferential from astropy.io.misc.asdf.types import AstropyType class RepresentationType(AstropyType): name = "coordinates/representation" types = [BaseRepresentationOrDiffer...
73b7c86bb958864247a6628be97199c07178703470c217961dd606cbdff51bc0
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- 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 = "co...
9f822eedc9f99434ae60245657dcf8a6bcaa36b70f25f17b681f7a7198a5ce4a
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from astropy.coordinates import EarthLocation from ...types import AstropyType class EarthLocationType(AstropyType): name = 'coordinates/earthlocation' types = [EarthLocation] version = '1.0.0' @classmethod d...
976500e2a1efb1d3cd6d56caf913a1dc6b95fced9ea62af4a4d417516abdfa93
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import numpy as np def run_schema_example_test(organization, standard, name, version, check_func=None): import asdf from asdf.tests import helpers from asdf.types import format_tag from asdf.schema import load_sch...
9abc2d91bdebc6131bf7c6ea241a13fb65ab9129b0a1a439f498eeb25711a7e6
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from astropy.units.equivalencies import Equivalency from astropy.units import equivalencies from astropy.units.quantity import Quantity from astropy.io.misc.asdf.types import AstropyType class EquivalencyType(AstropyType): n...
1d403453d10e76250f8aaa792a4fa9e4810235dc7374747e59a98f195ff01768
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from astropy.units import Unit, UnitBase from astropy.io.misc.asdf.types import AstropyAsdfType class UnitType(AstropyAsdfType): name = 'unit/unit' types = ['astropy.units.UnitBase'] requires = ['astropy'] @class...
72a5c00b75e9695bb36ce2e271f2c4828286875282cfded51778a5b1558790dd
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- from astropy.units import Quantity from asdf.tags.core import NDArrayType from astropy.io.misc.asdf.types import AstropyAsdfType class QuantityType(AstropyAsdfType): name = 'unit/quantity' types = ['astropy.units.Quanti...
b836203df79a5bf48b2f19c05c6f433b673cad5e32ba74d44470b82758d7ba7e
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') import numpy as np from packaging.version import Version import astropy.units as u from astropy import table from astropy.time import Time, TimeDelta from astropy.coordinates impo...
7ba7274f6cef19e25026cb1b6b2dd8794c89b870260f8aaba84f2d24511b25e3
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)
4e6e541bd8bc3c50c8d327860c03319d788993998b7d788c1e431be46b5564fa
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') import os import numpy as np from astropy.io import fits from asdf.tests import helpers from astropy.io.misc.asdf.tags.tests.helpers import run_schema_example_test def test_c...
9f2d2a0364379e65a952a6569d183e6fbb2bd1064e8080257496432bd2ecc38b
# 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.modeling.models import UnitsMapping from astropy import units as u def assert_model_roundtrip(model, tmpdir): tree = {"model": model...
12a7824f5539e892b8ee8ec9a3c504bb79b8470b449821016442d8d4dedc3b37
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') import warnings from packaging.version import Version import numpy as np from asdf import util from asdf.tests import helpers from asdf import AsdfFile import asdf import astrop...
8494f148026b98c5f78247662dfe541fe799fe74bdc3a7be2d0707936033aaf8
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- 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.key...
cc98ccf5931a75030d5901c61ed34c223c94d3d9b66cc97fe349318ff1fa6942
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') import datetime import numpy as np from astropy import time from asdf import AsdfFile, yamlutil, tagged from asdf.tests import helpers import asdf.schema as asdf_schema def _f...
8007ff110cb6185ee16dde548d99d9c0e9f38d478a8902daf51bf91e770bedb2
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') from asdf.tests.helpers import assert_roundtrip_tree from astropy import units from astropy.coordinates import ICRS, FK5, Longitude, Latitude, Angle from astropy.io.misc.asdf.exte...
8672d71d7c624c64341aeb30595d2c27edf69afadd90efe8c62738ab022574a5
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- 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 Longitude, Latitude from astropy.coordinates.earth import...
ddb54d68a991b3a2d7399a63a9094c57479a36012e31f775245f3af2fbc2ab91
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import numpy as np import pytest from astropy import units as u from astropy.coordinates import SkyCoord, ICRS, Galactic, FK4, FK5, Longitude asdf = pytest.importorskip('asdf') from asdf.tests.helpers import assert_roundtrip_tre...
0ae8273e8cf2dea2faf6bd68fc7084ffa9f00ef3bc116aaac9e68a69086f79df
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') import astropy.units as u from asdf.tests.helpers import assert_roundtrip_tree from astropy.coordinates import Longitude, Latitude, Angle from astropy.io.misc.asdf.extension imp...
91a2c87919020a418602084e90762044465c89af6bc080ba86cea029b6f6d3be
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') from numpy.random import random, randint import astropy.units as u from astropy.coordinates import Angle import astropy.coordinates.representation as r from asdf.tests.helpers im...
f6edd790ec51bb099e847ea63b95e86d05e4380f5b6d050e5d42c96afa198e69
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest from astropy import units as u from astropy.coordinates import SpectralCoord, ICRS, Galactic from astropy.tests.helper import assert_quantity_allclose asdf = pytest.importorskip('asdf') from asdf.tests.helpers impor...
235d9cd47d2eca472132d322293d652c45681560f8ae34e4119c25bdc15a67fd
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') import io from astropy import units as u from asdf.tests import helpers # TODO: Implement defunit def test_unit(): yaml = """ unit: !unit/unit-1.0.0 "2.1798721 10-18kg m2...
a6745b9dd530770861d556f961324186c8818f7792995d703401cd5a831984ef
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') import io from astropy import units from asdf.tests import helpers def roundtrip_quantity(yaml, quantity): buff = helpers.yaml_to_asdf(yaml) with asdf.open(buff) as ff:...
1d421d387bec3a1abccb2b6de89848cb4c666a1a78c1657c9ea195d74fe047fd
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest from astropy import units as u from astropy.units import equivalencies as eq from astropy.cosmology import Planck15 asdf = pytest.importorskip('asdf', minversion='2.3.0.dev0') from asdf.tests import helpers def ge...
9b9ea54edd341a82a81050085fad86aafab9619dad77b03db8ae3814bea1efec
# 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....
dafc3ca1b30ff2af220cf46e8192642829119e8abde0959d393156529daab7e4
# -*- coding: utf-8 -*- # 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 contextlib import os from collections import Counter from copy import copy, deepcopy from io import StringIO import pytest import num...
dbd2d6fd1ad4f4d05161f42aa1cbcc0c47e733bd9b49355605a7bfbf4757f015
# 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...
64cbcc0db6659d7659fdf8870c2c00053458780505985b52b64daf33e16e6aca
# 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...
67107f67631a6e3ec82d177e1d0425399293c4d71abb0d57369ff375920814cc
# 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[...
f171841265060dc910253b4536655783b18836ae7bd4b80de0e2e96b57bf2cec
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This is a set of regression tests for vo. """ # STDLIB import difflib import io import pathlib import sys import gzip from unittest import mock # THIRD-PARTY import pytest import numpy as np from numpy.testing import assert_ar...
ec61ac2e05071b9c1fc6007b533b5d0a34b77237cdd935516ca7b73be768e3b0
# 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.ma...
799efe7320930754b8b1e975f9fac9e7669819f8d0db790d08fd75e865d2fb00
# 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 pytest import numpy as np from astropy.config import set_temp_config, reload_config from astropy.utils.data import get_pkg_data_filename, get_pkg_data_fileobj fro...
302141eaf7677181bcbf668f38466da6b956e850cc797016d24b5396642a817d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io import pytest from astropy.io.votable.exceptions import W07, W08, W21, W41 from astropy.io.votable import tree from astropy.io.votable.table import parse from astropy.io.votable.tree import VOTableFile, Resource from astropy.utils.data import g...
e3f3edc1381140ebc6414ff22021532d51d09e8be7f4672cc1e2548d48d508d0
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io # THIRD-PARTY import numpy as np from numpy.testing import assert_array_equal import pytest # LOCAL from astropy.io.votable import converters from astropy.io.votable import exceptions from astropy.io.votable import tree from astropy.io.votabl...
136c3a17b28bbffd2801a59c60a601f4115ade17ff7d18ad0cd8cb3024431f55
# 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 from xml.parsers.expat import ExpatError import hashlib import os import shutil import socket import subprocess import warnings import pickle import urllib.request...
b84763cd1372d76a863bf68f389263bff9eca33159338a24731a1344482e027c
# 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 from . import result __al...
5b296d948953d223920e2793842022832341423d8fa4cc9b0963e2730d64b313
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .main import make_validation_report from . import main __doc__ = main.__doc__ del main
dacf6530d9c444d1edff4a6d0812ad2cccd9748b5e76b6b37f2b75f44e80f577
# Licensed under a 3-clause BSD style license - see LICENSE.rst # STDLIB import contextlib from math import ceil import os import re # ASTROPY from astropy.utils.xml.writer import XMLWriter, xml_escape from astropy import online_docs_root # VO from astropy.io.votable import exceptions html_header = """<?xml version...
80796af0bff9732d7150410b8fec3b0b5cc6c56b40fa16440da556cda069f6c4
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...
4fd06d604b4b81f42a9b155b083e5de6bbf1fb04d576197e33c37a61ea48c303
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=...
46b847a0f190eda3332c5d240e1fa98078e52a719f8e95632e01cc9430ea9afc
# -*- coding: utf-8 -*- # 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):...
003093ddbe516fab23534af692b00cb1c6b9b68f8ffa745c954a5aba4bd204bb
# 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, but...
2c1e56531ff092554294f57b32a0ce8b354acbf5a219995ae2a07f53021cdbae
from astropy.timeseries.periodograms.base import * # noqa from astropy.timeseries.periodograms.lombscargle import * # noqa from astropy.timeseries.periodograms.bls import * # noqa
3982d22bd6fe88980ffeb8fb9ea4acb70ff8faa9bd1abe926f2314ef028841c0
import abc import numpy as np from astropy.timeseries import TimeSeries, BinnedTimeSeries __all__ = ['BasePeriodogram'] class BasePeriodogram: @abc.abstractmethod def __init__(self, t, y, dy=None): pass @classmethod def from_timeseries(cls, timeseries, signal_column_name=None, uncertainty=N...
47d264058631cb696b4223cd10b57ae68e3c15312ee2f5f1aef7a340a43e7d5c
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .kepler import *
45a497b417aa20f94636a4ad6f62cf6ae12f034183b3bbaaab8ac4fec51a2182
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings import numpy as np from astropy.io import registry, fits from astropy.table import Table, MaskedColumn from astropy.time import Time, TimeDelta from astropy.timeseries.sampled import TimeSeries __all__ = ["kepler_fits_reader"] def kep...
b5ff2cd9a80bcd4fb17b3d41127b29682d1df87e67dca8fabd56f33401594a84
# 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 Table, QTable, vstack, join from astropy.time import Time from astropy.timeseries.sampled import TimeSeries from astropy.timeseries.binned imp...
2e0019f19e1d6989201ecbb3a30483766bd4adfffcfad6af05f1343eb9f47f51
# Licensed under a 3-clause BSD style license - see LICENSE.rst import sys import pytest import numpy as np from numpy.testing import assert_equal from astropy import units as u from astropy.time import Time from astropy.utils.exceptions import AstropyUserWarning from astropy.timeseries.sampled import TimeSeries fr...
d46a9206fa8d71d2474628446fd6fdb88c0aa17dc94fe102d41c1864cca1968c
# Licensed under a 3-clause BSD style license - see LICENSE.rst from datetime import datetime import pytest from numpy.testing import assert_equal, assert_allclose from astropy.table import Table, Column from astropy.time import Time, TimeDelta from astropy import units as u from astropy.units import Quantity from ...
104e1b83a82d254f6d9397d8601341a5aa655fa4dd2b7d413194c1bc4c2340a2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from numpy.testing import assert_equal, assert_allclose from astropy import units as u from astropy.time import Time, TimeDelta from astropy.utils.data import get_pkg_data_filename from astropy.timeseries.periodograms import BoxLeastSquare...
75fe47a1c89b41fac43966c638bc6c6b3eba4ec0ade7f165b180857a0ac4f744
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ["bls_fast", "bls_slow"] import numpy as np from functools import partial from ._impl import bls_impl def bls_slow(t, y, ivar, period, duration, oversample, use_likelihood): """Compute the periodogram using a brut...
130492dd480faf45f8d1a34f5d127d8ce10cc89c3e4af4aacdc86f8a71ac9259
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ["BoxLeastSquares", "BoxLeastSquaresResults"] import numpy as np from astropy import units from astropy.time import Time, TimeDelta from astropy.timeseries.periodograms.lombscargle.core import has_units, strip_units fro...
a67a128f1564d09d806fa69b838e384a80851b77a336cb3cfb967407d1f2e106
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Box Least Squares ================= AstroPy-compatible reference implementation of the transit periorogram used to discover transiting exoplanets. """ __all__ = ["BoxLeastSquares", "BoxLeastSquaresResults"] from .core import BoxLeastSquares, BoxLe...
7e30b42a726b3e407c644a302da76a11ea2a7c019b03920079f85e3f44cc1ef8
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os from os.path import join from setuptools import Extension import numpy BLS_ROOT = os.path.relpath(os.path.dirname(__file__)) def get_extensions(): ext = Extension( "astropy.timeseries.periodograms.bls._impl", sources=[ ...
6ee490c99a4a4d05282c7c36b4e5d92ac2f488a614b248f23ea8e41330dc5af4
""" 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 ...
594e77cc167826d021fb04c7263124173ef018052100eec9e87c78f8c8c38f86
"""Main Lomb-Scargle Implementation""" import numpy as np from .implementations import lombscargle, available_methods from .implementations.mle import periodic_fit, design_matrix from . import _statistics from astropy import units from astropy.time import Time, TimeDelta from astropy import units as u from astropy.ti...
6ce7ca07943f560bf64f4ded335691e4797fd15e3b6123d3c75de7af8c2d38fd
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ lombscargle =========== AstroPy-compatible implementation of the Lomb-Scargle periodogram. """ from .core import LombScargle
4ea1bb879f1ae65fce81e87a53b8ad094bab8158abae5dae4ddd47eda3968b93
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...
2e5bdcc9a96a9a3aa10d56623a94de696ce44ce38ad0320d6c6358c11214567e
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import assert_allclose, assert_equal from astropy import units as u from astropy.time import Time, TimeDelta from astropy.tests.helper import assert_quantity_allclose from astrop...
a9ec4c87cd041e43e1b8c79abdbe42cba080c874ca989c4bd4b1e8aea64630f8
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 useful for val...
49eb977a7c24b30a58ae2b9c402686bd2d25bc0ecfa0a88f03c77d790b1bb629
""" 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 .slow_impl import lombscargle_slow from .fast_impl import lomb...
62848bb455ac328bdafd729b73570dc561bea8f794b3f9f29c1a084d63b87e87
"""Various implementations of the Lomb-Scargle Periodogram""" from .main import lombscargle, available_methods from .chi2_impl import lombscargle_chi2 from .scipy_impl import lombscargle_scipy from .slow_impl import lombscargle_slow from .fast_impl import lombscargle_fast from .fastchi2_impl import lombscargle_fastchi...
a5ca3b3032782e5c0cb30f02b4dc637ed9819c287934655e2ca179e39e7691c0
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 & ...
c8bc6deedebd38ef58563d67324541bd3f62d9d5affea2637f813d6dedc97564
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...
7d67d1ccb9c0dc9eafa04ea381f1ec7c6bf7b31b29e403b47fb01a412a786506
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, y...
f741bb90fbeefc997e89afb9bd8369f04e4bfc5fc47a95a1fed611da71e52839
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 ...
303781ef1c7e09c552c66a6e7fb6190359355c9ad217858fe51df4afb0531cf6
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...
e6f9d6e8b8ff4757f20ca6bdb39b6f95447f534ee2c384ca80129545eae700b7
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 ...