hash
stringlengths
64
64
content
stringlengths
0
1.51M
4ddb2d52aae7cc995cf343dee5093df18061d966a122e84a35a6e101cc522b1c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import inspect import numpy as np import pytest from astropy import units as u from astropy.nddata.decorators import support_nddata from astropy.nddata.nddata import NDData from astropy.utils.exceptions import AstropyUserWarning from astropy.wcs import ...
a9ca8ae60fc24d04a2bcc9623a25c6224ab2778eb89625614cf83b7230b0bcdb
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pickle import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal from astropy import units as u from astropy.nddata.ccddata import CCDData from astropy.nddata.compat import NDDataArray from astropy.nddata.ndda...
92990bb28caccc4af38be63287533bee4c553bc5f88cadc0be866d986f5e9a93
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.nddata import NDData, NDSlicingMixin from astropy.nddata import _testing as nd_testing from astropy.nddata.nduncertainty import NDU...
a59087e0e371fc8db77af79c5a2c42fabe0076a2902da4e96446911bc1673755
from astropy.nddata import NDData, NDDataRef, NDIOMixin # Alias NDDataAllMixins in case this will be renamed ... :-) NDDataIO = NDDataRef def test_simple_write_read(): ndd = NDDataIO([1, 2, 3]) assert hasattr(ndd, "read") assert hasattr(ndd, "write")
d7705549d877c51051f64fe6fe36f85210986c84a7aae0d503a04491bb1fa883
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_array_equal from astropy import units as u from astropy.nddata import NDDataRef from astropy.nddata import _testing as nd_testing from astropy.nddata.nduncertain...
3d24e539c4832fd553e720635a52d8e0d748f66f3a0be9813a12c494dd01e49a
from .high_level_api import * from .high_level_wcs_wrapper import * from .low_level_api import * from .utils import * from .wrappers import *
0a572f0a85f8afe4d89f95e22d6b76fae7581b9279523f3e74055a429c32842a
import numpy as np import pytest from astropy.coordinates import SkyCoord from astropy.units import Quantity from astropy.wcs import WCS from astropy.wcs.wcsapi import BaseLowLevelWCS # NOTE: This module is deprecated and is emitting warning. collect_ignore = ["sliced_low_level_wcs.py"] @pytest.fixture def spectral...
9cbeae970ddf3981a632e947cd46bb449f40fb85bef1bf47d820923fe7c91a2b
from .high_level_api import HighLevelWCSMixin from .low_level_api import BaseLowLevelWCS from .utils import wcs_info_str __all__ = ["HighLevelWCSWrapper"] class HighLevelWCSWrapper(HighLevelWCSMixin): """ Wrapper class that can take any :class:`~astropy.wcs.wcsapi.BaseLowLevelWCS` object and expose the h...
1afd0a7a577d306b66b733f9ba0392bd0319afd8b20fc6237472a352c034497d
import abc import os import numpy as np __all__ = ["BaseLowLevelWCS", "validate_physical_types"] class BaseLowLevelWCS(metaclass=abc.ABCMeta): """ Abstract base class for the low-level WCS interface. This is described in `APE 14: A shared Python interface for World Coordinate Systems <https://doi.o...
be95a21b1609f7abae108effaed11962e6e6c4c51dc6cd38d3d7b4d36e2fc0b9
# Licensed under a 3-clause BSD style license - see LICENSE.rst import importlib import numpy as np __all__ = ["deserialize_class", "wcs_info_str"] def deserialize_class(tpl, construct=True): """ Deserialize classes recursively. """ if not isinstance(tpl, tuple) or len(tpl) != 3: raise Val...
f409d76b88f15f1d12601c71acf0e7d79e54007e845278ba2d5e9a217ce20fed
import warnings from astropy.utils.exceptions import AstropyDeprecationWarning from .wrappers.sliced_wcs import SlicedLowLevelWCS, sanitize_slices # noqa: F401 warnings.warn( "SlicedLowLevelWCS has been moved to" " astropy.wcs.wcsapi.wrappers.sliced_wcs.SlicedLowLevelWCS, or can be" " imported from astr...
07161e8b70d5aa79221e2be394d575085b0cd8f0710538a15f8b00cc25bb23a8
import abc from collections import OrderedDict, defaultdict import numpy as np from .utils import deserialize_class __all__ = ["BaseHighLevelWCS", "HighLevelWCSMixin"] def rec_getattr(obj, att): for a in att.split("."): obj = getattr(obj, a) return obj def default_order(components): order = [...
128baffa3743d5a978d9051f55ee534e2c566e00fdbbe98d8899dd4b512f38c1
# 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.consta...
5ac71c004beb6e327aad921eab0219667d4223145acdaf6662eb3642f01f4ef2
# Licensed under a 3-clause BSD style license - see LICENSE.rst def test_wtbarr_i(tab_wcs_2di): assert tab_wcs_2di.wcs.wtb[0].i == 1 def test_wtbarr_m(tab_wcs_2di): assert tab_wcs_2di.wcs.wtb[0].m == 1 def test_wtbarr_kind(tab_wcs_2di): assert tab_wcs_2di.wcs.wtb[0].kind == "c" def test_wtbarr_extna...
e4514c2b8be02aeb8fb10a9dd1fa6c4a7c68ccec86b3190a8ab5dd7250fb4ef0
# Licensed under a 3-clause BSD style license - see LICENSE.rst from contextlib import nullcontext import numpy as np import pytest from numpy.testing import assert_allclose, assert_almost_equal, assert_equal from packaging.version import Version from astropy import units as u from astropy.coordinates import ITRS, Ea...
15b39a59ca2c21351c9713c4969b5b40531d9444ab3e08aa7ad22d25ae0aebb3
# Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import copy, deepcopy import numpy as np import pytest from astropy import wcs def test_prjprm_init(): # test PyPrjprm_cnew assert wcs.WCS().wcs.cel.prj # test PyPrjprm_new assert wcs.Prjprm() with pytest.raises(wcs.Inva...
1a174845f204604320236d9a7b330c82223e30b03261aae7d93e16fbefa3d2e7
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import numpy as np import pytest from astropy import wcs from astropy.utils.data import get_pkg_data_contents, get_pkg_data_filenames from astropy.utils.misc import NumpyRNGContext from astropy.wcs.wcs import FITSFixedWarning # use the base n...
88e6b3bfa60e5a2cdbf2cc49bb06c31a623e65bb32a42eabd232676a4a89bf97
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io import os from contextlib import nullcontext from datetime import datetime import numpy as np import pytest from numpy.testing import ( assert_allclose, assert_array_almost_equal, assert_array_almost_equal_nulp, assert_array_equ...
e5393d69dcf9f528a1495c89f128e706e31f82a142a365d6ffa344d0f2a65822
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import pickle import numpy as np import pytest from numpy.testing import assert_array_almost_equal from astropy import wcs from astropy.io import fits from astropy.utils.data import ( get_pkg_data_contents, get_pkg_data_filename, g...
3fbf0853a86cfb4e7e45ac5474efe52e51619d0fe518b0986702feaea1fab6fd
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy import wcs from .helper import SimModelTAB @pytest.fixture(scope="module") def tab_wcs_2di(): model = SimModelTAB(nx=150, ny=200) # generate FITS HDU list: hdulist = model.hdulist # create WCS object: w...
69792e8a427f65ea545039bb6916454ffe6bf1cf27189fa95ac2c75700cc6271
# Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import deepcopy import numpy as np def test_wcsprm_tab_basic(tab_wcs_2di): assert len(tab_wcs_2di.wcs.tab) == 1 t = tab_wcs_2di.wcs.tab[0] assert tab_wcs_2di.wcs.tab[0] is not t def test_tabprm_coord(tab_wcs_2di_f): t = tab_...
3e6aff0d052f07a27ea849ad0d2752b62d8b50b6a2c4d0af48006354873b0636
# Licensed under a 3-clause BSD style license - see LICENSE.rst # Tests for the auxiliary parameters contained in wcsaux from numpy.testing import assert_allclose from astropy.io import fits from astropy.wcs import WCS STR_EXPECTED_EMPTY = """ rsun_ref: dsun_obs: crln_obs: hgln_obs: hglt_obs:""".lstrip() def test...
245c502e6daf7ec8e23d3deeefa116b323985553d69c045460d78c5bbdfa9fcf
# 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.io import fits from astropy.utils.data import get_pkg_data_filename from astropy.wcs import _wcs from .helper import Si...
d1f632430336bb21d4fee7036eae8e1fd8c00cbcfdeccea5a9cbe086b2a1505d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import gc import locale import re import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_array_equal from packaging.version import Version from astropy import units as u from astropy.io import fits from astropy.unit...
1607ed745ac8e3b35aef0d3b244aa99989cebb2a45efa414eb84af3c89e3bcb3
# Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import copy, deepcopy import numpy as np import pytest from astropy import wcs _WCS_UNDEFINED = 987654321.0e99 def test_celprm_init(): # test PyCelprm_cnew assert wcs.WCS().wcs.cel # test PyCelprm_new assert wcs.Celprm() ...
ab9e4b4b140baa2f8cbd85bd5d9cbaeda061232975dd2b79791b586ce7bbe4db
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.io import fits class SimModelTAB: def __init__( self, nx=150, ny=200, crpix=[1, 1], crval=[1, 1], cdelt=[1, 1], pc={"PC1_1": 1, "PC2_2": 1}, ): """se...
8dd6f73a71d3addeee5ccb104d147ecaa5fe332c4e42b841f269cf654be63158
from .base import BaseWCSWrapper from .sliced_wcs import *
b5d3ae5a47e0e14a69571b7669da8171bec907fe3716bf3c7259bdad757ce769
import abc from astropy.wcs.wcsapi import BaseLowLevelWCS, wcs_info_str class BaseWCSWrapper(BaseLowLevelWCS, metaclass=abc.ABCMeta): """ A base wrapper class for things that modify Low Level WCSes. This wrapper implements a transparent wrapper to many of the properties, with the idea that not all o...
bede7ac8e91d2abb5b68379f868487fd8a648b0dd8fe6978a94ada956b05dd98
import numbers from collections import defaultdict import numpy as np from astropy.utils import isiterable from astropy.utils.decorators import lazyproperty from .base import BaseWCSWrapper __all__ = ["sanitize_slices", "SlicedLowLevelWCS"] def sanitize_slices(slices, ndim): """ Given a slice as input san...
46b45886d859bd82c473cbf4ed8054a9c5d7327ed65b227f1fb2cf58bc8f50c6
# 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 itertools import product import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal from packagi...
bfb9ff0a09721bfdd16633cb89eedd3336466e20033f8c08e869d5c121676a6b
import numpy as np from numpy.testing import assert_allclose from astropy.coordinates import SkyCoord from astropy.units import Quantity from astropy.wcs.wcsapi.high_level_api import ( HighLevelWCSMixin, high_level_objects_to_values, values_to_high_level_objects, ) from astropy.wcs.wcsapi.low_level_api imp...
51adcce57d3077228222ff5879eda0b5c46d156299a4d49be059de694afa95f8
from pytest import raises from astropy import units as u from astropy.tests.helper import assert_quantity_allclose from astropy.wcs import WCS from astropy.wcs.wcsapi.utils import deserialize_class, wcs_info_str def test_construct(): result = deserialize_class(("astropy.units.Quantity", (10,), {"unit": "deg"})) ...
b78e27a054b989b6cdde2e2d778a5dc2c076d26cc969b09124253f3c89bca897
from pytest import raises from astropy.wcs.wcsapi.low_level_api import validate_physical_types def test_validate_physical_types(): # Check valid cases validate_physical_types(["pos.eq.ra", "pos.eq.ra"]) validate_physical_types(["spect.dopplerVeloc.radio", "custom:spam"]) validate_physical_types(["tim...
ca00ca5a9f06d661daab7c6d7808e83327aca602644ff6d8435e7ab1623ae952
import numpy as np import pytest from numpy.testing import assert_allclose from astropy.coordinates import SkyCoord from astropy.wcs.wcsapi.high_level_wcs_wrapper import HighLevelWCSWrapper from astropy.wcs.wcsapi.low_level_api import BaseLowLevelWCS class CustomLowLevelWCS(BaseLowLevelWCS): @property def pi...
652a3a51b993dda7ec27b4ed42c90e78de8b58fe8e232bc4d2fc7ff83c1d0f4d
import warnings import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal import astropy.units as u from astropy.coordinates import ICRS, Galactic, SkyCoord from astropy.io.fits import Header from astropy.io.fits.verify import VerifyWarning from astropy.time import Time from astropy.uni...
9aef02d314db7023b7a3f5c5fb8c8c73f0367089d9c0b24b9e72eb0f34aeee48
""" 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...
7aefdf3310b067b05625addc95fe2a34d967112cf1a283de32efd4429e88bd45
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy.time import Time, TimeDelta from astropy.units.quantity_helper.function_helpers import ARRAY_FUNCTION_ENABLED class TestFunctionsTime: def setup_class(cls): cls.t = Time(50000, np.arange(8).resh...
205df2275eb0a54ae649971c299b124784221a4a57454ceeb2a665c8452e381b
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import itertools import operator from datetime import timedelta from decimal import Decimal import numpy as np import pytest from astropy import units as u from astropy.table import Table from astropy.time import ( STANDARD_TIME_SCAL...
2e6723be5a30ba047e380824d2320c3ea180951032395cb21c5ffc6e706351f8
# Licensed under a 3-clause BSD style license - see LICENSE.rst import re import numpy as np import pytest from astropy.time import Time, TimeYearDayTime, conf iso_times = [ "2000-02-29", "1981-12-31 12:13", "1981-12-31 12:13:14", "2020-12-31 12:13:14.56", ] isot_times = [re.sub(" ", "T", tm) for tm...
abd564657a9d343f6f1ba9f3525c52e993877da1c4bc122a4bdf8fe1b8691e54
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import datetime import functools import os from copy import deepcopy from decimal import Decimal, localcontext from io import StringIO import erfa import numpy as np import pytest from erfa import ErfaWarning from numpy.testing import assert_...
69a6e4a1d4dfbf210a4ed7adb87996f102819ea5ea0d0d2399443af94dd1ecd7
import contextlib import decimal import functools import warnings from datetime import datetime, timedelta from decimal import Decimal import erfa import numpy as np import pytest from erfa import ErfaError, ErfaWarning from hypothesis import assume, example, given, target from hypothesis.extra.numpy import array_shap...
bf9512db3bf6eab77d4c09dfa1a22874d5b48e02b9eaa851090a196869de3a1a
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy import units as u from astropy.coordinates import EarthLocation, SkyCoord, solar_system_ephemeris from astropy.time import Time, TimeDelta from astropy.utils import iers from astropy.utils.compat.optional_deps import HAS_JPLEPHE...
a552736b504b7adf2ac8f469480cd98ef96627d147d12f7aa158030bac6797ca
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pickle import numpy as np from astropy.time import Time class TestPickle: """Basic pickle test of time""" def test_pickle(self): times = ["1999-01-01 00:00:00.123456789", "2010-01-01 00:00:00"] t1 = Time(times, scale="u...
ecfb2885caa2c6df961b9b756dfb513c9c614a2730cd412577252dd44e0424da
# Licensed under a 3-clause BSD style license - see LICENSE.rst from concurrent.futures import ThreadPoolExecutor from datetime import datetime, timedelta import erfa import pytest import astropy.time.core from astropy.time import Time, update_leap_seconds from astropy.utils import iers from astropy.utils.exceptions ...
568f8dc36f9adb5d16cd01cd55945cec0381d5e4dccbe2748c09f261e716633a
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import numpy as np import pytest from astropy.time import Time from astropy.utils.iers import conf as iers_conf from astropy.utils.iers import iers # used in testing allclose_jd = functools.partial(np.allclose, rtol=0, atol=1e-9) allcl...
1f0d380a5aa46c3bbf1bebd2d558f4a2171a80e4713b71cefb66a626a9356e6d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.time import Time class TestGuess: """Test guessing the input value format""" def test_guess1(self): times = ["1999-01-01 00:00:00.123456789", "2010-01-01 00:00:00"] t = Time(times, scale="utc") ...
190bfcdee3893a98d57beb981ef07698aae0360adeb8489e6b7f7f291d479913
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import numpy as np import pytest from astropy import units as u from astropy.table import Column from astropy.time import Time, TimeDelta allclose_sec = functools.partial( np.allclose, rtol=2.0**-52, atol=2.0**-52 * 24 * 3600 ) # 2...
ac5ad987afe33ed179f48e493ae59e517071d82d49ebb48f2e258fe57d7745eb
# Licensed under a 3-clause BSD style license - see LICENSE.rst import operator import numpy as np import pytest import astropy.units as u from astropy.time import Time, TimeDelta class TestTimeComparisons: """Test Comparisons of Time and TimeDelta classes""" def setup_method(self): self.t1 = Time...
71b3927ba37b5af1430198d7c702bf5727dc934d81f1fec3475152579c9f67f7
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import itertools import warnings import numpy as np import pytest import astropy.units as u from astropy.time import Time from astropy.time.utils import day_frac from astropy.units.quantity_helper.function_helpers import ARRAY_FUNCTION_ENABL...
1bcfb3888e930f5c384d7188db1692e4e2ccf59b2cb4c8381b63e57b2087dd3e
# Licensed under a 3-clause BSD style license - see LICENSE.rst from datetime import date from itertools import count import numpy as np import pytest from erfa import DJM0 from astropy.time import Time, TimeFormat from astropy.time.utils import day_frac class SpecificException(ValueError): pass @pytest.fixt...
5d9e055339cea191264d2f55aa3e25f0bda4cd36830f8646ccb53ff089fd5a3c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import numpy as np import pytest from astropy import units as u from astropy.table import Table from astropy.time import Time from astropy.utils import iers from astropy.utils.compat import PYTHON_LT_3_11 from astropy.utils.compat.optio...
3d938ab3b8091be0abda3c73b0cb191d9e22955ff59386a3cbe3c4dbe02acd42
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import itertools import erfa import numpy as np import pytest from astropy import units as u from astropy.time import Time from astropy.time.core import SIDEREAL_TIME_MODELS from astropy.utils import iers allclose_hours = functools.part...
ea38f7b0211eae93568c3edee2772e583780631c0c3414b9a4dad013919d4b83
# 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.py build_ext --inplace # ...
1f7bf061a8f842931fce212f2cbe1ded9c3fe4775b746f082756e5dba61c5b73
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "Console" unit format. """ from . import base, core, utils class Console(base.Base): """ Output-only format for to display pretty formatting at the console. For example:: >>> import astropy.units as u >>> ...
8388d9b9dc42a86ba8f4a409ca6aea393d39230d0a98f028138ec5a62920ca53
# 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...
9b9453cba7a92422fd6a61a2b7cff6269f1a29aff39a922771c011c587bbb583
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "VOUnit" unit format. """ import copy import keyword import operator import re import warnings from . import core, generic, utils class VOUnit(generic.Generic): """ The IVOA standard for units used by the VO. This is an im...
18c87406b743387c71e1cb80a556e1dddebaa32327b19a8191be4bb41ca5568b
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "LaTeX" unit format. """ import re import numpy as np from . import base, core, utils class Latex(base.Base): """ Output LaTeX to display the unit based on IAU style guidelines. Attempts to follow the `IAU Style Manual ...
5720a9f86e8c1036121b172fee671c35786d6c9c1e9a61d1b9ccd97352e45a20
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "Unicode" unit format. """ from . import console, utils class Unicode(console.Console): """ Output-only format to display pretty formatting at the console using Unicode characters. For example:: >>> import astro...
7087647036635782ed07b6590662c166b71ccd41cb12b8ed37e80f348ded07ff
# Licensed under a 3-clause BSD style license - see LICENSE.rst class Base: """ The abstract base class of all unit formats. """ registry = {} def __new__(cls, *args, **kwargs): # This __new__ is to make it clear that there is no reason to # instantiate a Formatter--if you try to...
e93235d1c56bb73a1b2d1e967387c66c4f3f9852aca97e156eedcaf738177980
# 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.py build_ext --inplace # ...
610427d85a1ad6644080967c1f39321fa5cd74c8732ade51093967a55d8e3e74
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Utilities shared by the different formats. """ import warnings from astropy.units.utils import maybe_simple_fraction from astropy.utils.misc import did_you_mean def get_grouped_by_powers(bases, powers): """ Groups the powers and bases in ...
77c24ea6ee22f660ef62ef12409c953ccfe6859f50ff79b5ce92e971c7cbae9c
# 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...
960d8bb9dbf76129bb3c91d9bd92884c9e6b87530bcd6e7af0f5e750620bb4b2
# 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 #...
82e1e992999f5ee771671850371f293fad57f3793879e55a4211354a89f3df62
# 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 result units for a given ufun...
6acf2644f1b33cf20ff93962ebc59d4013687cc179d9621d6aba1ec398d04b5f
# 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_and...
758a57f5f75eeeee5f958b49a74d567f44955951f8f27bd2ebfd6187135e115a
# 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, UnitTypeError, dimensionles...
05fb594ac46b9074075eff0ae795f88e7c211cf66b0063d08e638ec1e1dc5030
# 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.Quantity.__array_function__`. ...
77f6e5f513be7b243f67ea4d298f29fadeadd314be2df8f67964d90558f11f98
# 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, dimensionless_unscaled from...
4675ce5e3e8d4568cc5808034e665aa00b8029baf7eb5ca7e4816293a294ffa8
# 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 import assert_qu...
2fa9ab6883619d30201ca0b4d120dea68ae3935e0696f4e3fdb26d77b04566ec
# 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.AA}, "...
fffd6a335b1d12b58ad4ba4ad86c619636dca7c4edcd7dc24d2852b0c5af5431
# 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 deprecated, required_by_vouni...
0e1b954e61e1a2bdbe65c96716c06d74fc8398271f58b30ba4dde8115d995c74
# Licensed under a 3-clause BSD style license - see LICENSE.rst # STDLIB import typing as T # THIRD PARTY import pytest # LOCAL from astropy import units as u from astropy.units import Quantity from astropy.units._typing import HAS_ANNOTATED def test_ignore_generic_type_annotations(): """Test annotations that ...
805d12ee438ef2f88cb5355fbcb5948fde2f86b8219320913faa12034d3ea532
# 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_allclose from astropy.u...
6f10fd859f1845711be9af073e34f4c919a34af36c4c9aa40e60616b23ea3461
# 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 import units as u from astropy...
bad1456ae711dc9326d2e6abc84ac15af857b0e238e08164aafc594f13ec9851
# 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 u from astropy.units imp...
f2281654e76a5c814e451ce4b698238fe02822cee649031a91a0b3ec2741dd60
# 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_21...
4c5047dd68085a38c025e7ef58963c8255dacf86a7c1fa3091468a83ba3718ff
# 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 astropy.tests.helper i...
c5299b881191b52f5ad1b6c91f1d3d0c25793b0c72a016319b653f7a2fd46f18
# 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 Annotated @pytest.mark.skipif(sys.version_info < (3, 9), reason="requires py3.9+...
4ee91c8c3d469bb323b4fdb91265ed9c5895558dc13fbf79b726cc0b16e4091c
# 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 check_pickling_re...
3207ff3e70e65a16fb75eccc9a07120279ee69d00f9f883032f01e095cba43fe
""" Test ``allclose`` and ``isclose``. ``allclose`` was ``quantity_allclose`` in ``astropy.tests.helper``. """ import numpy as np import pytest from astropy import units as u @pytest.mark.parametrize( ("a", "b"), [ ([1, 2], [1, 2]), ([1, 2] * u.m, [100, 200] * u.cm), (1 * u.s, 1000 * ...
7a36e1b72961adbfac49f31d1629b3f79c790ca1a5d20f3cd4f487999a605dcd
# 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, assert_array_equal f...
5f7cda66df517024c2345254d3b31fa468a0aaba96c2dff008df798c4417408c
# 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 from astropy.test...
f9e2eec6b690bbd9125eea2c3509f8c3b170e9ee239bcd8a84a38605cca4cf21
# 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...
a0ff3b5a6f59e2aa3ceed28277204060986151ac7b5842630f67593c5bf2baa1
# 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...
e832cb69804235f3a3709ad3264e2c29ec1fb52f6490f6e130dacabe08df2ea0
# 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...
1f6a4dae2b1c145f7b65890cb3e493386cdd8662fc40d8fea09317a21a2e7e6c
# 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_inputs = [ (u.arcsec, ...
e663bdcdd668e7d4e4723153cb587653bfb4fe89286acacdce7cf32111953530
# 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 fr...
b07ede8dc4c6b44f3f6f037515c331a354c7cdc85bdf1f5a4c1fee8972db8619
# 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, ) ...
151d074751e60477eef7fab601cde66cdb2d420b8c78b71b331bbe7a1a90deee
# 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 be called, as it would ...
016cf3223b37ccda1f2f115381024a7a86963885006c8abf4ec69ff47b0458bb
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.units.core import IrreducibleUnit, Unit class FunctionMixin: """Mixin class that makes UnitBase subclasses callable. Provides a __call__ method that passes on arguments to a FunctionUnit. Instances of this class should define ``...
d472e4fb1dd08ebe239c378baedca5c156e44f57d9c93d3e6fcd936b0b62e1f3
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy from collections.abc import MappingView from types import MappingProxyType import numpy as np from astropy import units as u from astropy.coordinates import representation as r from astropy.coordinates.angles import Angle from astropy.coordi...
4d99dfe58bf6afdbaafba5c5b6e504d0bb98af81ccfff520aa0f6bc316b34a73
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.matrix_utilities import matrix_transpose, rotation_matrix from astropy.coordinates.transformations import StaticMatrixTransform from .galactic import Galactic from ....
ea0ce8276c1942b67e3b5593af3b820b18bc9584265936ae183d2b28f4d3a939
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates import earth_orientation as earth from astropy.coordinates.attributes import TimeAttribute from astropy.coordinates.baseframe import base_doc, frame_transform_graph from astropy.coordinates.transformations import DynamicMatrixTran...
64ae3ef51cd2bcf3b9c7b6a2d04d5c079f291bd29b07be387604577116aa5e5d
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains the transformation functions for getting to/from ITRS, TEME, GCRS, and CIRS. These are distinct from the ICRS and AltAz functions because they are just rotations without aberration corrections or offsets. """ import erfa import numpy as np f...
5df716a5c6a52c6b0d5145c73f6377ca842a612d03a9e6db52765d6eb742f5ad
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.attributes import TimeAttribute from astropy.coordinates.baseframe import base_doc from astropy.utils.decorators import format_doc from .baseradec import BaseRADecFrame, doc_components from .utils import DEFAULT_OBSTIME __all__ ...
ce3408416a1a9592f043023bcaa7cff83bfac4de8a256e42e5a8b3b4c4e45ab7
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy import units as u from astropy.coordinates import earth_orientation as earth from astropy.coordinates.attributes import TimeAttribute from astropy.coordinates.baseframe import base_doc, frame_transform_graph from astropy.c...
9ca3d87a7ff2711a08bfe105d852e6d53a990f0352b511a671f41350c206071f
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates import representation as r from astropy.coordinates.baseframe import ( BaseCoordinateFrame, RepresentationMapping, base_doc, ) from astropy.utils.decorators import format_doc __all__ = ["BaseRADecFrame"] doc_compone...
edb92ccb402cc769157fd427ced24f0fa997910f7612dc64b064b43be4ef05d7
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package contains the coordinate frames implemented by astropy. Users shouldn't use this module directly, but rather import from the `astropy.coordinates` module. While it is likely to exist for the long-term, the existence of this package and de...
a6980e91b1ad60301ec1047427564d53c3d12606a290098952c55c13ef155f83
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import units as u from astropy.coordinates import representation as r from astropy.coordinates.baseframe import ( BaseCoordinateFrame, RepresentationMapping, base_doc, ) from astropy.utils.decorators import format_doc from .galac...
b79a6a729fd90867a6dd0cc7b6264196826245e4262c57472f698436eb10db02
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.baseframe import base_doc from astropy.utils.decorators import format_doc from .baseradec import BaseRADecFrame, doc_components __all__ = ["ICRS"] @format_doc(base_doc, components=doc_components, footer="") class ICRS(BaseRADe...