hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
eaeeec226210e8b1f8a0a1ecbf9253b1b05b1701cce94c7015386dbb821ab1ef | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
from astropy import __minimum_asdf_version__
asdf = pytest.importorskip('asdf', minversion=__minimum_asdf_version__)
from asdf.tests.helpers import assert_roundtrip_tree
from astropy import units
from astropy.coord... |
7a3bdf74df05acb0e54be3da94a5b04629f901e4fe317dddd37901814bd54894 | # 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 as u
from astropy.coordinates.angles import Longitude, Latitude
from astropy.coordinates.earth import... |
367474b6e232c5daa0b12b17022b9af5d9efed9ae2d354bc202ee475829f8345 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import SkyCoord, ICRS, Galactic, FK4, FK5, Longitude
asdf = pytest.importorskip('asdf')
from asdf.tests.helpers import assert_roundtrip_tre... |
f15ab23ecdf72f94ca08ce2d7dc48bd536479d1e2f70eb4f3af100c03c3a98fd | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
from astropy import __minimum_asdf_version__
asdf = pytest.importorskip('asdf', minversion=__minimum_asdf_version__)
import astropy.units as u
from asdf.tests.helpers import assert_roundtrip_tree
from astropy.coo... |
dd88b4633012d96651c2f844d03c7ce49dcdf79c1844cdc7aa1f93fe8876cc1f | # 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
from astropy import __minimum_asdf_version__
asdf = pytest.im... |
6e2c2e404224d1e43e86d4095f0c66bb81c14758b87306149a32d49da1be5637 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import io
import pytest
from astropy import units as u
from astropy import __minimum_asdf_version__
asdf = pytest.importorskip('asdf', minversion=__minimum_asdf_version__)
from asdf.tests import helpers
# TODO: Implement defuni... |
568d1428ee497b99e9007ae3c7cc0cbdf7c48feb9d74fef57ca90e5ab0f6b15f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import io
import pytest
from astropy import units
from astropy import __minimum_asdf_version__
asdf = pytest.importorskip('asdf', minversion=__minimum_asdf_version__)
from asdf.tests import helpers
def roundtrip_quantity(yaml, ... |
d751cdce980422500df4f5aedaa4c16eb1fb4aa4ef42325f58e1cc36ebb73327 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import pytest
from astropy import units as u
from astropy.units import equivalencies as eq
from astropy.cosmology import Planck15
asdf = pytest.importorskip('asdf', minversion='2.3.0.dev0')
from asdf.tests import helpers
def ge... |
527fd8f57d12fb7031069666b030c1a01e8f33d5cdbddb031afc9c01e7f9b100 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# LOCAL
from astropy.tests.helper import catch_warnings
from astropy.io.votable import converters
from astropy.io.votable import exceptions
from astropy.io.votable import tree
def test_reraise():
def fail():
raise RuntimeError("This failed"... |
35d13c41e3d9a40e8d665ffa3644bd6181d24396a0f6e91e41b6a98545286212 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
A set of tests for the util.py module
"""
# LOCAL
from astropy.io.votable import util
from astropy.tests.helper import raises
def test_range_list():
assert util.coerce_range_list_param((5,)) == ("5.0", 1)
def test_range_list2():
assert ut... |
4b9de501488314c791ec32d65ea7523d392ccdea5f261eee505264a9c10e72f3 | # -*- 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... |
54031b87f8fd585ae5dbc71f6f1c474ba0675a862c1741193e41c2a98481262c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.tests.helper import raises
# LOCAL
from astropy.io.votable import ucd
def test_none():
assert ucd.check_ucd(None)
examples = {
'phys.temperature':
[('ivoa', 'phys.temperature')],
'pos.eq.ra;meta.main':
[('i... |
a972f74a09850ae91601ec1db48af94d44a020851114268677a36e73bc509b46 | # 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 astropy.utils.data import get_pkg_data_filename, get_pkg_data_fileobj
from astropy.io.votable.table import parse, writeto
from astropy.io.votable... |
34d10e2b6cb552aae2e0afec6c0773c97d4bef2f478d129a6dc7f76a7770240b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# LOCAL
from astropy.io.votable import exceptions
from astropy.io.votable import tree
from astropy.tests.helper import raises
@raises(exceptions.W07)
def test_check_astroyear_fail():
config = {'pedantic': True}
field = tree.Field(None, name='astr... |
ca98694cfb959cf38edbaccb7da19d66aaccc0bd69765f7a2506db500204e46e | # 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 astropy.io.votable import converters
from astropy.io.votable import exceptions
from astropy.io.votable import tree
from astropy.io.votable.table impo... |
40ab3c944a731dd30541aa6e8a9924f7cec0278c60a735773089228629c82ccc | # 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... |
ef6d890486e30e714949424b15ea29ac01d85afea82de46fa61a2301d0a9097f | # 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 astropy.utils.data import get_pkg_data_filename
from . import html
from . import result
__al... |
11346ba18113042fb2575bfe950ff980b25b0c27f0352688e4a1f569cff19113 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import contextlib
from math import ceil
import os
import re
# ASTROPY
from astropy.utils.xml.writer import XMLWriter, xml_escape
from astropy import online_docs_root
# VO
from astropy.io.votable import exceptions
html_header = """<?xml version... |
5150a3fd7867f71102e42c00a1077009ebc1fc1db84919ead80094933e0b6a86 | # 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... |
0d14ee5753a27bea5348f743de970628b07fff421dd1e048ffceb3e77cf98527 | from astropy import units as u
from astropy.tests.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.... |
87d71269a53a8eb09287b986a512d2691ce354ed4fe7a890e72dfc29ea7f8ec8 | # -*- 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 astropy import test as run_tests
from astropy.tests import helper
# run_tests should raise ValueError when asked to run on a mo... |
57fe1b39e3e287cc6ca46df10a9a72fe288ef404f8c7564fe36113d19dd4b5e0 | # 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 astropy.utils import find_current_module
pkgornm =... |
85618dc3c4c4f6845db01655d3c9c5098ec850e0971b52dc547c2b3047d9d27e | import abc
import numpy as np
from astropy.timeseries import TimeSeries, BinnedTimeSeries
__all__ = ['BasePeriodogram']
class BasePeriodogram:
@abc.abstractmethod
def __init__(self, t, y, dy=None):
pass
@classmethod
def from_timeseries(cls, timeseries, signal_column_name=None, uncertainty=N... |
673e175d7ed3412879d850631258803a98e02bac38d3a171bd9bf45d77a7789f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
from astropy.io import registry, fits
from astropy.table import Table
from astropy.time import Time, TimeDelta
from astropy.timeseries.sampled import TimeSeries
__all__ = ["kepler_fits_reader"]
def kepler_fits_reade... |
63b5bc4314c3d80b12b20b50b69388618f5e562bf58dc1debc4d525edbebd2e7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from numpy.testing import assert_equal
from astropy import units as u
from astropy.table import Table, QTable, vstack
from astropy.time import Time
from astropy.timeseries.sampled import TimeSeries
from astropy.timeseries.binned import Bi... |
53a93b9fac4ae88a9ac62a8971b0b94f3093756cdf8a82b824412444bd67d593 | # 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 import units as u
from astropy.time import Time
from astropy.timeseries.sampled import TimeSeries
from astropy.timeseries.downsample import aggregate_downsample, reduce... |
ec1d9ac34ca9a35fd566f5603f9070aa041415e604bf6203427735724d427da8 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from datetime import datetime
import pytest
from numpy.testing import assert_equal, assert_allclose
from astropy.table import Table, Column
from astropy.time import Time, TimeDelta
from astropy import units as u
from astropy.utils.data import get_pkg_d... |
e0a7c57b683ad28f4fc5f0a6a2521a07bf2908efac576fa7c00bd49f767180c0 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from numpy.testing import assert_equal, assert_allclose
from astropy import units as u
from astropy.time import Time, TimeDelta
from astropy.utils.data import get_pkg_data_filename
from astropy.timeseries.periodograms import BoxLeastSquare... |
bd61cf90b214f0ea5e859ba6d54b3b8764e55a0b05ec14eb203baeb22c980b91 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
__all__ = ["BoxLeastSquares", "BoxLeastSquaresResults"]
import numpy as np
from astropy import units
from astropy.time import Time, TimeDelta
from astropy.timeseries.periodograms.lombscargle.core import has_units, strip_units
fro... |
8da5aea55cbf0b7a14a4d68ef57a3aa17cb363f0ba09e31bca13cef3064ca600 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
from os.path import join
from distutils.core import Extension
BLS_ROOT = os.path.relpath(os.path.dirname(__file__))
def get_extensions():
ext = Extension(
"astropy.timeseries.periodograms.bls._impl",
sources=[
... |
eca2013c8d737860562b7f9c453c9e4c9ef9d7068d3e534df2a7b451414cc63f | """
Utilities for computing periodogram statistics.
This is an internal module; users should access this functionality via the
``false_alarm_probability`` and ``false_alarm_level`` methods of the
``astropy.timeseries.LombScargle`` API.
"""
from functools import wraps
import numpy as np
def _weighted_sum(val, dy):
... |
788524a147d7bd1198369ed483cb68bc503c33ad4c122d3e42a3de5a72a4b560 | """Main Lomb-Scargle Implementation"""
import numpy as np
from .implementations import lombscargle, available_methods
from .implementations.mle import periodic_fit, design_matrix
from . import _statistics
from astropy import units
from astropy.time import Time, TimeDelta
from astropy import units as u
from astropy.ti... |
7cf8f1d6d913e6fdf6b1f902f048ce380e9082fb465acfa9fce518c8cd0ef58e | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_equal
from astropy import units as u
from astropy.time import Time, TimeDelta
from astropy.tests.helper import assert_quantity_allclose
from astrop... |
6fdf11329b5acc2c7c3273525c74951159b722c32b614117add44717d2025e70 | """
Main Lomb-Scargle Implementation
The ``lombscargle`` function here is essentially a sophisticated switch
statement for the various implementations available in this submodule
"""
__all__ = ['lombscargle', 'available_methods']
import numpy as np
from .slow_impl import lombscargle_slow
from .fast_impl import lomb... |
9db667ea5f97df6f07c951c7b45d0042d21944bf09d5216d0b91ac3bb0fcddf9 | from math import factorial
import numpy as np
def bitceil(N):
"""
Find the bit (i.e. power of 2) immediately greater than or equal to N
Note: this works for numbers up to 2 ** 64.
Roughly equivalent to int(2 ** np.ceil(np.log2(N)))
"""
return 1 << int(N - 1).bit_length()
def extirpolate(x, y... |
30cdf5aa45c71c3335002144b1cc9a36f0e6fd4f39988b9ada7e3c33c38ad0ea | import numpy as np
import pytest
from numpy.testing import assert_allclose
try:
import scipy
except ImportError:
HAS_SCIPY = False
else:
HAS_SCIPY = True
from astropy.timeseries.periodograms.lombscargle import LombScargle
from astropy.timeseries.periodograms.lombscargle._statistics import (cdf_single, pdf... |
2141300a45c64efa6dc4ac897fde4f555fd69f99caf75c36c4d2956839e152af | import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy.timeseries.periodograms.lombscargle.utils import convert_normalization, compute_chi2_ref
from astropy.timeseries.periodograms.lombscargle.core import LombScargle
NORMALIZATIONS = ['standard', 'model', 'log', 'psd']
@pytest.fixt... |
16bc38e642ad5f6931417b6149be161ecf12d85d7bd7bf57d4c88e351429441b | import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.time import Time, TimeDelta
from astropy import units as u
from astropy.tests.helper import assert_quantity_allclose
from astropy.timeseries.periodograms.lombscargle import LombScargle
ALL_METHODS = LombScargle.available_methods
... |
01c400ef7794bd955bbdef345bddb6eef6146eac18a865bd76d44aada8a98e29 |
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_equal
from astropy.timeseries.periodograms.lombscargle.implementations.utils import extirpolate, bitceil, trig_sum
@pytest.mark.parametrize('N', 2 ** np.arange(1, 12))
@pytest.mark.parametrize('offset', [-1, 0, 1])
def test_bitceil(N... |
5579bdfaaf74a563845eae93eb4568ae107ec579f0779a1b227ebfbe2fc99395 | import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.timeseries.periodograms.lombscargle.implementations.mle import design_matrix, periodic_fit
@pytest.fixture
def t():
rand = np.random.RandomState(42)
return 10 * rand.rand(10)
@pytest.mark.parametrize('freq', [1.0, 2])
@... |
22281b8b65eb4017ea26e2f385ba2601aeda5953cefa1c95b5795168bf030ecc | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from unittest import mock
import pytest
from astropy.io.fits import HDUList, Header, PrimaryHDU, BinTableHDU
from astropy.utils.data import get_pkg_data_filename
from astropy.timeseries.io.kepler import kepler_fits_reader
def fake_header(extver, vers... |
fff9d0d34ebc260c70f2fcc77b0d7e6e1aa2ba2b6a18ff7394a8f585b8c31318 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy import constants as const
from astropy.tests.helper import pickle_protocol, check_pickling_recovery # noqa
originals = [const.Constant('h_fake', 'Not Planck',
0.0, 'J s', 0.0, 'fakeref',
... |
64dfc453b5a5b8b1484657b885467671e5cc601a8525805ada9c05c60fd219eb | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import pytest
from astropy.constants import Constant
from astropy.units import Quantity as Q
def test_c():
from astropy.constants.codata2010 import c
# c is an exactly defined constant, so it shouldn't be changing
assert c.va... |
e89de87af302f85a84f5bffaa686630339caeb13317c31bd0b09873ddb6f63a3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import pytest
from astropy.constants import Constant
from astropy.units import Quantity as Q
def test_c():
from astropy.constants import c
# c is an exactly defined constant, so it shouldn't be changing
assert c.value == 2.... |
071ec161b6ec6c38abcedc9566569e7725f414a6593c46342bf55ad0fe03ede5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy.tests.helper import pickle_protocol, check_pickling_recovery
from astropy import cosmology as cosm
originals = [cosm.FLRW]
xfails = [False]
@pytest.mark.parametrize(("original", "xfail"),
zip(origina... |
f06ba7e6c7372c7137ef5b3efd055a24719a480cce751e6be532974c3e4c7d04 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from io import StringIO
import pytest
import numpy as np
from astropy.cosmology import core, funcs
from astropy.units import allclose
from astropy.utils.compat import NUMPY_LT_1_14
from astropy import units as u
try:
import scipy # pylint: disable... |
4ba76341ddabbb736b9551c0ebe9b2d1642984a7cbfa2046922a3067d289822e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file is the main file used when running tests with pytest directly,
# in particular if running e.g. ``pytest docs/``.
from importlib.util import find_spec
import os
import pkg_resources
import tempfile
from astropy.tests.plugins.display import PY... |
ecc9c6b1fa6e53f91ffe90be4c11681bc39d32483486c306549e67c1810e03c2 | # 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.
"""
# Prior to... |
4b5245728dbee3f61ffb82c3f96a059d0eba7a820f778380a60768f8bb31c9ea | # 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).
"""
import os
import builtins
import tempfile
from astropy.tests.... |
03805ed64da383f132c8645eebd6b5abe892d3dd48427c8a286a145a9e9f8e4a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file needs to be included here to make sure commands such
# as ``python setup.py test ... -t docs/...`` works, since this
# will ignore the conftest.py file at the root of the repository
# and the one in astropy/conftest.py
import os
import tempfi... |
2dbd41a8166b3ca4f8163a1f7b8ed4f3ac8198c7fa4b1b5fedcecb1f39aacbd1 | # 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... |
f04bd37a1aa767986ee1267951a693822967b245a4c81a2835237378a114667e | # 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... |
ec98bfd1a995cdc05a7f516fd8b1a68fe2fd4565660caf1f8aa47d5c0d2ebb55 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Mathematical models."""
from collections import OrderedDict
import numpy as np
from astropy import units as u
from astropy.units import Quantity, UnitsError
from .core import (Fittable1DModel, Fittable2DModel,
ModelDefinitionErro... |
599a6692e65a1b1e9f3498725f03be219cec2b2dbf53972d2be2f0950e8a5dde | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""General purpose timer related functions."""
# STDLIB
import time
import warnings
from collections import OrderedDict
from collections.abc import Iterable
from functools import partial, wraps
# THIRD-PARTY
import numpy as np
# LOCAL
from astropy impor... |
e156ade79f5375020c6e0caac93b968b8f167f9ea4c9bec7b19aa390e727579d | # -*- 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... |
83bf66bfd0b512c6f4189c0d872f66483f14db2a029b91a515d9e0c646a11489 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from datetime import datetime
from astropy.time import Time
from astropy import units as u
__all__ = ['time_support']
__doctest_requires__ = {'time_support': ['matplotlib']}
UNSUPPORTED_FORMATS = ('datetime'... |
342a79400cbce337515bd2f96e8eed484d519b9995be99b4d0e32c012b2b0937 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Under the hood, there are 3 separate classes that perform different
parts of the transformation:
- `~astropy.wcs.Wcsprm`: Is a direct wrapper of the core WCS
functionality in `wcslib`_. (This includes TPV and TPD
polynomial distortion, b... |
cc65ce455a56a669623c806e2759a2be07e26934d73728f3fbcf60652ce05d34 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The astropy.time package provides functionality for manipulating times and
dates. Specific emphasis is placed on supporting time scales (e.g. UTC, TAI,
UT1) and time representations (e.g. JD, MJD, ISO 8601) that are used in
astr... |
26e6cd745611364011d2b529afc6752f526e856f489d23c05e0682d581988aa7 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Time utilities.
In particular, routines to do basic arithmetic on numbers represented by two
doubles, using the procedure of Shewchuk, 1997, Discrete & Computational
Geometry 18(3):305-363 -- http://www.cs.berkeley.edu/~jrs/pape... |
569de7c23d180c29b3687e75e5e3545f7a4164763bbffa858fd513baf9785fb5 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module defines the `Quantity` object, which represents a number with some
associated units. `Quantity` objects support operations like ordinary numbers,
but will deal with unit conversions internally.
"""
# Standard libra... |
134f67e704c4d7fc977652535a88ba8100a92964406e9c3a7a076e77d4e39844 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains convenience functions for retrieving solar system
ephemerides from jplephem.
"""
from urllib.parse import urlparse
from collections import OrderedDict
import numpy as np
import os.path
from .sky_coordinate import SkyCoord
from a... |
2e4edd1dda79546c4e9247ccbff96c731b89e382043a9e564c66ea28aa975e62 | # -*- 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.... |
46a0e4302697618c642e52cc1357797e43f3b70df697ae6f9246ddbe76d0575c | """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 functools import wraps
from astropy.co... |
1a2467b69cda9c55c3e1b10242f7939eb5f6dccbb4a519f585d612c18df08857 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Astronomical and physics constants in SI units. See :mod:`astropy.constants`
for a complete listing of constants defined in Astropy.
"""
import numpy as np
from .constant import Constant, EMConstant
# PHYSICAL CONSTANTS
class CODATA2014(Constant)... |
b204b3f802f764be09a477ce14d248e36047e03d22e460f03a0403c7f5571641 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Contains astronomical and physical constants for use in Astropy or other
places.
A typical use case might be::
>>> from astropy.constants import c, m_e
>>> # ... define the mass of something you want the rest energy of as m ...
>>> m = m_... |
0d2497df52f4a6edcb2eaa63849922bcd5affd535d9f7421022a879a66a8f87f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Astronomical and physics constants for Astropy v1.3 and earlier.
See :mod:`astropy.constants` for a complete listing of constants
defined in Astropy.
"""
from astropy.utils import find_current_module
from . import utils as _utils
from . import codata20... |
d69a5b75c154b28f5e845b688eea92e264c3f911f566e5c1e24f247de81b4812 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Configures the codata and iaudata used, possibly using user configuration.
"""
# Note: doing this in __init__ causes import problems with units,
# as si.py and cgs.py have to import the result.
import importlib
import astropy
phys_version = astropy.ph... |
e1bdc518550c178fe7ec38835af77de8a223211b8b78d01747bee6bd1b34fab7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Astronomical and physics constants for Astropy v2.0. See :mod:`astropy.constants`
for a complete listing of constants defined in Astropy.
"""
from astropy.utils import find_current_module
from . import utils as _utils
from . import codata2014, iau2015... |
1e46b78e34e0db15ac1cafd09df15a552f68893eddd6af075ba6597c9275d1fc | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Astronomical and physics constants in cgs units. See :mod:`astropy.constants`
for a complete listing of constants defined in Astropy.
"""
import itertools
from .constant import Constant
from .config import codata, iaudata
for _nm, _c in itertools.ch... |
d659d750be5df7f8966cbf5df92a9ce364d83957182e42f2cc6397a59db4f264 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Astronomical and physics constants in SI units. See :mod:`astropy.constants`
for a complete listing of constants defined in Astropy.
"""
import itertools
from .constant import Constant
from .config import codata, iaudata
for _nm, _c in itertools.cha... |
453e41a26e7540d60b74f43c14fc3ff9aff57ea717775d1649dd541933ed4357 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Astronomical and physics constants in SI units. See :mod:`astropy.constants`
for a complete listing of constants defined in Astropy.
"""
import math
from .constant import Constant, EMConstant
# PHYSICAL CONSTANTS
# https://en.wikipedia.org/wiki/201... |
48107bd491f70eb4083b75ed475ae6437a63dd3166ee9c4b473402d88fff3a5b | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import gc
import sys
import copy
from io import StringIO
from collections import OrderedDict
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
from astropy.io import fits
from astropy.... |
9234fa223cc995b2322dd72eb71c395752fb5b615262c7f1fa6879e6afadb643 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import operator
import pytest
import numpy as np
from astropy.tests.helper import assert_follows_unicode_guidelines, catch_warnings
from astropy import table
from astropy import units as u
class TestColumn():
def test_sub... |
b1cc7679202b138df739c9c5eeb3b9ea99d57aead79af4e1961f79b01c8d3585 | # 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, assert_array_less
from astropy.modeling import models, InputParameterError
from astropy.coordinates import Angle
from astropy.modeling import fitting
from as... |
dbc7c1a47b4ebb3f46e33a4f2cde149c0559338bec5af040e0a89f688da98bc7 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import hashlib
import os
import pathlib
import sys
import tempfile
import urllib.request
import urllib.error
import pytest
from astropy.utils.data import (_get_download_cache_locs, CacheMissingWarning,
... |
bdc9e0ce7dd7f9e949ba04b42dd42674abfb3949e01446bde7ba21e7b0a44787 | # 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 astropy.utils import minversion
__all__ = ['NUMPY_LT_1_14', 'NUMPY_LT_1_14_1', 'NUMPY_LT_1_14_2',
'NUMPY_LT_1_16', 'NUMPY_LT_1_17']
# T... |
21e916fd9a3bc58eaf7f069a32b9c033f2314b8b91696a2e870dd4a14fed62a6 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import pytest
try:
import matplotlib.pyplot as plt
except ImportError:
HAS_PLT = False
else:
HAS_PLT = True
from astropy import units as u
from astropy.coordinates import Angle
from astropy.visualization.un... |
715c366f8f0c70499f85dac2e0715d2532af98b5626ae587871edb8b1aacfd66 | # -*- 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
from astropy.time import Time
from astropy.visualization.time import time_support
def get_ticklabels(axis):
axis.figure.canvas.draw()
... |
0775543fd1003fb5faa5f2168b2f093fcca41e21472165579c950825370bce83 | # 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 astropy import units as u
from astropy.io import fits
from astropy.wcs import WCS
from ast... |
3355b6aee568d30f3735a5d4882fcd02d1a7637f1062162cde34da5aaed90899 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from astropy._erfa import core as erfa
from astropy.tests.helper import catch_warnings
def test_erfa_wrapper():
"""
Runs a set of tests that mostly make sure vectorization is
working as expected
"""
jd = np.linsp... |
44f888ceea1ef92eb14fb0dad50facf0cf3a87415b7cf3428f9dcbf02808649d | import os
import abc
import numpy as np
__all__ = ['BaseLowLevelWCS', 'validate_physical_types']
class BaseLowLevelWCS(metaclass=abc.ABCMeta):
"""
Abstract base class for the low-level WCS interface.
This is described in `APE 14: A shared Python interface for World Coordinate
Systems <https://doi.o... |
d009b396e00d0fc63f068279ae38137dda32273a7ebb2a48101b166e3150db2d | import abc
from collections import defaultdict, OrderedDict
import numpy as np
from .utils import deserialize_class
__all__ = ['BaseHighLevelWCS', 'HighLevelWCSMixin']
def rec_getattr(obj, att):
for a in att.split('.'):
obj = getattr(obj, a)
return obj
def default_order(components):
order = [... |
1833bd43ce3ff19e69a62ed2d30a990a15bd0ab204bc1dd0085a5a4d41b90eba | import pytest
from numpy.testing import assert_equal, assert_allclose
from astropy.wcs import WCS
from astropy.io.fits import Header
from astropy.coordinates import SkyCoord, Galactic
from astropy.units import Quantity
from astropy.wcs.wcsapi.sliced_low_level_wcs import SlicedLowLevelWCS, sanitize_slices
import astrop... |
bfd15a35e09a0114a0c9698b11408eb2d890f99932092e10302ab719671aad9d | import functools
import pytest
import numpy as np
from astropy.time import Time, TimeDelta
allclose_jd = functools.partial(np.allclose, rtol=2. ** -52, atol=0)
allclose_jd2 = functools.partial(np.allclose, rtol=2. ** -52,
atol=2. ** -52) # 20 ps atol
allclose_sec = functools.partial... |
919aa6b59fbb099c9224e774ff3cf672bc37b9513c689c0577238187aacd998e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import pytest
import numpy as np
from astropy.time import Time, TimeDelta
from astropy import units as u
from astropy.table import Column
allclose_sec = functools.partial(np.allclose, rtol=2. ** -52,
ato... |
795ac1595045742d91339457f460071ba027e5a450ee61fa34a15ae63c6b75fb | # -*- 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... |
aeed7b1bc7a611f03398cfbb2ed10c82a796fd8276cb65ff98ea6ace6557a590 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Converters for Quantity."""
import numpy as np
from astropy.units.core import (UnitsError, UnitConversionError, UnitTypeError,
dimensionless_unscaled)
__all__ = ['can_have_arbitrary_unit', 'conv... |
1e6aa17460f74d2c339c911a8e894f9c87bb1a0ac3a5ac41469b44359352279a | # coding: utf-8
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Test the Quantity class and related.
"""
import copy
import pickle
import decimal
from fractions import Fraction
import pytest
import numpy as np
from numpy.testing import (assert_allclose, assert_array_equal,
... |
14af49c875e963079f266826b5b7e61618031733746160f0dd39fbef50f9d3a8 | # 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 astropy import units as u
from astropy.uni... |
5cede9baf482798fc9ea1612650d91c64d6d0c41db2804edf87e6ffd62b83aa7 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Function Units and Quantities."""
from abc import ABCMeta, abstractmethod
import numpy as np
from astropy.units import (Unit, UnitBase, UnitsError, UnitTypeError, UnitConversionError,
dimensionless_u... |
0266f9e2298aae96e27a909e8f8623db9b1804837b8d5cadac4a06ad7cb49a8d | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains the coordinate frames actually implemented by astropy.
Users shouldn't use this module directly, but rather import from the
`astropy.coordinates` module. While it is likely to exist for the long-term,
the... |
3f27209690f2382ffe67a7a9396a08cd1324dfbd2a41a89e3b9ea06c7ba6b71d | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Contains the transformation functions for getting from ICRS/HCRS to CIRS and
anything in between (currently that means GCRS)
"""
import numpy as np
from astropy import units as u
from astropy.coordinates.baseframe import frame... |
88c5b3f41144fb318be8d5e13a0ad03dc0c80b0dc5f6a8e5b93d60b9b45b419f |
import pytest
import numpy as np
from urllib.error import HTTPError
from astropy.time import Time
from astropy import units as u
from astropy.constants import c
from astropy.coordinates.builtin_frames import GCRS
from astropy.coordinates.earth import EarthLocation
from astropy.coordinates.sky_coordinate import SkyCoo... |
fde8370144b2030415f4f1e849d7ca0dde31dd48b11b36b7fb726108f06734c4 | # -*- coding: utf-8 -*-
# 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.coordinates.distances import Distance
from astropy.coordinates.builtin_frames import (ICRS, FK5, FK4, FK4NoETerms, Galactic,
... |
46e65bf9d0295309bb07a8f4c36fade178302dd10fcdbd270efa4cf942831110 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Regression tests for coordinates-related bugs that don't have an obvious other
place to live
"""
import io
import copy
import pytest
import numpy as np
from astropy import units as u
from astropy.coordinates import (AltAz, ... |
db83cab250c8b87109ebc70cbf2f6529856270670122eb15eee80157ab8eae5c | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import collections
import copy
import itertools
import re
import warnings
from .card import Card, _pad, KEYWORD_LENGTH, UNDEFINED
from .file import _File
from .util import (encode_ascii, decode_ascii, fileobj_closed,
fileobj_is_binary, ... |
f9eda3a430231b651b36096f8b017acf8b70de6e820062eeac9ca5725adf7108 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
"""
Convenience functions
=====================
The functions in this module provide shortcuts for some of the most basic
operations on FITS files, such as reading and updating the header. They are
included directly in the 'astropy.io.fits' namespace so ... |
0928f1aa18907f0a458e7ab8a6a18a78475c67aaced6cb48e0cd1e9198859566 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import gzip
import itertools
import io
import mmap
import operator
import os
import platform
import signal
import sys
import tempfile
import textwrap
import threading
import warnings
import weakref
from contextlib import contextmanager, suppress
from func... |
2224e90bab2ce0b04b92216ebbc98e1edef0a983d70c68063c86d04b86f372d7 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import re
import warnings
import numpy as np
from .util import _str_to_num, _is_int, translate, _words_group
from .verify import _Verify, _ErrList, VerifyError, VerifyWarning
from . import conf
from astropy.utils.exceptions import AstropyUserWarning
_... |
18965e4b231adee9211af0babc5e2fc9ff50ac7fd0fc2bfb39950f3a5f260a05 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module handles the conversion of various VOTABLE datatypes
to/from TABLEDATA_ and BINARY_ formats.
"""
# STDLIB
import re
import sys
from struct import unpack as _struct_unpack
from struct import pack as _struct_pack
# THIRD-PARTY
import numpy ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.