hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
1814677e830117cc068ebe68ad6d36ee2c0c49e2e6ec8e9dc7d2d4d41968f293 | import abc
from collections import OrderedDict
import pytest
import numpy as np
from astropy.utils.metadata import MetaData, MergeConflictError, merge, enable_merge_strategies
from astropy.utils.metadata import common_dtype
from astropy.utils import metadata
from astropy.io import fits
class OrderedDictSubclass(Or... |
04120efb53c1bcb0ba1189d59f732ed73e42b30423f106bc8b5f56787108515f | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from astropy.utils.data_info import dtype_info_name
STRING_TYPE_NAMES = {(True, 'S'): 'bytes',
(True, 'U'): 'str'}
DTYPE_TESTS = ((np.array(b'abcd').dtype, STRING_TYPE_NAME... |
04ecb782b09450941abd807de77fd527fa7e11ecc6db91c98fe4a55dcbc06993 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import hashlib
import os
import pathlib
import sys
import tempfile
import urllib.request
import urllib.error
import pytest
from astropy.utils.data import (_get_download_cache_locs, CacheMissingWarning,
... |
6cf09674c397e73d920e0ba0ed09d0689ea59bd8738a4bef96ba76c26a70faa4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import io
import pytest
from . import test_progress_bar_func
from astropy.utils import console
from astropy import units as u
class FakeTTY(io.StringIO):
"""IOStream that fakes a TTY; provide an encoding to emulate an outp... |
08aa4d38f0b110dd0a7591dc4a7d67910782cab2177628351b3b1b6dfb7e473b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# namedtuple is needed for find_mod_objs so it can have a non-local module
from collections import namedtuple
import pytest
from astropy.utils import introspection
from astropy.utils.introspection import (find_current_module, find_mod_objs,
... |
c170ea5afa229bb3630e06d5a630ab03acce696b4d4460720182cef11bee9128 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy.tests.helper import raises
from astropy.utils import collections
@raises(TypeError)
def test_homogeneous_list():
l = collections.HomogeneousList(int)
l.append(5.0)
@raises(TypeError)
def test_homogeneous_list2():
... |
c2b2d77c3101ba962b7edc7b7b8e2434051e5872f35a5f9ae6e559d0cbd27ece | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import inspect
import pickle
import pytest
from astropy.utils.decorators import (deprecated_attribute, deprecated, wraps,
sharedmethod, classproperty,
format_do... |
696dc61fcd281b11994c7360394bba4c5becb26ced300fff2b6e83e87c9d4064 | import time
import numpy as np
from astropy.utils.misc import NumpyRNGContext
def func(i):
"""An identity function that jitters its execution time by a
pseudo-random amount.
FIXME: This function should be defined in test_console.py, but Astropy's
`python setup.py test` interacts strangely with Pyth... |
f194d120cfdc29d3ddd0c16f515dacea6ad2e3b01bab028f58c7e3125181e7a6 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is a collection of monkey patches and workarounds for bugs in
earlier versions of Numpy.
"""
from astropy.utils import minversion
__all__ = ['NUMPY_LT_1_14', 'NUMPY_LT_1_14_1', 'NUMPY_LT_1_14_2',
'NUMPY_LT_1_16']
# TODO: It might als... |
d0ca735d6f5ef1d67fb39cf4a175f9de22f3d749a368583037b55ed26be8b60b | from inspect import signature, Parameter, Signature, BoundArguments
__all__ = ['BoundArguments', 'Parameter', 'Signature', 'signature']
import warnings
from astropy.utils.exceptions import AstropyDeprecationWarning
warnings.warn("astropy.utils.compat.funcsigs is now deprecated - "
"use inspect instead"... |
4ad1830cd9521bd35dc2340c1eb1dc916ec2a2c1afa0a24bc5a986f8158c5a6d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Simple utility functions and bug fixes for compatibility with all supported
versions of Python. This module should generally not be used directly, as
everything in `__all__` will be imported into `astropy.utils.compat` and can
be accessed from there.
... |
b8202833d6dc7266289c26028e925f26c8edb47182e7cfd4bb7e080e9f1cb9e0 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import urllib.request
import warnings
import pytest
import numpy as np
from astropy.tests.helper import assert_quantity_allclose, catch_warnings
from astropy.utils.iers import iers
from astropy import units as u
from astropy.table import QTabl... |
86c588a7265e2b6ba9ddd4a411e08692335ad0ed383913f637067fb9ffdc2184 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# LOCAL
from astropy.utils.xml.iterparser import _fast_iterparse
# SYSTEM
import io
import zlib
# The C-based XML parser for VOTables previously used fixed-sized
# buffers (allocated at __init__() time). This test will
# only pass with the patch that a... |
d4d4a4ede0b94ff92011f1aadfc27057e1a1fc7b241279c16ddb98a3e7e50d9f | from concurrent.futures import *
import warnings
from astropy.utils.exceptions import AstropyDeprecationWarning
warnings.warn("astropy.utils.compat.futures is now deprecated - "
"use concurrent.futures instead", AstropyDeprecationWarning)
|
d949da1df57bf8d121208c24be7edc53aa55c55a92fd0a717364f266616c81c9 | # coding: utf-8
# Licensed like numpy; see licenses/NUMPY_LICENSE.rst
import warnings
import numpy as np
from numpy import matmul as np_matmul
from astropy.utils.exceptions import AstropyDeprecationWarning
__all__ = ['matmul', 'GE1P10']
def GE1P10(module=np):
return hasattr(module, 'matmul')
def matmul(*args... |
1d0843c7ca67710cafebe022ff93959f9986130fea6f46453e0c898198768ceb | # coding: utf-8
# Licensed like the corresponding numpy file; see licenses/NUMPY_LICENSE.rst
"""
Utilities that manipulate strides to achieve desirable effects.
An explanation of strides can be found in the "ndarray.rst" file in the
NumPy reference guide.
"""
import warnings
import numpy as np
from numpy.lib.stride_... |
5dfa4cc90d99be96ad0bc951441dc7889623a211f7e48d2b463d73ce2a5cf8dc | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
from distutils.version import LooseVersion
from astropy.visualization.mpl_normalize import simple_norm
from astropy import log
from astropy.io.fits import getdata
def fits2bitmap(filename, ext=0, out_fn=None, stretch='linear',
... |
1ff147e575ddb307bd93477df0e2b7d0ea034fecc491cdc098815f79878633f9 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# Note: This file incldues code dervived from pywcsgrid2
#
# This file contains Matplotlib transformation objects (e.g. from pixel to world
# coordinates, but also world-to-world).
import abc
import numpy as np
from matplotlib.path import Path
from ma... |
ddd1154ad1e1bd668bd071134b03d19949271c9e2347ca0ec461271547de7e57 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file defines the classes used to represent a 'coordinate', which includes
axes, ticks, tick labels, and grid lines.
"""
import warnings
import numpy as np
from matplotlib.ticker import Formatter
from matplotlib.transforms import Affine2D, Sca... |
1c780b0d206f51a4c62945876cf00aac72b2f665e7aa260333acca581979aced | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file defines the AngleFormatterLocator class which is a class that
# provides both a method for a formatter and one for a locator, for a given
# label spacing. The advantage of keeping the two connected is that we need to
# make sure that the form... |
3eab0c700a44a0f919e87179c1d1dddad64cafa424bc9a2be98acdca458632a2 | # 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,... |
f8b9857ece65261c96baa119d87a867c7d9eddee281684653a5ebfabe668b9a6 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
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):
def __init__(self, frame, *arg... |
58aef50704fde51635359a12a7f2d9860edd980c46c0574ff72871d212fac619 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
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 ticks themselves
are markers. Thu... |
5b5df07ae523e20590527f97d3a7ac3a0d20619fc8ad349191fa66f71d1ca7f0 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from matplotlib.patches import Polygon
from astropy import units as u
from astropy.coordinates.representation import UnitSphericalRepresentation
from astropy.coordinates.matrix_utilities import rotation_matrix, matrix_product
__all_... |
9bd69290e595124e5d9e03e2bcfe3889f44c94957a635cf780f77c9ed70c26a8 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from .coordinate_helpers import CoordinateHelper
from .transforms import WCSPixel2WorldTransform
from .utils import coord_type_from_ctype
from .frame import RectangularFrame
from .coordinate_range import find_coordinate_range
class CoordinatesMap:
... |
3208bf678bb98e05a294ddde821fb2e31d2b45db0a16c732034f0662425f66b7 | # 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 BaseCoordinateFrame
__all__ = ['select_step_degree', 'select_step_hour', 'select_step_scalar',
'coord_type_from_ctype', 'transform_contour_set_inplace']
def s... |
849c617a18388436cf7d6ebbc4dda720258c6d744b7ff3d62b9d98a2f8ff76cf | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from matplotlib import rcParams
from matplotlib.text import Text
import matplotlib.transforms as mtransforms
from .frame import RectangularFrame
class AxisLabels(Text):
def __init__(self, frame, minpad=1, *args, **kwargs):
... |
ce82bc246bdafd37345cfaa35082b2f28971d1655a86a68405f1bddf071da8fe | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
from astropy import units as u
# Algorithm inspired by PGSBOX from WCSLIB by M. Calabretta
LONLAT = {'longitude', 'latitude'}
def wrap_180(values):
values_new = values % 360.
with np.errstate(invalid='igno... |
9e8ed6dd6e2b9810a96533cbb0a9982cb8049df443ec30a2884de01941dc919f | # 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__ = ['Spine', 'BaseFrame', 'RectangularFrame', 'EllipticalFrame... |
40a0583c519dc5613a5598e64d735755880d3f063f1091139ce4b6ed86e763a1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from matplotlib.lines import Path
from astropy.coordinates.angle_utilities import angular_separation
# Tolerance for WCS round-tripping
ROUND_TRIP_TOL = 1e-1
# Tolerance for discontinuities relative to the median
DISCONT_FACTOR = 1... |
bd1381880f3ca15a2c3d8ddf9ea39107336b2a777afb2dded68a8c42b3676c16 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from numpy.testing import assert_allclose
try:
import matplotlib.pyplot as plt
HAS_PLT = True
except ImportError:
HAS_PLT = False
try:
import scipy # noqa
HAS_SCIPY = True
except ImportError:
HAS_SCIPY = False
import pytest
im... |
801dbaa9aeb5344ec737ac41832c0df40568790deeec814fd16df3bb2c48a6f7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from astropy.utils import NumpyRNGContext
from astropy.visualization.interval import (ManualInterval, MinMaxInterval, PercentileInterval,
AsymmetricPercentileInterval, ZScaleInterval)
class Test... |
b24c99796fc0f74175a5980e273dba8f07587d032352ebc3f9dfa10cd2b63b6d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from astropy.visualization.stretch import (LinearStretch, SqrtStretch, PowerStretch,
PowerDistStretch, SquaredStretch, LogStretch,
AsinhStretch, SinhStretch, HistEqStretch,
... |
db6ed4d309d92f0074831faa142e6032da258501d841a6ad1b3f21d00ab70158 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import pytest
try:
import matplotlib.pyplot as plt
except ImportError:
HAS_PLT = False
else:
HAS_PLT = True
from astropy import units as u
from astropy.visualization.units import quantity_support
@pytest.... |
c30eeed1ed53e0e4d9f4c28924f0fe441a63fd0d3553cf0f7e5cc17b507031c2 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for RGB Images
"""
import sys
import os
import tempfile
import pytest
import numpy as np
from numpy.testing import assert_equal
from astropy.convolution import convolve, Gaussian2DKernel
from astropy.visualization import lupton_rgb
try:
... |
ad2e3eabaf7299ce69acac9aa19576c549ea61263f100332a064ad1795299f17 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy import ma
from numpy.testing import assert_allclose
from astropy.visualization.mpl_normalize import ImageNormalize, simple_norm, imshow_norm
from astropy.visualization.interval import ManualInterval
from astrop... |
538dbdb01be823e895197843fe65cb6073bb24fb22f6441fd5d3deb6a1a1cab2 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from astropy.io import fits
try:
import matplotlib # pylint: disable=W0611
import matplotlib.image as mpimg
HAS_MATPLOTLIB = True
from astropy.visualization.scripts.fits2bitmap import fits2bitmap, main
e... |
8a798f4debaa1516c2f2829b06af101b8ba127d9899bfd4727053efdebae0762 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import warnings
from distutils.version import LooseVersion
import pytest
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.contour import QuadContourSet
from astropy import units as u
from astropy.wcs import ... |
dfbc55ce2cb616f833ec095397dbcd2d6287f6842e37e9f9f9b749cc4aa00b16 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from numpy.testing import assert_almost_equal
from astropy import units as u
from astropy.visualization.wcsaxes.utils import (select_step_degree, select_step_hour, select_step_scalar,
coord_type_from_ctype)
from astropy.tests.helpe... |
f1661782525f11cdbbf234f2b5e296665ee89eb37b234c60cc844337b3728291 | # 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... |
d949f1fa97faa1524a4408c8a5bd61bf3bf55723f7d358872245d0c6750d52e3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Downloads the FITS files that are used in image testing and for building documentation.
"""
from astropy.utils.data import get_pkg_data_filename
from astropy.io import fits
__all__ = ['fetch_msx_hdu',
'fetch_rosat_hdu',
'fetch_tw... |
3d73cebd4c71f7933af150f438a8548215eb02d079c1abb69b2b4e900246e93b | # 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... |
bd5eaf702248b8848a463425cca27e47eec1af8d97f40190f83114e8e585be49 | # 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... |
744053dc5dbf7dc700ca879a75f476588dd7817f02b21ed87add8df479c4f050 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.visualization.wcsaxes.core import WCSAxes
import matplotlib.pyplot as plt
from matplotlib.backend_bases import KeyEvent
from astropy.wcs import WCS
from astropy.coordinates import FK5
from astropy.time import Time
from astropy.tests.image_tes... |
91e4d3421e9a48c8f0ff8ea2684fc435707bcd5529460906897779de75290e6e | # 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.visualization.wcsaxes.core import WCSAxes
from astropy import units as u
from astropy.tests.imag... |
96f9c5ebaa43424a3d70ea4af1725202998842fa0b012a3825deb6ed230427be | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import pytest
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Rectangle
from matplotlib import rc_context
from astropy import units as u
from astropy.io import fits
from astropy.wcs i... |
ab1aa808369067db626643556aef80b49aa8d6a7214bd3dcfbeb3ac7543b4b19 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from matplotlib.transforms import Affine2D, IdentityTransform
from astropy.wcs import WCS
from astropy.visualization.wcsaxes.transforms import WCSWorld2PixelTransform
WCS2D = WCS(naxis=2)
WCS2D.wcs.ctype = ['x', 'y']
WCS2D.wcs.cuni... |
167729acf0240b6ef224475ae124c16aae5b39a0cf196f0208296f27d290b2f1 | # 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
__all__ = ['NDSlicingMixin']
class NDSlicingMixin:
"""Mixin to provide slicing on objects using the `NDData`
interface.
The ``data``, ``mask``, ``unce... |
cb7fa539951671582c602927dd670a4bd0482824ab7f20b015407202b64730eb | # 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... |
71abe7a2c8678b85c49a30184e76f14e87570261adcd3cf9a9b8b57d79c8a68f | # 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-dimensiona... |
e760cd38c48e845cf66ad111a38409eeffbc58d238ab0eac89a77a87301b8a8d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This module implements the base CCDData class.
import textwrap
import numpy as np
import pytest
from astropy.io import fits
from astropy.nddata.nduncertainty import (
StdDevUncertainty, MissingDataAssociationException, VarianceUncertainty,
Inv... |
96f675b99aa449857ea6afa658694d129db0f7ea437db64c4e921b2de688f330 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
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.utils import (extract_array, add_array, subpixel_indices,
bl... |
535f336f243514a607f9cba29e22c48df7943b773ff6b3c1e123cf96af5b7ef7 | """
A module containing unit tests for the `bitmask` modue.
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.le... |
34a8c089c054e3beacc5bb57a2dbdd88b10506e2fc68be527fd8560d355c7f45 | # 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]... |
c0f2c171ea374c36664ed694c3016a9b99ccac4eb5c27289d1e2336e4d939484 | # 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... |
818769a6809574056c03eb34f174818e9593ea066a95a809c1cc14cc75e30da3 | # 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... |
95dc4d43d871b1e8895985b3b0e1bb9723eeeba0714e0a213b95d24f8e9a5487 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import inspect
import pytest
import numpy as np
from astropy.tests.helper import catch_warnings
from astropy.utils.exceptions import AstropyUserWarning
from astropy import units as u
from astropy.nddata.nddata import NDData
from astropy.nddata.decorato... |
ca815c59f2e316fb5ee9ea9c57ed13e6182a96f5dbe4bfa4fecfa850f7f27a16 | # 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,
... |
af6dfbeaec97607dfd62836130ca28f0472f1f2653d77a324a12f8761ecaa24f | # 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.nduncertainty import NDUncertainty, StdDevUncertainty
from astropy import units as u
# Just add the Mi... |
6acc4394e701efacfc5c8eb36b7788f217f0714e5403ae27e0994a289dc965bd | # 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,
... |
4d592fe3c5797a06a88e0a938bdf14326ee2d19110d849ee6afe92a44511e44c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from astropy._erfa import core as erfa, ufunc as erfa_ufunc
from astropy.tests.helper import catch_warnings
from astropy.utils.compat import NUMPY_LT_1_16
def test_output_dim_3_signature():
if NUMPY_LT_1_16:
assert erfa_u... |
0318f2b888d50602785e3ccdb03eb51374992d751576603b77aac43103c76527 | from .low_level_api import *
from .high_level_api import *
from .high_level_wcs_wrapper import *
from .sliced_low_level_wcs import *
|
6ad22f24633d55b2ba54b300485c24ce74d48b7f5078c2aebe9e1680245d89eb | from .high_level_api import HighLevelWCSMixin
from . import BaseLowLevelWCS
__all__ = ['HighLevelWCSWrapper']
class HighLevelWCSWrapper(HighLevelWCSMixin):
"""
Wrapper class that can take any :class:`~astropy.wcs.wcsapi.BaseLowLevelWCS`
object and expose the high-level WCS API.
"""
def __init__... |
4c8d43623299b774ce71b0020e71b36902f98af99e8ba0634d2ba82d25a79285 | 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... |
3f7f579714aa6e6b94a41d7e9dd4c5a392715361845502354ea7bce5dd0f90a9 | import importlib
def deserialize_class(tpl, construct=True):
"""
Deserialize classes recursively.
"""
if not isinstance(tpl, tuple) or len(tpl) != 3:
raise ValueError("Expected a tuple of three values")
module, klass = tpl[0].rsplit('.', 1)
module = importlib.import_module(module)
... |
602a06ae7983b79440ea168b1c1431e0cfb6300c1a53378bb870731cc33a34fb | import numbers
import numpy as np
from astropy.wcs.wcsapi import BaseLowLevelWCS
__all__ = ['sanitize_slices', 'SlicedLowLevelWCS']
def sanitize_slices(slices, ndim):
"""
Given a set of input
"""
if not isinstance(slices, (tuple, list)): # We just have a single int
slices = (slices,)
s... |
b7b222c5e2bb634c8fbeed21d1ce0aa7a432807c043a938ae2a0267f7e553d18 | 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 = [... |
b3da6dcdc7fa4da23de87750bb2e0dc46a88f4f0cd0f3e1289172467777eec05 | # 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 .low_level_ap... |
b0c03e15267454c072e858c967b103ae8feaa37a44b98b1da2d2f406b8eb6b4a | # 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 numpy.testing import assert_allclose
from astropy.utils.data import get_pkg_data_contents, get_pkg_data_filename
from astropy.time import Time
from astropy import units ... |
850752283f2796e6a51acb5eb1557b5968afd07dd3066cecd5951c61df649e16 | # 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
# hdr_map_file_list = list(get_pkg_data_filenames("maps", p... |
8311ed237fd69b445bdbc4b4afdfa757e869b8c3a2854ca31c4a411fc8607a82 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import os
import warnings
from datetime import datetime
import pytest
import numpy as np
from numpy.testing import (
assert_allclose, assert_array_almost_equal, assert_array_almost_equal_nulp,
assert_array_equal)
from astropy.tests.hel... |
b0e88f2efb7f85c830c3ba3f4ac30155b8bb4eb9d5d53227310c838309dd4d22 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal
from astropy.utils.data import get_pkg_data_contents, get_pkg_data_fileobj
from astropy.utils.misc import NumpyRNGContext
from astropy.io import fits
from as... |
d54a621d551a5fdf4f03dac52c060cab8a236697ea3eb22cf966e032d5da921a | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import gc
import locale
import re
import pytest
import numpy as np
from numpy.testing import (assert_array_equal, assert_array_almost_equal,
assert_allclose)
from astropy.tests.helper import raises, ca... |
95aa4067d5ff45d8ea1a0212aa5cfc633be0d6725efd74b8d229662178f2b986 | # 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
import numpy as np
import pytest
from numpy.testing import assert_equal, assert_allclose
from astropy import units as u
from astro... |
1d794576a8ce5a076386bc2ac14a630fd238ce9bad729b1f2245342d547cb198 | 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
class DoubleLowLevelWCS(BaseLowLevelWCS):
"""
... |
685d9ac4bdb74b220bc16171a5159161f45e4714fdc7771acb5fe6bb9bea51fd | import pytest
from numpy.testing import assert_equal, assert_allclose
from astropy.wcs import WCS
from astropy.io.fits import Header
from astropy.coordinates import SkyCoord, Galactic
from astropy.units import Quantity
from astropy.wcs.wcsapi.sliced_low_level_wcs import SlicedLowLevelWCS, sanitize_slices
import astrop... |
bbfc46b57da1a1ace9d84d4012d6ed9c6a78664198565875d210251b897490e6 | from pytest import raises
from astropy.tests.helper import assert_quantity_allclose
from astropy import units as u
from astropy.wcs.wcsapi.utils import deserialize_class
def test_construct():
result = deserialize_class(('astropy.units.Quantity', (10,), {'unit': 'deg'}))
assert_quantity_allclose(result, 10 ... |
f00b56c3d1bc2e091152dfbf148168677ddac517d675236f2148d56589375f06 | 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... |
933dac30c1d1c95d142c237197faf45306d872c02d155f9f0258874939ad06a0 | 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 ... |
6f273f7db3ef39328cc5968b61f8c7d10054f35f360e0502939bda064247c02d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import itertools
import numpy as np
import operator
import pytest
from datetime import timedelta
from astropy.time import (Time, TimeDelta, OperandTypeError, ScaleValueError,
TIME_SCALES, STANDARD_TIME_SCALES, TIME_DELTA... |
14d44cfba60dde3b7cbdb96058a4725f66ef2bfdcf3c63c8964928ee2e9106bc | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import functools
import datetime
from copy import deepcopy
import numpy as np
from numpy.testing import assert_allclose
from astropy.tests.helper import catch_warnings, pytest
from astropy.utils.exceptions import AstropyDeprecationWarning
f... |
1cf7ff22af7ba13814615758fc7cba809f44e9fdf69a2ee02d8b7972c6b97f90 | import functools
import pytest
import numpy as np
from astropy.time import Time, TimeDelta
allclose_jd = functools.partial(np.allclose, rtol=2. ** -52, atol=0)
allclose_jd2 = functools.partial(np.allclose, rtol=2. ** -52,
atol=2. ** -52) # 20 ps atol
allclose_sec = functools.partial... |
5cb8f0a786df9d52bd387a3eddb31fd4fbb2dcd5ce4ab527ea26f500afc7dde8 | # 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
try:
import jplephem # pylint: disable=W0611
except ImportError:
HAS_JPLEPHEM =... |
800c2b2f7a9fcb3a52627f80b7f5f181169e17585ab4bee523d38853d78074d6 | # 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=... |
a06e795a075fe81fd5489f0471ecbcd783fd4e71681ec90e3a1624837a03fc4e | # 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 iers # used in testing
allclose_jd = functools.partial(np.allclose, rtol=0, atol=1e-9)
allclose_sec = functools.partial(np.allclose, rtol=1e-... |
f4813650f6d063770784107b2ff8155dc7ab4bfd7cfd9ed1c31dad7d320857e1 | # 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')
... |
b6c89913acd659d5bd6e2391acaab86dec2c2261a4619208aca0193e7c776cac | # 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... |
4c2de17d95968cb2325343e62bd958b9ad01b2ea0e014d07754aec9c5d3b1ef0 | # 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
class TestTimeComparisons():
"""Test Comparisons of Time and TimeDelta classes"""
def setup(self):
self.t1 = Time(np.arange(49995, 50005), forma... |
6a02adfee81ea4866430f39655c0912dd5836e4d7b8efafd73cb4d15d7f10b93 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import copy
import pytest
import numpy as np
from astropy.time import Time
@pytest.fixture(scope="module", params=[True, False])
def masked(request):
# Could not figure out a better way to parametrize the setup method
global u... |
babc59a038f06de2378c903fe9aa59d95f71e00bb3191986065d185f36a59b6a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import numpy as np
from astropy.utils.compat import NUMPY_LT_1_14
from astropy.tests.helper import pytest
from astropy.time import Time
from astropy.table import Table
try:
import h5py # pylint: disable=W0611
except ImportError:
... |
372b714dfc0f6ee0c72562d588b655770ee007ce6da04b5f5640604cf2077aa8 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import itertools
import pytest
import numpy as np
from astropy.time import Time
from astropy.time.core import SIDEREAL_TIME_MODELS
allclose_hours = functools.partial(np.allclose, rtol=1e-15, atol=3e-8)
# 0.1 ms atol; IERS-B files change... |
ed0c2bde88a0454c3af99d3c6a2543c8736faf8249888f15114c8dbad183a067 | # -*- 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... |
0982a78b18e291de316e50ddea2cb34370b2bda915df0e4f7285724a784a3721 | # -*- 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... |
7dd1afdce1a622e7ab096c2c443b4fbf4dda7face33581061e3023e97e050c94 | # 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... |
906d8953f2de8f80c665e7acd63cb915170ba4b8ebc12a42c177c8c29c2fb7de | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles the "LaTeX" unit format.
"""
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
<https:/... |
3f97575439f4cbf7d6ea85d911bd3b1766fe83270cf0e78d84abca168a912faa | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
from astropy.utils.misc import InheritDocstrings
class _FormatterMeta(InheritDocstrings):
registry = {}
def __new__(mcls, name, bases, members):
if 'name' in members:
formatter_name = members['name'].lower()
... |
3bc5ae6b911d3e458b8eadb1183bb4a4e3df7d4e708d73925e0cdc187cd0ad24 | # -*- 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... |
25ffa7c1dd6a0dc703d713fa43bf9c01ac0ec70a03b5e6c49f9ea93d4fed56ea | # 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
def get_grouped_by_powers(bases, powers):
"""
Groups the powers and bases in the given
`~astropy... |
8cee085a4b66fbadb1ef6bfa490584aab955d4551fe3a69e3a17454236072141 | # 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... |
29c8f4e8bb87734f38133c4a5f25ec95d6b57ce325d223eac11f9c2edee88e2b | # 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
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.