hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
0879c936f4d2f5a563557bb46e7f858a243e28d3eed878f87b39a677365116fd | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import numpy as np
from numpy.testing import assert_array_equal
from asdf import yamlutil
from astropy import table
from astropy.io import fits
from ...types import AstropyAsdfType
class FitsType(AstropyAsdfType):
name = 'f... |
967e3aedc0b4ef8286f13233c2b02d21502c66f3bc999e16cf85b573c1ee9daf | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from asdf import tagged, yamlutil
from astropy.modeling import mappings
from astropy.utils import minversion
from astropy.modeling import functional_models
from ...types import AstropyAsdfType
__all__ = ['TransformType', 'Identi... |
26ab077fc39b38d1b9a18e66faac498da206e5fc25b4e70b3423fa10c5c6fdef | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from numpy.testing import assert_array_equal
from asdf import yamlutil
from astropy import modeling
from .basic import TransformType
__all__ = ['AffineType', 'Rotate2DType', 'Rotate3DType']
class AffineType(TransformType):
... |
0685aefea131c460b29a408bc32851eac8403e3aa85c6b7a99df09fd52d49e44 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import numpy as np
from numpy.testing import assert_array_equal
from asdf import yamlutil
from astropy import modeling
from .basic import TransformType
__all__ = ['ShiftType', 'ScaleType', 'PolynomialType']
class ShiftType(Tr... |
d0e8b30edea3cb4f760d327f84e6ed8ea58c10d521488dabfb55c14b324cbdce | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import numpy as np
from numpy.testing import assert_array_equal
from asdf import yamlutil
from astropy import modeling
from .basic import TransformType
__all__ = ['TabularType']
class TabularType(TransformType):
name = "t... |
ec467a52b98d8f82248514a41f0216c92a43e28c966a4d9bfd68d7912bec8c11 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from asdf import tagged, yamlutil
from asdf.tests.helpers import assert_tree_match
from astropy import modeling
from astropy.modeling.models import Identity, Mapping
from .basic import TransformType, ConstantType
__all__ = ['Com... |
dedd7c7e695bd28f17af07804e165779932b23cbb78a6a46fe813e060b50f86b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import numpy as np
from numpy.testing import assert_array_equal
from asdf import yamlutil
from asdf.versioning import AsdfSpec
from astropy import time
from astropy import units as u
from astropy.units import Quantity
from astrop... |
725c00785debe4afaea2993e0fed55dd70564dd0b9188201ba330591d32fab1f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from asdf.yamlutil import custom_tree_to_tagged_tree
from astropy.units import Quantity
from astropy.coordinates import ICRS, Longitude, Latitude, Angle
from astropy.tests.helper import assert_quantity_allclose
from ...types impo... |
6e744e7db677958b276090004c80e3ef8662501aca366f04ee4ba91714eb9d39 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import six
from astropy.units import Unit, UnitBase
from ...types import AstropyAsdfType
class UnitType(AstropyAsdfType):
name = 'unit/unit'
types = ['astropy.units.UnitBase']
requires = ['astropy']
@classmethod... |
aec73618735b6d87ea4d933d9ec4276c54a7c1d433d43c86af1da3af9aaf3ea2 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from numpy import isscalar
from astropy.units import Quantity
from asdf.yamlutil import custom_tree_to_tagged_tree
from asdf.tags.core import NDArrayType
from ...types import AstropyAsdfType
from .unit import UnitType
class Qua... |
7c101e32c6c2ae927b3e07cefc6c257bca273b35a0e4303a42a2279372f542e7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
import numpy as np
from astropy import table
asdf = pytest.importorskip('asdf')
from asdf.tests import helpers
def test_table(tmpdir):
data_rows = [(1, 2.0, 'x'),
(4, 5.0, 'y'),
... |
61df4ba1ddac29cafb265270a2a82b216c69981a12c830307f49c4a5f1cf87fb | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import os
import pytest
import numpy as np
from astropy.io import fits
asdf = pytest.importorskip('asdf')
from asdf.tests import helpers
def test_complex_structure(tmpdir):
with fits.open(os.path.join(
os.path.... |
16f9cbceb2d723550fd190bca0e54df04c71c0f827501ff362b98a185a4baccd | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
import numpy as np
asdf = pytest.importorskip('asdf')
from asdf import util
from asdf.tests import helpers
from astropy.modeling import models as astmodels
test_models = [
astmodels.Identity(2), astmodels.Polyn... |
e7bc62a8ee47cfee2ee0b0897036ee6c90adbc81df3710134423282278f1faeb | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import datetime
from collections import OrderedDict
import pytest
import numpy as np
from astropy import time
asdf = pytest.importorskip('asdf')
from asdf import AsdfFile, yamlutil, tagged
from asdf.tests import helpers
import ... |
de53b29a0d286e64a8c04a9ee528395821e0b131e533ca77380550c262ddc303 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
asdf = pytest.importorskip('asdf')
from asdf.tests.helpers import assert_roundtrip_tree
from astropy import units
from astropy.coordinates import ICRS, Longitude, Latitude, Angle
from ....extension import AstropyEx... |
e209b056b99dc99505100bc05c4d0c72c42d17451e939737aec0d7bfa3878225 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import io
import pytest
from astropy import units as u
asdf = pytest.importorskip('asdf')
from asdf.tests import helpers
# TODO: Implement defunit
def test_unit():
yaml = """
unit: !unit/unit-1.0.0 "2.1798721 10-18kg m2 s... |
f4773a25ec66531ae5c5b8eae807c9ba4dfbc3f1b77e4ae18f7cac7fd72218de | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import io
import pytest
from astropy import units
asdf = pytest.importorskip('asdf')
from asdf.tests import helpers
def roundtrip_quantity(yaml, quantity):
buff = helpers.yaml_to_asdf(yaml)
with asdf.AsdfFile.open(buff)... |
233187cc80159984b7bcbac77019720b0699f016eca0c5ceb4fb5d9220411e6a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# LOCAL
from ....tests.helper import catch_warnings
from .. import converters
from .. import exceptions
from .. import tree
def test_reraise():
def fail():
raise RuntimeError("This failed")
try:
try:
fail()
... |
64ad329f4909ad55213f87c7226eb50051e179cb946079c0f1c0d30939024b7b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
A set of tests for the util.py module
"""
# LOCAL
from .. import util
from ....tests.helper import raises
def test_range_list():
assert util.coerce_range_list_param((5,)) == ("5.0", 1)
def test_range_list2():
assert util.coerce_range_list... |
3f5cd5ae585b2f68a617ebe9899458972ad4b8f0d1d9f4e9488f032340b4313d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# LOCAL
from .. import parse
from ....utils.data import get_pkg_data_filename
def test_resource_groups():
# Read the VOTABLE
votable = parse(get_pkg_data_filename('data/resource_groups.xml'))
resource = votable.resources[0]
groups = reso... |
da49133324058d1f2d6e537a179b25af95954936336ffd312bb2d6c783e49b67 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is a set of regression tests for vo.
"""
# STDLIB
import difflib
import io
import pathlib
import sys
import gzip
# THIRD-PARTY
import pytest
import numpy as np
from numpy.testing import assert_array_equal
# LOCAL
from... |
e1655b596e48ae5db7c83ddca5c8edbce35a27583806a938ae9315eea91841de | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from ....tests.helper import raises
# LOCAL
from .. import ucd
def test_none():
assert ucd.check_ucd(None)
examples = {
'phys.temperature':
[('ivoa', 'phys.temperature')],
'pos.eq.ra;meta.main':
[('ivoa', 'pos.eq.ra'), ... |
9d7e5969aeb091104adf2ce335d8dd3a01515101752d5666493a5deefd53232a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Test the conversion to/from astropy.table
"""
import io
import os
import pathlib
import numpy as np
from ....utils.data import get_pkg_data_filename, get_pkg_data_fileobj
from ..table import parse, writeto
from .. import tree
def test_table(tmpdi... |
acedeaf6a6ffa484ac299efd1ab8e1d90917cbc795ec56091d2cd5dbadfd8ab1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# LOCAL
from .. import exceptions
from .. import tree
from ....tests.helper import raises
@raises(exceptions.W07)
def test_check_astroyear_fail():
config = {'pedantic': True}
field = tree.Field(None, name='astroyear')
tree.check_astroyear('X2... |
bcd937c78c333b9a8820d7564f4fd69b899243ef87ff6710e013bc0d530ca66d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
# THIRD-PARTY
import numpy as np
from numpy.testing import assert_array_equal
# LOCAL
from .. import converters
from .. import exceptions
from .. import tree
from ..table import parse_single_table
from ....tests.helper import raises, catch_... |
86391efb1dae36e6673d96b2c8695aa5d4e74a06e79fed1feafae94b95d39de1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Contains a class to handle a validation result for a single VOTable
file.
"""
# STDLIB
from xml.parsers.expat import ExpatError
import hashlib
import os
import shutil
import socket
import subprocess
import warnings
import pickle
import urllib.request... |
b057d2b84d531d713b1fd6f884edb4b8a1034818c62d7e9f930cbf7d406e0b80 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Validates a large collection of web-accessible VOTable files,
and generates a report as a directory tree of HTML files.
"""
# STDLIB
import os
# LOCAL
from ....utils.data import get_pkg_data_filename
from . import html
from . import result
__all__ ... |
6bdad2594491985985084b21ecc53f100557b6f8826708dd0b680451979530fd | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import contextlib
from math import ceil
import os
import re
# ASTROPY
from ....utils.xml.writer import XMLWriter, xml_escape
from .... import online_docs_root
# VO
from .. import exceptions
html_header = """<?xml version="1.0" encoding="UTF-8"... |
f4d9671c6301fbc26800294054198b484dfda28fa542555e121739f6f1aced67 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains pytest plugins that are used by the astropy test suite.
"""
|
cde2f5498d48582146073c93060bdcc878d3ad77a0d154209dfa599c81e568d3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This plugin provides customization of configuration and cache directories used
by pytest.
"""
import datetime
import locale
import os
import sys
from collections import OrderedDict
import pytest
from ...config.paths import set_temp_config, set_temp_c... |
423890efaac9c12dcc44e8e2d0a2dcc63b59ead4135ecfbe83fabffea11de428 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This plugin provides customization of the header displayed by pytest for
reporting purposes.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import sys
import datetime
import l... |
89fae93a671909cf71e77e5bd052aa0de122475774326e510470ff05bfd774b1 | from ... import units as u
from ..helper import assert_quantity_allclose, pytest
def test_assert_quantity_allclose():
assert_quantity_allclose([1, 2], [1, 2])
assert_quantity_allclose([1, 2] * u.m, [100, 200] * u.cm)
assert_quantity_allclose([1, 2] * u.m, [101, 201] * u.cm, atol=2 * u.cm)
with py... |
cc8f2b2c9c393c9ce6ec9146fbe3f9eafd45c6f31d67ccc70367380be034fee6 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import doctest
from textwrap import dedent
import pytest
# test helper.run_tests function
from ... import test as run_tests
from .. import helper
# run_tests should raise ValueError when asked to run on a module it can't f... |
6ccf501eb4148d93f55c05cbec13b721e86245ba0f75f74cbd82a8125d430021 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pkgutil
import os
import types
def test_imports():
"""
This just imports all modules in astropy, making sure they don't have any
dependencies that sneak through
"""
from ...utils import find_current_module
pkgornm = find... |
54bd3dc46ae37bd4ccfa81cfd8261498292cd73cef99f761a2b24764d6c65d28 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from ... import constants as const
from ...tests.helper import pickle_protocol, check_pickling_recovery # noqa
originals = [const.Constant('h_fake', 'Not Planck',
0.0, 'J s', 0.0, 'fakeref',
... |
2baa144cf4c3490761077bd2427e729472587913faabc083c74fa6076c49f1f2 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import pytest
from .. import Constant
from ...units import Quantity as Q
def test_c():
from ..codata2010 import c
# c is an exactly defined constant, so it shouldn't be changing
assert c.value == 2.99792458e8 # default is S.... |
086baa3ed5ce3f1f1598b4d8adc9ae43d5b62bc25973fe299afe2e3f5238af22 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import pytest
from .. import Constant
from ...units import Quantity as Q
def test_c():
from .. import c
# c is an exactly defined constant, so it shouldn't be changing
assert c.value == 2.99792458e8 # default is S.I.
a... |
a39e1a49a1ce802bde50cf9da056b12f6eebbd63f307bfffd40e18a378eb5a37 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from ...tests.helper import pickle_protocol, check_pickling_recovery
from ... import cosmology as cosm
originals = [cosm.FLRW]
xfails = [False]
@pytest.mark.parametrize(("original", "xfail"),
zip(originals, xfail... |
13cd7cf8eb83aac53a280ed4facc4094724468b99bf7a9836ad34d8c923a553c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from io import StringIO
import pytest
import numpy as np
from .. import core, funcs
from ...tests.helper import quantity_allclose as allclose
from ...utils.compat import NUMPY_LT_1_14
from ... import units as u
try:
import scipy # pylint: disable=... |
ea613b38b76cd957ab95f3cf0577c910ebc954ce650cced8c77b68b81de175d5 | # Load the WCS information from a fits header, and use it
# to convert pixel coordinates to world coordinates.
import numpy as np
from astropy import wcs
from astropy.io import fits
import sys
def load_wcs_from_file(filename):
# Load the FITS hdulist using astropy.io.fits
hdulist = fits.open(filename)
# ... |
5caa8a62e3f3333c666adac05d0abd668d7da339185cc6bfff37abbad0fac9e0 | # Set the WCS information manually by setting properties of the WCS
# object.
import numpy as np
from astropy import wcs
from astropy.io import fits
# Create a new WCS object. The number of axes must be set
# from the start
w = wcs.WCS(naxis=2)
# Set up an "Airy's zenithal" projection
# Vector properties may be set... |
3b967ebccb06a8e046c0c8fbe2ae4db9386d7fc40d5076154805d1616ed13651 | #!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
# This is the same check as astropy/__init__.py but this one has to
# happen before importing ah_bootstrap
__minimum_python_version__ = '3.5'
if sys.version_info < tuple((int(val) for val in __minimum_python_version__.spl... |
8cb9941f0eeb9b24157afb62bff779eb74915ac55918110c19574ee200fe1335 | """
This bootstrap module contains code for ensuring that the astropy_helpers
package will be importable by the time the setup.py script runs. It also
includes some workarounds to ensure that a recent-enough version of setuptools
is being used for the installation.
This module should be the first thing imported in th... |
692fc16e7d309ca57d6e2d47aa234c0f9047b379386a7e6970345a4e518c40a0 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Astropy is a package intended to contain core functionality and some
common tools needed for performing astronomy and astrophysics research with
Python. It also provides an index for other astronomy packages and tools for
managing them.
"""
import sy... |
be25ddfa509d2650c90158e1034f7d0236e6fc8dff0a5298a1e34cb75bde4936 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file contains pytest configuration settings that are astropy-specific
(i.e. those that would not necessarily be shared by affiliated packages
making use of astropy's test runner).
"""
from importlib.util import find_spec
from astropy.tests.plugi... |
553699d484faa9d99797883d6a8f109d4a5ad69e5a484eaab565d62f0d058dc7 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this file.
#
# All configurati... |
226f32952ebef13b9fa1f9a87966cb63a48116fdee16e5a6d0f7f9f2bc0a0e9a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import warnings
from ..utils.exceptions import AstropyUserWarning
from ..utils import isiterable
__all__ = ['SigmaClip', 'sigma_clip', 'sigma_clipped_stats']
class SigmaClip:
"""
Class to perform sigma clipping.
The dat... |
225bec0376e85d5397857f1efa778a30fa8fc1bf127dbd3f44b6fc67d48b6ff4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Methods for selecting the bin width of histograms
Ported from the astroML project: http://astroML.org/
"""
import numpy as np
from . import bayesian_blocks
__all__ = ['histogram', 'scott_bin_width', 'freedman_bin_width',
'knuth_bin_width... |
c713820ba9583c904719ad9304a90d35a319d421693556ac89ec4fdf5af49e1f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
from functools import partial
from .core import Kernel, Kernel1D, Kernel2D, MAX_NORMALIZATION
from ..utils.exceptions import AstropyUserWarning
from ..utils.console import human_file_size
from ..utils.decorators impor... |
74d4ad95e83d6cc46dd86d416934e3db66196942ad62b9302f2764410e5e02d2 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module implements classes (called Fitters) which combine optimization
algorithms (typically from `scipy.optimize`) with statistic functions to perform
fitting. Fitters are implemented as callable classes. In addition to the data
to fit, the ``__c... |
61937d37f580fb2fe88ba082253e21f8615e9f54b83fa9aceabd047b47a93773 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module defines two classes that deal with parameters.
It is unlikely users will need to work with these classes directly, unless they
define their own models.
"""
import functools
import numbers
import types
import operator
import numpy as np... |
1628b53a239aa5b795583902d2f2a4a3829cb50e0fc7b4ca32e50edd58b7e705 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module defines base classes for all models. The base class of all
models is `~astropy.modeling.Model`. `~astropy.modeling.FittableModel` is
the base class for all fittable models. Fittable models can be linear or
nonlinear in a regression analys... |
06be30a2d143e4a7c2f2a06bbafa4540044ae6b5fa0b9f08a160e4ef8401d451 | """
Special models useful for complex compound models where control is needed over
which outputs from a source model are mapped to which inputs of a target model.
"""
from .core import FittableModel
__all__ = ['Mapping', 'Identity']
class Mapping(FittableModel):
"""
Allows inputs to be reordered, duplicate... |
7cfbe827c32cfc9cb942362b2defe9cfeb024db9ff764cfb593bd617c210acb7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Model and functions related to blackbody radiation.
.. _blackbody-planck-law:
Blackbody Radiation
-------------------
Blackbody flux is calculated with Planck law
(:ref:`Rybicki & Lightman 1979 <ref-rybicki1979>`):
.. math::
B_{\\lambda}(T) = ... |
93b4586df2452d12031cbfb5d4aecbe2e37e6d5e0c7ecbe522ecc08d247596bd | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Implements rotations, including spherical rotations as defined in WCS Paper II
[1]_
`RotateNative2Celestial` and `RotateCelestial2Native` follow the convention in
WCS Paper II to rotate to/from a native sphere and the celestial sphere.
The implement... |
dd29687979ebd4be5f0fabd789cc8869bdff040218caf737a120f039166003f2 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides utility functions for the models package
"""
from collections import deque, MutableMapping
from inspect import signature
import numpy as np
from ..utils import isiterable, check_broadcast
from ..utils.compat import NUMPY_LT_1... |
715f5d445c55e6b90fa4a37db23c1bde9476283b99669c986e6a43a02a5bdf46 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Mathematical models."""
from collections import OrderedDict
import numpy as np
from .core import (Fittable1DModel, Fittable2DModel,
ModelDefinitionError)
from .parameters import Parameter, InputParameterError
from .utils import e... |
0be7bb717009d21d028ee1183c22b990b07a37a3c6841366af988f4e937e0056 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
Implements projections--particularly sky projections defined in WCS Paper II
[1]_.
All angles are set and and displayed in degrees but internally computations are
performed in radians. All functions expect inputs and outputs d... |
8eeb50b87e289bb27f4a348c410d5cd4d8168dc0868c131dc3f607939a85fde3 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
A "grab bag" of relatively small general-purpose utilities that don't have
a clear module/package to live in.
"""
import abc
import contextlib
import difflib
import inspect
import json
import os
import signal
import sys
import t... |
c9748a9148b2f86e87abb7ea5d90699c26e7584d239ebd212ddf09ae6825d2e5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from .. import units as u
from .wcs import WCS, WCSSUB_CELESTIAL
__doctest_skip__ = ['wcs_to_celestial_frame', 'celestial_frame_to_wcs']
__all__ = ['add_stokes_axis_to_wcs', 'celestial_frame_to_wcs',
'wcs_to_celestial_fra... |
519b2904ed129ea8ba591a3033ce1d25528e6d13445612b19e88ec2dfb50f368 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# The idea for this module (but no code) was borrowed from the
# quantities (http://pythonhosted.org/quantities/) package.
"""Helper functions for Quantity.
In particular, this implements the logic that determines scaling and resul... |
6b6e47f961662e92e226a33b6a7a2bfa15ee0aecb62542d7d41b12f3ff55210e | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file was automatically generated from ply. To re-generate this file,
# remove it from this folder, then build astropy and run the tests in-place:
#
# python setup.py build_ext --inplace
# pytest astropy/coordinates
#
# Y... |
521519c46e12616d3f49733bdd236abad46e2b429c709b5252584ea00e005c7b | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This module includes files automatically generated from ply (these end in
# _lextab.py and _parsetab.py). To generate these files, remove them from this
# folder, then build astropy and run the tests in-place:
#
# python setup.... |
6555ed7218ac9cc1f02765bebd08b2bd859e9a8e7683a490d583a0fbe2ceb6aa | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains a general framework for defining graphs of transformations
between coordinates, suitable for either spatial coordinates or more generalized
coordinate systems.
The fundamental idea is that each class is a node in the transformati... |
71b4883638abe8a83789b6258a083f84b18f20dc1a8dba04f4363068c914cfb9 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Framework and base classes for coordinate frames/"low-level" coordinate
classes.
"""
# Standard library
import abc
import copy
import inspect
from collections import namedtuple, OrderedDict, defaultdict
import warnings
# Depe... |
9b06a5a35f0abafdcb1dc878f91c8f2fb7c5c46c54dc2dd3bae1eddb60bd4128 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains the fundamental classes used for representing
coordinates in astropy.
"""
from collections import namedtuple
import numpy as np
from . import angle_utilities as util
from .. import units as u
from ..util... |
f15764fcbd675f3b97ac70596056484f7f2ce8c37641d5c5f3cb7aa4a84d09f7 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# Dependencies
import numpy as np
import warnings
# Project
from .. import units as u
from ..utils.exceptions import AstropyDeprecationWarning
from ..utils import OrderedDescriptor, ShapedLikeNDArray
__all__ = ['Attribute', 'Tim... |
f6ddee412d9e18cff51a94c5bab5c1bfa456f42ee0a2885f910983073b930f78 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# Standard library
import re
import textwrap
import warnings
from datetime import datetime
from urllib.request import urlopen
# Third-party
from .. import time as atime
from ..utils.console import color_print, _color_text
from . ... |
7558a0b533e0b6727e6b065eb5765a65c5ef541e4106ba92fd4a28769059e38f | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file was automatically generated from ply. To re-generate this file,
# remove it from this folder, then build astropy and run the tests in-place:
#
# python setup.py build_ext --inplace
# pytest astropy/coordinates
#
# Y... |
7383afce4bb71edb922dbf8a737037fc1af6bada26887e08d66d34425423786d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import contextlib
import pathlib
import re
import sys
from collections import OrderedDict
from operator import itemgetter
import numpy as np
__all__ = ['register_reader', 'register_writer', 'register_identifier',
'identify_format', 'get_re... |
3e176f8ee63caf54896320760295498e55a46541c996876085cbfb8cd97b0d04 | """
Implements the wrapper for the Astropy test runner in the form of the
``./setup.py test`` distutils command.
"""
import os
import glob
import shutil
import subprocess
import sys
import tempfile
from setuptools import Command
class FixRemoteDataOption(type):
"""
This metaclass is used to catch cases whe... |
17acf73183b0bbbf6d39cca69457c1a82e986f6eec358de6a48c8787911cb025 | """Implements the Astropy TestRunner which is a thin wrapper around py.test."""
import inspect
import os
import glob
import copy
import shlex
import sys
import tempfile
import warnings
import importlib
from collections import OrderedDict
from importlib.util import find_spec
from ..config.paths import set_temp_config,... |
05bcda36fabdadd3fbe9ee3037c48a10077bbf9ca269b50573032d70f72a57c0 | import matplotlib
from matplotlib import pyplot as plt
from ..utils.decorators import wraps
MPL_VERSION = matplotlib.__version__
ROOT = "http://{server}/testing/astropy/2018-03-27T18:38:34.793133/{mpl_version}/"
IMAGE_REFERENCE_DIR = (ROOT.format(server='data.astropy.org', mpl_version=MPL_VERSION[:3] + '.x') + ',' +... |
1711f140270a6976d734742985ce3a550f236eb90de7bbb989e7cf629d87c7a1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_equal, assert_allclose
try:
import scipy # pylint: disable=W0611
except ImportError:
HAS_SCIPY = False
else:
HAS_SCIPY = True
from ..jackknife import jackknife_resampling, j... |
d91d328ad86ca5698894cbd05d53577033ba1dee19e9e1945834cffb0574955e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.random import randn
from numpy.testing import assert_equal, assert_allclose
try:
from scipy import stats # used in testing
except ImportError:
HAS_SCIPY = False
else:
HAS_SCIPY = True
from ..sig... |
632e662f42576d4503b77e158aa27f2f7f55d85fa8663d29dca46d842c663ec1 |
from numpy.testing import assert_allclose
from ..info_theory import bayesian_info_criterion, bayesian_info_criterion_lsq
from ..info_theory import akaike_info_criterion, akaike_info_criterion_lsq
def test_bayesian_info_criterion():
# This test is from an example presented in Ref [1]
lnL = (-176.4, -173.0)
... |
01ab3fdbec625656050884f11df9dc306b914cf294301295c6b848b29519ec27 |
import pytest
import numpy as np
from numpy.testing import assert_equal, assert_allclose
from astropy import units as u
try:
import scipy.stats
except ImportError:
HAS_SCIPY = False
else:
HAS_SCIPY = True
from ..circstats import _length, circmean, circvar, circmoment, circcorrcoef
from ..circstats impo... |
a8166f7a88c28ba6e0dae487d8130cfbcffba181b136bfeb6c240f0077318628 |
import numpy as np
import pytest
from numpy.testing import assert_allclose
from ..spatial import RipleysKEstimator
from ...utils.misc import NumpyRNGContext
a = np.array([[1, 4], [2, 5], [3, 6]])
b = np.array([[-1, 1], [-2, 2], [-3, 3]])
@pytest.mark.parametrize("points, x_min, x_max", [(a, 0, 10), (b, -5, 5)])
... |
e9dcbf41ad50c0aaf4207c2620bafa5474295e79510f28ae785323ceaf899b27 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.random import randn, normal
from numpy.testing import assert_equal, assert_allclose
try:
import scipy # pylint: disable=W0611
except ImportError:
HAS_SCIPY = False
else:
HAS_SCIPY = True
try:
... |
f6a557eb5f8af42804d959151bc4fb5c0c1b944cd295e2b68e54a7d5427c1e42 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.random import randn, normal
from numpy.testing import assert_equal, assert_allclose
from ..biweight import (biweight_location, biweight_scale,
biweight_midvariance, biweight_midcovarianc... |
b134d1f36a745e20d33e7d93462c358f206a408e9b7d7deb2398861fc3cd8658 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import pytest
import numpy as np
from numpy.testing import assert_allclose
from ..convolve import convolve_fft
VALID_DTYPES = []
for dtype_array in ['>f4', '<f4', '>f8', '<f8']:
for dtype_kernel in ['>f4', '<f4', '>f8', '<f8']:
... |
7b18ab2662056ac05374cf183971be4b250c734dbda9b28663dfb80d25884b7d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test sky projections defined in WCS Paper II"""
import os
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_almost_equal
from .. import projections
from ..parameters import InputParameterError
from ... import units ... |
604c3dbb18bf3fb3c7e6273a500cc6be28e2c74dd13e66245a5c01c3a9eafe60 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Module to test fitting routines
"""
import os.path
import pytest
import numpy as np
from numpy import linalg
from numpy.testing import assert_allclose, assert_almost_equal
from unittest import mock
from . import irafutil
from .. import models
from .... |
6e803a09c26ab5a5da800bb1391ae92c03561bde4485fee835e990c38ef5853c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for model evaluation.
Compare the results of some models with other programs.
"""
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_equal
from .example_models import models_1D, models_2D
from .. import fitting... |
c14a7626ce23106bcebc68fb0340c92170c68e7ff2d261d24de6c11f3dbc57cd | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module tests model set evaluation for some common use cases.
"""
import pytest
import numpy as np
from numpy.testing import assert_allclose
from ..models import Polynomial1D, Polynomial2D
from ..fitting import LinearLSQFitter
from ..core import M... |
77cc288efb4e4cf869a9067bfdc1f75a910cc7cc8c6c98be4740d07be70e6697 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_allclose
from ...wcs import wcs
from .. import models
from ... import units as u
from ...tests.helper import assert_quantity_allclose
@pytest.mark.parametrize(('inp'), [(0, 0), (4000, -... |
3e7e6ed9490ca8754e76d7fded5f5aa069cb392d13ee88d07474bf007e30ebe2 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests that relate to evaluating models with quantity parameters
"""
import numpy as np
import pytest
from numpy.testing import assert_allclose
from ..core import Model
from ..models import Gaussian1D, Shift, Scale, Pix2Sky_TAN
from ... import unit... |
c92db1093ac8421a9c92605ff918ef54720ce21b856884f103fe94734c8d6b4a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module tests fitting and model evaluation with various inputs
"""
import pytest
import numpy as np
from numpy.testing import assert_allclose
from .. import models
from .. import fitting
from ..core import Model, FittableModel, Fittable1DModel
fr... |
f1b2e5889190fb3efec4701223df81c5fe269eef4d1bfc2719cfedab7426f7aa | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for polynomial models."""
import os
from itertools import product
import pytest
import numpy as np
from numpy.testing import assert_allclose
from .. import fitting
from ... import wcs
from ...io import fits
from ..polynomial import (Chebyshe... |
e5d30a1e6c48234254391a0cfb8b1c298f925dcd5bf5ea94eb9a249364845b6e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import inspect
from copy import deepcopy
import pickle
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
from ..core import Model, ModelDefinitionError
from ..parameters import Parameter
from ..models impo... |
cf2cea29a055d6bfb34bc4418debfe4f944a7610998b1161d226326ff0776112 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from inspect import signature
from numpy.testing import assert_allclose
from ..core import Model, custom_model
from ..parameters import Parameter
from .. import models
class NonFittableModel(Model):
"""An example cl... |
0db0536a0344da3f02b723b42f13b3e34138145811b37a4343c696069cad5741 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests models.parameters
"""
import itertools
import pytest
import numpy as np
from numpy.testing import (assert_allclose, assert_equal, assert_array_equal,
assert_almost_equal)
from . import irafutil
from .. import models,... |
83c6b00401566f6e7aeebf79bc96a220c6bebdc63a066dce2c5f82eedd954fcb | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from math import cos, sin
import pytest
import numpy as np
from numpy.testing import assert_allclose
from .. import models
from ...wcs import wcs
@pytest.mark.parametrize(('inp'), [(0, 0), (4000, -20.56), (-2001.5, 45.9),
... |
674d2a7276b9ce7ee3f2f73a70635fb8292b8b907ba4df1d36bdb77f0ea340c3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import types
import pytest
import numpy as np
from numpy.testing import assert_allclose
from numpy.random import RandomState
from ..core import Fittable1DModel
from ..parameters import Parameter
from .. import models
from .. import fitting
from .utils ... |
d895872524e76ef64758e915e3c28a834465b7b7b97ffb8df3adc80e041f1590 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
from ..fitting import LevMarLSQFitter
from ..models import Shift, Rotation2D, Gaussian1D, Identity, Mapping
from ...utils import NumpyRNGContext
try:
from... |
f5aa2cd401bf6144319105518e2530b649ee5fbbb2a3d7e50bf15f70e35214e3 | # 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... |
26b81f456cf2f8ce600f0954b3c259b87dc4bd7ffbff598dff0a0f8de9346686 | # 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... |
b2c89e920aaaec62f3089e091c58b9a4f8956930da99276448b6957897c95630 | # -----------------------------------------------------------------------------
# ply: lex.py
#
# Copyright (C) 2001-2017
# 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... |
605c161d63c2500f7960252242d83ffee1e31e38145d24f00a399318b6efd13f | # -----------------------------------------------------------------------------
# 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.
# -------------------------------------------------------------... |
d8960d798b6b3f3d49ccb48b3b77781ac4bccc953c8d8fc8fc2475548f605ab0 | # 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 LParser.parsedebug() in yacc.py. The source code
# for that method is then used to create the other meth... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.