hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
d594b94497075e211266c3588bec4a7b237eb80d84ee39606cf1b4a30de62462 | # -----------------------------------------------------------------------------
# ply: yacc.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 ar... |
8b9e41106a832902a64f4ae9ad4818b21ba37671e15b59121d315ad5ff52119d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# Note: This file incldues code dervived from pywcsgrid2
#
# This file contains Matplotlib transformation objects (e.g. from pixel to world
# coordinates, but also world-to-world).
import abc
import numpy as np
from matplotlib.path import Path
from ma... |
66e1e7aa037162d36cd49966d6338c9783f6623f3f88a6b0189e5b16eea15cd5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file defines the classes used to represent a 'coordinate', which includes
axes, ticks, tick labels, and grid lines.
"""
import numpy as np
from matplotlib.ticker import Formatter
from matplotlib.transforms import Affine2D, ScaledTranslation
fr... |
9a84221b6cf3b674aaad062b1f94a94de3fe5b3edef741e01c209765ce260549 | # 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... |
199cfecf19aaeea59df6e636aafca466088e8d86d08b303c7191e492e8b0fcbc | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from functools import partial
from collections import defaultdict
import numpy as np
from matplotlib.artist import Artist
from matplotlib.axes import Axes, subplot_class_factory
from matplotlib.transforms import Affine2D, Bbox, Transform
from ...coordi... |
1a90cdc6fc24c2598f24e9dbdcdefb9e6ab1c49f5f653c6f0de670ac05bf2283 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from matplotlib.text import Text
from .frame import RectangularFrame
def sort_using(X, Y):
return [x for (y, x) in sorted(zip(Y, X))]
class TickLabels(Text):
def __init__(self, frame, *args, **kwargs):
self.clear... |
18a77b1493997ea9adb3d0d02fce1eeeb7300fd5686890fbf58d93a1688162bb | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from .coordinate_helpers import CoordinateHelper
from .transforms import WCSPixel2WorldTransform
from .utils import coord_type_from_ctype
from .frame import RectangularFrame
from .coordinate_range import find_coordinate_range
class CoordinatesMap:
... |
58db26ffacb4c75efd8873e39819aa27903223ad501db80e2289dbeca0f53bd1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from ... import units as u
from ...coordinates import BaseCoordinateFrame
# Modified from axis_artist, supports astropy.units
def select_step_degree(dv):
# Modified from axis_artist, supports astropy.units
if dv > 1. * u.... |
7f3fd6c0efbe65e3fa9205f24e9b2aa07deb15afa99222222d6dc45a4d88b9fa | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
from ... import units as u
# Algorithm inspired by PGSBOX from WCSLIB by M. Calabretta
LONLAT = {'longitude', 'latitude'}
def wrap_180(values):
values_new = values % 360.
with np.errstate(invalid='ignore')... |
6af6984086a99bb1966e3cb597539eb31a7233194754500ab66802a97f627f33 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from numpy.testing import assert_almost_equal
from .... import units as u
from ..utils import (select_step_degree, select_step_hour, select_step_scalar,
coord_type_from_ctype)
from ....tests.helper import (assert_quantity_allclose ... |
45c784dfd9fafdbed487a122e57cdc5f3b9de400ff90f224dd16f20b60ab4bad | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_almost_equal
from matplotlib import rc_context
from .... import units as u
from ....tests.helper import assert_quantity_allclose
from ....units import UnitsError
from ..formatter_locator ... |
93934bcd06776cb54100a7a3da43ea5445f98ab519ad3b83d9494418ade45a8e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from ..core import WCSAxes
import matplotlib.pyplot as plt
from matplotlib.backend_bases import KeyEvent
from ....wcs import WCS
from ....coordinates import FK5
from ....time import Time
from ....tests.image_tests import ignore_matplotlibrc
from .test_im... |
fe1f1ad87142a81c209ec2bb4642a27f7a20228f04d334e637cc86f06b72be11 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from unittest.mock import patch
import pytest
import matplotlib.pyplot as plt
from ..core import WCSAxes
from .... import units as u
from ....tests.image_tests import ignore_matplotlibrc
@ignore_matplotlibrc
def test_getaxislabel():
fig = plt.fig... |
720ca307186b0fd3f66d10825f4e1fd7e39fb6a0ef5d6a40fbf96f841a58c406 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import pytest
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Rectangle
from matplotlib import rc_context
from .... import units as u
from ....io import fits
from ....wcs import WCS
from ....coordinate... |
4d2a89d31df9ba1b048f98d225f5b39c04fd98c59e0b400cd8badd3147c83fed | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_almost_equal
from numpy.testing import assert_allclose
from ...utils.data import get_pkg_data_contents, get_pkg_data_filename
from ...time import Time
from ... import units as u
from ..w... |
657c2465cfb5661c4484a0cf832be52602ee4cdad5290a730801751f1c7a709b | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICNSE.rst
# This module includes files automatically generated from ply (these end in
# _lextab.py and _parsetab.py). To generate these files, remove them from this
# folder, then build astropy and run the tests in-place:
#
# python setup.p... |
918a56113e88faba7b44f167962dd2a6cd977d1a2f6ff1d3d09c86b71f0a0a5f | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file was automatically generated from ply. To re-generate this file,
# remove it from this folder, then build astropy and run the tests in-place:
#
# python setup.py build_ext --inplace
# pytest astropy/units
#
# You can... |
f60f337cf34578c77f95812195c8455a49dd197ed540510b61e3e8de9b4be46a | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file was automatically generated from ply. To re-generate this file,
# remove it from this folder, then build astropy and run the tests in-place:
#
# python setup.py build_ext --inplace
# pytest astropy/units
#
# You can... |
609242b94056eecd11704b26793dcc73037bcc9d6e440e83f2ebd8a7455059c2 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file was automatically generated from ply. To re-generate this file,
# remove it from this folder, then build astropy and run the tests in-place:
#
# python setup.py build_ext --inplace
# pytest astropy/units
#
# You can... |
1567ac4f8eaab6f91f37f3db25a2c10421858cc2c0eebadf75a8b76803bbe171 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file was automatically generated from ply. To re-generate this file,
# remove it from this folder, then build astropy and run the tests in-place:
#
# python setup.py build_ext --inplace
# pytest astropy/units
#
# You can... |
3f13b7a6b6147a1c20269ca15085ae69621f16e57c490a738b247f04ebb5e8fb | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file was automatically generated from ply. To re-generate this file,
# remove it from this folder, then build astropy and run the tests in-place:
#
# python setup.py build_ext --inplace
# pytest astropy/units
#
# You can... |
fa5e63838da35fd8d35696cdfa493e52f92db53f031020eabeb76ba5c6c10206 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
from ...utils.misc import InheritDocstrings
class _FormatterMeta(InheritDocstrings):
registry = {}
def __new__(mcls, name, bases, members):
if 'name' in members:
formatter_name = members['name'].lower()
el... |
31179e55b55349867254460481a7d71913356c9adedfaa9035f81a0951b3419a | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICNSE.rst
# This module includes files automatically generated from ply (these end in
# _lextab.py and _parsetab.py). To generate these files, remove them from this
# folder, then build astropy and run the tests in-place:
#
# python setup.p... |
cd2741eb27c87818a9fa8202b8af6df1e77d676dd1d656d73b273de9205ef414 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file was automatically generated from ply. To re-generate this file,
# remove it from this folder, then build astropy and run the tests in-place:
#
# python setup.py build_ext --inplace
# pytest astropy/units
#
# You can... |
ee75071fbe950429f7f93245d709ca7d908415670651d8a99e9158fa7cc52f13 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This module includes files automatically generated from ply (these end in
# _lextab.py and _parsetab.py). To generate these files, remove them from this
# folder, then build astropy and run the tests in-place:
#
# python setup.py build_ext --inplace
#... |
948d6256b7ad737c68bacc63d7807099349abeff9ee80ae8bdd7d31e6bd16912 | # coding: utf-8
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Separate tests specifically for equivalencies."""
# THIRD-PARTY
import warnings
import pytest
import numpy as np
from numpy.testing import assert_allclose
# LOCAL
from ... import units as u
from ... import constants
from ...tests.helpe... |
739fd0d52dd0a86f0dc15ca4dc172b7fabeca80582b066f2657ee8663ec15855 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Regression tests for the units.format package
"""
import pytest
from numpy.testing import assert_allclose
from ...tests.helper import catch_warnings
from ... import units as u
from ...constants import si
from .. import core
f... |
5519c26c508f796c3d6c19c47515eeb5e5b05ea8fccc95496466d6eb1e945b8e | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Regression tests for the units package
"""
import pickle
from fractions import Fraction
import pytest
import numpy as np
from numpy.testing import assert_allclose
from ...tests.helper import raises, catch_warnings
from ... im... |
9c03d695704ced6b3a77def23a01b7661a513554edb569461536148605b5f33a | # coding: utf-8
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Test the Logarithmic Units and Quantities
"""
import pickle
import itertools
import pytest
import numpy as np
from numpy.testing import assert_allclose
from ...tests.helper import assert_quantity_allclose
from ... import units as... |
0b087e5b3e1ffca81c6fff23b4e59208f71f2e4a9b7fd20841affe354aaee387 | # The purpose of these tests are to ensure that calling ufuncs with quantities
# returns quantities with the right units, or raises exceptions.
import warnings
from collections import namedtuple
import pytest
import numpy as np
from numpy.testing import assert_allclose
from ... import units as u
from ...tests.helper... |
bcbe4ac6ab7e1662b0488b415185d8fcc08a4fa23398c5b7d7a1c10e0cb7ffb0 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains functions/values used repeatedly in different modules of
the ``builtin_frames`` package.
"""
import warnings
import numpy as np
from ... import units as u
from ... import _erfa as erfa
from ...time import... |
d88f706206cc8430031d13d0fc66f740369a64d87b1f9fb8b1ea164915210980 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from copy import deepcopy
import numpy as np
from ... import units as u
from ...tests.helper import (catch_warnings,
pytest, quantity_allclose as allclose,
assert_quantity... |
f50aa95a451c90b43fc3a8a68e632d886b6927222452c6edc991b8ec4dd38967 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initalization and other aspects of Angle and subclasses"""
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
from ..angles import Longitude, Latitude, Angle
from ... import unit... |
2f27a66a053b16cccdd14d4e5c85dcf055fcce263ab66110cc7e840e33b9743f | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for putting velocity differentials into SkyCoord objects.
Note: the skyoffset velocity tests are in a different file, in
test_skyoffset_transformations.py
"""
import pytest
import numpy as np
from ... import units as ... |
4c87a92fddc04ad12f5610971f63be352a734b0c30f02688788de84ff3a39965 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
from ... import units as u
from ..matrix_utilities import rotation_matrix, angle_axis
def test_rotation_matrix():
assert_array_equal(rotation_ma... |
b5cc71779d590d61e219e59ffd1e76a20ee7a380c133ea356cd34bab0628f524 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from copy import deepcopy
from collections import OrderedDict
import pytest
import numpy as np
from numpy.testing import assert_allclose
from ... import units as u
from ...tests.helper import (assert_quantity_allclose as
... |
e4f6e86b9c0839c0c31d7d2db3918225ebd689c93c991421bbb49196a7271b2d | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initialization of angles not already covered by the API tests"""
import pickle
import pytest
import numpy as np
from ..earth import EarthLocation, ELLIPSOIDS
from ..angles import Longitude, Latitude
from ...tests.helper ... |
5ea423f77321a17466f11ca49c8623036df5c006dabfa38a47ac954aaeaaa0b5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
from copy import copy
from io import StringIO
import pytest
import numpy as np
from ..registry import _readers, _writers, _identifiers
from .. import registry as io_registry
from ...table import Table
from ... import units as u
_READERS_ORIGI... |
8d876b9f7981eb148c6b28ae14787189cc7f64230fc618bd4c1727dfa3c98306 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# TODO: Test FITS parsing
# STDLIB
import io
import re
import sys
import gzip
import base64
import codecs
import urllib.request
import warnings
# THIRD-PARTY
import numpy as np
from numpy import ma
# LOCAL
from .. import fits
from ... import __version__... |
29eb56ed03a71fba27439ace7f62823fbde03e569fad7480062c224cba3a2786 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file contains a contains the high-level functions to read a
VOTable file.
"""
# STDLIB
import io
import os
import sys
import textwrap
import warnings
# LOCAL
from . import exceptions
from . import tree
from ...utils.xml import iterparser
from .... |
ee68a3a0d8f550c0214bbc203d46a9b51b94a84593dfd4c54c4d75a7a012ff3c | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import datetime
import os
import sys
import warnings
from contextlib import suppress
from inspect import signature, Parameter
import numpy as np
from .. import conf
from ..file import _File
from ..header import Header, _pad_length
from ..util import (_... |
01a0a27afda7b03d56995225a65c6d6d07bebf62a95d093bd37c5e9aec55f4fd | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import bz2
import gzip
import itertools
import os
import shutil
import sys
import warnings
import numpy as np
from . import compressed
from .base import _BaseHDU, _ValidHDU, _NonstandardHDU, ExtensionHDU
from .groups import GroupsHDU
from .image import ... |
625ecb626dea12977af4250dafb23d0af4c27521cff35af56959c3ee8bb777f3 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import contextlib
import copy
import gc
import pickle
import re
import pytest
import numpy as np
from numpy import char as chararray
try:
import objgraph
HAVE_OBJGRAPH = True
except ImportError:
HAVE_OBJGRAPH = False
from ....io import fits
... |
d159d04958f91301e1a74bc9bdb4a301812260b133379bd05f80ce88a0d090ae | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import glob
import io
import os
import platform
import sys
import copy
import pytest
import numpy as np
from ..verify import VerifyError
from ....io import fits
from ....tests.helper import raises, catch_warnings, ignore_warnings
from ....utils.exception... |
f614010b5433cac4549da89ca10afe22312418b66bf0d424ea40ea35315660c1 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import os
import shutil
import warnings
import pytest
import numpy as np
from ....io import fits
from ....table import Table
from .. import printdiff
from ....tests.helper import catch_warnings
from . import FitsTestCase
class TestConvenience(FitsTes... |
3e3004481aa4e722b6925bbee7d9b5ade058fd66f2ad00740bbd7ec12b58f421 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import os
from asdf.extension import AsdfExtension, BuiltinExtension
from asdf.resolver import Resolver, DEFAULT_URL_MAPPING
from asdf.util import filepath_to_url
# Make sure that all tag implementations are imported by the time ... |
a6eeea445be13157eba2b170e2ca5ca414d8d27866c37f254c0fe793ba9dda08 | # 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
from . import _parameter_to_value
__all__ = ['AffineType', 'Rotate2DType', 'Rotate3DType']
c... |
bf0cdf8db1ec0952c9305f9e0b01fd3a79dbfe611ca9dc1eb018699f96ecff63 | # 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
import astropy.units as u
from astropy import modeling
from .basic import TransformType
from . import _parameter_to_value
__all__ = ['Shif... |
fbaca7aac2d19ccf33fd37a20ccb51d07e0fcb2cd2def39d749e4ec582e370d3 | # 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... |
257acc3dbab99e1cb48a0ffd7c2936f54baa2d9fc88637a52d23497eb664a398 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import os
import glob
from asdf import tagged
from asdf.yamlutil import custom_tree_to_tagged_tree
import astropy.coordinates
from astropy.coordinates.baseframe import frame_transform_graph
from astropy.tests.helper import assert_... |
a78711cd04696a361f935c58ff467f83388b5cb734b6c2431b340ba33bbe3573 | from asdf.yamlutil import custom_tree_to_tagged_tree
import astropy.coordinates.representation
from astropy.coordinates.representation import BaseRepresentationOrDifferential
from astropy.tests.helper import assert_quantity_allclose
from ...types import AstropyType
class RepresentationType(AstropyType):
name = ... |
51e80771f186ba9d803e9e9242b1c15d8653b1f33c1c9125c607ee91ee4b62ba | # 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.coordinates import Angle, Latitude, Longitude
from ..unit.quantity import QuantityType
__all__ = ['AngleType', 'LatitudeType', 'LongitudeType']
class AngleType(... |
7ff638dc07a718d7bded1fc98625a6fc1118527f17af9f98b054b9aeb15e1682 | # 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', minversion='2.0.0')
from asdf.tests import helpers
def test_table(tmpdir):
data_rows = [(1, 2.0, 'x'),
(4, 5.0, '... |
324e68daf3a16e3572e8eb6051528439ffb657d44444e3e3ff11b119c63357d9 | # 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', minversion='2.0.0')
from asdf.tests import helpers
def test_complex_structure(tmpdir):
with fits.open(os.path.join(
... |
995f20fac25f6bd8a993012981ca3a341478ee9158776b7f667272c5d189fd1e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
import numpy as np
asdf = pytest.importorskip('asdf', minversion='2.0.0')
from asdf import util
from asdf.tests import helpers
import astropy.units as u
from astropy.modeling import models as astmodels
test_models ... |
73f6528413c99a178cd5fff3ace0f0e8180b9ce29798554c67c916c07f80fd37 | # 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', minversion='2.0.0')
from asdf import AsdfFile, yamlutil, tagged
from asdf.tests im... |
645a7cb3b8c9e24557af9877654e1cfae70dab8ad65666708d1c1adac263a4f4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
asdf = pytest.importorskip('asdf', minversion='2.0.0')
from asdf.tests.helpers import assert_roundtrip_tree
from astropy import units
from astropy.coordinates import ICRS, FK5, Longitude, Latitude, Angle
from ....e... |
a4092407df96a3757896d58c35c1e8509b41a3f3e2510c08e13869451baf4760 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
asdf = pytest.importorskip('asdf')
import astropy.units as u
from asdf.tests.helpers import assert_roundtrip_tree
from astropy.coordinates import Longitude, Latitude, Angle
from ....extension import AstropyExtens... |
64a0d6f2dbe75ecdc34f41c2102a909035baa7f5e57b06de9a75a91d99c73db7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
from numpy.random import random, randint
import astropy.units as u
from astropy.coordinates import Angle
import astropy.coordinates.representation as r
asdf = pytest.importorskip('asdf')
from asdf.tests.helpers imp... |
6af5ecb56b9997a8717dc4b7a37c67ddaf8b986e2582adb0baa1dcd70c2b654d | # 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', minversion='2.0.0')
from asdf.tests import helpers
# TODO: Implement defunit
def test_unit():
yaml = """
unit: !unit/unit-1.0.0 "2.1... |
c2dfa457cd203a5c2c4b1b686377d73790396d00acf9eea435428e178d03ba92 | # 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', minversion='2.0.0')
from asdf.tests import helpers
def roundtrip_quantity(yaml, quantity):
buff = helpers.yaml_to_asdf(yaml)
with asdf... |
1db139a9dc43c4d35d2e11a64603e4654ac7e4772a2fa9f4594d9f96f7dc8f37 | # -*- 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
from unittest import mock
# THIRD-PARTY
import pytest
import numpy as np
from numpy.testing import assert... |
054f0fd151ec7c2836b931726ed7fd6be5b979374fdf7e6e3668e2027b3a12b8 | # 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(tmpdir)... |
0107ddb8694d5b20ae5a2a5ec583d9df0f7200812dcc3cb52bc08d1d48a28ea2 | """
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... |
029bc732ec918bfa2e82e1dd18aa8e9ece82cc5cb5ccf77a60509d4cd9a8623b | # 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... |
de9f007f6d5abd2414f0728ee6bb684c9fcfebb0b741bc9acacdf6472e1c580f | # -*- 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... |
60f64ab7ae5c3a8a312b30268538d85dc274fc06e660fb1f1c6d9979615a2b22 | # -*- coding: utf-8 -*-
"""
==========================================================
Create a new coordinate class (for the Sagittarius stream)
==========================================================
This document describes in detail how to subclass and define a custom spherical
coordinate frame, as discussed in ... |
bc86096363f56c068f5af6e9c6dcbc4a911e5830bd336dacd3388c34d1ccad86 | # -*- coding: utf-8 -*-
"""
==========================================
Create a very large FITS file from scratch
==========================================
This example demonstrates how to create a large file (larger than will fit in
memory) from scratch using `astropy.io.fits`.
-------------------
*By: Erik Bray*
... |
31ef4a03a458ba713df3ac5af2e5fb796692615590d6e822eecc4aa01c5a98cc | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
from ..utils import isiterable
from ..utils.decorators import deprecated_renamed_argument
from ..utils.exceptions import AstropyUserWarning
try:
import bottleneck # pylint: disable=W0611
HAS_BOTTLENECK = Tru... |
a790cbc00a7f459bea2769486b2eefac45b8172063c49775420494c05f5a6c90 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage contains statistical tools provided for or used by Astropy.
While the `scipy.stats` package contains a wide range of statistical
tools, it is a general-purpose package, and is missing some that are
particularly useful to astronomy or a... |
61c08e9e7074a435c3709fafe849ee05b9de48150f2d1b621a3ea47aea5272eb | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains simple functions for model selection.
"""
import numpy as np
__all__ = ['bayesian_info_criterion', 'bayesian_info_criterion_lsq',
'akaike_info_criterion', 'akaike_info_criterion_lsq']
__doctest_requires__ = {'bayesia... |
f27688c5ec5b240fbf14a5eedc6290f96fb12e639c87a61a162b8bf5a008999c | # 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... |
5bc8651df0a7400e02ac901037b7f450e55c8057f1178e8f94188cf78a658962 | """
Table property for providing information about table.
"""
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
import os
from contextlib import contextmanager
from inspect import isclass
import numpy as np
from ..utils.data_info import DataInfo
__all__ = ['table_info', 'TableInfo', 'serializ... |
40566103466e98c75986a99ed7eff9590a9aca80557060013356dbe2ecd5bdc7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The Index class can use several implementations as its
engine. Any implementation should implement the following:
__init__(data, row_index) : initialize index based on key/row list pairs
add(key, row) -> None : add (key, row) to existing data
remove(... |
035ca2b5e29361db608a675640761faef4555ff99a022b44a1d85b4b531d8669 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import collections
import operator
import numpy as np
class Row:
"""A class to represent one row of a Table object.
A Row object is returned when a Table object is indexed with an integer
or when iterating over a table::
>>> from a... |
173607ebb474d8525de17a7fd486c457aaba414e41dac269ad4584aee4ab5480 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import platform
import warnings
import numpy as np
from .index import get_index_by_names
from ..utils.exceptions import AstropyUserWarning
__all__ = ['TableGroups', 'ColumnGroups']
def table_group_by(table, keys):
# index copies are unnecessary ... |
4ddf816436c6fcfd5e48a6c0fec01a15f1df7df4272429e3f5fa8192d1f24a82 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from .index import TableIndices, TableLoc, TableILoc, TableLocIndices
import re
import sys
from collections import OrderedDict, Mapping
import warnings
from copy import deepcopy
import numpy as np
from numpy import ma
from .. import log
from ..io import... |
e1743946769a1746846d8873af496d824cf2b7ae2a042ff3dafda10e3eed44af | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from .. import config as _config
class Conf(_config.ConfigNamespace):
"""
Configuration parameters for `astropy.table`.
"""
auto_colname = _config.ConfigItem(
'col{0}',
'The template that determines the name of a column ... |
ead1fa28e1da840513d6595efe967a000db787524f1f079dfc944021abefe118 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import weakref
import re
from copy import deepcopy
import numpy as np
from numpy import ma
# Remove this when Numpy no longer emits this warning and that Numpy version
# becomes the minimum required version for Astropy.
# https://github... |
d2aa94db0c1108e2ece5bd6ecb2a86c2dc5c5fb60db32f2b526a638a73ab8ce9 | from importlib import import_module
import re
from copy import deepcopy
from collections import OrderedDict
from ..utils.data_info import MixinInfo
from .column import Column
from .table import Table, QTable, has_info_class
from ..units.quantity import QuantityInfo
__construct_mixin_classes = ('astropy.time.core.Tim... |
3ad9a54db262dafef216c27306b5905b8e1b10526f7c535dfaf35821943d6dc4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Helper functions for table development, mostly creating useful
tables for testing.
"""
from itertools import cycle
import string
import numpy as np
from .table import Table, Column
from ..utils.data_info import ParentDtypeInfo
class TimingTables:... |
17879a2f6b3c1737d2e52e31e332ebc39b7daa4774f15656dc9b142bf454a57c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The SCEngine class uses the ``sortedcontainers`` package to implement an
Index engine for Tables.
"""
from collections import OrderedDict
from itertools import starmap
try:
from sortedcontainers import SortedList
HAS_SOCO = True
except Impor... |
84f05578d2796a66d4560d8e32cb3486a5c18a20532962882b8d070bd20ed2a1 | # 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... |
70a6c2754403d79b7f27fe314d3ff9a3403d236e3556c60bc31dafff2df8680f | # 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... |
e8ddda64d207ef3ba3775288086c6ef53df98e5086eb6868eb340c2d92c9b9cd | # 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... |
eaa46ff73c103c875cbd7d2db15ec53121f1d8a1b70211e54f02698cefa59a01 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Creates a common namespace for all pre-defined models.
"""
from .core import custom_model # pylint: disable=W0611
from .mappings import *
from .projections import *
from .rotations import *
from .polynomial import *
from .functional_models import *... |
121edcbb4e333eed41db9f0e79fd561ee867a914dd23bcc13e7ca9bcf6f515a0 | """
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... |
084e9d51ade399b0367093c1b87a0beb433d7065fda8aa44c9e1cd026cadfa14 | # 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... |
47f338e4f71e228785e626a90735c5641f755756f5111a4c8a47131239aaa5e0 | # 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... |
723d99a0bae88e4361368b05e41b137748361067c99a05c3970c71bacb04a707 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tabular models.
Tabular models of any dimension can be created using `tabular_model`.
For convenience `Tabular1D` and `Tabular2D` are provided.
Examples
--------
>>> table = np.array([[ 3., 0., 0.],
... [ 0., 2., 0.],
... ... |
bd88bab25b9ff0131ce945032322147ccf28167543c6bde38011685b01829431 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Sundry function and class decorators."""
import functools
import inspect
import textwrap
import types
import warnings
from inspect import signature
from .codegen import make_function_with_signature
from .exceptions import (Ast... |
4ea017b9ae5762e17f8819b456b17faa5cc37e5c4d011f76bb2729191407ac25 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Functions related to Python runtime introspection."""
import inspect
import re
import types
import importlib
from distutils.version import LooseVersion
__all__ = ['resolve_name', 'minversion', 'find_current_module',
... |
03e5458bcf3557aa5092819d8f54a452520a85f91c2f6a6548f831ddd6ea890f | import difflib
import functools
import sys
import numbers
import numpy as np
from .misc import indent
__all__ = ['fixed_width_indent', 'diff_values', 'report_diff_values',
'where_not_allclose']
# Smaller default shift-width for indent
fixed_width_indent = functools.partial(indent, width=2)
def diff_va... |
ad0a2bf34b578caab37e4cb9385437581cbdb173e28723e1320e34611a386a5f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from distutils.core import Extension
from os.path import dirname, join, relpath
ASTROPY_UTILS_ROOT = dirname(__file__)
def get_extensions():
return [
Extension('astropy.utils._compiler',
[relpath(join(ASTROPY_UTILS_ROOT, '... |
b054eada7e188bd00add051852927b597a352b167a1ce95fe8de78fe40e27582 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""This module contains functions and methods that relate to the DataInfo class
which provides a container for informational attributes as well as summary info
methods.
A DataInfo object is attached to the Quantity, SkyCoord, and ... |
b86c739a6d4311d7e2633c9e062a3bae9bbb9ca7a579bad6aa194b358037d9a3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
""" This module contains helper functions for accessing, downloading, and
caching data files.
"""
import atexit
import contextlib
import fnmatch
import hashlib
import os
import io
import pathlib
import shutil
import socket
import sys
import time
import u... |
ae78f36edb2892a42f2982be7caf61e91f4582e8cc15df13b25fa9a717d0063c | # -*- 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... |
4f96ba30886471d7e37d3477025795a7a6ace7974f8556dca3ba8c2f63a42bc3 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
__doctest_skip__ = ['quantity_support']
def quantity_support(format='latex_inline'):
"""
Enable support for plotting `astropy.units.Quantity` instances in
matplotlib.
May be (optionally) used... |
9683cb04c5a4334e91f352b5c11022ce3bf0f7138789dff6649e966925c0061c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""This module implements the base CCDData class."""
import numpy as np
from .compat import NDDataArray
from .nduncertainty import StdDevUncertainty, NDUncertainty
from ..io import fits, registry
from .. import units as u
from .. import log
from ..wcs im... |
b4a7297ae136d9c53a16c33b6fac231996d4a369468d3552c4f60945ea319bbe | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module includes helper functions for array operations.
"""
from copy import deepcopy
import numpy as np
from .decorators import support_nddata
from .. import units as u
from ..coordinates import SkyCoord
from ..utils import lazyproperty
from ..w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.