hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
318924067fcfc9593e43b1c87742c377de47ae613e789ae4adbb12c85dcc88dd | """Implements the Astropy TestRunner which is a thin wrapper around pytest."""
import copy
import glob
import inspect
import os
import shlex
import sys
import tempfile
import warnings
from collections import OrderedDict
from functools import wraps
from importlib.util import find_spec
from astropy.config.paths import ... |
30666c09f3619177079b6a99aaf65bca8d056bb4edae82ec886201a7e133bd64 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Built-in mask mixin class.
The design uses `Masked` as a factory class which automatically
generates new subclasses for any data class that is itself a
subclass of a predefined masked class, with `MaskedNDArray`
providing such a predefined class for `... |
269ee2a914a14449c94ac559548613208a25862663a31a61fb9b4dd7d3538be6 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Facilities for diffing two FITS files. Includes objects for diffing entire
FITS files, individual HDUs, FITS headers, or just FITS data.
Used to implement the fitsdiff program.
"""
import fnmatch
import glob
import io
import operator
import os
import... |
eedd6666bb2b6cbfa7163ca6b5d066489f31150ebd1f3a34d0b12497f457c238 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import copy
import operator
import warnings
import weakref
from contextlib import suppress
from functools import reduce
import numpy as np
from numpy import char as chararray
from astropy.utils import lazyproperty
from .column import (
_VLF,
ASC... |
5c89a2399b2ca5ecb00e92f13483ac823f1127f65219bd8c9bc199f49f831ca9 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import re
import warnings
import numpy as np
from astropy.utils.exceptions import AstropyUserWarning
from . import conf
from .util import _is_int, _str_to_num, _words_group, translate
from .verify import VerifyError, VerifyWarning, _ErrList, _Verify
__... |
71211b4944f81282561cb61a6280f7b0dda42b656a057097a0fc60a315892d07 | # Licensed under a 3-clause BSD style license
import os
from setuptools import Extension
SRC_DIR = os.path.join(os.path.dirname(__file__), "src")
def get_extensions():
return [
Extension(
"astropy.io.fits._tiled_compression._compression",
sources=[
os.path.join(... |
264c4cad62facd7c4de96f3b01d965c5423c408ae246f6859d5bf0f4cd398646 | """
This module contains low level helper functions for compressing and
decompressing buffer for the Tiled Table Compression algorithms as specified in
the FITS 4 standard.
"""
import sys
import numpy as np
from astropy.io.fits.hdu.base import BITPIX2DTYPE
from .codecs import PLIO1, Gzip1, Gzip2, HCompress1, Rice1
... |
f735675152455814b189c7a038a9d6d5643b7e5d58b8b14dd51e5f15da678808 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import contextlib
import csv
import operator
import os
import re
import sys
import textwrap
import warnings
from contextlib import suppress
import numpy as np
from numpy import char as chararray
# This module may have many dependencies on astropy.io.fit... |
efc532120cd5fee844c842e4548f152ea13b9bb3245510cf3a782b68142d80b0 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import ctypes
import gc
import itertools
import math
import re
import time
import warnings
from contextlib import suppress
import numpy as np
from astropy.io.fits import conf
from astropy.io.fits._tiled_compression import compress_hdu, decompress_hdu
fro... |
e8c497358a769afe2f70df3666eb2db047ac4bcf79c4ff6257b80edd15d62323 | # 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 Parameter, signature
import numpy as np
from astropy.io.fits import conf
from astropy.io.fits.file import _File
from astropy.io.fits.header import H... |
723ec0036e7099dced2910f1323eeae9319a3cee8562867067a9aec841a4f58d | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import contextlib
import copy
import gc
import pickle
import re
import sys
import warnings
import numpy as np
import pytest
from numpy import char as chararray
try:
import objgraph
HAVE_OBJGRAPH = True
except ImportError:
HAVE_OBJGRAPH = Fal... |
519b1ebd6bbe7f100eb15521b6e56d3459c25c2635e4735bee52d0eeee56d2bd | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import collections
import copy
import warnings
from io import BytesIO, StringIO
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.card import _pad
from astropy.io.fits.header import _pad_length
from astropy.io.fits.util im... |
de4112c94d0fe7c76985d39b9f2962edd318d6589054101d150fdf9abc3bed3a | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import math
import os
import re
import time
import numpy as np
import pytest
from numpy.testing import assert_equal
from astropy.io import fits
from astropy.io.fits.hdu.compressed import DITHER_SEED_CHECKSUM, SUBTRACTIVE_DITHER_1
from astropy.utils.data ... |
14d9eb617260fd735ea4e6f41d608f93e840e2a9bd1b3f0f82f90144298a4982 | import itertools
import numpy as np
import pytest
COMPRESSION_TYPES = [
"GZIP_1",
"GZIP_2",
"RICE_1",
"HCOMPRESS_1",
"PLIO_1",
]
def fitsio_param_to_astropy_param(param):
# Convert fitsio kwargs to astropy kwargs
_map = {"qlevel": "quantize_level", "qmethod": "quantize_method"}
param... |
b2b072791d8ddaf71bd1d94aae47360cf6a930e8438963c8b3c2b88d4dceca04 | from pathlib import Path
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
from astropy.io import fits
from astropy.io.fits._tiled_compression.codecs import PLIO1
from .conftest import fitsio_param_to_astropy_param
@pytest.fixture
def canonical_data_base_path():
return Pa... |
e23523f5669049e670f1c544371b2a24dc2b9894b78a3232314184d2a5253b75 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
asdf = pytest.importorskip("asdf")
import numpy as np
from asdf.tags.core.ndarray import NDArrayType
from asdf.tests import helpers
from packaging.version import Version
import astropy.units as u
from astropy import table
from astropy.coo... |
91ad634589321411f9345a0b8b03d11fdbb24b1602b0f77bf3796258b08d69d8 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
asdf = pytest.importorskip("asdf")
import os
import numpy as np
from asdf.tests import helpers
from astropy.io import fits
from astropy.io.misc.asdf.tags.tests.helpers import run_schema_example_test
@pytest.mark.filterwarnings(
"ig... |
5767726f971a7575cdc90762e910fd11742c00d6ac82d7eff1776625709b2caa | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains simple statistical algorithms that are
straightforwardly implemented as a single python function (or family of
functions).
This module should generally not be used directly. Everything in
`__all__` is imported into `astropy.stats... |
3dc70d55c9ef497b47aafdde501474944db6dbb3430fb52c483d51a15ef393a1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import sys
import types
import warnings
import weakref
from collections import OrderedDict, defaultdict
from collections.abc import Mapping
from copy import deepcopy
import numpy as np
from numpy import ma
from astropy import log
from as... |
22e0e644bcfa5eadbe3c3eb55abbf01c7470031a525e1fb7070a148d8d7dd09d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Mathematical models."""
# pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name
import numpy as np
from astropy import units as u
from astropy.units import Quantity, UnitsError
from .core import Fittable1DModel, Fittable2DMo... |
3736ad7fb53e9e3878831989e1fa82d30ef16f79f999e0cddf139aeb0b638d50 | # 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.
"""
# STDLIB
import numbers
import operator
i... |
7d5a79087c536fec9ae67a698f1859c69a5b8902678a62f935c059102ab45333 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import collections
import json
import socket
import urllib.error
import urllib.parse
import urllib.request
from warnings import warn
import erfa
import numpy as np
from astropy import constants as consts
from astropy import units as u
from astropy.units... |
bc2faeaf4fffd5cf33f72e6538c0a4fc0f6797c771cdc8a573b6a99fadd2bbbc | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import base64
import contextlib
import errno
import hashlib
import io
import itertools
import os
import pathlib
import platform
import random
import shutil
import stat
import sys
import tempfile
import urllib.error
import urllib.parse
import urllib.reques... |
b24da1a951a6f34db5ac5b816cdbf8bf484e49bf3bdf3c573e8eba4ce72f9617 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test all functions covered by __array_function__.
Here, run through all functions, with simple tests just to check the helpers.
More complicated tests of functionality, including with subclasses, are done
in test_functions.
TODO: finish full coverage ... |
504154abb73956d6c6437a9b64d984b26ec80a097d3486a03796d90b382bf671 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from collections import defaultdict
from functools import partial
import numpy as np
from matplotlib import rcParams
from matplotlib.artist import Artist
from matplotlib.axes import Axes, subplot_class_factory
from matplotlib.transforms import Affine2D, ... |
1fc8c506a90a15f25057f5b1cbfa2c9b119385fcb6f82659c8569b738bf79ecc | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pickle
import textwrap
from collections import OrderedDict
from itertools import chain, permutations
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from astropy import units as u
from astropy.nddata import NDDataAr... |
1865401c13660bbaa8bea15f9edd10ce1c2e56770ef67fd093bf6c8ec90fa2bb | # 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
#... |
b3ad6bd98e655436652d2f0a64ac5eb02580e1961abc6db8af2acd626aac097e | # Licensed under a 3-clause BSD style license. See LICENSE.rst except
# for parts explicitly labelled as being (largely) copies of numpy
# implementations; for those, see licenses/NUMPY_LICENSE.rst.
"""Helpers for overriding numpy functions.
We override numpy functions in `~astropy.units.Quantity.__array_function__`.
... |
b95a3845529e6e6ff3835cc9dc398f3b694e842a296ebfe5054bdfdcc0b39715 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Regression tests for the units.format package
"""
import warnings
from contextlib import nullcontext
from fractions import Fraction
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy import units as u
from astropy... |
766688c4d7c8479efcd551b32e8fe1fb57a6b2e05059a755538e0e5b82a7d56f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import inspect
import itertools
import numpy as np
import numpy.lib.recfunctions as rfn
import pytest
from numpy.testing import assert_array_equal
from astropy import units as u
from astropy.units.quantity_helper.function_helpers import (
ARRAY_FUNCT... |
43c36ec4aeedb6bacd7f6364218116d6335ef3d5f1a0a6ef2dd316b8c2a987e8 | # The purpose of these tests are to ensure that calling ufuncs with quantities
# returns quantities with the right units, or raises exceptions.
import concurrent.futures
import dataclasses
import warnings
from collections import namedtuple
import numpy as np
import pytest
from erfa import ufunc as erfa_ufunc
from num... |
b2c0e86f3fb2457e8abc50c4675a4dbe9b4a34d9d27764c6c3c6347435a7535f | import os
from urllib.error import HTTPError, URLError
import numpy as np
import pytest
from astropy import units as u
from astropy.constants import c
from astropy.coordinates.builtin_frames import TETE
from astropy.coordinates.earth import EarthLocation
from astropy.coordinates.funcs import get_sun
from astropy.coor... |
d9d2def56a3a07206e46918985917771697d6c44f7829d441cc28df3631cb782 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Accuracy tests for GCRS coordinate transformations, primarily to/from AltAz.
"""
import os
import warnings
from importlib import metadata
import erfa
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import (
... |
d26bb9167d1c38a4be4983e26984c16018d5545d71af419fadc37fd8a61b1b9f | import pytest
from astropy import units as u
from astropy.coordinates import EarthLocation, Latitude, Longitude
from astropy.coordinates.sites import (
SiteRegistry,
get_builtin_sites,
get_downloaded_sites,
)
from astropy.tests.helper import assert_quantity_allclose
from astropy.units import allclose as qu... |
c008ea802ff270187a11fef0f7572129e3a2c56c7444d3d734677079e62f5c35 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import collections
import copy
import warnings
from io import BytesIO, StringIO
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.card import _pad
from astropy.io.fits.header import _pad_length
from astropy.io.fits.util im... |
8b5c833ecd3250aa003cb211563d95be9b2a5339d82e4f45041d705ba89df187 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import math
import os
import re
import time
from io import BytesIO
from itertools import product
import numpy as np
import pytest
from hypothesis import given
from hypothesis.extra.numpy import basic_indices
from numpy.testing import assert_equal
from as... |
fe7f62ebb95ab972f904b2a72a453c31b8ed289470e2cd571d52b2bf71edc960 | """
This test file uses the https://github.com/esheldon/fitsio package to verify
our compression and decompression routines against the implementation in
cfitsio.
*Note*: The fitsio library is GPL licensed, therefore it could be interpreted
that so is this test file. Given that this test file isn't imported anywhere
... |
bf0e5af206388b7d5e9b179a9cd4204f394d2d7e5a6fb1dfbe225dca0b1edb7b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
from functools import partial
import numpy as np
from astropy import units as u
from astropy.modeling.convolution import Convolution
from astropy.modeling.core import SPECIAL_OPERATORS, CompoundModel
from astropy.nddata import support_nd... |
f4413e9e9b7b20b1e5a8cc9137198611f58908c6ca90faa93f13b3543a18f568 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test all functions covered by __array_function__.
Here, run through all functions, with simple tests just to check the helpers.
More complicated tests of functionality, including with subclasses, are done
in test_functions.
TODO: finish full coverage ... |
d8710a5338dee4bdfc02317ed49d4f5d98308c941394ab47a199740aed331ec1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import inspect
import itertools
import numpy as np
import numpy.lib.recfunctions as rfn
import pytest
from numpy.testing import assert_array_equal
from astropy import units as u
from astropy.units.quantity_helper.function_helpers import (
ARRAY_FUNCT... |
6a0283eb80e89ff3d5735eae961b9060fa73a6218bacd1a252e1809059150e8d | from contextlib import nullcontext
import numpy as np
import pytest
from numpy.testing import assert_allclose
import astropy.units as u
from astropy import time
from astropy.constants import c
from astropy.coordinates import (
FK5,
GCRS,
ICRS,
CartesianDifferential,
CartesianRepresentation,
Ea... |
ccbfbeb3988e8efd6e6bc67fa1930d5d8b2d9180f9cbe96dcc40d7fd12914f8b | # 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 configuration values have a default... |
76104fa698fb5ad8aa9126e643b06fdb2472667deaed34bc0aeec310cc235856 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains simple functions for dealing with circular statistics, for
instance, mean, variance, standard deviation, correlation coefficient, and so
on. This module also cover tests of uniformity, e.g., the Rayleigh and V tests.
The Maximum L... |
ca25f89e1f0562ed0980c50d75720c1aee16b806760d41d089645e7841562612 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains simple statistical algorithms that are
straightforwardly implemented as a single python function (or family of
functions).
This module should generally not be used directly. Everything in
`__all__` is imported into `astropy.stats... |
718678c3a4213632c608342f7873654a5ed8330adaf7d715c8690836d4818fcf | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
"""
This module defines 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 operator
impo... |
d811a2b8680febb111a4890ecc8d9367940a1b206b49fefb517bdfd1730dc6b2 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module is to contain an improved bounding box.
"""
from __future__ import annotations
import abc
import copy
import warnings
from collections import namedtuple
from typing import Any, Callable
import numpy as np
from astropy.units import Quan... |
c974544c5f5736ef5a533ba42f3809e21197a69c0a829fbb027c6787b1bb3bdf | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Mathematical models."""
# pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name
import warnings
import numpy as np
from astropy import units as u
from astropy.units import Quantity, UnitsError
from astropy.utils.compat.optio... |
bfe5a9f41badcd8cd8b79f044735231a291f385969755c70eb074b3ef6bc539c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
"""
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 out... |
e5488c90ddefeecbc72ca86aae400650dfc404ac735b481ef4a122a204b2621d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains models representing polynomials and polynomial series.
"""
# pylint: disable=invalid-name
from math import comb
import numpy as np
from astropy.utils import check_broadcast, indent
from .core import FittableModel, Model
from .f... |
43c11a74c8244a388212fbdece878784468f270e30367f6281d7c6f3c13f539a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Models that have physical origins.
"""
# pylint: disable=invalid-name, no-member
import warnings
import numpy as np
from astropy import constants as const
from astropy import units as u
from astropy.utils.exceptions import AstropyUserWarning
from .... |
f6271f3d0b1bd17fe7ed20f5bb79b15678b86bc7b5e64803d8e14688ff011e83 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Power law model variants.
"""
# pylint: disable=invalid-name
import numpy as np
from astropy.units import Magnitude, Quantity, UnitsError, dimensionless_unscaled, mag
from .core import Fittable1DModel
from .parameters import InputParameterError, Para... |
a7cef9efa2a792eb384bd48867f07b61025c53e3a81e2509878103a91ca37de3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import os
import queue
import select
import socket
import threading
import time
import uuid
import warnings
import xmlrpc.client as xmlrpc
from urllib.parse import urlunparse
from astropy import log
from .constants import SAMP_STATUS_OK, __... |
86f5fb17da166062176d333e260fb1cfeebefd083ea8b70f024b20cffa863494 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
__all__ = ["quantity_input"]
import inspect
import typing as T
from collections.abc import Sequence
from functools import wraps
from numbers import Number
import numpy as np
from .core import (
Unit,
UnitBase,
UnitsError,
add_enabled_eq... |
3a5b1737aa933864f2d6c005d39de0b7e19907b715ae3546c981837198033eba | # 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.
"""
# STDLIB
import numbers
import operator
i... |
c408a42866c27f74eb2ac3581385404b232d541f3083477a4cc59ff72b0482ab | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains the fundamental classes used for representing
coordinates in astropy.
"""
import functools
from collections import namedtuple
import numpy as np
from astropy import units as u
from astropy.utils import isiterable
from . import... |
bee1c21706d21278bda1735d9ce7ff2773f11ecf8c10e59d92a4ec2b8e87339f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import annotations
import abc
import inspect
from typing import TYPE_CHECKING, Any, TypeVar
import numpy as np
from astropy.io.registry import UnifiedReadWriteMethod
from astropy.utils.decorators import classproperty
from astropy.utils.... |
48388fad9c881b092b77e62be86961684094e00c8601a7d1d8d83c0ee8afa20a | import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
from astropy import units as u
from astropy.stats.circstats import (
_length,
circcorrcoef,
circmean,
circmoment,
circvar,
rayleightest,
vonmisesmle,
vtest,
)
from astropy.utils.compat.optional_deps... |
2bb9537a9bfe662d248fd3e33ad3dd8bdb65b7a362f272d4bae625c3b3df3df7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests that relate to using quantities/units on parameters of models.
"""
import numpy as np
import pytest
from astropy import coordinates as coord
from astropy import units as u
from astropy.modeling.core import Fittable1DModel, InputParameterError
f... |
7b227494173713593c812ce36ba1099378a2ec999d9e37a80ff676d859f50468 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests models.parameters
"""
# pylint: disable=invalid-name
import functools
import itertools
import unittest.mock as mk
import numpy as np
import pytest
from astropy import units as u
from astropy.modeling import fitting, models
from astropy.modelin... |
954df382e9e4fc25355d4aa0f83a66c5bde62102783b664991f131489bb69593 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
# By default, tests should not use the internet.
from astropy.samp import SAMPWarning, conf
from astropy.samp.client import SAMPClient
from astropy.samp.hub import SAMPHubServer
from astropy.samp.hub_proxy import SAMPHubProxy
from astropy.s... |
f190e1a623f64bf4e8579ced024b3b86e898c3ff0fdb1a6ebec1e0d3b9322ba4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
from contextlib import nullcontext
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pytest
from matplotlib.contour import QuadContourSet
from packaging.version import Version
from astropy import units as u
from ... |
afcbce1fdf4b6d2976b3a330c84f7b8f5df829230794e40c2c859952c1f32434 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from matplotlib import rc_context
from numpy.testing import assert_almost_equal
from astropy import units as u
from astropy.tests.helper import assert_quantity_allclose
from astropy.units import UnitsError
from astropy.vi... |
4fea0133504229082f8734feac982e2fc60d28c42603f63f74f254a495b5c249 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import typing as T
# THIRD PARTY
import pytest
# LOCAL
from astropy import units as u
from astropy.units import Quantity
def test_ignore_generic_type_annotations():
"""Test annotations that are not unit related are ignored.
This test... |
fb3e774424427a32c68709a026e3a3fd8cac1f634c7462d74c1a5649fec95062 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test the Quantity class and related."""
from typing import Annotated, Any, Optional, Union, get_args, get_origin, get_type_hints
import numpy as np
from astropy import units as u
class TestQuantityTyping:
"""Test Quantity Typing Annotations."""... |
2d7b66b3250c90e969313e2d7f9265e38d7ce95ae3a919341693ce79beae2b23 | # The purpose of these tests are to ensure that calling ufuncs with quantities
# returns quantities with the right units, or raises exceptions.
import concurrent.futures
import dataclasses
import warnings
from collections import namedtuple
import numpy as np
import pytest
from erfa import ufunc as erfa_ufunc
from num... |
2300d794d0ca5166335f6d896c7f160133858585bdc5de91b07efc5449fd0601 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import typing
# THIRD PARTY
import numpy as np
import pytest
# LOCAL
from astropy import units as u
# list of pairs (target unit/physical type, input unit)
x_inputs = [
(u.arcsec, u.deg),
("angle", u.deg),
(u.kpc / u.Myr, u.km / u.... |
92bd8a587f6c79692c4341408371bb888a5691f22c39b4776d2ec408a10676a1 | """
Tests the Angle string formatting capabilities. SkyCoord formatting is in
test_sky_coord
"""
import pytest
from astropy import units as u
from astropy.coordinates.angles import Angle
def test_to_string_precision():
# There are already some tests in test_api.py, but this is a regression
# test for the bu... |
df65f87a3b832d2f61d50bedef02e14ac4ba93f8a7eb85d11cd12a188d40e4cf | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initialization and other aspects of Angle and subclasses"""
import pickle
import threading
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
import astropy.units as u
from astropy.coordinates.angles i... |
ffacf702ceb065f0e7b79956d6f1d42c84c039fa314b72e85502e9a92cfaeb65 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import copy
import numbers
import operator
import re
import sys
import warnings
import weakref
from collections import OrderedDict
from contextlib import suppress
from functools import reduce
import numpy as np
from numpy import char as chararray
from as... |
d7cc40f8a3879b311bce63974188f38fcb84ec0bf9a3902259626d2f581d80a6 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains functions for reading and writing QDP tables that are
not meant to be used directly, but instead are available as readers/writers in
`astropy.table`. See :ref:`astropy:table_io` for more details.
"""
import copy
import re
import w... |
9fce3956afbe5f4fbf68733b31a7865ccbef510a5b493e9ec5a5fa59c3078534 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains functions for reading and writing Parquet
tables that are not meant to be used directly, but instead are
available as readers/writers in `astropy.table`. See
:ref:`astropy:table_io` for more details.
"""
import os
import warning... |
115c0214acdd6fac707bfd285fcd06f14bbe97dddfb0e351abc01e89277c36df | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import ctypes
import itertools
import math
import re
import time
import warnings
from contextlib import suppress
import numpy as np
from astropy.io.fits import conf
from astropy.io.fits._tiled_compression import compress_hdu, decompress_hdu_section
from ... |
84db7806143d123f8ce570385c98e0db026b9c64a3d8482761ff7c0c9d59e718 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import contextlib
import copy
import gc
import pickle
import re
import sys
import warnings
import numpy as np
import pytest
from numpy import char as chararray
try:
import objgraph
HAVE_OBJGRAPH = True
except ImportError:
HAVE_OBJGRAPH = Fal... |
215053a4e3d1c234ad0509c5e896d01ef25e242261c77ad3d1f2c3dcf46103e1 | import gc
import warnings
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from astropy import units as u
from astropy.io import fits
from astropy.io.fits import (
BinTableHDU,
HDUList,
ImageHDU,
PrimaryHDU,
connect,
table_to_hdu,
)
from astropy.io... |
27770300868866c8c1102e2e46628da274671a95f1d57f14e57cda23ddfcf481 | import numpy as np
import pytest
from astropy.io import ascii
from astropy.io.ascii.qdp import _get_lines_from_file, _read_table_qdp, _write_table_qdp
from astropy.table import Column, MaskedColumn, Table
from astropy.utils.exceptions import AstropyUserWarning
def test_get_tables_from_qdp_file(tmp_path):
example... |
a494da99e2c04cf7f4356caf9011041862c60b0cd97a07a3d25d5be6c25f03df | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import (
Angle,
CartesianRepresentation,
EarthLocation,
Latitude,
Longitude,
SkyCoord,
SphericalCosLatDifferential,
SphericalRepresen... |
526ad9f93f0e746d5bbc180bbce3f63cce71c2eb7063b282e7721920d226afe5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Comparison functions for `astropy.cosmology.Cosmology`.
This module is **NOT** public API. To use these functions, import them from
the top-level namespace -- :mod:`astropy.cosmology`.
This module will be moved.
"""
from __future__ import annotations... |
34fceab0d78311e19ea6e770f4944093028073786a5beb1933450876afeb3d03 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import annotations
import warnings
from abc import abstractmethod
from math import exp, floor, log, pi, sqrt
from numbers import Number
from typing import TYPE_CHECKING, Any, TypeVar
import numpy as np
from numpy import inf, sin
import ... |
461ee8017399414881dd7c1a37527eca85bc5c06b798d674a6fec68f29788780 | # 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/``.
import os
import tempfile
import hypothesis
from astropy import __version__
try:
from pytest_astropy_header.display import... |
96e3740aa5112028edfba18fcceb8f635927816a92c951e43f833fa7c8a73fed | # 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 builtins
import os
import sys
import tempfile
import wa... |
6658a18cc5085ae1d65e417e3e7a2284d5e920cf6403ff2f56d23d6e0008f70c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""This module defines a logging class based on the built-in logging module.
.. note::
This module is meant for internal ``astropy`` usage. For use in other
packages, we recommend implementing your own logger instead.
"""
import inspect
import ... |
93c9a11843bfb33fa31e5b247121d6e092fa28c4f90fa2db978a297b33e11d25 | # 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 configuration values have a default... |
5c9042fdc14da552a85582c43388385474e1c69c247a85c37ac07440ee202bed | """
========================================================================
Transforming positions and velocities to and from a Galactocentric frame
========================================================================
This document shows a few examples of how to use and customize the
`~astropy.coordinates.Galacto... |
1913097fc76662574dac525d431f769da2249397c66f51927c119feed8febbc2 | """
================================================================
Convert a radial velocity to the Galactic Standard of Rest (GSR)
================================================================
Radial or line-of-sight velocities of sources are often reported in a
Heliocentric or Solar-system barycentric reference... |
12d8a8caa71a6c3cfb0ef15847ba72f29ee0da4698cbb661d8d6610d94d84966 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains simple statistical algorithms that are
straightforwardly implemented as a single python function (or family of
functions).
This module should generally not be used directly. Everything in
`__all__` is imported into `astropy.stats... |
514d302adf93d056a62e753a15ba44cb658c192f517800d1840c3a6181999e5c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Methods for selecting the bin width of histograms.
Ported from the astroML project: https://www.astroml.org/
"""
import numpy as np
from .bayesian_blocks import bayesian_blocks
__all__ = [
"histogram",
"scott_bin_width",
"freedman_bin_... |
d973e93773f276e307f5b8398ca9b876ee3f52868147f0badb4295b56da5c0ba | """
Table property for providing information about table.
"""
import os
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
from contextlib import contextmanager
import numpy as np
from astropy.utils.data_info import DataInfo
__all__ = ["table_info", "TableInfo", "serialize_method_as"]
def ... |
1aede49d4d5a16ba646c56102ee1ef4ee1cf37c26363159c015051c172c0cb30 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Indexing for Table columns.
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, r... |
94457f026de4e31db816d9036f34fa1a7891004ebd3b34494253e9cb359ad8c1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import collections
from collections import OrderedDict
from operator import index as operator_index
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 a... |
b8a0c8dfc3b4a5e2c35fe690a760e417986d651fe86b7a542efe4d5af5f1ca50 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import platform
import warnings
import numpy as np
from astropy.utils.exceptions import AstropyUserWarning
from .index import get_index_by_names
__all__ = ["TableGroups", "ColumnGroups"]
def table_group_by(table, keys):
# index copies are unnece... |
95e9cc344bc97ff7b3093a9d785c655b65bf14f493f897afc5c61b7ad9616e7a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import sys
import types
import warnings
import weakref
from collections import OrderedDict, defaultdict
from collections.abc import Mapping
from copy import deepcopy
import numpy as np
from numpy import ma
from astropy import log
from as... |
70ee8ac78ab97b628b1ae9099a51598e5625e32dc14d6a2499c728f07b2362a0 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import astropy.config as _config
from astropy.utils.compat import optional_deps
from .column import Column, ColumnInfo, MaskedColumn, StringTruncateWarning
__all__ = [
"BST",
"Column",
"ColumnGroups",
"ColumnInfo",
"Conf",
"JSVie... |
2dd6ba656c766994130af5c04d95a05d68bcbe5d2305a4f8fa68722b2acd39d4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import warnings
import weakref
from copy import deepcopy
import numpy as np
from numpy import ma
from astropy.units import Quantity, StructuredUnit, Unit
from astropy.utils.console import color_print
from astropy.utils.data_info import ... |
66dc43b7328a5ae239eafe443d463af8c641280cd510cf37160c8600fb0996f1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import operator
__all__ = ["BST"]
class MaxValue:
"""
Represents an infinite value for purposes
of tuple comparison.
"""
def __gt__(self, other):
return True
def __ge__(self, other):
return True
def __lt__(... |
803e2b03a3ef7d53638c74087331e08bc5df8b7dd8ec98c9cf711aca338834c5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from collections import OrderedDict
from copy import deepcopy
from importlib import import_module
import numpy as np
from astropy.units.quantity import QuantityInfo
from astropy.utils.data_info import MixinInfo
from .column import Column, MaskedColumn
f... |
013e011beb275a1e3580d0ceabd928bfba824149cc1730177f37de938fa0a104 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Helper functions for table development, mostly creating useful
tables for testing.
"""
import string
from itertools import cycle
import numpy as np
from astropy.utils.data_info import ParentDtypeInfo
from .table import Column, Table
class Timin... |
90d417f5311f7cdfe647dea11b504d8cb7944b71cff945e645a9a5234c2017e8 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import math
import numpy as np
from astropy.modeling import models
from astropy.modeling.core import Fittable1DModel, Fittable2DModel
from .core import Kernel, Kernel1D, Kernel2D
from .utils import KernelSizeError, has_even_axis
__all__ = [
"Gauss... |
6dafe0e2d2907b3369dee2efa26a3dcf2aae4861239242a5a33e464ae866f035 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains the convolution and filter functionalities of astropy.
A few conceptual notes:
A filter kernel is mainly characterized by its response function. In the 1D
case we speak of "impulse response function", in the 2D case we call it "po... |
7782de68d4c25dbf4921d0233d0fd893793905bff864bbc6bc8e6f4a807f3471 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from astropy.modeling.core import Model, custom_model
__all__ = [
"discretize_model",
"KernelError",
"KernelSizeError",
"KernelArithmeticError",
]
class KernelError(Exception):
"""
Base error class for kernel ... |
b01b23ef161d616dabe7d8567fecc757e87168fd41449710228cfb7548e0aa57 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
from functools import partial
import numpy as np
from astropy import units as u
from astropy.modeling.convolution import Convolution
from astropy.modeling.core import SPECIAL_OPERATORS, CompoundModel
from astropy.nddata import support_nd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.