hash
stringlengths
64
64
content
stringlengths
0
1.51M
63a3dc5729503c5890bebcbbbedd943c2f6b2e9ecd8b401efb0f17e6b8ec1d5f
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test separability of models. """ import numpy as np # pylint: disable=invalid-name import pytest from numpy.testing import assert_allclose from astropy.modeling import custom_model, models from astropy.modeling.core import ModelDefinitionError from ...
db445614d30daa9c81bdcde4e3a6db73336a30963ac9b409f788e1fb09c4bc44
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests models.parameters """ # pylint: disable=invalid-name import functools import itertools import unittest.mock as mk import numpy as np import pytest from astropy import units as u from astropy.modeling import fitting, models from astropy.modelin...
2f10840ad29a76c41916cedd2eec3b395b728040f73bc6f498a58d7ceab31fd1
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for physical functions.""" # pylint: disable=no-member, invalid-name import numpy as np import pytest from astropy import cosmology from astropy import units as u from astropy.modeling.fitting import ( DogBoxLSQFitter, LevMarLSQFitter, ...
9be4fc998cd59f67d0fd6417234049ed04be3c6d2daba1a85c1b2e196f929378
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import unittest.mock as mk from math import cos, sin import numpy as np import pytest from numpy.testing import assert_allclose import astropy.units as u from astropy.modeling import models, rotations from astropy.tests.he...
19c60d735a03da723d83d84ce9c361e7c38c72f2a38b606ba92aff6edf2cc111
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_allclose from astropy.modeling import math_functions x = np.linspace(-20, 360, 100) @pytest.mark.filterwarnings(r"ignore:.*:RuntimeWarning") def test_math(): for name in math_functi...
11af79d133afaa2c49c0ff7b29493a196ec5ec962044e1f0607555c2f58fd8f8
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import platform import types import warnings import numpy as np import pytest from numpy.random import default_rng from numpy.testing import assert_allclose from astropy.modeling import fitting, models from astropy.modelin...
ef73504395877ef898958aa8633cecbca2c08607ee33893719e0ef9c469bb5a0
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal from astropy import units as u from astropy.modeling.fitting import ( DogBoxLSQFitter, LevMarLSQFitter, LMLSQFitter, ...
9a410d7808bbac388a5cd2bb90349bb476dc06dd98ba2a4b63bbdf14bc24edc0
# Various tests of models not related to evaluation, fitting, or parameters # pylint: disable=invalid-name, no-member import pytest from astropy import units as u from astropy.modeling import models from astropy.modeling.core import _ModelMeta from astropy.modeling.models import Gaussian1D, Mapping, Pix2Sky_TAN from a...
18765dd12a86814a53d1384bccec1d84548558840c15ffb4d1d6379d4883605f
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name, no-member import numpy as np import pytest from astropy import units as u from astropy.modeling.bounding_box import ModelBoundingBox from astropy.modeling.core import fix_inputs from astropy.modeling.fitting import ( D...
b629f533b10520db2ce861403c1e4764508f0900c0217815de9ab1572c696361
# Licensed under a 3-clause BSD style license - see LICENSE.rst # By default, tests should not use the internet. from astropy.samp import conf from astropy.samp.errors import SAMPClientError, SAMPHubError, SAMPProxyError def setup_module(module): conf.use_internet = False def test_SAMPHubError(): """Test t...
7a92d5cb4c824a58f0d09b5a8155b98eae98981c9f079de29a4f2945ae1b2c37
import pytest # By default, tests should not use the internet. from astropy.samp import conf from astropy.samp.errors import SAMPProxyError from astropy.samp.hub import SAMPHubServer from astropy.samp.integrated_client import SAMPIntegratedClient from .test_helpers import TEST_REPLY, Receiver, assert_output, random_p...
408115332bc3da55aaacb1abb031cb869f6af31784603766097e61412b2e055c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest # By default, tests should not use the internet. from astropy.samp import conf from astropy.samp.client import SAMPClient from astropy.samp.hub import SAMPHubServer from astropy.samp.hub_proxy import SAMPHubProxy from astropy.samp.integrate...
0821ae8c09ab28d422dae3867c816cee006c853ddd1995aa0bccbdffeb423f76
import sys import pytest from astropy.samp import conf from astropy.samp.hub_script import hub_script def setup_module(module): conf.use_internet = False def setup_function(function): function.sys_argv_orig = sys.argv sys.argv = ["samp_hub"] def teardown_function(function): sys.argv = function.s...
ec5359db21b618745e0e6c8c4d2a5a4fb2bb91043d01da2750775a2809bb2f9a
from astropy.samp import conf from astropy.samp.hub import SAMPHubServer from astropy.samp.hub_proxy import SAMPHubProxy def setup_module(module): conf.use_internet = False class TestHubProxy: def setup_method(self, method): self.hub = SAMPHubServer(web_profile=False, mode="multiple", pool_size=1) ...
194c84d28f91a6fb43b04dd652b3d0039b9f8c2e383022f26f1d3f232f7d6324
""" Test the web profile using Python classes that have been adapted to act like a web client. We can only put a single test here because only one hub can run with the web profile active, and the user might want to run the tests in parallel. """ import threading from urllib.request import Request, urlopen import pytes...
ec4d79932300c9142f6e190aeacdf61f0a181b9c9939fd5410b0c9701e78b16e
import os import pickle import random import string import time from astropy.samp import SAMP_STATUS_OK TEST_REPLY = {"samp.status": SAMP_STATUS_OK, "samp.result": {"txt": "test"}} def write_output(mtype, private_key, sender_id, params): filename = params["verification_file"] f = open(filename, "wb") pi...
e8bf92499740072ff646a2696e252f276c940046bf96e649a6c2ae1cd3a6fb57
import threading import time import xmlrpc.client as xmlrpc from astropy.samp.client import SAMPClient from astropy.samp.errors import SAMPClientError, SAMPHubError from astropy.samp.hub import WebProfileDialog from astropy.samp.hub_proxy import SAMPHubProxy from astropy.samp.integrated_client import SAMPIntegratedCli...
cca3ae431e73dd2a1d3aca6673bffc579a3b9a056ab107efce918857c7c8c8dd
# Licensed under a 3-clause BSD style license - see LICENSE.rst import time import pytest from astropy.samp import conf from astropy.samp.hub import SAMPHubServer def setup_module(module): conf.use_internet = False def test_SAMPHubServer(): """Test that SAMPHub can be instantiated""" SAMPHubServer(we...
c4efa832a3d068620e10540f14fe6e71fbcba71c191c195ba7c1c65bf80ebb10
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The astropy.utils.iers package provides access to the tables provided by the International Earth Rotation and Reference Systems Service, in particular allowing interpolation of published UT1-UTC values for given times. These are used in `astropy.time`...
dda6338ae27c841d06145a53e5a0f08896dcbd683b4521bce44204f2ccc34f61
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ A collection of functions for checking various XML-related strings for standards compliance. """ import re import urllib.parse def check_id(ID): """ Returns `True` if *ID* is a valid XML ID. """ return re.match(r"^[A-Za-z_][A-Za-z0-...
c76919241255ac89ccbc8a9095d4d0e30eb9483cdbd8a7633e26068601beaf0c
# Licensed under a 3-clause BSD style license - see LICENSE.rst """URL unescaper functions.""" # STDLIB from xml.sax import saxutils __all__ = ["unescape_all"] # This is DIY _bytes_entities = { b"&amp;": b"&", b"&lt;": b"<", b"&gt;": b">", b"&amp;&amp;": b"&", b"&&": b"&", b"%2F": b"/", } _by...
e6324c2ba4ae18676e4867091c67e99bbce2e0895387b7b7c1262c6754c3de6c
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains a class that makes it simple to stream out well-formed and nicely-indented XML. """ # STDLIB import contextlib import textwrap try: from . import _iterparser except ImportError: def xml_escape_cdata(s): """ Escapes &...
5c07b23e9376c212c3314028378e4f2ce55350a557007880cf15ce1a7740ba98
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import sys from collections import defaultdict from os.path import join from setuptools import Extension from extension_helpers import pkg_config def get_extensions(build_type="release"): XML_DIR = "astropy/utils/xml/src" cfg = defa...
9170e3658f0ab883f0ebbfe122a75f4cc104ebe2d3957bc460ac6240b0844b38
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module includes a fast iterator-based XML parser. """ # STDLIB import contextlib import io import sys # ASTROPY from astropy.utils import data __all__ = ["get_xml_iterator", "get_xml_encoding", "xml_readlines"] @contextlib.contextmanager def ...
5c80d94158a8a54f0e31e0813e10fd1adbc5a4b2f65e23cec4ce02f0aca51eee
# 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...
8bca71b0e0352a2f5a9254e902de695da13e19441655f4343aca99c8b26ef348
# Licensed under a 3-clause BSD style license - see LICENSE.rst import json import locale import os import urllib.error from datetime import datetime import numpy as np import pytest from astropy.io import fits from astropy.utils import data, misc def test_isiterable(): assert misc.isiterable(2) is False a...
cd6ead2e0885352120473bbd4f36386664fd8036a214a190e7a1f7843cfb1fda
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io import pytest from astropy.utils.compat.optional_deps import HAS_BLEACH from astropy.utils.xml import check, unescaper, writer def test_writer(): fh = io.StringIO() w = writer.XMLWriter(fh) with w.tag("html"): with w.tag(...
06e8d3f490ac0bd0043f7dc4404e494bdf767a33d7d6c7dd8e3067e8317428ac
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy.utils.shapes import check_broadcast, unbroadcast def test_check_broadcast(): assert check_broadcast((10, 1), (3,)) == (10, 3) assert check_broadcast((10, 1), (3,), (4, 1, 1, 3)) == (4, 1, 10, 3) ...
5ce1efac2ee665c2407e3e0c06ad3eb0fedf247c69d40084aef4782fb310ad1d
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Some might be indirectly tested already in ``astropy.io.fits.tests``. """ import io import numpy as np import pytest from astropy.table import Table from astropy.utils.diff import diff_values, report_diff_values, where_not_allclose @pytest.mark.par...
fd43db8bf82cdc9c8119ab18a14be629c68f0e6ec27b50932e45858e2c3274bb
# Licensed under a 3-clause BSD style license - see LICENSE.rst import importlib import secrets from textwrap import dedent import pytest from astropy.utils.parsing import _TAB_HEADER def _docstring_canary(): """Docstring that's here just to check for -OO.""" @pytest.mark.skipif(not _docstring_canary.__doc__...
d4ece921cdd89a4871f02a0836dde4c41fe7e7ac95441374859a4e533bcd0897
import abc from collections import OrderedDict import numpy as np import pytest from astropy.io import fits from astropy.utils import metadata from astropy.utils.metadata import ( MergeConflictError, MetaData, common_dtype, enable_merge_strategies, merge, ) class OrderedDictSubclass(OrderedDict)...
70c05cd94e59bb455997e96eb69e5e44a39f983d8a6a80bc098d5fbe023a6d9d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest import astropy.units as u from astropy.coordinates import SkyCoord from astropy.table import QTable from astropy.table.index import SlicedIndex from astropy.time import Time from astropy.utils.data_info import dtype_info_...
af5b38b7a93049962c823b5b71f80ec81ccfe7374f835a6342ed71e4a73aff34
# Licensed under a 3-clause BSD style license - see LICENSE.rst import base64 import contextlib import errno import hashlib import io import itertools import os import pathlib import platform import random import shutil import stat import sys import tempfile import urllib.error import urllib.parse import urllib.reques...
bfec6bea2fcf59b6ada83c2b18db1dfc3a7c2ea13f205485625ac4f971ea65da
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io import sys import pytest from astropy import units as u from astropy.utils import console from . import test_progress_bar_func class FakeTTY(io.StringIO): """IOStream that fakes a TTY; provide an encoding to emulate an output strea...
40ae4c69ea72c5a4d49463f1b9f72498ed1d440518a48b7a66e16619787a2890
# 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 from unittest import mock import pytest import yaml from astropy.utils import introspection from astropy.utils.introspection import find_curren...
b67700da1702e2b118757b7f391b3789047aaae29a0870f20ecfb4da1868a8f9
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.utils import collections def test_homogeneous_list(): l = collections.HomogeneousList(int) with pytest.raises(TypeError): l.append(5.0) def test_homogeneous_list2(): l = collections.HomogeneousList(int) ...
9850f41a66e002f9da35c2eedbd1155e3ca3cdf4ee6872db1f6da41f023f7d64
# Licensed under a 3-clause BSD style license - see LICENSE.rst import concurrent.futures import inspect import pickle import pytest from astropy.utils.decorators import ( classproperty, deprecated, deprecated_attribute, deprecated_renamed_argument, format_doc, lazyproperty, sharedmethod,...
c19b5aad4256158e94d6f256e37eab620814d7818b01801bb3ee730a4571b8b5
# Licensed under a 3-clause BSD style license - see LICENSE.rst import sys import traceback import pytest from astropy.utils.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 corre...
0f0c2d380cbd7c07431920c8c63f3157a33d0f42962aed76c14b57427f04b760
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Built-in mask mixin class. The design uses `Masked` as a factory class which automatically generates new subclasses for any data class that is itself a subclass of a predefined masked class, with `MaskedNDArray` providing such a predefined class for `...
eb4fe420aaa96a8044e0230a138cc02708dca80b61fe8f77ba1ff11e100274db
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Built-in mask mixin class. The design uses `Masked` as a factory class which automatically generates new subclasses for any data class that is itself a subclass of a predefined masked class, with `MaskedNDArray` providing such a predefined class for `...
efea3b589551fc0ea02b9606e4cdfc45b0e476ba5e3ccd142159abcb2dc2ce93
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Helpers for letting numpy functions interact with Masked arrays. The module supplies helper routines for numpy functions that propagate masks appropriately., for use in the ``__array_function__`` implementation of `~astropy.utils.masked.MaskedNDArray`....
8ef802b41e5f0ec09cd50ae8d30d976c947fe346af91e83170ded1722731672c
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Checks for optional dependencies using lazy import from `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_. """ import importlib import warnings # First, the top-level packages: # TODO: This list is a duplicate of the dependencies in setup.cfg "all...
0bad59dd58b508227b56cdbad7b6210edb0729a5d4bc9738e6aa8f9144de1fff
# 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 ...
366b8824693aa31870c2b13623aa9174adfcea494a845f706eadbf72a4cc8fff
# 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. """ import numpy as np from astropy.utils import minversion __all__ = [ "NUMPY_LT_1_21_1", "NUMPY_LT_1_22", "NUMPY_LT_1_22_1", "NUMPY_LT_1_...
b56c9d08ce8d98983b79e4ef42f0576d2353900b2dcadfa8e8abf7903d41a180
# 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. ...
b78f58ce16cbda6c92632c7a584fb65427597f931a04405c3f2a57af241c41d2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import locale import os import platform import urllib.request import erfa import numpy as np import pytest from numpy.testing import assert_array_equal from astropy.tests.tests.test_imports import test_imports from astropy.time import Time, TimeDelta fro...
da16f65ab44e683f4b5f8c085d8473f7d7af1573e5b64bc976b70ee26c9d8774
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import re import warnings from pathlib import Path import numpy as np import pytest from astropy import units as u from astropy.config import set_temp_cache from astropy.table import QTable from astropy.tests.helper import assert_quantity_allc...
56afd7938e4d78ec021f03959ebbc280e744b558f993c85baed1749f1a216c52
# Licensed under a 3-clause BSD style license - see LICENSE.rst # LOCAL # SYSTEM import io import zlib from astropy.utils.xml.iterparser import _fast_iterparse # 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...
886a393d95015a64cbf5529ade487319feb4c54e0f31d756828d36e6b81130e5
from astropy.utils.data import get_pkg_data_filename def get_data_filename(): return get_pkg_data_filename("data/foo.txt")
8bd0b0dd174c9b6d9d02325a0554d1af4d8a82eaf65d1e5711b4ac41ce514de0
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.table import QTable, hstack, join, vstack from astropy.utils.compat.optional_deps import HAS_H5PY from astropy.utils.masked import M...
9d33b81c4e2cdad0b8493a201daedd08b87bb74da6e10ad88c116526414adf19
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test numpy functions and ufuncs on Masked arrays and quantities. The tests here are fairly detailed but do not aim for complete coverage. Complete coverage of all numpy functions is done with less detailed tests in test_function_helpers. """ import nu...
67484867e2f1c2771f424ce3324e7d2382788619234053cc788a1d78fdae2408
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test masked class initialization, methods, and operators. Functions, including ufuncs, are tested in test_functions.py """ import operator import numpy as np import pytest from numpy.testing import assert_array_equal from astropy import units as u fr...
317e2473ce31927eb0fdc9c4a67d5f4cf4e35f43d3afe531839a64f083a5621a
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.coordinates import SkyCoord from astropy.coordinates import representation as r from astropy.time import Time from astropy.utils.mas...
6feeed70d1b9fb33f8bd437f3b1c4c097796499d7a1e5c4148c94b9081adbb5f
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test all functions covered by __array_function__. Here, run through all functions, with simple tests just to check the helpers. More complicated tests of functionality, including with subclasses, are done in test_functions. TODO: finish full coverage ...
d3118faae84eea9ee080c92c4249ad253c326eec28fecd627b89e1ed3c5205b9
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os from astropy import log from astropy.io.fits import getdata from astropy.visualization.mpl_normalize import simple_norm __all__ = ["fits2bitmap", "main"] def fits2bitmap( filename, ext=0, out_fn=None, stretch="linear", po...
6543a76914c37e65b3a89bfd96db1056f7b2fee602cf1c33de8bafe47ae8af8a
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Helpers functions for different kinds of WCSAxes instances """ import numpy as np from mpl_toolkits.axes_grid1.anchored_artists import AnchoredEllipse, AnchoredSizeBar import astropy.units as u from astropy.wcs.utils import proj_plane_pixel_scales ...
0ab45f25edf8947c2a681492203f71db04d84fd14027c438f35015c55c5a32df
# Licensed under a 3-clause BSD style license - see LICENSE.rst # Note: This file includes code derived 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 matp...
a316dc354112ac651bf4c558b363a733b8a77c3d3d27e03084ecf1e1ac40c73b
# 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 import rcParams from matplotlib.patches import PathPatch from matplotlib....
cd16f439257dbb42260038c532aa60921f1bebe83a88dfa6ed8d42275db4cd83
# 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...
3831d95563f2f2d4fe9d99a7a72e09f442e2074ef3b88a2c0f99feeb3417a91c
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import defaultdict from functools import partial 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, ...
09c156e7e788ff31ef8832efe4a9e0b7d8aa52d776ae4e917206b0aa8c2d40ce
# 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 astropy imp...
17a2a74878f47d486b0b51e821f00c531604c3acaf0ba90b092f1c4f1bccda64
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import defaultdict import numpy as np from matplotlib import rcParams from matplotlib.text import Text from .frame import RectangularFrame def sort_using(X, Y): return [x for (y, x) in sorted(zip(Y, X))] class TickLabels(Text): ...
11ca2bb0eaea32fa238f658479563e8fb7ef5cc47eea56a0105b96dc3e94adb9
# Functions/classes for WCSAxes related to APE14 WCSes import numpy as np from astropy import units as u from astropy.coordinates import ICRS, BaseCoordinateFrame, SkyCoord from astropy.wcs import WCS from astropy.wcs.utils import local_partial_pixel_derivatives from astropy.wcs.wcsapi import SlicedLowLevelWCS from ...
858dac09b8a37ac74d4415734bfa61094c74b5e4635229e777e7108413fc9a84
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import defaultdict import numpy as np from matplotlib import rcParams from matplotlib.lines import Line2D, Path from matplotlib.transforms import Affine2D class Ticks(Line2D): """ Ticks are derived from Line2D, and note that ti...
a44e252370d7b6b531e7d43607cb761ada5f96fd6ce12e46d6ffa88f88977de3
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings import numpy as np from matplotlib.patches import Polygon from astropy import units as u from astropy.coordinates import SkyCoord from astropy.coordinates.matrix_utilities import rotation_matrix from astropy.coordinates.representation i...
5ffc70d730fc75496de08509b9813b1ebe79d696d5697f4c47113dfb8eb53130
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import OrderedDict from textwrap import indent from .coordinate_helpers import CoordinateHelper from .coordinate_range import find_coordinate_range from .frame import RectangularFrame, RectangularFrame1D class CoordinatesMap: """ ...
33293045c9665329547c5840cbf8909ecaa3d5776b32dcb234519a2c368bd3b4
# 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", "transform_contour_set_inplace", ] def select_step_degre...
7bd5c3b22572114865ab0163a88e975a331483e859f2bbff6d99f69e2315302d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import matplotlib.transforms as mtransforms import numpy as np from matplotlib import rcParams from matplotlib.text import Text from .frame import RectangularFrame class AxisLabels(Text): def __init__(self, frame, minpad=1, *args, **kwargs): ...
50c05d74e38c8611ad3d398ea2ffdb41387fea5ae24cc5f01f6669c38b2cb643
# 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.0 with np.errstate(invalid="ign...
d2184ec8d05c4515446ef9d69a1d02419af71ed58d281fd31f5b9042d49b2864
# Licensed under a 3-clause BSD style license - see LICENSE.rst import abc from collections import OrderedDict import numpy as np from matplotlib import rcParams from matplotlib.lines import Line2D, Path from matplotlib.patches import PathPatch __all__ = [ "RectangularFrame1D", "Spine", "BaseFrame", ...
c11fe6e9a00a639a7829ca22d14c7ac4be7737e8a514fb55cb7606d2b1f84af9
# 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, relative to the scale size ROUND_TRIP_RTOL = 1.0 # Tolerance for discontinuities relative to th...
38fa46d27f53da5d5e8446ddd8a5c9f4b2d334fee7556aa812034d8498421f5d
# Licensed under a 3-clause BSD style license - see LICENSE.rst from numpy.testing import assert_allclose from astropy.utils.compat.optional_deps import HAS_PLT, HAS_SCIPY if HAS_PLT: import matplotlib.pyplot as plt import numpy as np import pytest from astropy.stats import histogram from astropy.visualizatio...
6bda045ebc507635195eecb593b663737fff391a43fff585b95de9e901c7d958
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy.utils import NumpyRNGContext from astropy.visualization.interval import ( AsymmetricPercentileInterval, ManualInterval, MinMaxInterval, PercentileInterval, ZScaleInterval, ) class TestIn...
6888a489cb12d8b9e5f99d39c16784d871ec6b6e0ecdd5f4bc7bc77c1c6e7c85
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_equal from astropy.visualization.stretch import ( AsinhStretch, ContrastBiasStretch, HistEqStretch, InvertedHistEqStretch, InvertedLogStretch, InvertedPowerDistStre...
26672a68b638e9c49a783a8ece920c8e54b844c24d93a973600133b61d2cdec2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io import pytest from astropy.utils.compat.optional_deps import HAS_PLT if HAS_PLT: import matplotlib.pyplot as plt import numpy as np from astropy import units as u from astropy.coordinates import Angle from astropy.visualization.units im...
fdd4fe3353206b8a847501f3e832afa548a110c5a7c30d716aff8813c674b43b
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for RGB Images """ import os import sys import tempfile import numpy as np import pytest from numpy.testing import assert_equal from astropy.convolution import Gaussian2DKernel, convolve from astropy.utils.compat.optional_deps import HAS_MAT...
b6ab9ebf95a3b613acd0879ada5e8b42a876b2be05f68a2ee7619b5d52cf1395
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy import ma from numpy.testing import assert_allclose, assert_equal from packaging.version import Version from astropy.utils.compat.optional_deps import HAS_MATPLOTLIB, HAS_PLT from astropy.visualization.interval...
ea737c446dfab7356a06146219061473d8d039e991661081efac95e3f677b19c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest pytest.importorskip("matplotlib") from contextlib import nullcontext import matplotlib.dates import matplotlib.pyplot as plt from erfa import ErfaWarning from astropy.time import Time from astropy.visualization.time import time_support ...
e5dff3111595192eb15a7e444ca02eda1e6571d6eda1fc23700f85ade58fc0f9
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy.io import fits from astropy.utils.compat.optional_deps import HAS_MATPLOTLIB if HAS_MATPLOTLIB: import matplotlib.image as mpimg from astropy.visualization.scripts.fits2bitmap import fits2bitmap, ma...
8e0bbf5ab82acba814436d4112636886fb224480a363089335516679c082c399
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings import matplotlib import matplotlib.pyplot as plt import numpy as np import pytest from matplotlib.contour import QuadContourSet from packaging.version import Version from astropy import units as u from astropy.coordinates import SkyCoord...
c2a0cc762362d7f3897b8d4855299df99bb75517ca96e74211c9d68d3eaca7f6
# 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.tests.helper import ( assert_quantity_allclose as assert_almost_equal_quantity, ) from astropy.visualization.wcsaxes.utils import ( select_step_degree, ...
00afe13a94db72822b57e6e2583f4e99eb6c4da656fd40626b185a8c008632dc
# Licensed under a 3-clause BSD style license - see LICENSE.rst import matplotlib.pyplot as plt import numpy as np from astropy.tests.figures import figure_test from astropy.visualization.wcsaxes import WCSAxes from astropy.visualization.wcsaxes.frame import BaseFrame from astropy.wcs import WCS from .test_images im...
5a15f1b4c9bc87f122297579b34a7c357b878c1d517467d9a2bbf7103dcf9daf
# Licensed under a 3-clause BSD style license - see LICENSE.rst import matplotlib.pyplot as plt import numpy as np from astropy import units as u from astropy.tests.figures import figure_test from astropy.visualization.wcsaxes import WCSAxes from astropy.visualization.wcsaxes.transforms import CurvedTransform from a...
17b4305211d96e7b2becee265fd3c34d7d5e77c888fba8490c336ea9d3c7d3a8
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from matplotlib import rc_context from numpy.testing import assert_almost_equal from astropy import units as u from astropy.tests.helper import assert_quantity_allclose from astropy.units import UnitsError from astropy.vi...
3db5a938e009bde186d950deadd74f7c82152d9b5ba07eceb7f656473449078f
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings from textwrap import dedent import matplotlib.pyplot as plt import numpy as np import pytest from matplotlib.transforms import Affine2D, IdentityTransform from astropy import units as u from astropy.coordinates import SkyCoord from astro...
86fe3abcd13663b36c31eb01b993b1a560fcd46ae85f6e034fe112303f05829e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import matplotlib.pyplot as plt import numpy as np from matplotlib.backend_bases import KeyEvent import astropy.units as u from astropy.coordinates import FK5, SkyCoord, galactocentric_frame_defaults from astropy.time import Time from astropy.visualizatio...
88ab470783a06c1e6f2c224b5c82040a3d6b3df951489cfbb729b718492362bf
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...
10a96f89397b0da396e11344d19fde44b994b438af5ddc71ea0298a7571043d6
# Licensed under a 3-clause BSD style license - see LICENSE.rst from unittest.mock import patch import matplotlib.pyplot as plt import pytest from astropy import units as u from astropy.io import fits from astropy.utils.data import get_pkg_data_filename from astropy.visualization.wcsaxes.core import WCSAxes from ast...
2fcede79e7a128384c5e5dd6e63382120512b87f62846f250b46452d762829c8
# Licensed under a 3-clause BSD style license - see LICENSE.rst import matplotlib.lines import matplotlib.pyplot as plt import numpy as np import pytest from matplotlib import rc_context from matplotlib.figure import Figure from matplotlib.patches import Circle, Rectangle from astropy import units as u from astropy.co...
09e956d3a90a054ba8721f36fd981cefbc2738f54031c1d821235c4b612961a7
# 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 ( BaseHighLevelWCS, BaseLowLevelWCS, HighLevelWCSWrapper, SlicedLowLevelWCS, ) __all__ = ["NDSlicingMixin"] class ND...
1663bab7cf14eb698630cd30a32a2b709d77fbed205b9f25ebd5ea3ab0baf707
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module implements the Arithmetic mixin to the NDData class. import warnings from copy import deepcopy import numpy as np from astropy.nddata.nduncertainty import NDUncertainty from astropy.units import dimensionless_unscaled from astropy.utils im...
9f0eb944a96d790a6832d7be99a08c23b8f9c7931fc74a876538dc5c4d84c44e
# 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...
2de25808385032793ca8f27275531bc9e0cf9a94a055568d1fb5622f42e46b02
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import textwrap import numpy as np import pytest from astropy import log from astropy import units as u from astropy.io import fits from astropy.nddata import _testing as nd_testing from astropy.nddata.ccddata import CCDData from astropy.nddat...
cadce47cdba7dfa234a8bb71b28834b6edc15065deedd289d80c20a0828a7a5e
# 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): ...
8347990c99f5173ac82449dfa58ee788bf84bed45d2c1fcfe5d64d04194b2b39
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal from packaging.version import Version from astropy import units as u from astropy.coordinates import SkyCoord from astropy.nddata import ( CCDData, Cut...
762cfaa17755c43507e5e2b3cc15a53813c2a54b5fcd5a1f4c2689dbae59bcdc
""" 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....
cc61698a18fee16af2abd21211a8abf7add9769ea701040f6a4335b19c77d7b0
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from astropy.nddata import block_reduce, block_replicate, reshape_as_blocks class TestReshapeAsBlocks: def test_1d(self): data = np.arange(16) reshaped = reshape_as_blocks(data, 2) assert res...
40b8862d769434488841bad80c8071ed7691ac01845bb06999b006a96de77fa2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest 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.valu...
498c17d1035becbb1addd9ce7dbc4155da4e9aaa3c321a00b6f4c2525f8d3682
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pickle import textwrap from collections import OrderedDict import numpy as np import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.nddata import _testing as nd_testing from astropy.nddata.nddata ...
1c3b8f28d178313694e1c690e9d8ad679f9355ca15fae34d4efbc8bcb604652d
# 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 numpy as np import pytest from astropy import units as u from astropy.nddata.compat import NDDataArray from astropy.nddata.nddata import NDData from astropy.nddata.nduncertaint...