hash
stringlengths
64
64
content
stringlengths
0
1.51M
a5ec36fa5c0dafbaad54a3ed871df1967cbd3539859d69ac43ee6f65d098d8ba
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module provides functions to help with testing against iraf tasks """ import numpy as np from astropy.logger import log iraf_models_map = {1.: 'Chebyshev', 2.: 'Legendre', 3.: 'Spline3', ...
46f6c52d61947fc74e1afb64cb19683aa30bfd69e4f061733935a77b1612941c
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Here are all the test parameters and values for the each `~astropy.modeling.FittableModel` defined. There is a dictionary for 1D and a dictionary for 2D models. Explanation of keywords of the dictionaries: "parameters" : list or dict Model parame...
05f72d03ab34befa51271b252f2954470bcd34238227b4d64b23ed24a98b92d3
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Module to test fitting routines """ # pylint: disable=invalid-name import os.path import unittest.mock as mk from importlib.metadata import EntryPoint from itertools import combinations from unittest import mock import numpy as np import pytest from n...
a4c2eea9fdd68707618f333437d69344cc9f007341aaf76997eeb8b361a4b474
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal, assert_array_less from astropy import units as u from astropy.coordinates import Angle from astropy.modeling import InputParame...
51ab6aecc2e952e1179f0bf28826ebfcf286e02dd90664e4d2b70f5def12597d
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name from inspect import Parameter import numpy as np import pytest from astropy.modeling.utils import ( _SpecialOperatorsDict, _validate_domain_window, get_inputs_and_params, poly_map_domain) def test_poly_map_domain(): ...
80c12ef4a9b1c9ccece5db2c78c8176d6390c047ac8ddf35ab8b330528f9b7e7
# Licensed under a 3-clause BSD style license - see LICENSE.rst: """ Tests for model evaluation. Compare the results of some models with other programs. """ import unittest.mock as mk import numpy as np # pylint: disable=invalid-name, no-member import pytest from numpy.testing import assert_allclose, assert_equal im...
6402396d8a145e5c431af6fef398b1ec6b1b2dc55e77734d802d56862ddcc41e
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module tests model set evaluation and fitting for some common use cases. """ import numpy as np # pylint: disable=invalid-name import pytest from numpy.testing import assert_allclose from astropy.modeling.core import Model from astropy.modeling.f...
3f97222663d33ab2844cfe62efc1ceefc87955bff35db2bb023037d3d3217539
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests that relate to evaluating models with quantity parameters """ # pylint: disable=invalid-name, no-member import numpy as np import pytest from numpy.testing import assert_allclose from astropy import units as u from astropy.modeling.core import...
701df49e00095147dea3d5fae46618f195c402952d36696e5182ef3cafd4064b
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests that relate to fitting models with quantity parameters """ # pylint: disable=invalid-name, no-member import numpy as np import pytest from astropy import units as u from astropy.modeling import fitting, models from astropy.modeling.core import F...
ac313a8a863288f5b83b8663fa3f0119e84e8d43e8cd55654478e398bc5f6c46
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module tests fitting and model evaluation with various inputs """ import numpy as np import pytest from numpy.testing import assert_allclose from astropy.modeling import fitting, models from astropy.modeling.core import Fittable1DModel, Fittable...
503e2f47910164fdae9960f8da53a7ed8743f21f6bbc3f40cbabe4b74cac3d61
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests that relate to using quantities/units on parameters of models. """ # pylint: disable=invalid-name, no-member import numpy as np import pytest from astropy import coordinates as coord from astropy import units as u from astropy.modeling.core im...
f5e009f222629e65c08c66143612df784872d7bda835214893fb24407c2a7e67
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for polynomial models.""" # pylint: disable=invalid-name import os import unittest.mock as mk import warnings from itertools import product import numpy as np import pytest from numpy.testing import assert_allclose from astropy import conf, wcs...
478ff40b80cac489a38daed054cc55fa5ad7245783be8dcfd1d0c866eb235bdb
# Licensed under a 3-clause BSD style license - see LICENSE.rst import unittest.mock as mk import numpy as np import pytest import astropy.units as u from astropy.coordinates import SpectralCoord from astropy.modeling.bounding_box import ( CompoundBoundingBox, ModelBoundingBox, _BaseInterval, _BaseSelectorArgume...
4f8394826c8e983c42d3316897437e550af0ebc690b750790a965112f19214d9
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name, pointless-statement import pickle import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal import astropy.units as u from astropy.modeling.core import CompoundModel, Model, ModelDefin...
c2544b00a27825d63b74eaf51f77169909f5ede3930c87572ed96aa4fb71dba7
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import numpy as np import pytest from astropy.convolution import convolve_models_fft from astropy.modeling.models import Const1D, Const2D from astropy.utils.compat.optional_deps import HAS_SCIPY # noqa: F401 @pytest.mark....
ea25ef284aa012d58bc2899efd1036502b5641e6f481184f21aea4a3195416be
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import os import subprocess import sys import unittest.mock as mk from inspect import signature import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal import astropy import astropy.modeling...
686fb4b504ff4be44e0edfab3adb05426f70363a066bd79d6e041d12434a02c9
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for spline models and fitters""" import unittest.mock as mk import numpy as np import pytest from numpy.testing import assert_allclose from astropy.modeling.core import FittableModel, ModelDefinitionError from astropy.modeling.fitting import ( ...
38540592d36d317709a763740e05ffa3cd33a718d7146e1add6081f33d08136a
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test separability of models. """ import numpy as np # pylint: disable=invalid-name import pytest from numpy.testing import assert_allclose from astropy.modeling import custom_model, models from astropy.modeling.core import ModelDefinitionError from a...
71d36a21c997c8ec80f266f289c6e15242dd48b55f9e5e861bd9893fa1d17158
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests models.parameters """ # pylint: disable=invalid-name import functools import itertools import unittest.mock as mk import numpy as np import pytest from astropy import units as u from astropy.modeling import fitting, models from astropy.modelin...
3316fde3e54fa51da469cf7ea134e5b0911ac27322232d651b11140fb8fa1ffa
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for physical functions.""" # pylint: disable=no-member, invalid-name import numpy as np import pytest from astropy import cosmology from astropy import units as u from astropy.modeling.fitting import DogBoxLSQFitter, LevMarLSQFitter, LMLSQFitter,...
1c83014eaebf1910fb068fa45696e360bcd91fdbbd872c7277e7dba1ce89b157
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import unittest.mock as mk from math import cos, sin import numpy as np import pytest from numpy.testing import assert_allclose import astropy.units as u from astropy.modeling import models, rotations from astropy.tests.he...
7dd627dbd7e1ab63bcdb2fdcce850d376687d51719a238473a91997815a8f7f5
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import platform import types import warnings import numpy as np import pytest from numpy.random import default_rng from numpy.testing import assert_allclose from astropy.modeling import fitting, models from astropy.modelin...
34822c47bb3366a6dbbd686087d5cff5d2a0d7e5d9f98093e2f0088f5542f092
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal from astropy import units as u from astropy.modeling.fitting import DogBoxLSQFitter, LevMarLSQFitter, LMLSQFitter, TRFLSQFitter f...
9b6d45b12056ad3e27e2c640d7173cb5dd2c91fc343f49785b26d8d7cb130748
# Various tests of models not related to evaluation, fitting, or parameters # pylint: disable=invalid-name, no-member import pytest from astropy import units as u from astropy.modeling import models from astropy.modeling.core import _ModelMeta from astropy.modeling.models import Gaussian1D, Mapping, Pix2Sky_TAN from a...
2c17fcbcc04fde01581435e4e8b1d1ceb1802f3ea9b2a0f568aa4d337e61014a
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name, no-member import numpy as np import pytest from astropy import units as u from astropy.modeling.bounding_box import ModelBoundingBox from astropy.modeling.core import fix_inputs from astropy.modeling.fitting import DogBoxL...
63b0ef0c7879d854198b2cc21eadb9c613db9cb5883252de5851f9aa7979a822
import sys import pytest from astropy.samp import conf from astropy.samp.hub_script import hub_script def setup_module(module): conf.use_internet = False def setup_function(function): function.sys_argv_orig = sys.argv sys.argv = ["samp_hub"] def teardown_function(function): sys.argv = function.s...
8ab1807745fc7ea6b7144b29350f0fc7cbe98414faacdf584828e153ac9c1464
# Licensed under a 3-clause BSD style license - see LICENSE.rst import time import pytest from astropy.samp import conf from astropy.samp.hub import SAMPHubServer def setup_module(module): conf.use_internet = False def test_SAMPHubServer(): """Test that SAMPHub can be instantiated""" SAMPHubServer(we...
a11b4aa47e77fbabc5d4339b36fd75dec2547d336b6266101549c6870a417939
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The astropy.utils.iers package provides access to the tables provided by the International Earth Rotation and Reference Systems Service, in particular allowing interpolation of published UT1-UTC values for given times. These are used in `astropy.time`...
b7ce4f787971738eead77361fcfa90446e8003e4e7d08b7718c430e8ed78f887
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import io import os import sys import stat import errno import base64 import random import shutil import hashlib import pathlib import platform import tempfile import warnings import itertools import contextlib import urllib.error ...
22a833f584c1129938097c24d952ecf6cc3ca28b25f66b7914a0f17af97cf6c6
# Licensed under a 3-clause BSD style license - see LICENSE.rst import concurrent.futures import inspect import pickle import pytest from astropy.utils.decorators import (deprecated_attribute, deprecated, sharedmethod, classproperty, lazyproperty, ...
ff0a37f58dcf1ef448612ce96108e839b782de90f572a1426977e207157e0824
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Built-in mask mixin class. The design uses `Masked` as a factory class which automatically generates new subclasses for any data class that is itself a subclass of a predefined masked class, with `MaskedNDArray` providing such ...
6a02a6c6a2b9e7990568eb29915ee60e7f1ff51ac6bc453e591323e5b38cc3d1
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Helpers for letting numpy functions interact with Masked arrays. The module supplies helper routines for numpy functions that propagate masks appropriately., for use in the ``__array_function__`` implementation of `~astropy.utils.masked.MaskedNDArray`....
5fb9a584a384755bc8f6e100371204894c91cae01fee2837cc1a21bf41c893c6
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Checks for optional dependencies using lazy import from `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_. """ import importlib import warnings # First, the top-level packages: # TODO: This list is a duplicate of the dependencies in setup.cfg "all...
bc96d165397cb6ab3d8c7af5fa7412f911c277e41fab17406cb3fd37e2d97750
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import warnings from pathlib import Path import pytest import numpy as np from astropy.tests.helper import assert_quantity_allclose from astropy.utils.data import get_pkg_data_filename from astropy.config import set_temp_cache from astropy.uti...
5c282b5f773da980a6d876f9886aea055c2a99bf08cf61885dafcf1f7380ea79
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test masked class initialization, methods, and operators. Functions, including ufuncs, are tested in test_functions.py """ import operator import numpy as np from numpy.testing import assert_array_equal import pytest from astropy import units as u fr...
89e2abdc2f8be00def53c45683394f92494c44d90636dfeabca3c2b3ee16c5ab
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test all functions covered by __array_function__. Here, run through all functions, with simple tests just to check the helpers. More complicated tests of functionality, including with subclasses, are done in test_functions. TODO: finish full coverage ...
3e48d52f2c60cabc657386b55e64e5ae5321988b6a2056ea58790dd09c7332a9
# Licensed under a 3-clause BSD style license - see LICENSE.rst from functools import partial from collections import defaultdict import numpy as np from matplotlib import rcParams from matplotlib.artist import Artist from matplotlib.axes import Axes, subplot_class_factory from matplotlib.transforms import Affine2D,...
5d0a79e99390c9e4c986aab96b852a9e87add76da34bfa5112b71a548cfbb733
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import defaultdict import numpy as np from matplotlib import rcParams from matplotlib.text import Text from .frame import RectangularFrame def sort_using(X, Y): return [x for (y, x) in sorted(zip(Y, X))] class TickLabels(Text):...
61642f404e9b5f2837f6fe9af6cd1cb3ea23187bb464be5ae2bf4e5ac42de5db
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import defaultdict import numpy as np from matplotlib.lines import Path, Line2D from matplotlib.transforms import Affine2D from matplotlib import rcParams class Ticks(Line2D): """ Ticks are derived from Line2D, and note that t...
ccc25ad7471169340b36eb24c216866a792045aa079c338674dacb1ecd715515
# Licensed under a 3-clause BSD style license - see LICENSE.rst import abc from collections import OrderedDict import numpy as np from matplotlib import rcParams from matplotlib.lines import Line2D, Path from matplotlib.patches import PathPatch __all__ = ['RectangularFrame1D', 'Spine', 'BaseFrame', 'RectangularFr...
479c27960b9f238421de203c7f6ddeb160d806facbb4f88774ad5bcda243f4c2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from astropy.io import fits from astropy.utils.compat.optional_deps import HAS_MATPLOTLIB if HAS_MATPLOTLIB: import matplotlib.image as mpimg from astropy.visualization.scripts.fits2bitmap import fits2bitmap, ma...
3cfec60793d0353f64381d4f183e4ea9dc88b9c53eb7c72530d5cfa7c3ed57d3
# Licensed under a 3-clause BSD style license - see LICENSE.rst import textwrap import numpy as np import pytest from astropy.io import fits from astropy.nddata.nduncertainty import ( StdDevUncertainty, MissingDataAssociationException, VarianceUncertainty, InverseVariance) from astropy import units as u from...
08a96a6c0482e040780ea4778e82acbd5f76d8d95e05a07dd0b7eb282eabcecf
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pickle import pytest import numpy as np from numpy.testing import assert_array_equal, assert_allclose from astropy.nddata.nduncertainty import (StdDevUncertainty, VarianceUncertainty, Inve...
08623c197581b569da8595f12ae408e598e5ea52920df9acdec3ad7de845eb86
# This file includes the definition of a mix-in class that provides the low- # and high-level WCS API to the astropy.wcs.WCS object. We keep this code # isolated in this mix-in class to avoid making the main wcs.py file too # long. import warnings import numpy as np from astropy import units as u from astropy.coordi...
bec736a6e107d2cddbcd00b6501989dc84bd71e651b00e0a5eb9d698551b5303
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io import os from contextlib import nullcontext from datetime import datetime from packaging.version import Version import pytest import numpy as np from numpy.testing import ( assert_allclose, assert_array_almost_equal, assert_array_almost_eq...
fb3d1eb325c954fc408ecb3788b518d9e5eeb622aa9dc05e5a83caf2fd885b81
# Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import deepcopy import numpy as np import pytest from packaging.version import Version from astropy import wcs from astropy.wcs import _wcs # noqa from astropy.io import fits from astropy.utils.data import get_pkg_data_filename from . helper ...
945c85c9083e256fe856ebdc36c09dc86bdc45653f98af06d2ae635de98ba701
# Note that we test the main astropy.wcs.WCS class directly rather than testing # the mix-in class on its own (since it's not functional without being used as # a mix-in) import warnings from packaging.version import Version import numpy as np import pytest from numpy.testing import assert_equal, assert_allclose from...
6fdd08781364f29ee8cbbe3b8d40720a19b06f866ef451ba2f95c721c4e2c5b8
""" Helper functions for Time. """ from . import function_helpers
938ab58c7e777f9ddd7f591e89ed6fc3c3c1ddcbcda95855f41b17516dfc300e
""" Helpers for overriding numpy functions in `~astropy.time.Time.__array_function__`. """ import numpy as np from astropy.units.quantity_helper.function_helpers import FunctionAssigner # TODO: Fill this in with functions that don't make sense for times UNSUPPORTED_FUNCTIONS = {} # Functions that return the final res...
172964082434e22ec7ba942e7e380094a837d7090f8ecaafbd08094d48bc4918
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import copy import functools import datetime from copy import deepcopy from decimal import Decimal, localcontext from io import StringIO import numpy as np import pytest from numpy.testing import assert_allclose import erfa from erfa import Erf...
bbd40d1b510a9ad04b3448eb0bbcce3fe53109c761db2338c659fa8f2374d7d4
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICNSE.rst # This module includes files automatically generated from ply (these end in # _lextab.py and _parsetab.py). To generate these files, remove them from this # folder, then build astropy and run the tests in-place: # # python setup.p...
1ecf37e60c54c53e157bed2135bf4508f5f5c7f286afbde8c056e815a6ad25b4
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ A collection of different unit formats. """ # This is pretty atrocious, but it will prevent a circular import for those # formatters that need access to the units.core module An entry for it should # exist in sys.modules since astropy.units.core imp...
c91ea701086511eb32ce9a0e4a844d096e4c8c05821a1d1401453a4d9613b95a
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICNSE.rst # This module includes files automatically generated from ply (these end in # _lextab.py and _parsetab.py). To generate these files, remove them from this # folder, then build astropy and run the tests in-place: # # python setup.p...
a18136f41fa8716b3b1519d3635d8c1e21c9e530c39c89eb807ea8c2ebc18ff4
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Utilities shared by the different formats. """ import warnings from fractions import Fraction from astropy.utils.misc import did_you_mean from ..utils import maybe_simple_fraction def get_grouped_by_powers(bases, powers): """ Groups the ...
88c24be6b0909c0510ec466c9c352205040c52f08f78f1dcc65331e725d2fe39
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "FITS" unit format. """ import copy import keyword import operator import numpy as np from . import core, generic, utils class Fits(generic.Generic): """ The FITS standard unit format. This supports the format defined in...
282a20a457a2b6d6db6c61a1e968466ef17236e18b819aaf2de16c4d16e98cac
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module includes files automatically generated from ply (these end in # _lextab.py and _parsetab.py). To generate these files, remove them from this # folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace #...
360a1e92d08434840efe60d5fb1cdc62bc2e12f00c8c2557676421f60bce7781
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # The idea for this module (but no code) was borrowed from the # quantities (http://pythonhosted.org/quantities/) package. """Helper functions for Quantity. In particular, this implements the logic that determines scaling and resul...
66146588e7118617a42fe643b73dbdcb3b8ad2eb354ae1adbd4779f24ac2d7d9
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """Converters for Quantity.""" import threading import numpy as np from astropy.units.core import ( UnitConversionError, UnitsError, UnitTypeError, dimensionless_unscaled) __all__ = ['can_have_arbitrary_unit', 'converters_an...
679c96b67138e4652c978d0ee920a37b28c2131f03140a81e749a0ed589c654e
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Helper functions for Quantity. In particular, this implements the logic that determines scaling and result units for a given ufunc, given input units. """ from .converters import * # isort: split # By importing helpers, all the unit conversion functi...
ae7ce60bc97f7def23090c5afa1c0dda206b43011bf76c9e6ec298a8bd1cf408
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """Quantity helpers for the ERFA ufuncs.""" # Tests for these are in coordinates, not in units. from erfa import dt_eraASTROM, dt_eraLDBODY, dt_pv from erfa import ufunc as erfa_ufunc from astropy.units.core import UnitsError, Uni...
89dce95350995d001a5c93223fd4bc547b3680c1220afdde7b641d5c121a2702
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license. See LICENSE.rst except # for parts explicitly labelled as being (largely) copies of numpy # implementations; for those, see licenses/NUMPY_LICENSE.rst. """Helpers for overriding numpy functions. We override numpy functions in `~astropy.units.Quanti...
a675cba587fc132d6dd486b76719d3da7f3d51d2712e8ee33e702473c542bcc0
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """Quantity helpers for the scipy.special ufuncs. Available ufuncs in this module are at https://docs.scipy.org/doc/scipy/reference/special.html """ import numpy as np from astropy.units.core import UnitsError, UnitTypeError, dime...
ac7ecae01643733f4ed4506f8f08f9668a79acdefee6af4ccbbd7b4875f47c64
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """Separate tests specifically for equivalencies.""" import numpy as np # THIRD-PARTY import pytest from numpy.testing import assert_allclose # LOCAL from astropy import constants from astropy import units as u from astropy.tests.helper i...
bb1b8f9a18f0cc06aae3f984f6243b55311d671d0226137c8735785a4e8d7dd5
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """Test setting and adding unit aliases.""" import pytest import astropy.units as u trials = [ ({"Angstroms": u.AA}, "Angstroms", u.AA), ({"counts": u.count}, "counts/s", u.count / u.s), ({"ergs": u.erg, "Angstroms": u...
9b4122847abfcb1f646aef17bc4cdbc744a987f7d320187dff58d5a8bfcbdda1
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test utilities for `astropy.units`. """ import numpy as np from numpy import finfo from astropy.units.quantity import Quantity from astropy.units.utils import quantity_asanyarray, sanitize_scale _float_finfo = finfo(float) def t...
d704e129caca9881f6e99d4fa0bd8da07c9208a2145469aabf6de09fac4a6d09
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """Regression tests for deprecated units or those that are "soft" deprecated because they are required for VOUnit support but are not in common use.""" import pytest from astropy import units as u from astropy.units import depre...
8ae8413961995b06a056aaa49dee46f5b74a3b971880f87250e4a7a82e2ca592
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for the photometric module. Note that this is shorter than might be expected because a lot of the relevant tests that deal with magnidues are in `test_logarithmic.py` """ from astropy.tests.helper import assert_quantity_allclos...
e21a329e4e4d53520642193e059dc5d501adc797e8ec0eca45ca6f87a336aa38
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Regression tests for the units.format package """ import warnings from contextlib import nullcontext from fractions import Fraction import numpy as np import pytest from numpy.testing import assert_allclose from astropy impor...
23a8316043e199e0a5ba502598b70e1c8f264b8f0a16710faf47946377b43c7e
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """Regression tests for the units package.""" import pickle from fractions import Fraction import numpy as np import pytest from numpy.testing import assert_allclose from astropy import constants as c from astropy import units as ...
c68ac88fdd25522d9173c81f9bcc48b811446a3acb13c8a22c45b0285dc54aa6
# The purpose of these tests are to ensure that calling quantities using # array methods returns quantities with the right units, or raises exceptions. import sys import numpy as np import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.utils.compat import NUMPY_LT_1_20...
1393d7cabb6b36badfc5b6b2797acfc114cb74b954a105420e6657c3cf75ec45
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test the Logarithmic Units and Quantities """ import itertools import pickle import numpy as np import pytest from numpy.testing import assert_allclose from astropy import constants as c from astropy import units as u from astrop...
c96cd4ebbb45fc25f858b2e9385f22ccbd6781bce86e50f01ec578cdc259f449
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """Test the Quantity class and related.""" import sys import typing as T import numpy as np import pytest from astropy import units as u from astropy.units._typing import HAS_ANNOTATED, Annotated @pytest.mark.skipif(sys.version_info < ...
f522f4f67f96d107ce297dfb48bb6f253debf274f7ef3cb0c5a9c493c2de273b
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test Structured units and quantities. """ import copy import numpy as np import numpy.lib.recfunctions as rfn import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.tests.helper import c...
f4ead3f4385c0c4b1c343b8bb735489cbf148214aba3f66208179c1c372f995d
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """Test the Quantity class and related.""" import copy import decimal import numbers import pickle from fractions import Fraction import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_almost_equal, asser...
729512e71cc2c514053464f4552b2ab8d833afa03425c62ae58a06794113424d
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test Structured units and quantities specifically with the ERFA ufuncs. """ import erfa import numpy as np import pytest from erfa import ufunc as erfa_ufunc from numpy.testing import assert_array_equal from astropy import units as u f...
7fa2087ebbaf653053dd67d4094541ad939144e5f38d8d4748170b1b7e183fb5
# Licensed under a 3-clause BSD style license - see LICENSE.rst import inspect import itertools import numpy as np import numpy.lib.recfunctions as rfn import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.units.quantity_helper.function_helpers import ( ARRAY_FUNCT...
25e155277aec2c111231ee61db62d0750c8c40830f522d50d15c9985e0c9c25e
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Unit tests for the handling of physical types in `astropy.units`. """ import pickle import pytest from astropy import units as u from astropy.constants import hbar from astropy.units import physical from astropy.utils.exceptions import AstropyDeprec...
7f2b2bacc519610c9d46d9db6a9e419e9396edb022919af96c02e9d3568697e7
# The purpose of these tests are to ensure that calling ufuncs with quantities # returns quantities with the right units, or raises exceptions. import concurrent.futures import warnings from collections import namedtuple import numpy as np import pytest from erfa import ufunc as erfa_ufunc from numpy.testing import a...
aa8fac3bd9b7b2d2c2a42726675856dd3b03fd98c12ffca58813bf41afd1dff1
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # STDLIB import sys import typing # THIRD PARTY import numpy as np import pytest # LOCAL from astropy import units as u from astropy.units._typing import HAS_ANNOTATED # list of pairs (target unit/physical type, input unit) x_in...
ad3f463626ca51a891ec9e05504e9fb0ce700f6d26a56e26e118dc1f729c5f1f
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import numbers import numpy as np from astropy.units import ( CompositeUnit, Unit, UnitConversionError, UnitsError, UnitTypeError, dimensionless_unscaled, photometric) from .core import FunctionQuantity, FunctionUnitBase ...
223652b6164b7cef14c60fd362aeca90f611b33f2e0bc550e1c3160166ab5c84
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """Function Units and Quantities.""" from abc import ABCMeta, abstractmethod import numpy as np from astropy.units import ( Quantity, Unit, UnitBase, UnitConversionError, UnitsError, UnitTypeError, dimensionless_unscaled)...
6187c6e52a9c4e2461f001932dc8e1f21e92b9b18c90546ed0f6ed7e7bf5d64f
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package defines units that can also be used as functions of other units. If called, their arguments are used to initialize the corresponding function unit (e.g., ``u.mag(u.ct/u.s)``). Note that the prefixed versions cannot...
53c0ce3a3bb6ef866353692738556da458825d4054bc2e197aaa6eb06bded209
import os import pytest import numpy as np from urllib.error import HTTPError, URLError from astropy.time import Time from astropy import units as u from astropy.constants import c from astropy.coordinates.builtin_frames import GCRS, TETE from astropy.coordinates.earth import EarthLocation from astropy.coordinates.sk...
1a5b1ca7df7de52490112091322310c6fd4c53aa23d1de81df93c7dcf7f51e6b
# -*- coding: utf-8 -*- """ Tests the Angle string formatting capabilities. SkyCoord formatting is in test_sky_coord """ from astropy.coordinates.angles import Angle from astropy import units as u def test_to_string_precision(): # There are already some tests in test_api.py, but this is a regression # tes...
35fcafc9415a542aa506d74fe875daf8f8d978fcec7581cf51f4b5c4a34e4f92
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """Test initialization and other aspects of Angle and subclasses""" import threading import warnings import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal import astropy.units as u from as...
fa733bbae35857fa02f1cee59105aba4b9367a15234b3834a96b1d97e181c726
from contextlib import nullcontext import astropy.units as u import numpy as np from numpy.testing import assert_allclose import pytest from astropy import time from astropy.constants import c from astropy.table import Table from astropy.time import Time from astropy.utils import iers from astropy.coordinates import ...
d72e6fa05a9ee65b614bde6a6feec14dfab04f701659674a0d05938715d3a640
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from contextlib import ExitStack import pytest import numpy as np from numpy import testing as npt from astropy import units as u from astropy.time import Time from astropy.tests.helper import assert_quantity_allclose as assert_al...
6bbf372e89e8fe557b3ee8b53064bbcec21dfb1b77748e887c88749d8b9a1cb5
import pytest from astropy.tests.helper import assert_quantity_allclose from astropy.units import allclose as quantity_allclose from astropy import units as u from astropy.coordinates import Longitude, Latitude, EarthLocation from astropy.coordinates.sites import get_builtin_sites, get_downloaded_sites, SiteRegistry ...
d72ced925d2271ce432fc95383de6694824c981bc91e773b4c05d8a43580a247
# Licensed under a 3-clause BSD style license - see PYFITS.rst import gzip import errno import http.client import mmap import operator import io import os import sys import tempfile import warnings import zipfile import re from functools import reduce import numpy as np from .util import (isreadable, iswritable, is...
2351ec827014ffff83ae7491dcdd6cf6c7c615a3ebb5eb70016c7336bca34356
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import re import warnings from copy import deepcopy import numpy as np from astropy.io import registry as io_registry from astropy import units as u from astropy.table import Table, serialize, meta, Column, MaskedColumn from astropy.time impo...
35926f6103fa405fc4e3a3fcd245653dd002e9ab3efd22034096e477af146e8d
# Licensed under a 3-clause BSD style license - see PYFITS.rst import collections import copy import itertools import numbers import re import warnings from .card import Card, _pad, KEYWORD_LENGTH, UNDEFINED from .file import _File from .util import (encode_ascii, decode_ascii, fileobj_closed, file...
8699e51b380074a7989cea3bdb3a9c623618417006dff5fed10c21a8a2e5c004
# Licensed under a 3-clause BSD style license - see PYFITS.rst import gzip import itertools import io import mmap import operator import os import platform import signal import sys import tempfile import textwrap import threading import warnings import weakref from contextlib import contextmanager, suppress from funct...
c676913a7d38ae35e8e8cf9c17d313e17aa7aaeec11e5df00963bd016fc0452a
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ An extensible ASCII table reader and writer. core.py: Core base classes and functions for reading and writing tables. :Copyright: Smithsonian Astrophysical Observatory (2010) :Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu) """ import copy i...
fc2ba6203285105ca3df9986b662bf21f5c541e3c87a22e2f5d9f8f63adf991f
READ_DOCSTRING = """ Read the input ``table`` and return the table. Most of the default behavior for various parameters is determined by the Reader class. See also: - https://docs.astropy.org/en/stable/io/ascii/ - https://docs.astropy.org/en/stable/io/ascii/read.html Parameters -----...
7bfc2c1c60e948d566559b188c4f4f981af0ba91780446e479daa389c154afdb
# Licensed under a 3-clause BSD style license - see LICENSE.rst """An extensible ASCII table reader and writer. ui.py: Provides the main user functions for reading and writing tables. :Copyright: Smithsonian Astrophysical Observatory (2010) :Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu) """ import re impor...
a327560d615f6624ae148793fbffb1b5ec598100a2f65ecf153e1bb08be3db5b
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package contains functions for reading and writing HDF5 tables that are not meant to be used directly, but instead are available as readers/writers in `astropy.table`. See :ref:`astropy:table_io` for more details. """ import os import warnings i...
8378a1ea154b6e22359ca05b56d0dc389b0d929044babc7bc42f5ac240f1e3d7
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Mixin columns for use in ascii/tests/test_ecsv.py, fits/tests/test_connect.py, and misc/tests/test_hdf5.py """ import numpy as np from astropy import coordinates, table, time, units as u el = coordinates.EarthLocation(x=[1, 2] * u.km, y=[3, 4] * u....
9c7f66dccf082e9e5e84605e7da12645e82056bb977a25f0d6b9bfc3542e29ee
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import sys from collections import OrderedDict import numpy as np from .base import IORegistryError, _UnifiedIORegistryBase __all__ = ['UnifiedIORegistry', 'UnifiedInputRegistry', 'UnifiedOutputRegistry'] PATH_TYPES = (str, os.PathLike) # ...
b8e2e2436b870943e7f7392b25cc0409994a788f7ee972d0f64c2448d0c4396c
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ ``fitsheader`` is a command line script based on astropy.io.fits for printing the header(s) of one or more FITS file(s) to the standard output in a human- readable format. Example uses of fitsheader: 1. Print the header of all the HDUs of a .fits fil...
020c8bc8242eedea536738346110383c5d3637a1445f9add5405e0579e67b7f5
# Licensed under a 3-clause BSD style license - see PYFITS.rst import contextlib import csv import operator import os import re import sys import textwrap import warnings from contextlib import suppress import numpy as np from numpy import char as chararray from .base import DELAYED, _ValidHDU, ExtensionHDU # This ...