hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
5da8386945a24efd81a0e2ae5b91f861365eb4b977bf3ea17142e1fb1314a793 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Functions to do XML schema and DTD validation. At the moment, this
makes a subprocess call to xmllint. This could use a Python-based
library at some point in the future, if something appropriate could be
found.
"""
import os
import subprocess
de... |
de0df7703512ff95c671f33c5a3a045ce4e41ab5cc7e923585055e432fda3138 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import json
import os
from datetime import datetime
import locale
import pytest
import numpy as np
from .. import data, misc
def test_isiterable():
assert misc.isiterable(2) is False
assert misc.isiterable([2]) is True
assert misc.isiterab... |
402236b02576e946e1b2c8d2541b84da07717212c5c506864e356072246e0b76 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test `astropy.utils.timer`.
.. note::
The tests only compare rough estimates as
performance is machine-dependent.
"""
# STDLIB
import time
# THIRD-PARTY
import pytest
import numpy as np
# LOCAL
from ..timer import RunTimePredictor
from ..... |
3d591015e5a9b3dae5a5754c079705723faf9860ed12e5f5de581605918c8b02 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import pytest
from ..xml import check, unescaper, writer
def test_writer():
fh = io.StringIO()
w = writer.XMLWriter(fh)
with w.tag("html"):
with w.tag("body"):
w.data("This is the content")
w.comme... |
01644893af7dbaf5eefc41611ec5762f445693ff07daf58c1e3b68a300f28d89 | import abc
from collections import OrderedDict
import pytest
import numpy as np
from ..metadata import MetaData, MergeConflictError, merge, enable_merge_strategies
from ..metadata import common_dtype
from ...utils import metadata
from ...io import fits
class OrderedDictSubclass(OrderedDict):
pass
class MetaB... |
bc6377b1282df4f37e7538a6b3b4dabdca338b71f1e02a3aef549e29669bf04d | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from ..data_info import dtype_info_name
STRING_TYPE_NAMES = {(True, 'S'): 'bytes',
(True, 'U'): 'str'}
DTYPE_TESTS = ((np.array(b'abcd').dtype, STRING_TYPE_NAMES[(True, 'S'... |
bcc896e3bd486ffa337241dd4b417a8aa40bce4af373517a0b55fde00c40978a | # -*- 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 ..data import (_get_download_cache_locs, CacheMissingWarning,
get_pkg_data_filena... |
edeced5fd15917a6190108ea7a6706f8f7918fdfb127c94b1b02a014d4ec351c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import io
import numpy as np
import pytest
from . import test_progress_bar_func
from .. import console
from ... import units as u
class FakeTTY(io.StringIO):
"""IOStream that fakes a TTY; provide an encoding to emulate an... |
2372528dea8718b8637b5a661940aa02a0513848b5205e3fc19b14be01092d1f | # 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 .. import introspection
from ..introspection import (find_current_module, find_mod_objs,
isinst... |
84eddb76e1fc796259ca122888297806d6fc0db836665f1a561b7f50646d0d0b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from ...tests.helper import raises
from .. import collections
@raises(TypeError)
def test_homogeneous_list():
l = collections.HomogeneousList(int)
l.append(5.0)
@raises(TypeError)
def test_homogeneous_list2():
l = collectio... |
1c80498c2f1f985b73e7e1d0af6a73b2fb1d91958d0d5b956766f71908b736ae | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import inspect
import pickle
import pytest
from ..decorators import (deprecated_attribute, deprecated, wraps,
sharedmethod, classproperty,
format_doc, deprecated_renamed_argument)
from... |
307ed3b52a1b5e6eb541c169d3d83a91b599be8453c95552314e5bea5920283f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
import traceback
import pytest
from ..codegen import make_function_with_signature
def test_make_function_with_signature_lineno():
"""
Tests that a function made with ``make_function_with_signature`` is give
the correct line numb... |
0f4d8d8733b97a22c9ddf4fb8600d593d2ffc8f9693af7fccf2fa850772cf985 | import time
import numpy as np
from ..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 Python's `multip... |
043c1552ba82ab3619ce313dbc1f9aa24e089fa8ac2ec49b81631fe08c148402 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage contains utility modules for compatibility with older/newer
versions of python, as well as including some bugfixes for the stdlib that are
important for Astropy.
Note that all public functions in the `astropy.utils.compat.misc` module ... |
c10c02006bbf70bb2c953642956a7852d5b00c90d49d6def1f92c8721075af42 | # 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 ...utils import minversion
__all__ = ['NUMPY_LT_1_10_4', 'NUMPY_LT_1_11', 'NUMPY_LT_1_11_2',
'NUMPY_LT_1_12', 'NUMPY_LT_1_13', 'NUMPY_LT... |
0f46911008cacafedce12ab4e3ec2db28be80dcd8412a6074992a413828fad13 | from inspect import signature, Parameter, Signature, BoundArguments
__all__ = ['BoundArguments', 'Parameter', 'Signature', 'signature']
import warnings
from ..exceptions import AstropyDeprecationWarning
warnings.warn("astropy.utils.compat.funcsigs is now deprecated - "
"use inspect instead", AstropyDep... |
2fce7b711e53d84bb081dc8b2db17854706e7b4afff5e73a663431ab29713e2e | # 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.
... |
15958d99cb0ed42d960b61ab43eea48595f7429ec0e1dc2f2ae475f1029d1f01 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import urllib.request
import pytest
import numpy as np
from ....tests.helper import assert_quantity_allclose, catch_warnings
from .. import iers
from .... import units as u
from ....table import QTable
from ....time import Time
FILE_NOT_FOUN... |
29149f397014797e1f6fb8f3ea56ed05297a6ceec410bd77f2afd2baf552bc09 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# LOCAL
from ....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 allow... |
b3545f1e532fb2740834cde771c87d8e343eadf9b47df9d67f0146903739738c | # coding: utf-8
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""NumPy functions and classes needed for astropy but not available
in all supported NumPy versions. See docs/utils/numpy.rst for details.
"""
from .lib.stride_tricks import broadcast_arrays, broadcast_to
from .core.multiarray import ma... |
ed7a113b6f9de55be5dde4e81218177d84e84b2982a70e942b8dfbf114f68979 | from concurrent.futures import *
import warnings
from ...exceptions import AstropyDeprecationWarning
warnings.warn("astropy.utils.compat.futures is now deprecated - "
"use concurrent.futures instead", AstropyDeprecationWarning)
|
b1c73f993bd5360dfb3d8c45d3ed4f773b70ee51cc7018081ca15b31e23d70d8 | # 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 ....exceptions import AstropyDeprecationWarning
__all__ = ['matmul', 'GE1P10']
def GE1P10(module=np):
return hasattr(module, 'matmul')
def matmul(*args, **kwargs... |
3f2cbc22765df5702db95f2b18d71d849c7f348cfc27e983218a9f8081399d40 | # 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_... |
55ee51821eadc3b962042785c9d517352f3614d5ac9c705164ee6a59d9332d5f | # -----------------------------------------------------------------------------
# ply: lex.py
#
# Copyright (C) 2001-2016
# David M. Beazley (Dabeaz LLC)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are... |
ad5a69f42f3c16a0f8a8253c8f2a8ab3d076094b163a29231e3bf8ee5aedfd2f | # -----------------------------------------------------------------------------
# cpp.py
#
# Author: David Beazley (http://www.dabeaz.com)
# Copyright (C) 2007
# All rights reserved
#
# This module implements an ANSI-C style lexical preprocessor for PLY.
# --------------------------------------------------------------... |
ab8b3ce90c11b1845adb42fdb9e4b17e1fa13e28697ed0630cebd86b6fd24b66 | # PLY package
# Author: David Beazley (dave@dabeaz.com)
__version__ = '3.9'
__all__ = ['lex','yacc']
|
a323221afd69924cda39af2cd98c654f091b0aee12e60a03275ce18a98da3679 | # -----------------------------------------------------------------------------
# ply: yacc.py
#
# Copyright (C) 2001-2016
# David M. Beazley (Dabeaz LLC)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ar... |
30a92c9cde344de84f86055fc422618e3fc18cbf78ddaa6b78004a633f9b9746 | # ----------------------------------------------------------------------
# ctokens.py
#
# Token specifications for symbols in ANSI C and C++. This file is
# meant to be used as a library in other tokenizers.
# ----------------------------------------------------------------------
# Reserved words
tokens = [
# Li... |
03a85d259563237b7f81e79b67d07352fc11ac85e8d257f0cd094cd8b70ac9ab | """Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2015 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including with... |
1bd374b063b8b240a449761811b14603f1d6a2457c8fd50403e300275cc56d1c | # configobj.py
# A config file reader/writer that supports nested sections in config files.
# Copyright (C) 2005-2014:
# (name) : (email)
# Michael Foord: fuzzyman AT voidspace DOT org DOT uk
# Nicola Larosa: nico AT tekNico DOT net
# Rob Dennis: rdennis AT gmail DOT com
# Eli Courtwright: eli AT courtwright DOT org
#... |
c78413a99704e1dd71d4a39b83f45b355e92a11facbbf314cc916a68b8df1c6f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
from distutils.version import LooseVersion
from ..mpl_normalize import simple_norm
from ... import log
from ...io.fits import getdata
def fits2bitmap(filename, ext=0, out_fn=None, stretch='linear',
power=1.0, asinh_a=0.1, min_... |
7587137f95d64fbdc17c8d550ba23f03d2ba28be06e2420787a5df25cf477afe | # 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... |
02f54f7aba00dbc1dc92131c012391417692d98c2c643c44954289f0a4cdd514 | # 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 numpy as np
from matplotlib.ticker import Formatter
from matplotlib.transforms import Affine2D, ScaledTranslation
fr... |
fc1dd12e0ca2c81aac79d2091b6470017dfd0dad31c6c533492c1f136bd504d5 | # 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... |
7ae67be1d46985642431807e682fd9c06745ebc3138ec7b0eb100c0f2c870774 | # 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.artist import Artist
from matplotlib.axes import Axes, subplot_class_factory
from matplotlib.transforms import Affine2D, Bbox, Transform
from ...coordi... |
239713085a6f8ad4773472182b2dc302ec0f361ba82921660b71502294118263 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# The following few lines skip this module when running tests if matplotlib is
# not available (and will have no impact otherwise)
try:
import pytest
pytest.importorskip("matplotlib")
del pytest
except ImportError:
pass
from .core import... |
77853076d816908fa241ef0409533fce3ea6fd5d87f741b0df8fc87baccdefbe | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
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, *args, **kwargs):
self.clear... |
3ded2b2d163a07f839ea817fa85e247001ad65b7c4ccfb4aa1739da24aa65858 | # 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... |
33c8a83bbd13bea9a05e0ce701a7bbd7168d0736a9a3143e4413d33170122ddb | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from matplotlib.patches import Polygon
from ... import units as u
from ...coordinates.representation import UnitSphericalRepresentation
from ...coordinates.matrix_utilities import rotation_matrix, matrix_product
__all__ = ['Spherica... |
48128c482209dfd338c89c75c7039ac4e5f8ab262e298bfe33153d1a72e342e0 | # 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:
... |
7e7d67e4a6ab7ea99f13926ebe2f51472dab3fac41715913a36da20aff29254a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from ... import units as u
from ...coordinates import BaseCoordinateFrame
# Modified from axis_artist, supports astropy.units
def select_step_degree(dv):
# Modified from axis_artist, supports astropy.units
if dv > 1. * u.... |
1932983c893529fe7a80ed3f103bbd33b559572e0a18b5b60f901e560ef518c4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
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):
self._frame = frame
... |
2cacbdf93ebb3323c8be009e1d368750e46ce7f789d2ac3ff602ff4033205710 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
from ... import units as u
# Algorithm inspired by PGSBOX from WCSLIB by M. Calabretta
def wrap_180(values):
values_new = values % 360.
with np.errstate(invalid='ignore'):
values_new[values_new > 18... |
adecab2487a946d1aacbcb234bf0d4eff5c2f2e13743cdf9c029206e3e79888c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import abc
from collections import OrderedDict
import numpy as np
from matplotlib.lines import Line2D, Path
from matplotlib.patches import PathPatch
__all__ = ['Spine', 'BaseFrame', 'RectangularFrame', 'EllipticalFrame']
class Spine:
"""
A ... |
b11d682c733b4feb412af5d578871bbc6179c4b838adb18c489aac46587b2b66 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from matplotlib.lines import Path
from ...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 = 10.
... |
c875e51ce4ac6e6e98f768f8ef02ed480fd43e707cc85f09bb040c741ae02b8b | # 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... |
a3b99aaa0c81eccfee689d176702d45b9f96a9cdf98a53eced23a95cf926c277 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from ...utils import NumpyRNGContext
from ..interval import (ManualInterval, MinMaxInterval, PercentileInterval,
AsymmetricPercentileInterval, ZScaleInterval)
class TestInterval:
data = np.... |
843e948928d58ca746724f8ab894b8650b5b3774f10233f59328a63a6f71ad90 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from ..stretch import (LinearStretch, SqrtStretch, PowerStretch,
PowerDistStretch, SquaredStretch, LogStretch,
AsinhStretch, SinhStretch, HistEqStretch,
... |
b402127848afbd6c3cee827c4ea01c431f81492bf61098763d392ff71b7b25c7 | # -*- 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 ... import units as u
from ..units import quantity_support
@pytest.mark.skipif('not HAS_PL... |
af0343f017d8a9a37e8f266e4b9726eed9bf07016887173533a90ed46fddca53 | # 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 ...convolution import convolve, Gaussian2DKernel
from .. import lupton_rgb
try:
import matplotlib # no... |
218d88373f72a064535ca2a7eba7c8fab50bfe20a4cb098591c066b431beef48 | # 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 ..mpl_normalize import ImageNormalize, simple_norm
from ..interval import ManualInterval
from ..stretch import SqrtStretch
try:
import matplotlib ... |
176cb7acd49aa02bac33dc90cb1a3ae6f66dddcf6b363229b8998225d966d8bc | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from ....io import fits
try:
import matplotlib # pylint: disable=W0611
import matplotlib.image as mpimg
HAS_MATPLOTLIB = True
from ..fits2bitmap import fits2bitmap, main
except ImportError:
HAS_MATPL... |
bf708267e02a32c030f58d4931651288d395fae3134727ab0d8f59bc902de6c8 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import warnings
import pytest
import numpy as np
import matplotlib.pyplot as plt
from .... import units as u
from ....wcs import WCS
from ....io import fits
from ....coordinates import SkyCoord
from ....tests.helper import catch_warnings
from ... |
c4a53b0ee436381b7f30d426507c535faddcf20fbfea4924b5bfcb59f4f54ca6 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from numpy.testing import assert_almost_equal
from .... import units as u
from ..utils import (select_step_degree, select_step_hour, select_step_scalar,
coord_type_from_ctype)
from ....tests.helper import (assert_quantity_allclose ... |
4a919dde900f23fe0ec43e4068d5e3e5eaff32edacb505fee6ec54d1fb4fbbc9 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This sub-package makes use of image testing with the pytest-mpl package:
#
# https://pypi.python.org/pypi/pytest-mpl
#
# For more information on writing image tests, see the 'Image tests with
# pytest-mpl' section of the developer docs.
|
2697d83cc9cec8ea8e2a9d16ef8d44d3b5bcb4fa85befe9a10026412e516ae1d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
import matplotlib.pyplot as plt
from ....wcs import WCS
from .. import WCSAxes
from ..frame import BaseFrame
from ....tests.image_tests import IMAGE_REFERENCE_DIR
from .test_images import BaseImageTests
class Hexagona... |
df93cf4723d75c5cee5faea17ef9f75820da4314901d60f5cb3df3f21aa39c17 | # 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 ....utils.data import get_pkg_data_filename
from ....io import fits
__all__ = ['fetch_msx_hdu',
'fetch_rosat_hdu',
'fetch_twoMASS_k_... |
3aa0617127f5c0ccd43acc2979830d12b157f842f3a6fdd301d7c362abb11e5d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
import matplotlib.pyplot as plt
from .... import units as u
from ....wcs import WCS
from .. import WCSAxes
from .test_images import BaseImageTests
from ..transforms import CurvedTransform
from ....tests.image_tests imp... |
227a7fb9184ff690e3480a07a8252e3b643f1ed1ae6431c28a92f7db5858fe7a | # 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 .... import units as u
from ..formatter_locator import AngleFormatterLocator, ScalarFormatterLocator
class TestAngleFormatterLocator:... |
0982303b5e2a75b83e5b200b6ad2e2721d6db920d309205f122fa0a62efb370b | def get_package_data():
return {'astropy.visualization.wcsaxes.tests': ['baseline_images/*/*.png', 'data/*']}
|
f8f85dd37fd0f07992fa81ddffe477e64d1f4ef72cfd0a0a27f5759e0dc0c831 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from ..core import WCSAxes
import matplotlib.pyplot as plt
from matplotlib.backend_bases import KeyEvent
from ....wcs import WCS
from ....coordinates import FK5
from ....time import Time
from ....tests.image_tests import ignore_matplotlibrc
from .test_im... |
e0f60adcb9986b47e4e3f0ed7245e99e11f2769aaa8303885503b1962cfd3b1a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from unittest.mock import patch
import pytest
import matplotlib.pyplot as plt
from ..core import WCSAxes
from .... import units as u
from ....tests.image_tests import ignore_matplotlibrc
@ignore_matplotlibrc
def test_getaxislabel():
fig = plt.fig... |
2e5dcb76d63e0865d1365e416f668cf4ef8f52f721ec8f252a2b86519a50b9a9 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import pytest
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Rectangle
from matplotlib import rc_context
from .... import units as u
from ....io import fits
from ....wcs import WCS
from ....coordinate... |
da51c9cc0ac5e42081c1cbf081c4640403f40966859eb12ac52520841bfb07a5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from matplotlib.transforms import Affine2D, IdentityTransform
from ....wcs import WCS
from ..transforms import WCSWorld2PixelTransform
WCS2D = WCS(naxis=2)
WCS2D.wcs.ctype = ['x', 'y']
WCS2D.wcs.cunit = ['km', 'km']
WCS2D.wcs.crpix... |
dc401b34d7acca692cf8079ecebd0cba0897939c33ab53561bc160c60c6a7a2e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This module implements the Slicing mixin to the NDData class.
from ... import log
__all__ = ['NDSlicingMixin']
class NDSlicingMixin:
"""Mixin to provide slicing on objects using the `NDData`
interface.
The ``data``, ``mask``, ``uncertai... |
8673fa3df20b8fac1a79c32184e182cfda0dc80c26619f6e14b1c886bb0025b6 | # 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 ..nduncertainty import NDUncertainty
from ...units import dimensionless_unscaled
from ...utils import format_doc, sharedmethod
__all__... |
5f4793263c238f277b5fc0c1d6bbf25f0532011251042bd4b14c25a95403ee68 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This module implements the I/O mixin to the NDData class.
from ...io import registry as io_registry
__all__ = ['NDIOMixin']
class NDIOMixin:
"""
Mixin class to connect NDData to the astropy input/output registry.
This mixin adds two met... |
3891e8b863283806ac7ee6ce7dcd5b71185d261547360198c9e857ff2ad09884 | # 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 ...io import fits
from ..nduncertainty import StdDevUncertainty, MissingDataAssociationException
from ... import units as u
from ... import log
from .... |
0cc2878d90478ac3e054bee1d6f7cb087298ce9786583a8e70b750c68b25ec79 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# Tests of NDDataBase
from ..nddata_base import NDDataBase
class MinimalSubclass(NDDataBase):
def __init__(self):
super().__init__()
@property
def data(self):
return None
@property
def mask(self):
return su... |
16cb0915b956210e0f0c4d1a75d1743343232231dd2981e658d355c65b565e28 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_allclose
from ...tests.helper import assert_quantity_allclose
from ..utils import (extract_array, add_array, subpixel_indices,
block_reduce, block_replicate,
... |
08ba7c544a79ee02e207efa294cd20ce99ec9649e44d642fe9b3113d2838a028 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from .. 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] == ('FlagCo... |
b103e89af29dfd9a0b08635457a256779dedeb9088bf697562fede8b1a6f7b28 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import textwrap
from collections import OrderedDict
import pytest
import numpy as np
from numpy.testing import assert_array_equal
from ..nddata import NDData
from ..nduncertainty import NDUncertainty, StdDevUncertainty
from ... import units as u
from ... |
aff2afb3cc50e5139d4821016328fb8d9f6d3f76cab90dfdce93d4376a86d296 | # 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 ..nddata import NDData
from ..compat import NDDataArray
from ..nduncertainty import StdDevUncertainty
from ... import units as u
NDDATA_ATTRIBU... |
517a5064b8a4118d5fd34e73165abf378cc32dc615c03e8cc4d8ee81199f3101 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import inspect
import pytest
import numpy as np
from ...tests.helper import catch_warnings
from ...utils.exceptions import AstropyUserWarning
from ... import units as u
from ..nddata import NDData
from ..decorators import support_nddata
class CCDData... |
a87fef9066aaeeccf468f027e1370a2697afb3d7cc401a6d61555fc50516b205 | # 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 ..nduncertainty import (StdDevUncertainty, NDUncertainty,
IncompatibleUncertaintiesException,
UnknownUncertaint... |
675a6e0b2d51667a9aa3de38025e8fb2d81eb4c31c8accac2d6615756c0ca8f5 | # 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 ... import NDData, NDSlicingMixin
from ...nduncertainty import NDUncertainty, StdDevUncertainty
from .... import units as u
# Just add the Mixin to NDData
# TODO: Make... |
89fc021581f6c13015170edf19615735cb3b38e6dbc102d9164377a63e82b10b |
from ... 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')
|
bbe134d7a256b6e0b86686ec953091169bc0194108b6c8580324191bb808048a | # 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 ...nduncertainty import (StdDevUncertainty, UnknownUncertainty,
IncompatibleUncertaintiesException)
from ... imp... |
ce5045e6c76e8231e8de1b7d036db247429893677e59bdf6847558d68281b073 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from .. import core as erfa
from ...tests.helper import catch_warnings
def test_erfa_wrapper():
"""
Runs a set of tests that mostly make sure vectorization is
working as expected
"""
jd = np.linspace(2456855.5, 24... |
0232375f8b24cae39732532d470602e64bdce7a0021f3ef958ba7f6b52b77b18 | # 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 ...utils.data import get_pkg_data_contents, get_pkg_data_filename
from ...time import Time
from ... import units as u
from ..w... |
f6e9282f9a8fd84da014331b0786fc2959e2489e6be6c0e5c16f4048566401fa | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import pytest
import numpy as np
from ...utils.data import get_pkg_data_filenames, get_pkg_data_contents
from ...utils.misc import NumpyRNGContext
from ... import wcs
# hdr_map_file_list = list(get_pkg_data_filenames("maps", pattern="*.hdr"... |
105af9aff83e53dcd11d7949f9214fa812cae505c8c1a4265ecdd1c0c2b51b51 | # 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 ...tests.helper i... |
81d8fcc0d26a8dae46f315bf643aa097e4d7c86f2243464dc545af8295117e82 | # 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 ...utils.data import get_pkg_data_contents, get_pkg_data_fileobj
from ...utils.misc import NumpyRNGContext
from ...io import fits
from ... import wcs
... |
0fd21ebac3ea3f5fe9e624349e642896d370642d9cb437023b74140e6b828dbd | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import gc
import locale
import re
import pytest
from numpy.testing import assert_array_equal, assert_array_almost_equal
import numpy as np
from ...tests.helper import raises, catch_warnings
from ...io import fits
from .. import ... |
4ddded1e59c261c4dd31caa039aaf17b52a17823830f4ac61d470a60bc697ffb | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import sys
if __name__ == '__main__':
astropy_path = sys.argv[-1]
sys.argv = sys.argv[:-1]
sys.path.insert(0, astropy_path)
from astropy import wcs
import numpy as np
from distutils.core import setup, Extension
if... |
6c6417a3818fcb3b8109394eea76ff8bfceaa8fff36b42b83efa0bc00999876d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import subprocess
import sys
import pytest
def test_wcsapi_extension(tmpdir):
# Test that we can build a simple C extension with the astropy.wcs C API
setup_path = os.path.dirname(__file__)
astropy_path = os.path.abspath(
... |
d069df7490a2a962b063499c3954ac12d09311d8e67a1ed501694546e6a79239 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import itertools
import numpy as np
import operator
import pytest
from .. import (Time, TimeDelta, OperandTypeError, ScaleValueError,
TIME_SCALES, TIME_DELTA_SCALES)
from ... import units as u
allclose_jd = functools.par... |
a2f201beec18e23c0922bea391b8fe3521a955e9c10d3cbbd93ce331f273e855 | # 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 ...tests.helper import catch_warnings, pytest
from ...utils import isiterable
from .. import Time, ScaleValueError, TIME_SCALES, TimeString, TimezoneInfo
fro... |
83c1f0e8e4e7f191fb861aee82a2fb8d453ac8dc1c41a58faef04b67c466a257 | import functools
import pytest
import numpy as np
from .. 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(np.allclo... |
92e18ad8ec8dd88bc3005dd020d38258235d99ec87d4bd6aa79ba4bab7a2adff | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from ... import units as u
from ...coordinates import EarthLocation, SkyCoord, solar_system_ephemeris
from .. import Time, TimeDelta
try:
import jplephem # pylint: disable=W0611
except ImportError:
HAS_JPLEPHEM = False
else:
HA... |
73cacdb1f7dce0b9e3cb1d2015f7f59ac56712d81e2fc24761751e315df11e5b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pickle
import numpy as np
from .. 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='utc')
... |
a8062fb85c8b4cffa9a4fd085264ea8208bad4e8ee9411db3601b4016ad39a96 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import pytest
import numpy as np
from .. import Time
from ...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-15, atol=1e-4)
... |
58541290d2cd443d982f07b04b7e21c3761753102382be24b30f7a203119cdb9 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from .. 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')
assert... |
b3f3868d31cc73ff7f43663521cd63615d6167f2cc5a2b765131a21a930ac4b3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import pytest
import numpy as np
from .. import Time, TimeDelta, OperandTypeError
from ... import units as u
from ...table import Column
allclose_sec = functools.partial(np.allclose, rtol=2. ** -52,
atol... |
7178fb72abc0bf29e997f35992e59e859cc60a27b6cb6f6fe8f5ad0d877ef903 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import operator
import pytest
import numpy as np
from .. import Time, TimeDelta, OperandTypeError
class TestTimeComparisons():
"""Test Comparisons of Time and TimeDelta classes"""
def setup(self):
self.t1 = Time(np.arange(49995, 50005... |
e17814afa04e7d241d2176d963b724ab81b12bdf4ecec688c99e71d8549d37d4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import copy
import pytest
import numpy as np
from .. 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 use_masked_... |
2c6819975a6b0e86c30b2a814ddc952b990d1e2dcb564573b5a738105ae21f46 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import numpy as np
from ...utils.compat import NUMPY_LT_1_14
from ...tests.helper import pytest
from .. import Time
from ...table import Table
try:
import h5py # pylint: disable=W0611
except ImportError:
HAS_H5PY = False
else:
... |
5fd0912dfe3702c9c191e209d9ceae70de5a976be032ece6057391332cadc0d3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import itertools
import pytest
import numpy as np
from .. import Time
from ..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 at that level.
withi... |
5c5c2ae05629c3a878e1970356a8e484fb1c6a2cd69cb0997b2428516f95f0a7 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICNSE.rst
# Note that files generated by lex/yacc not always fully py 2/3 compatible.
# Hence, the ``clean_parse_tables.py`` tool in the astropy-tools
# (https://github.com/astropy/astropy-tools) repository should be used to fix
# this when/... |
20eb0f22fcd50fd85736dd86a3defed7c7ea2d14336c1a20e59a127705caa586 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
_tabversion = '3.8'
_lextokens = set(('UINT', 'WHITESPACE', 'STAR', 'OPEN_PAREN', 'UNIT', 'SIGN', 'UFLOAT', 'STARSTAR', 'DIVISION', 'LIT10', 'CLOSE_PAREN', 'UNKNOWN'))
_lexreflags = 0
_lexliterals = ''
_lexstateinfo = {'INI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.