hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
8a1286e2ba3c1fc509193948e1e84af8a1e78fa51bb1a83a49f1dc7174cfe5bf | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
import unittest.mock as mk
from astropy.modeling.bounding_box import (_BaseInterval, _Interval, _ignored_interval,
_BoundingDomain, ModelBoundingBox,
... |
9eb0cc5cb549463a6eb57a5a3b6fb63fd9a385ae9667687b100be79bae80e362 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name, pointless-statement
import pickle
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
from astropy.utils import minversion
from astropy.modeling.core import Model, ModelDefiniti... |
a45e80639e00bb568df9341b8f40440d31c79c92f803b0b6e57b39750d19f341 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
import pytest
import numpy as np
from astropy.convolution import convolve_models_fft
from astropy.modeling.models import Const1D, Const2D
try:
import scipy # pylint: disable=W0611 # noqa
except ImportError:
HAS_SCI... |
6e83786f8a372f63514c39f3584863443f8147078d04c4da8a66b1af2bcec128 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from astropy import units as u
from astropy.modeling.core import Model, fix_inputs
from astropy.modeling.models import Polynomial1D
class _ExampleModel(Model):
n_inputs = 1
n_outputs = 1
def __init__(self):
... |
7dbbb893d7cbda1badf5ef9f2c5fb145b41a242692aba97bbe53280342e5b32a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
import os
import sys
import subprocess
import pytest
import unittest.mock as mk
import numpy as np
from inspect import signature
from numpy.testing import assert_allclose, assert_equal
import astropy
from astropy.modeling.c... |
474c3405257c47647e8ad2989c04b42a1a0396444c6ea99f7ca9a005e012acc0 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for spline models and fitters"""
# pylint: disable=invalid-name
from astropy.utils.exceptions import AstropyUserWarning
import pytest
import unittest.mock as mk
import numpy as np
from numpy.testing import assert_allclose
from astropy.utils.co... |
25e72c604c7c28afbb71afd4b5c65f8ab1f762e5f16fc96bab06b56a8cde83db | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Test separability of models.
"""
# pylint: disable=invalid-name
import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.modeling import custom_model, models
from astropy.modeling.models import Mapping
from astropy.mode... |
0375f8bedab67b916b0fac0194ff0b539484e7011462d3da5d2971053bccce8f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests models.parameters
"""
# pylint: disable=invalid-name
import itertools
import functools
import pytest
import numpy as np
import unittest.mock as mk
from astropy.modeling import models, fitting
from astropy.modeling.core import Model, FittableMo... |
9ef195ce05922cf9fa0dd95dc308df91eff9712ac675251fde9e31872c05d826 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for physical functions."""
# pylint: disable=no-member, invalid-name
import pytest
import numpy as np
from astropy.modeling.physical_models import BlackBody, NFW
from astropy.modeling.fitting import LevMarLSQFitter
from astropy.tests.helper impo... |
1b1e9eadd0bf2e8e3f1aed4697463ebf4ae3d142a89417c27ee995f59c80e4f7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
from math import cos, sin
import pytest
import unittest.mock as mk
import numpy as np
from numpy.testing import assert_allclose
import astropy.units as u
from astropy.tests.helper import assert_quantity_allclose
from astr... |
2e5ac5e24a828fb6586088c8afc51dbf1e8f6803f8839dfa547f00b673e2ef87 | # 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... |
2dbb0d55941d8f06647679ccf57096fffdbff93d233e404ad12314f54ddcc55c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
import types
import warnings
import pytest
import numpy as np
from numpy.testing import assert_allclose
from numpy.random import default_rng
from astropy.modeling.core import Fittable1DModel
from astropy.modeling.parameter... |
9798a7b6e3d5468828a6353a6f02267a6f3f7fc713cb6cb917b377b424262e19 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
from astropy.modeling.fitting import LevMarLSQFitter
from astropy.modeling.models import Shift, Rotation2D, Gaussian1D, Identity,... |
9baccb42396f4c7925c29db38799ef84e051aeff597df312dbf62c5d76bd26db | # Various tests of models not related to evaluation, fitting, or parameters
# pylint: disable=invalid-name, no-member
import warnings
import pytest
from astropy import units as u
from astropy.tests.helper import assert_quantity_allclose
from astropy.modeling.models import Mapping, Pix2Sky_TAN, Gaussian1D
from astrop... |
b8e6041495c266b2a1310602178306baf1c747435ecdf4d12c14398c8642cafa | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name, no-member
import pytest
import numpy as np
from astropy import units as u
from astropy.tests.helper import assert_quantity_allclose
from astropy.utils.compat.optional_deps import HAS_SCIPY # noqa
from astropy.modeling.cor... |
3357fb8e43ce751b987e23b80b80c966cce1803739d7eaba1a876edee00f6108 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
dpath = os.path.split(os.path.abspath(__file__))[0]
|
2cd424901c69f6c38a53689e184cca1fd1088d2f9c7c5f7620472608d2559179 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.samp.errors import SAMPHubError, SAMPClientError, SAMPProxyError
# By default, tests should not use the internet.
from astropy.samp import conf
def setup_module(module):
conf.use_internet = False
def test_SAMPHubError():
"""Test ... |
80fefe96c387a22187d99f605372ac0ad1742a85c91b4b8a30a7e6e342a53755 | import ssl
import tempfile
import pytest
from astropy.utils.data import get_pkg_data_filename
from astropy.samp.hub import SAMPHubServer
from astropy.samp.integrated_client import SAMPIntegratedClient
from astropy.samp.errors import SAMPProxyError
# By default, tests should not use the internet.
from astropy.samp i... |
72ce5e2de14d3775b8bb6ca4bbc1991e707e48454a3dcf7f2483b0481a4b52e7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy.samp.hub_proxy import SAMPHubProxy
from astropy.samp.client import SAMPClient
from astropy.samp.integrated_client import SAMPIntegratedClient
from astropy.samp.hub import SAMPHubServer
# By default, tests should not use the in... |
4e64b6bbb8b1ad4b5fa924418a3527786da11197ae741ea7d43ce09609ab7269 | import sys
from astropy.samp.hub_script import hub_script
from astropy.samp import conf
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.sys_argv_orig
... |
b87e5cbee34f8270a5cf05cab4660dc44e82b74a542b20595df2be1f94ed50d9 | from astropy.samp.hub_proxy import SAMPHubProxy
from astropy.samp.hub import SAMPHubServer
from astropy.samp import conf
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... |
308426876df5a16c8324dbd0dcf79d14cffb8b139abc3b4328beffa9abe99f0d | """
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 os
import threading
import tempfile
from urllib.request import Req... |
a1bffc862b5fd18c6a7e4c97a62b131db14a50038bf7459ced43e02fb9ac63e1 | import os
import time
import pickle
import random
import string
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... |
ff435c6d9f55cbbfd6bd2eacf7d06f6e89d13e516ac07d944f4e5c1b5ce5ae8a | import time
import threading
import xmlrpc.client as xmlrpc
from astropy.samp.hub import WebProfileDialog
from astropy.samp.hub_proxy import SAMPHubProxy
from astropy.samp.client import SAMPClient
from astropy.samp.integrated_client import SAMPIntegratedClient
from astropy.samp.utils import ServerProxyPool
from astrop... |
1888a78f9719fb4394cc643a2d41e586c026ae9130ebdcab6b660bbd3797a4e7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import time
from astropy.samp.hub import SAMPHubServer
from astropy.samp import conf
def setup_module(module):
conf.use_internet = False
def test_SAMPHubServer():
"""Test that SAMPHub can be instantiated"""
SAMPHubServer(web_profile=Fals... |
6c92009ce72a60330bb8291233e1436b7674ef48cb992f6f54ae36520f736e58 |
from .iers import *
|
ffb1e4f6ad7a546bbc0a38c3b84d1fda32be1a45b81b34c22836c9bb1a91e9a1 | # 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`... |
ce96447faa44ea2c193a9761b5d7f2768b6f5b8b5c9b7e5e6286338a2c5be53d | # 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-... |
03573e228055f873656d6754c8510ae63314dc79a633073ef073289104b5efc3 | # 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'&': b'&', b'<': b'<', b'>': b'>',
b'&&': b'&', b'&&': b'&', b'%2F': b'/'}
_bytes_key... |
e06bf12a6b9bbd578d1bab08bf7b790a313cff8c7d09fe368c05fa861f17c344 | # 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 &,... |
61d92c23d6be5d110a8fe3ce9f7ebe42cbecdffa94771167ea7147e58856cf46 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
from collections import defaultdict
from setuptools import Extension
from os.path import join
import sys
from extension_helpers import pkg_config
def get_extensions(build_type='release'):
XML_DIR = 'astropy/utils/xml/src'
cfg = defa... |
bd6948951f8881061c7c2eaff18500ae669ab75f904a5ea36c3b9df7540b14c3 | # 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... |
680154076c904a77f9c7ef007fbe9e5d1b6dc3d9401a56f82583818f1eff1b43 | # 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... |
34add0ce9d5bc25fed19110d21a7cde794876954ccac49de5434f180e304d3f4 | # 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 pytest
import numpy as np
from astropy.utils import data, misc
from astropy.io import fits
def test_isiterable():
assert misc.isiterable(2) is False
a... |
a0b40b1869f3167b7784b01c17a759f5dad213295d8395ba4932c553f10377a7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import pytest
from astropy.utils.xml import check, unescaper, writer
from astropy.utils.compat.optional_deps import HAS_BLEACH # noqa
def test_writer():
fh = io.StringIO()
w = writer.XMLWriter(fh)
with w.tag("html"):
wit... |
56ab50b6f7d2481008ace78ace04fae903c81dbca1e175ce0980c4de2fddfb96 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
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)
... |
913b7e0cd5ddcaead3857e1bd644a4e890821c01b4655e0c828042df0a277ce5 | # 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.utils.diff import diff_values, report_diff_values, where_not_allclose
from astropy.table import Table
@pytest.mark.par... |
0b4055fdc697472300dfbc5b499c80481cfe2f9bcc5abd5b5f57e1e1e84003c7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import importlib
import secrets
import sys
from textwrap import dedent
import pytest
from astropy.utils.parsing import lex, yacc, _TAB_HEADER
def _docstring_canary():
"""Docstring that's here just to check for -OO."""
@pytest.mark.skipif(not _do... |
6bdce693da7f2c154629460ea0d26a9a3515835a12e7274ba1b689cbcebe3cd6 | 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... |
130771987f91bfd8f218d13615c5d55f3527d9d45b4001dbe0d1bc6dfaea1b73 | # -*- 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
from astropy.table import QTable
from astropy.table.index import SlicedIndex
from astropy.time import Time
from astropy.coordinates import SkyC... |
2740a9359abd23c2ecbfeb631855043c80fc58b2567d30b0e2faba2f475c002b | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import os
import sys
import stat
import errno
import base64
import random
import shutil
import hashlib
import pathlib
import platform
import tempfile
import warnings
import itertools
import contextlib
import urllib.error
... |
e4f8ad19cc1d07889c34ff65b4d8f57e046e341b2228f90485774e282d491983 | # 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... |
5dde31cbf26bcbf8a6a5d22fea44c44b944859c1394e535b4da8d352b3ac130e | # 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_curre... |
568db9b97bb72b2ab069e7595998649c969d7f22cf436e798fb8601e91de8101 | # 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)
... |
ca1c8fedd548f53bf208029e3629846278185aa635b3c3ac350697f613350a10 | # 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 (deprecated_attribute, deprecated,
sharedmethod, classproperty, lazyproperty,
... |
2679be7acfd93ae01b6b79d250ee068fd0d08ebc7da63f8460c9f612af3da654 | # 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... |
49d3d96927ec9765caa5979ab84be00c2c739f39d313ccacb941453a6794e154 | 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
test runner interacts strangely with Python's `multi... |
cdd89a126890daf75868162943e11ee325bd69cd3cd25b3906c4288ceca0f467 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.utils.state import ScienceState
def test_ScienceState_and_Context():
"""
Tests a ScienceState and spawned contexts.
"""
class MyState(ScienceState):
_value = "A"
_state = dict(foo="bar")
state = {"foo":... |
657aa82dd82768dc61b0076f88168026aa285cf340c49eec13d12fb8bd30f9da | # -*- coding: utf-8 -*-
# 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 ... |
1afc7f56ae4363fe4bc06ba800e7abbe1c6ffeab8b85470a900ba5a9f1e30c95 | # 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 `... |
e451a8659d394ba4702091ac5b23077dbc8df6108b27c32bfd46748bf0fa6259 | # 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`.... |
876df8bbee2363eff5db82838215db7f20cc37b0cb82cf8add3af19ed71f152a | # 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... |
2092252ef5001400a2fc6fb990b97bd25ccba401cb8fc853d730780d3c81cf05 | # 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 ... |
b68f2dfb868108d624ce0d3e415b72cf1e7e25ce6d49f66fc7e6b9210daee145 | # 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_19', 'NUMPY_LT_1_20', 'NUMPY_LT_1_21_1',
'NUMPY_LT_1_22', 'NUM... |
466589b41aae7bc6b94550bbf9b075b7e8965d8b4aecf92133bb78a9473610b7 | # 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.
... |
347ea97b9e61f3d3d3eb90e15b845ef5978997329c1f7e48687d2150b1a1f8e0 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import urllib.request
import os
import locale
import platform
import pytest
import numpy as np
from numpy.testing import assert_array_equal
import erfa
from astropy.time import Time, TimeDelta
from astropy.utils.iers import iers
from astropy.utils.data i... |
4df3c29ee49fad367953d9627b0e1ac1883f29b6610b4f0eb96f27d1329ded29 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import warnings
from pathlib import Path
import pytest
import numpy as np
from astropy.tests.helper import assert_quantity_allclose
from astropy.utils.data import get_pkg_data_filename
from astropy.utils.iers import iers
from astropy import un... |
f359458eb1276054b7ff9688522e13e721f08790f0137c318d44c56eb87f264e | # 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... |
04fe07719ea5661e9f2246374f6ebb7caaa176a6ddf6a5e381c0ea7bc3abb0d2 | from astropy.utils.data import get_pkg_data_filename
def get_data_filename():
return get_pkg_data_filename('data/foo.txt')
|
5b41a12ce9df8e8adb1bbc5ee36a224f1f4dc0447286953b0874a134226a2965 | # coding: utf-8
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from astropy import units as u
from astropy.table import QTable, hstack, vstack, join
from astropy.utils.masked import Masked
from astropy.utils.compat.optiona... |
5a4182ad29daf3349750eb10e32941282a36ddda99eb0ced980ac24c8d91bcd5 | # 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 py... |
f1f81bca223387ea5c55c64831bb4ad2ef25445e75cd24dfbc958a779882cbf1 | # 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
from numpy.testing import assert_array_equal
import pytest
from astropy import units as u
fr... |
6ca4e21f5d0c2c6787d2550b512651b828293cebf2e284b3ea4079c4c1df2f87 | # coding: utf-8
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from astropy import units as u
from astropy.coordinates import SkyCoord, representation as r
from astropy.time import Time
from astropy.utils.masked import Mas... |
9525988e7c2c352395c1f7ad5952c3df60b9e36b8294c1bf018b9d6537463d5d | # 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 ... |
6da6d12129c801fcc7a3b5aa2d8176a86092687d1bb4cf1ddf3b601da2b7480d | # -----------------------------------------------------------------------------
# ply: lex.py
#
# Copyright (C) 2001-2018
# 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... |
293835dd1e5229e89cc199bb6c83cbe3829c40145c1ec99e1063b020156f2e4a | # -----------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------... |
4d19e4660c79041078dd0b29bb6278815b69781badf31ad3119a0b6cd3746fa3 | # ply: ygen.py
#
# This is a support program that auto-generates different versions of the YACC parsing
# function with different features removed for the purposes of performance.
#
# Users should edit the method LRParser.parsedebug() in yacc.py. The source code
# for that method is then used to create the other meth... |
b31ea204817ffd6288794d22c36592a12a8185c947179121053734c038a04d5f | # PLY package
# Author: David Beazley (dave@dabeaz.com)
__version__ = '3.11'
__all__ = ['lex','yacc']
|
105d38deb207ad72581ba8dc6f5e5323648bc1d0a834e4195c237fd4cdfe2389 | # -----------------------------------------------------------------------------
# ply: yacc.py
#
# Copyright (C) 2001-2018
# 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... |
1a6c9660363d9e5e85d56250f6b99c405821d459c00c5967a7f4c18d3704b2a5 | # ----------------------------------------------------------------------
# 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... |
4bbdbdd7076f82c3643fc46d5f659713949679b03f4333062e7a0947dac4a094 | # 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
#... |
6e740932be51b61a6532c1c23699848d3b8a23a22007317b90870d786b92c5c2 | # validate.py
# A Validator object
# Copyright (C) 2005-2014:
# (name) : (email)
# Michael Foord: fuzzyman AT voidspace DOT org DOT uk
# Mark Andrews: mark AT la-la DOT com
# Nicola Larosa: nico AT tekNico DOT net
# Rob Dennis: rdennis AT gmail DOT com
# Eli Courtwright: eli AT courtwright DOT org
# This software is l... |
ca4a951e07b61262034cc39df7a8760f218768cfe0a69ff02b3dcad4c9596627 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
|
1c13c50b6d0ba3a8d52d914cde165f0ef8d0478fab99f9457b6a09836461869e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
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',
power=1.0, asinh_a=0.1, min_cut=None, max_... |
dfa2d97a2d8636ab4f647c32ae76c4298f27527e918902bd4c62e18e6aaaa600 | # 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 mat... |
ba0f50b3509ec23a13f1785e62edd84533c46e37d894f6b45a8e7a7b653cd829 | # 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, Scal... |
1b60d38f4e5ef97935d24efee0f33ec9b3c41dbef1ae2386215a472927c50869 | # 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... |
3e89d3446bfc67e8d8db7b867587d1466869c794fbe7b789ac5a54383c21bd79 | # 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,... |
f505a77e9853d664495e26acf71fcb111b5f32f48d7a5f72c26a40cd20599ff6 | # 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... |
bf648f33c8c90e2afc3585194c14667ffc1cd04ba9e9913f493ac8bbc1be2350 | # 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... |
4c99881e82a13c200179c349f8b5d4c81162f5e1c494d87446b9be42605c389b | # Functions/classes for WCSAxes related to APE14 WCSes
import numpy as np
from astropy.coordinates import SkyCoord, ICRS, BaseCoordinateFrame
from astropy import units as u
from astropy.wcs import WCS
from astropy.wcs.utils import local_partial_pixel_derivatives
from astropy.wcs.wcsapi import SlicedLowLevelWCS
from ... |
bfa24e119b1e6423c2dedbef759b4fc64aeb74efe6bbb3a83fba481b0ea6dc78 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from collections import defaultdict
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 t... |
5b5ef628457632729948630d8e99ef3ddfdfbf0b9f6c7f52fbc6fe39be4587c3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import warnings
from matplotlib.patches import Polygon
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.coordinates.representation import UnitSphericalRepresentation, SphericalRepresentation
from as... |
379c2fa627a75eaff9fc056a5b7059a438867a59a664d6b9251403972e02637d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from textwrap import indent
from collections import OrderedDict
from .coordinate_helpers import CoordinateHelper
from .frame import RectangularFrame, RectangularFrame1D
from .coordinate_range import find_coordinate_range
class CoordinatesMap:
"""
... |
14f3ef92412fe75f6133369f822f80abd6eed6466d8ab4c70f014bba4451ed10 | # 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_degree(dv):
... |
c1fe7e28d4c63558c1fbc1196f3078f89ef08bf8b928848e7e22f86cb24d14c9 | # 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):
... |
6cece3229ad7b9a5274ce33bd2d0395adcd5cc2be42a82050dfb10418df305eb | # 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... |
134b3b37f3e4b53dc999ddf61bd9ddd37dc52529a50daa93edefa41ba7a3bf34 | # 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', 'RectangularFr... |
8d37080a565618acbfcf75aecb3c2e0956c6781bf2244ca3a8495b23204b7237 | # 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.
# Tolerance for discontinuities relative to th... |
33a78136d0a1102b578fcbb247c89684adbd05ab4f315f237979aed7bf72b1e9 | # 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 pytest
import numpy as np
from astropy.visualization import hist
from astropy.stats impo... |
446884651dd8b1f446274d165cb929c6da350a6f590d319b1cb26107bd1ca591 | # 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,
PercentileInter... |
3353ddeb85cd530372668bda77af449137fcd765dff6415daa1e5ef2fe003e35 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_equal
from astropy.visualization.stretch import (LinearStretch, SqrtStretch,
PowerStretch, PowerDistStretch,
... |
1cf3ede9372e751357828de1e16b572bd85cad1b57dfa36592824a97b15a3d35 | # -*- coding: utf-8 -*-
# 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.... |
a82e3b1edddb65412a22dad90eb888845b5fdb40c469ea58fdecbb87c7678a54 | # 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
from astr... |
1bb0af079c96d01d1115dfecea0040c8a3f87275ea146d4f152a9c78b4d5c0d9 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from packaging.version import Version
import pytest
import numpy as np
from numpy import ma
from numpy.testing import assert_allclose, assert_equal
from astropy.utils.exceptions import AstropyDeprecationWarning
from astropy.visualization.mpl_normalize im... |
5fb45ab0ea8ebae69105ed0b52dd68934e369b518b9dd50fab491344fa439574 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
pytest.importorskip('matplotlib') # noqa
import matplotlib.pyplot as plt
import matplotlib.dates
from contextlib import nullcontext
from erfa import ErfaWarning
from astropy.time import Time
from astropy.visualiza... |
97361e62c936657cf0b42f4bfc0832d20b123accb7c3f95e48a829afd071bbe3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
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... |
f025a90688c00d544695061dc8eb65bd293aa92ad3a4eeaf98aa171aaa5d6f74 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
from packaging.version import Version
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 WCS
from astropy... |
dbbda9af028d182c9684f8e4d89e4fe4d879ea30c54677a1c0d4ef43da315cd2 | # 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
from astropy.tests.helper import (assert_quantity_allclose as
... |
14057f6030aa7a587109fa2927816141a258e7b237da4e23824a761e32eb5ffd | # 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.org/project/pytest-mpl
#
# For more information on writing image tests, see the 'Image tests with
# pytest-mpl' section of the developer docs.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.