hash
stringlengths
64
64
content
stringlengths
0
1.51M
5b50c4c3620724027610051d4ad8fe08b538903a322fdb1848d127dc49f6efbc
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np import matplotlib.pyplot as plt from astropy.wcs import WCS from astropy.visualization.wcsaxes import WCSAxes from astropy.visualization.wcsaxes.frame import BaseFrame from astropy.tests.image_tests import IMAGE_REFEREN...
2c9312049c8065ee51c68605846bdd76948d16154c2b977a83ca217cd9ae28d5
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np import matplotlib.pyplot as plt from astropy import units as u from astropy.wcs import WCS from astropy.visualization.wcsaxes import WCSAxes from .test_images import BaseImageTests from astropy.visualization.wcsaxes.tra...
cab2561e730d1b1d50700bd749cb587b3dbc5679b6099d516d5552fd2d456df5
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import assert_almost_equal from matplotlib import rc_context from astropy import units as u from astropy.tests.helper import assert_quantity_allclose from astropy.units import UnitsError from astropy.v...
321a531012a746eba449bcc1233a617f83c3ea5304e8adfc9430fee11f4c4751
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import warnings from textwrap import dedent import pytest import numpy as np import matplotlib.pyplot as plt from matplotlib.transforms import Affine2D, IdentityTransform from astropy.io import fits from astropy import units as u from astropy...
3fa6c0004abba4f5ed2edf1e7994963172018ea41ae51befcae547dbe6cf4a7c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import matplotlib.pyplot as plt import pytest from matplotlib.backend_bases import KeyEvent import numpy as np import astropy.units as u from astropy.coordinates import FK5, SkyCoord from astropy.io import fits from astropy.time import Time from astropy....
f0ea20139c8ca96d6303b8bd914db5b89c4060ef0080ff59c0ecc9cb15caf4ba
import numpy as np import pytest from matplotlib.lines import Path from astropy.visualization.wcsaxes.grid_paths import get_lon_lat_path @pytest.mark.parametrize('step_in_degrees', [10, 1, 0.01]) def test_round_trip_visibility(step_in_degrees): zero = np.zeros(100) # The pixel values are irrelevant for this...
dd530b6f93519674f8e30b10755c653a18bf1e19e107e1867030fcfb228ff4cb
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os from unittest.mock import patch import pytest import matplotlib.pyplot as plt from astropy.wcs import WCS from astropy.io import fits from astropy.utils.data import get_pkg_data_filename from astropy.visualization.wcsaxes.core import WCSAxes f...
1db69d66d3aed8614e9dd14296386ece7f91cc3cf772965535c33107273bfd0e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import matplotlib.lines import matplotlib.pyplot as plt import pytest from matplotlib import rc_context from matplotlib.patches import Circle, Rectangle import numpy as np from astropy import units as u from astropy.coordinates import SkyCoord from astro...
02dc324bc20afb2233686f80c95f9a292ac7d53672ce0871986f6b3ec302fdca
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module implements the Slicing mixin to the NDData class. from astropy import log from astropy.wcs.wcsapi import (BaseLowLevelWCS, BaseHighLevelWCS, SlicedLowLevelWCS, HighLevelWCSWrapper) __all__ = ['NDSlicingMixin...
b8178dee0a65bdb7c9734b1878348f3ba48301deb13aefbac6b7262059ab2f37
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module implements the Arithmetic mixin to the NDData class. from copy import deepcopy import numpy as np from astropy.nddata.nduncertainty import NDUncertainty from astropy.units import dimensionless_unscaled from astropy.utils import format_doc...
d13e953abdab945d00eb41390e7c9a8c8ac943ad9f66eedf09c4aa9ad838edb2
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module implements the I/O mixin to the NDData class. from astropy.io import registry __all__ = ['NDIOMixin'] __doctest_skip__ = ['NDDataRead', 'NDDataWrite'] class NDDataRead(registry.UnifiedReadWrite): """Read and parse gridded N-dimension...
82b1097a6cc93afbe45814a6da1d684dd8974614fbe88677f74ea5a9abd3976d
# 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...
c1995c21d244f3eccad169577c1fe31b5fbb30aff4f5280dbe1be7fbbde9ef7d
# Licensed under a 3-clause BSD style license - see LICENSE.rst # Tests of NDDataBase from astropy.nddata.nddata_base import NDDataBase class MinimalSubclass(NDDataBase): def __init__(self): super().__init__() @property def data(self): return None @property def mask(self): ...
06f218eb55d052cc7dfadf6e7738d7a2622cd5cbd774637d4256f9041541ad49
# Licensed under a 3-clause BSD style license - see LICENSE.rst from packaging.version import Version import pytest import numpy as np from numpy.testing import assert_allclose, assert_array_equal from astropy.tests.helper import assert_quantity_allclose from astropy.nddata import (extract_array, add_array, subpixel_...
830d221ff201391b67b10476ba598deffe207907e677ae0be4fc35dd96c4450f
""" A module containing unit tests for the `bitmask` module. Licensed under a 3-clause BSD style license - see LICENSE.rst """ import warnings import numpy as np import pytest from astropy.nddata import bitmask MAX_INT_TYPE = np.maximum_sctype(np.int_) MAX_UINT_TYPE = np.maximum_sctype(np.uint) MAX_UINT_FLAG = np....
d3526dbc813d267b630f8b48b4546100c90eb35d8d44dc3698b890aefaa78587
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy.nddata import reshape_as_blocks, block_reduce, block_replicate class TestReshapeAsBlocks: def test_1d(self): data = np.arange(16) reshaped = reshape_as_blocks(data, 2) assert res...
154af441160aadd2bfc29d53434eab1d1edaab7bd781b590b178fa7dd2943c90
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from astropy.nddata import FlagCollection def test_init(): FlagCollection(shape=(1, 2, 3)) def test_init_noshape(): with pytest.raises(Exception) as exc: FlagCollection() assert exc.value.args[0] ...
a77e667b6b5fce344344f418c25c11c84b46303a9edc113aa9e6c57029f28294
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pickle import textwrap from collections import OrderedDict import pytest import numpy as np from numpy.testing import assert_array_equal from astropy.nddata.nddata import NDData from astropy.nddata.nduncertainty import StdDevUncertainty from ast...
34fcde7977ad07f71d77828a240f1f2f9fe8d7576f472c21c9fdb600b6a1847a
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module contains tests of a class equivalent to pre-1.0 NDData. import pytest import numpy as np from astropy.nddata.nddata import NDData from astropy.nddata.compat import NDDataArray from astropy.nddata.nduncertainty import StdDevUncertainty from...
b4a6dfc57ab67b8141896550d6f4d9c01e48bc43b30579cd184a0bd4a6ca160c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import inspect import pytest import numpy as np from astropy.utils.exceptions import AstropyUserWarning from astropy import units as u from astropy.wcs import WCS from astropy.nddata.nddata import NDData from astropy.nddata.decorators import support_nd...
c14abf217af5ca49de5f87441682bbe020bfdeca789e1a09aa211f8d2165f5f5
# 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 from astropy.nddata.nduncertainty import (StdDevUncertainty, VarianceUncertainty, InverseVariance, ...
133458ee7233f6941186d8fdd512fd95d86e88c73b3ac033e42b318ccbdacc64
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import assert_array_equal from astropy.nddata import NDData, NDSlicingMixin from astropy.nddata import _testing as nd_testing from astropy.nddata.nduncertainty import NDUncertainty, StdDevUncertainty f...
b1c98332e7957257679e3aaa64851a770310bc3b4b7142b08abca16fdbfb56fd
from astropy.nddata import NDData, NDIOMixin, NDDataRef # Alias NDDataAllMixins in case this will be renamed ... :-) NDDataIO = NDDataRef def test_simple_write_read(tmpdir): ndd = NDDataIO([1, 2, 3]) assert hasattr(ndd, 'read') assert hasattr(ndd, 'write')
326ff94a94ff77e2f1022876909edd59ebb77be89b446316c995da46051f14fc
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal from astropy.nddata.nduncertainty import ( StdDevUncertainty, VarianceUncertainty, InverseVariance, UnknownUncertainty, IncompatibleU...
de94b1db80ad8429fddb4672df0855272bb5eb80da00b8dafbf0ca63969595cf
from .low_level_api import * # noqa from .high_level_api import * # noqa from .high_level_wcs_wrapper import * # noqa from .utils import * # noqa from .wrappers import * # noqa
a68bd650c3bf50b60a66081b1ee19a33fac50245db1925dd2d2608a3da64d89d
import pytest import numpy as np 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...
913d096cb94a35d01b4c3d16cc730efa579c0d3d1ef7cf24fd6b2c6bd3627749
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...
edfef4e0c07d4b443660cae5bc56b447395a00c866c3cef966d4697cea73abdd
import os import abc 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...
eed895577ca5b208195b6c6e64ef7507317a8d88dfe2e043a25cf8b4c5fa1f60
# 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 Valu...
5b41f2fbab9f14086c62046f6e13b67bbaaae35ee91bc55ed0ec2aca939c7daf
import warnings from .wrappers.sliced_wcs import SlicedLowLevelWCS, sanitize_slices from astropy.utils.exceptions import AstropyDeprecationWarning warnings.warn( "SlicedLowLevelWCS has been moved to" " astropy.wcs.wcsapi.wrappers.sliced_wcs.SlicedLowLevelWCS, or can be" " imported from astropy.wcs.wcsapi....
ed49b242712792dae1022e300e33f91d24409c7d055c77843bcf42ebe624c5d8
import abc from collections import defaultdict, OrderedDict 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 = [...
441d936829b78178dce943f5d71870f12d195937ad3ceb6baf5f1c7b4c97889d
# 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...
db0a5eac37f04c2acdccd8b31aed3cf21ebecbca0153ac009307f354339e6fa4
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from astropy import wcs 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_m(tab_wcs_2di): assert t...
31fd3e452818004779aa3622a84826e918d34e25d10c53b8cfab2ed603af1f29
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings from contextlib import nullcontext import pytest from packaging.version import Version import numpy as np from numpy.testing import assert_almost_equal, assert_equal, assert_allclose from astropy.utils.data import get_pkg_data_contents, ...
749230dc96c29f184526671692f7a1759b07ac2334b1d3c557324b56cbb431db
# Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import copy, deepcopy import pytest import numpy as np from astropy import wcs from . helper import SimModelTAB def test_prjprm_init(): # test PyPrjprm_cnew assert wcs.WCS().wcs.cel.prj # test PyPrjprm_new assert wcs.Prjprm()...
88880d8b9cf6e4979ffe95ad180dcf0eaab847fd1d34ec46dc1c114346845aea
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import pytest import numpy as np from astropy.utils.data import get_pkg_data_filenames, get_pkg_data_contents from astropy.utils.misc import NumpyRNGContext from astropy import wcs from astropy.wcs.wcs import FITSFixedWarning # use the base ...
71a13c3ec74dc56b431f744cb1a53378348be96dc05effd876962d3ff950c233
# 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...
3656d992f8c047385bb138dc0fb5169dab71eba42790b0712ab14136a1dd4fe7
# 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.utils.data import (get_pkg_data_contents, get_pkg_data_fileobj, get_pkg_data_filename) from astropy...
bb692d3368e95de20591246fca173267bb5781f1333eb6bc8189fb7bfc2457d2
# 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: ...
195b355914f32da44dee4ce806ff4e43366b7efdd04fcd04646c0676558afca5
# Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import deepcopy import pytest import numpy as np from astropy import wcs from . helper import SimModelTAB 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_2d...
af898037a9f7b78151d3b480a913cb61d183020a890fe2eb95d5d2d1d8d80d93
# -*- coding: utf-8 -*- # 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_o...
d459895dbeeacb4a1cadc02d1aaa6cfe528c47d563fc554b410dae800a315146
# Licensed under a 3-clause BSD style license - see LICENSE.rst 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 import SimModelTAB _WCSL...
81a7e6576e7c56e0c7d589c2f470a07886936d2c31d03feb0c265702274e63fb
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import gc import locale import re from packaging.version import Version import pytest import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal from astropy.io import fits from astropy.wcs import...
b03f4c05280974562886bf3489697fe5680a68614cb7f7eb2040eff6c67586be
# Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import copy, deepcopy import pytest import numpy as np from astropy import wcs from . helper import SimModelTAB _WCS_UNDEFINED = 987654321.0e99 def test_celprm_init(): # test PyCelprm_cnew assert wcs.WCS().wcs.cel # test PyCelp...
06cc3e5712e73a86ffce2be30ed6573562597989b4286c66a3eb937dbf3dd37a
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from astropy import wcs 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}): """ s...
fdc5c7bfde76594f089d69b21dc3898141859e725abb21563b52b94194169c3f
from .sliced_wcs import * # noqa from .base import BaseWCSWrapper
2598d3745e205be979749ccf83b8a8ff635485c668623acff28a3f44751db938
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...
9fbac7091b35375a2f461a514438ce326e380b8d79339a08b6ed23392d1104f0
import numbers from collections import defaultdict import numpy as np from astropy.utils import isiterable from astropy.utils.decorators import lazyproperty from ..low_level_api import BaseLowLevelWCS from .base import BaseWCSWrapper __all__ = ['sanitize_slices', 'SlicedLowLevelWCS'] def sanitize_slices(slices, n...
a6065e3f9bb90d20d2ab97bbddc477880021062c5853869c33f1c86b941e2adb
# 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...
a2d329c6d9f08be5c61f5206f62590ffcd13da05d3dc22d12e8ac5206136dfde
import numpy as np from numpy.testing import assert_allclose from astropy.units import Quantity from astropy.coordinates import SkyCoord from astropy.wcs.wcsapi.low_level_api import BaseLowLevelWCS from astropy.wcs.wcsapi.high_level_api import HighLevelWCSMixin, high_level_objects_to_values, values_to_high_level_obje...
9124e51ee9f7a99780d3c5cfe724f59cc42539b4588596c26464c1c427e2ccee
import numpy as np from numpy.testing import assert_allclose import pytest from pytest import raises from astropy import units as u from astropy.wcs import WCS from astropy.tests.helper import assert_quantity_allclose from astropy.wcs.wcsapi.utils import deserialize_class, wcs_info_str def test_construct(): r...
a0ccabbf0e260f8c89e19402a8e0d717cd900a2caa683e821180a9cf05e407da
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(['ti...
0b2b622cdcd0e07b8018c7a848a96c4bf959aab1118e553138668c46ff4bc341
import pytest import numpy as np from numpy.testing import assert_allclose from astropy.coordinates import SkyCoord from astropy.wcs.wcsapi.low_level_api import BaseLowLevelWCS from astropy.wcs.wcsapi.high_level_wcs_wrapper import HighLevelWCSWrapper class CustomLowLevelWCS(BaseLowLevelWCS): @property def ...
a870efcfdea7fe14e61c2affac5219388d1383ca9ba5cb3914e87f6024c26802
import warnings import pytest import numpy as np from numpy.testing import assert_equal, assert_allclose from astropy.wcs.wcs import WCS, FITSFixedWarning from astropy.time import Time from astropy.wcs import WCS from astropy.io.fits import Header from astropy.io.fits.verify import VerifyWarning from astropy.coordina...
dc09edaf43873d8820dc1e84950eec7c0ca7330a3de489db2bc0bd79787132ce
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np 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).res...
5f12db6759d17501442d5ce9fbcf029f423b86d254d0bbaaace7a34a19557f0b
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import itertools import operator from decimal import Decimal from datetime import timedelta import pytest import numpy as np from astropy.time import ( Time, TimeDelta, OperandTypeError, ScaleValueError, TIME_SCALES, STANDARD_TIM...
054a32279eaebc40a7f0d8aa0c2faf452d586006dd4422d3a73efc7a2fb1416f
# Licensed under a 3-clause BSD style license - see LICENSE.rst import re import numpy as np import pytest from astropy.time import Time, conf, TimeYearDayTime 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 in iso_times] yday...
5246348189651ed3fe946f227808a3eef68760a1d480b734919b4e90a9ee0d9d
# 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 import numpy as np import pytest from numpy.testing import assert_allclose import erfa from erfa import ErfaWarning from astropy.u...
836169c512d115acdc03eb1d45161bca6410c010c2938868b595aa7a9dc5c9ce
import decimal import warnings import functools import contextlib from decimal import Decimal from datetime import datetime, timedelta import pytest from hypothesis import assume, example, given, target from hypothesis.extra.numpy import array_shapes, arrays from hypothesis.strategies import (composite, datetimes, flo...
d4af71513c067381ba72440689d28bada4affb3e71ec83b4b155937bd2cdefd8
# 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...
b1376f9171935231e00d05d80fa6fcb680186949231c001985c38210a3313ca6
# 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...
a26abdde5ad5426b52ee90ca5a406a2c36218ba3e5951711c5ce2fa21df018dc
# Licensed under a 3-clause BSD style license - see LICENSE.rst from concurrent.futures import ThreadPoolExecutor from datetime import datetime, timedelta import pytest import erfa from astropy.utils import iers from astropy.utils.exceptions import AstropyWarning import astropy.time.core from astropy.time import upd...
788cea655430d6b91280e438295cd1078bdc85bd2482369ee2daed7400074ec9
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import pytest import numpy as np 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...
3771fc9f53d7985e453a4bd8a46274c8a382c65f89ca6cbdc74211c6376b44ea
# 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') ...
d224a387c65aeea953c3eb8cbe4cbbe2bdab1249addf4bcde6f5a0f91c3e80b4
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import pytest import numpy as np from astropy.time import Time, TimeDelta from astropy import units as u from astropy.table import Column allclose_sec = functools.partial(np.allclose, rtol=2. ** -52, ato...
4d7d8df3270a0a28fc5054107f661bf7285441844bf572c67c775001a778fd2f
# Licensed under a 3-clause BSD style license - see LICENSE.rst import operator import pytest import numpy as np from astropy.time import Time, TimeDelta import astropy.units as u class TestTimeComparisons: """Test Comparisons of Time and TimeDelta classes""" def setup(self): self.t1 = Time(np.ara...
280186d23a5de0e9a6f9c04aa4b0fcd588812b2a9b03c58e342b6461868a907c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings import itertools import copy import pytest import numpy as np from astropy.time import Time from astropy.utils import iers from astropy.units.quantity_helper.function_helpers import ARRAY_FUNCTION_ENABLED needs_array_function = pytest....
9f991075aa8d06f6bef3e4c4a4b96bb273c13c0034d2976922e5421caa311029
# Licensed under a 3-clause BSD style license - see LICENSE.rst from datetime import date from itertools import count import pytest import numpy as np from erfa import DJM0 from astropy.time import Time, TimeFormat from astropy.time.utils import day_frac class SpecificException(ValueError): pass @pytest.fix...
0dcc5b39d570a8d9bfaf8d7fb08512827f994789dd1e462852a0977f2d6f2c3f
# 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.utils import iers from astropy.time import Time from astropy.table import Table from astropy.utils.compat.optional_deps import HAS_H5PY allclose_sec = functoo...
febe90c3b70b6bb1faf89a06a4d8f62106cd2e2d325d382006de59af4fc5317a
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import itertools import pytest import numpy as np import erfa 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...
98e4a35973be6d404ff47b9b749ced825ad977ad8aba08dde487d61a496c82fd
# -*- 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...
336bfb6b3eafd8e3b57edfab33289f8062bb6d32e4285170134ef778a0d4e310
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # This file was automatically generated from ply. To re-generate this file, # remove it from this folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # pytest astropy/units # # You can...
da98f90351a20f4f67830fcb8e0b6b8d7cc6c7f88192f16cceaea3faf37d8967
# -*- coding: utf-8 -*- # 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 astro...
0e3f1bd7a4c1884f5cff665dac5a2f4ce070ab21785467e717215807320813e7
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # This file was automatically generated from ply. To re-generate this file, # remove it from this folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # pytest astropy/units # # You can...
e0694cebcb2b0b729ec82647c089626d2d8d6d21bab6476d319e3d07933334c8
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # This file was automatically generated from ply. To re-generate this file, # remove it from this folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # pytest astropy/units # # You can...
eef4256d0e8913a748defff955b75d8d6cf888aec0b5d126672d1505c99c8cc8
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # This file was automatically generated from ply. To re-generate this file, # remove it from this folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # pytest astropy/units # # You can...
4c8bb5d046c6c671fca145e6af3942b7e9dae4b204283a79b336638ee32af0e9
# 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...
384e7586b394b7d9330ba6863319431211a4acdc6c0203cd65b3c9bf43c48d25
# 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...
73914533ad702179ad37143d23196b09ebab8623282b3308d37a74298c6a8f98
# 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 ...
22647b3ae1f4ca84626542dc13e9788d57459c873b3ceae3a3f5190bf892e0e3
# -*- coding: utf-8 -*- # 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::...
940608021a361ad77e4dfcc391a4b233e64e1ac6e5e6e0da0f2837fe6dd17e45
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # This file was automatically generated from ply. To re-generate this file, # remove it from this folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # pytest astropy/units # # You can...
fca8b7912322bb82f5204235be4bacc218ffa711bae1bdfa41d9a3ad37d9b88e
# 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 y...
7a4c92e69716a87c54e51c8138192d155bd6767a92a27f74c79a3edac3bb7b01
# -*- 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...
621bc9736ae1f6cf20037bf5872b2c3e625b934f040e6a84b5d2ce008eb425cf
# 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 p...
80176c99196c647054dfc444bbbd62a7b70d29b5847ee634eb51ec0feb87d8db
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # This file was automatically generated from ply. To re-generate this file, # remove it from this folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # pytest astropy/units # # You can...
c7f52c75d80f96f5d12610fe6c488bee80479162951d247c2133b0925eb447f0
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "FITS" unit format. """ import numpy as np import copy import keyword import operator from . import core, generic, utils class Fits(generic.Generic): """ The FITS standard unit format. This supports the format defined in...
6cded613b1b0b388c3fbdaa62ed94ac95768357c15e1b94e2304fe499a2dc80d
# 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 #...
05b30f9e7e1071078ec18a4ce3fcf596156a5944a52a190c9937229f1472ff7e
# -*- 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...
56df8ce8ed3a64490a8720efb4ea8c59676759b7f9968aa7921a036a10165112
# -*- 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 (UnitsError, UnitConversionError, UnitTypeError, dimensionless_unscaled) __all__ = ['can_have_arbi...
9c274e60c287a02a015c54b612399a7bb1266c73883730e76dcf7442a82f9797
# 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 * # By importing helpers, all the unit conversion functions needed for # ...
3c8e8aeb4482bab1e04e6e7d3b2470ca4dcf3d4c81d9168ea508ae0707113ea8
# -*- 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 ufunc as erfa_ufunc, dt_pv, dt_eraLDBODY, dt_eraASTROM from astropy.units.core import UnitsError, UnitTypeError, dime...
5b20e9673a6f23728f091533c138ec761829e2d38e94e5856609858510817ff2
# -*- 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...
75c515dd75882ae204821d41e7c0ad640ce69f8f138a1a2a3b0eb788adca9380
# -*- 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...
ba527ae919c55bde7077185170a67067a2d5d74040843844d45d62df41541a36
# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """Separate tests specifically for equivalencies.""" # THIRD-PARTY import pytest import numpy as np from numpy.testing import assert_allclose # LOCAL from astropy import units as u from astropy.units.equivalencies import Equivalency from ...
ad5a817c858328178f97958b4a5127bc1f006ba6d98b1cc76db3b4d3b0dcc3c5
# -*- 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": ...
306dff63a30d8f6cf82a6f28d3f87c72c7b560e1d43c96cf21ce08fa6b7e67c7
# 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.utils import sanitize_scale from astropy.units.utils import quantity_asanyarray from astropy.units.quantity import Quantity _floa...
5962e3b3e0d0c9bd7de33a8730f50b568374546e55b5a05f3732c3236165c758
# -*- 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.units import deprecated, required_by_vounit from ...
387570f98abd09cdb70ad3b97be1c75e7cc3c7ec2f5115b8cb183c2195916ad8
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # STDLIB import sys 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, Annotated def test_ignore_generic_typ...
491e76724d23fbe787cc9bfbd98fecf41b14520ad58f9f37c6bec7fa79159053
# 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...
4dc1fae0dc4c1df85d60cefa8b076b6f1fe3e84bcd3cd4853a05599cf0239a47
# -*- 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 pytest import numpy as np from numpy.testing import assert_allclose from astropy impor...