hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
69d8b2edb245bf38aa3a621d59fc4090de73de7f1552f04d642dd90765df408c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains a helper function to fill erfa.astrom struct and a
ScienceState, which allows to speed up coordinate transformations at the
expense of accuracy.
"""
import warnings
import erfa
import numpy as np
import astropy.units as u
from as... |
d2b95730b9d81e7150425f84c9121c2379d586eac45f96dd7d3a20886b1f0e1e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# Standard library
import re
import textwrap
import warnings
from datetime import datetime
from urllib.request import Request, urlopen
# Third-party
from astropy import time as atime
from astropy.utils.console import _color_text, color_print
from .func... |
4b2d5fc7a2fd51841bb0b65a210eb2ee3aa9f569686613be7fce6c766ae58fa4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains standard functions for earth orientation, such as
precession and nutation.
This module is (currently) not intended to be part of the public API, but
is instead primarily for internal use in `coordinates`
"""
import erfa
import ... |
3a2d8c4b82fd555d40f3906a090a893b6c08f7d5f012e39d8f7938c1e6fa3655 | """Implements the wrapper for the Astropy test runner.
This is for backward-compatibility for other downstream packages and can be removed
once astropy-helpers has reached end-of-life.
"""
import os
import shutil
import stat
import subprocess
import sys
import tempfile
from contextlib import contextmanager
from setu... |
6f7df7e8d7d7c4120544ad3129df3945c2341b4903af0a89fe6c4428c4efcb72 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import importlib
import locale
import logging
import sys
import warnings
import pytest
from astropy import log
from astropy.logger import LoggingError, conf
from astropy.utils.exceptions import AstropyUserWarning, AstropyWarning
# Save original values ... |
64b64195a6f68418557c8ac0579a629e27dc08a8b7c729ead7ded1f665b31e62 | """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 ... |
07a5f9ea31713c3d33e509cf146513a095808562ec132a8c6e021ec1f4f3c87a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides the tools used to internally run the astropy test suite
from the installed astropy. It makes use of the `pytest`_ testing framework.
"""
import functools
import inspect
import os
import pickle
import sys
import warnings
import py... |
21f4b9d26fe94e1c7f21a16ea8fa317ff5aa481e4dd44f66406229351c8e6d87 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from copy import deepcopy
import numpy as np
from astropy import units as u
from astropy.table import QTable, Table, groups
from astropy.time import Time, TimeDelta
from astropy.timeseries.core import BaseTimeSeries, autocheck_required_columns
from astr... |
4cac07b66bb678e70e7b9021bd16c63ce9753d4dd258b8eebb971a11d154b44b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
from astropy import units as u
from astropy.time import Time, TimeDelta
from astropy.timeseries.binned import BinnedTimeSeries
from astropy.timeseries.sampled import TimeSeries
from astropy.utils.exceptions import Astr... |
3e65aa0c695bef7c5df2b2cc25b7cf3ae22e9fcf28fdd78ca43fffe1dd3aeb49 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from contextlib import contextmanager
from functools import wraps
from types import FunctionType
from astropy.table import QTable
__all__ = ["BaseTimeSeries", "autocheck_required_columns"]
COLUMN_RELATED_METHODS = [
"add_column",
"add_columns",... |
686cea3b3b58908c27db754e3ce2b473c9fe72236d759c7b5663703fa561081f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage contains classes and functions for work with time series.
"""
from astropy.timeseries import io
from astropy.timeseries.binned import *
from astropy.timeseries.core import *
from astropy.timeseries.downsample import *
from astropy.tim... |
adadc3ed511222a79b709206e30226092340d950ba6f3dea476b74d14e479a3a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from copy import deepcopy
import numpy as np
from astropy import units as u
from astropy.table import QTable, Table, groups
from astropy.time import Time, TimeDelta
from astropy.timeseries.core import BaseTimeSeries, autocheck_required_columns
from astr... |
66b73e243bac684a661ea59862785e3834488f4916a95fbe51a01d1cffaeb061 | # 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
# ASTRONOMICAL CONSTANTS
class IAU2012(Constant):
defau... |
7f0702be20c7cb7c44fc45bcbdd5ec373e7e560e5e34d477e421f727423505ad | # 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)... |
fb6138ebebd4e766de14a4c1faf228ada96a63c1e040dfff6177563d45798353 | # 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_... |
32971fb0548a3279045d30285b3292f480d1b824e2b18c003b014d626db83ae8 | # 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 CODATA2010(Constant)... |
764430d977f841b67544628b1d147dd6d011122f0001b8a65982cde0dedcc1bc | # 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 .config import codata
from .constant import Constant
# ASTRONOMICAL CONSTANTS
class I... |
8b7943d33c078bf620dd373fd732b9283f4634bc30a117acd3e0689899cae2b6 | # 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.p... |
ce632f9c2bdbaa1fe7644e684b2376a02ff54ae1da672ae4771ef1a2e8058f9c | # 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.
"""
import warnings
from astropy.utils import find_current_module
from . import codata2014, iau2015
from . impor... |
a417ea64bff35f0f09ee69a0cfea32b3ff669686a954d104e0e50ccc866a466f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Utility functions for ``constants`` sub-package."""
import itertools
__all__ = []
def _get_c(codata, iaudata, module, not_in_module_only=True):
"""
Generator to return a Constant object.
Parameters
----------
codata, iaudata : ob... |
118858d84f033158452e67f5588d342c35b9e5dd8d47317db6ce958996c1f0a3 | # 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 .config import codata, iaudata
from .constant import Constant
for _nm, _c in itertools.ch... |
49f7a868431111aeea8ae27157738073ff886833bebd5012a7c1522f976186aa | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import types
import warnings
import numpy as np
from astropy.units.core import Unit, UnitsError
from astropy.units.quantity import Quantity
from astropy.utils import lazyproperty
from astropy.utils.exceptions import AstropyUserWarning
... |
cfd1fa234ae1b5b9191509532398c84268d5de6b9a27766f1daeff1473a51e50 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Astronomical and physics constants for Astropy v4.0.
See :mod:`astropy.constants` for a complete listing of constants defined
in Astropy.
"""
import warnings
from astropy.utils import find_current_module
from . import codata2018, iau2015
from . impor... |
7d783d62bdbf2c9adba29024d1472e563fd1c2970177e0eb6f66578b5b968708 | # 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 .config import codata, iaudata
from .constant import Constant
for _nm, _c in itertools.cha... |
a675b255df6b40c6bfbf1566802219440235a21b664e0ec2d6348e5d69a4cd97 | # 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/2019... |
321e5b1b8e8f323a427f0cfa9ec1a9356d45765ee640b3b1de8136169cd48737 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.cosmology import units as cu
from astropy.io import registry as io_registry
from astropy.units import add_enabled_units
__all__ = [
"CosmologyRead",
"CosmologyWrite",
"CosmologyFromFormat",
"CosmologyToFormat",
]
__doctest_sk... |
03859b07ab290afe0dafc97da29ba73c25565b937a8e67d8b74f748edfee5c58 | # 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, Mapping, TypeVar
import numpy as np
from astropy.io.registry import UnifiedReadWriteMethod
from astropy.utils.decorators import classproperty
from astro... |
b69028611483c8b5e56a1b458e9da03568246e336b89d9768395d38187dfaef5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
""" astropy.cosmology contains classes and functions for cosmological
distance measures and other cosmology-related calculations.
See the `Astropy documentation
<https://docs.astropy.org/en/latest/cosmology/index.html>`_ for more
detailed usage examples a... |
632549413dfbe7c3b64a2a5c2b28d923fcb8d40c035125cc2c9b85ee56306ed1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import astropy.units as u
from astropy.utils.decorators import deprecated_attribute, deprecated_renamed_argument
__all__ = ["Parameter"]
class Parameter:
r"""Cosmological parameter (descriptor).
Should only be used with a :class:`... |
790452b8ebef97c19c836b27903e96157ded873ab48ed303d6d249fdefc8d09a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
from math import inf
from numbers import Number
import numpy as np
from astropy.units import Quantity
from astropy.utils import isiterable
from astropy.utils.decorators import deprecated
from . import units as cu
__all__ = [] # nothi... |
63ef09f9e2289758632c9eafca439b587585fa364fb64b5864177a67e80a2c2a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Cosmological units and equivalencies.
""" # (newline needed for unit summary)
import astropy.units as u
from astropy.units.utils import generate_unit_summary as _generate_unit_summary
__all__ = [
"littleh",
"redshift",
# redshift equival... |
a0a10fe8cc5ef7744d51ee275cc108905ee6dbc108b290d221e02401a44b4dc3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import pathlib
import sys
from typing import Optional, Union
# LOCAL
from astropy.utils.data import get_pkg_data_path
from astropy.utils.decorators import deprecated
from astropy.utils.state import ScienceState
from .core import Cosmology
_COS... |
88384c8d1c0cf0066c2ca2f83d5807bc40ce22a113abe92608b14ef06ea98391 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# The BoxLeastSquares periodogram functionality has been moved to
# astropy.timeseries.periodograms.bls. The purpose of this file is to provide backward-
# compatibility during a transition phase. We can't emit a deprecation warning
# simply on import of ... |
a661da62b0b4aedc40287980e860fb55246b0d3397f7b87a850b4733e674e65d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
from astropy.stats.jackknife import jackknife_resampling, jackknife_stats
from astropy.utils.compat.optional_deps import HAS_SCIPY
def test_jackknife_resampling():... |
f689da31a0d69594f6a8e3a88d385dcd95de35586575ad2c8a7162c1786a06f8 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy.stats import (
calculate_bin_edges,
freedman_bin_width,
histogram,
knuth_bin_width,
scott_bin_width,
)
from astropy.utils.compat.optional_deps imp... |
3389bf80b51d022c4a1c11fbed87fbeea34e733bbca32985b6bc547b6e063f7e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
from astropy import units as u
from astropy.stats import mad_std
from astropy.stats.sigma_clipping import SigmaClip, sigma_clip, sigma_clipped_stats
from astropy.uti... |
59cb765d82bcd4d8dfc7c79f101ec34bf7e37b836885b13a4fde368ee4a2614f | from numpy.testing import assert_allclose
from astropy.stats.info_theory import (
akaike_info_criterion,
akaike_info_criterion_lsq,
bayesian_info_criterion,
bayesian_info_criterion_lsq,
)
def test_bayesian_info_criterion():
# This test is from an example presented in Ref [1]
lnL = (-176.4, -1... |
5ca1a2327faca5017ea39a7901c17751240acefd74a795452c20c5cd5918ab5a | 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... |
dbd452db128539b6d9ba2b3ea922050c7f2add0e03da59bf0c11888d59274fee | import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy.stats.spatial import RipleysKEstimator
from astropy.utils.misc import NumpyRNGContext
a = np.array([[1, 4], [2, 5], [3, 6]])
b = np.array([[-1, 1], [-2, 2], [-3, 3]])
@pytest.mark.parametrize("points, x_min, x_max", [(a, 0, 10),... |
54c82246278c1007a2971fba0ec9cf76992f1f09ffbcbac571473f1f8441f071 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy.stats import RegularEvents, bayesian_blocks
def test_single_change_point(rseed=0):
rng = np.random.default_rng(rseed)
x = np.concatenate([rng.random(100), 1... |
93dc9f589115e7c01ebe3124d64468593bfd906bc39822bc136fa8cb7f690f27 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
from astropy import units as u
from astropy.stats import funcs
from astropy.utils.compat.optional_deps import HAS_MPMATH, HAS_SCIPY
from astropy.utils.misc import Nu... |
e0d5588fd9514b2b74b328dabdea7a2177d2ab75738bf3db6746967e42c010f6 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_almost_equal_nulp, assert_equal
import astropy.units as u
from astropy.stats.biweight import (
biweight_location,
biweight_midcorrelation,
biweight_midco... |
210cfcd8bdd9626f0b68a1ec3630f02de77551004196bfe0fc3f657453331076 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# The LombScargle periodogram functionality has been moved to
# astropy.timeseries.periodograms.bls. The purpose of this file is to provide backward-
# compatibility during a transition phase. We can't emit a deprecation warning
# simply on import of this... |
1c5b8bd21fe1496707625c077d9fe7038d1872c8abfc5513ddf829a6fc9451c4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
``showtable`` is a command-line script based on ``astropy.io`` and
``astropy.table`` for printing ASCII, FITS, HDF5 or VOTable files(s) to the
standard output.
Example usage of ``showtable``:
1. FITS::
$ showtable astropy/io/fits/tests/data/tabl... |
a4d568a7bc87c8f0db6ecf9b3d403a4b1d746b244451e7d2497495ffb5e8595e | # This module handles the definition of mixin 'handlers' which are functions
# that given an arbitrary object (e.g. a dask array) will return an object that
# can be used as a mixin column. This is useful because it means that users can
# then add objects to tables that are not formally mixin columns and where
# adding... |
a3476ea33d6848d2e54303b23028d0b26ff5f551b9b491a36cc54e650639b39e | import dask.array as da
from astropy.utils.data_info import ParentDtypeInfo
__all__ = ["as_dask_column"]
class DaskInfo(ParentDtypeInfo):
@staticmethod
def default_format(val):
return f"{val.compute()}"
class DaskColumn(da.Array):
info = DaskInfo()
def copy(self):
# Array hard-cod... |
25a18e158beba81020ca2d34e8fbdd5c09699527cff95b04ee2548acefe1317e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy.table.sorted_array import SortedArray
from astropy.table.table import Table
@pytest.fixture
def array():
# composite index
col0 = np.array([x % 2 for x in range(1, 11)])
col1 = np.array([x for x... |
c64a74bb00cbf9259e866ba50479f07056e825abaac206596653c4fe3af81749 | import numpy as np
from astropy.table import np_utils
def test_common_dtype():
"""
Test that allowed combinations are those expected.
"""
dtype = [
("int", int),
("uint8", np.uint8),
("float32", np.float32),
("float64", np.float64),
("str", "S2"),
("uni... |
3c4a446f73145449e3c3a20788e1c553138286717ea1ce6d52984fc52bd38bcf | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import gc
import os
import pathlib
import pickle
import sys
from collections import OrderedDict
from io import StringIO
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from astropy import table
... |
20a707b506411263023f4464307b8fc1c82c8854fd40dcc860b0b7aec1834470 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
from collections import OrderedDict
from copy import deepcopy
from io import StringIO
import numpy as np
import pytest
from astropy import coordinates, table, time
from astropy import units as u
from astropy.table.info import serialize_... |
61e46d3811e887baddd71e1e778b3f60345be11fddc5e04b5c5d42cb4a5b93ff | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
import pytest
from astropy import units as u
from astropy.table import Column, QTable, Row, Table, hstack
from astropy.table.bst import BST
from astropy.table.column import BaseColumn
from astropy.table.index import Sl... |
4ed65f850d01b0bbbaa0bb8a8e07907a5cf126b1e5add24965f63d639f04277e | import textwrap
from os.path import abspath, dirname, join
import pytest
from astropy import extern
from astropy.coordinates import SkyCoord
from astropy.table.table import Table
from astropy.time import Time
from astropy.utils.compat.optional_deps import HAS_BLEACH, HAS_IPYTHON
from astropy.utils.misc import _NOT_OV... |
dfd1d8b50a151ca7eed07f2759c7e303821291d93292f04651a8e3c46a74361c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from collections import OrderedDict, UserDict
from collections.abc import Mapping
import numpy as np
import pytest
import astropy.units as u
from astropy.table import Column, MaskedColumn, Table, TableColumns
class DictLike(Mapping):
"""A minimal ... |
8a554bafe32a8f6afe2fb941b3913ecc1e0425e575fde2494d6b44f37639b3d4 | import os
import re
import numpy as np
import pytest
from astropy.table.scripts import showtable
ROOT = os.path.abspath(os.path.dirname(__file__))
ASCII_ROOT = os.path.join(ROOT, "..", "..", "io", "ascii", "tests")
FITS_ROOT = os.path.join(ROOT, "..", "..", "io", "fits", "tests")
VOTABLE_ROOT = os.path.join(ROOT, ".... |
3a24de35f6c29da5b29da8cc6b33287906030dcb9ba2d015c9e3c2fd645c1936 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy import coordinates, time
from astropy import units as u
from astropy.table import Column, NdarrayMixin, QTable, Table, table_helpers, unique
from astropy.utils.compat import NUMPY_LT_1_22, NUMPY_LT_1_22_1
fro... |
4f10f34763f0d5d8ae4b9a53af7bcfb2996ec07e3583ca6f8323c5f1c2426df7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test behavior related to masked tables"""
import numpy as np
import numpy.ma as ma
import pytest
import astropy.units as u
from astropy.table import Column, MaskedColumn, QTable, Table
from astropy.table.column import BaseColumn
from astropy.time impo... |
7c7e1e53932f566befc75ae4dc0bdcdf31cec9134efb1b8af6e291d6b71cfce5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
""" Verify item access API in:
https://github.com/astropy/astropy/wiki/Table-item-access-definition
"""
import numpy as np
import pytest
@pytest.mark.usefixtures("table_data")
class BaseTestItems:
pass
@pytest.mark.usefixtures("table_data")
clas... |
fc74e14c687414c84e4fde013b4907f097a81bc10f49fe31979fca86f110564f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy import table
from astropy.table import pprint
class MyRow(table.Row):
def __str__(self):
return str(self.as_void())
class MyColumn(table.Column):
pass
class MyMaskedColumn(table.MaskedColumn):
pass
class MyTableCo... |
af24adfc6f8f96ed6a348790a0ca01bc6263cb34203ce08a2b310cfee3533ae0 | import pickle
import numpy as np
from astropy.coordinates import SkyCoord
from astropy.table import Column, MaskedColumn, QTable, Table
from astropy.table.table_helpers import simple_table
from astropy.time import Time
from astropy.units import Quantity, deg
def test_pickle_column(protocol):
c = Column(
... |
a208c8273800d886aa0b4e15641e8ea82f0c8d1d554b187d682feb76f88049c4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
All of the pytest fixtures used by astropy.table are defined here.
`conftest.py` is a "special" module name for pytest that is always
imported, but is not looked in for tests, and it is the recommended
place to put fixtures that are shared between mod... |
5b8cfc86b24def71b72dc71e4022048dfbc5e9e1a1b3ce203b8f662abd94f063 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from collections import OrderedDict
from contextlib import nullcontext
import numpy as np
import pytest
from astropy import table
from astropy import units as u
from astropy.coordinates import (
BaseRepresentationOrDifferential,
CartesianReprese... |
c40cff6f022797f93e061e8551feadb46c4009bdf959f7638a48b5edcf05ebf1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import operator
import warnings
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from astropy import table, time
from astropy import units as u
from astropy.tests.helper import assert_follows_unicode_guidelines
from astropy.... |
9210630cb19e13a1c0cb5e4e41346b39c9b94f046e88599bbff9acec226188f8 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
import numpy as np
import pytest
from astropy import table
from astropy import units as u
from astropy.table import Row
from .conftest import MaskedTable
def test_masked_row_with_object_col():
"""
Numpy < 1.8 has a bug in masked ar... |
09587b474bfdca9bb317fec9e660d92be1b30c7bf17784ec7e8e303435f30e45 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import pickle
from io import StringIO
import numpy as np
import pytest
from astropy import coordinates, time
from astropy import units as u
from astropy.coordinates import EarthLocation, SkyCoord
from astropy.coordinates.tests.helper import... |
a85e620d101e0b66def2c8ff607201b6de4f389746141bcece1fe79a61430e2e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from io import StringIO
import numpy as np
import pytest
from astropy import table
from astropy import units as u
from astropy.io import ascii
from astropy.table import QTable, Table
from astropy.table.table_helpers import simple_table
from astropy.uti... |
09fd5de1065e3408d221e7c68e08461c9d09d654e3f6878e54277a15db39fe43 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy.table.bst import BST
def get_tree(TreeType):
b = TreeType([], [])
for val in [5, 2, 9, 3, 4, 1, 6, 10, 8, 7]:
b.add(val)
return b
@pytest.fixture
def tree():
return get_tree(BST)
r"""
5
... |
e5cee6978896e6f0f123b5a4273b22d3fbf2d6e1164edb751bdf2cfd053f506f | from copy import copy
import pytest
from numpy.testing import assert_equal
from astropy.table import Table
from astropy.table.mixins.registry import (
MixinRegistryError,
_handlers,
get_mixin_handler,
register_mixin_handler,
)
from astropy.table.table_helpers import ArrayWrapper
ORIGINAL = {}
def s... |
b6d0237cc3462c05483a72c078c72b170250b730e6a5c603a8abbce7c5b428be | import numpy as np
import pytest
from numpy.testing import assert_equal
from astropy.table import Table
da = pytest.importorskip("dask.array")
class TestDaskHandler:
def setup_method(self, method):
self.t = Table()
self.t["a"] = da.arange(10)
def test_add_row(self):
self.t.add_row(s... |
6729531b0d4eb835caf8b912ef8e49f57020d7d780b1c72fbc3ab64b6be3e924 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
from contextlib import nullcontext
import numpy as np
import pytest
from numpy.testing import (
assert_allclose,
assert_array_almost_equal_nulp,
assert_array_equal,
)
from astropy import units as u
from astropy.convolution.c... |
e907bc0b35c534bd9e91df35d41858995051e19f23a0f1a0da039575258703ed | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy import convolution as conv
from astropy.tests.helper import check_pickling_recovery, pickle_protocol # noqa: F401
@pytest.mark.parametrize(
("name", "args", "kwargs", "xfail"),
[
(conv.Cust... |
ab063765f755b9858e04ea554a5aa508497c37d5b33287318d1ca7943e0afb90 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy.convolution.convolve import convolve, convolve_fft
from astropy.convolution.kernels import Gaussian2DKernel
from astropy.nddata import NDData
def test_basic_nddata():
arr = np.zeros((11, 11))
arr[5,... |
4bed9fde54bb39ced7b3f2ca39130bb9c5014d2609621b53631396649b6931ed | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_almost_equal
from astropy import units as u
from astropy.convolution.convolve import convolve, convolve_fft
from astropy.convolution.kernels import (
... |
d8b67047eaa34020d6ebd23c76c07c4af020abc41ddbfdca28f87bc72799237c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_almost_equal
from astropy.convolution.convolve import convolve, convolve_fft
from astropy.convolution.kernels import (
AiryDisk2DKernel,
Box1DKer... |
c00a46561acac6f1060dbdbfa34045d0f69898dfa1256d9029907babfda1c081 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy.convolution.utils import discretize_model
from astropy.modeling.functional_models import (
Box1D,
Box2D,
Gaussian1D,
Gaussian2D,
... |
c98ce772fa235454880ac8068f4bacb5ce8821e6d0277a9517b3d55806f92769 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
from contextlib import nullcontext
import numpy as np
import numpy.ma as ma
import pytest
from numpy.testing import (
assert_allclose,
assert_array_almost_equal,
assert_array_almost_equal_nulp,
)
from astropy import units as... |
ba18d1d9a51c6f025d5a42c74d1da9b3e04c2356a9d96e637da04bcce84ace9b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import math
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_almost_equal
from astropy.convolution.convolve import convolve, convolve_fft, convolve_models
from astropy.modeling import fitting, models
from astropy.utils.... |
c65a90d76e24c92d168a1eb53aa7d406d961256f2428c6a62fbf5a3fea4e3cbd | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import timeit
# largest image size to use for "linear" and fft convolutions
max_exponents_linear = {1: 15, 2: 7, 3: 5}
max_exponents_fft = {1: 15, 2: 10, 3: 7}
if __name__ == "__main__":
for ndims in [1, 2, 3]:
print(
f"\n{ndims}... |
bf79cde679ae95f5a90df85863c3ecf7eaa54bc2c3b233101fd37a328e2f51be | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import os
import subprocess
import sys
import pytest
from astropy.config import configuration, create_config_file, paths, set_temp_config
from astropy.utils.data import get_pkg_data_filename
from astropy.utils.exceptions import AstropyDeprecat... |
9034d0a934260dcade004d613260307f6e8907b7947b38d6622cf2116abbb301 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from astropy import units as u
from astropy.coordinates import Angle
from astropy.tests.helper import assert_quantity_allclose
from astropy.uncertainty import distributions as ... |
4e3a09da0afc4106d5a51817beabbecb613e0e7c548713ef3df53b3fe5214b88 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Module to test statistic functions
"""
import numpy as np
# pylint: disable=invalid-name
import pytest
from numpy.testing import assert_almost_equal
from astropy.modeling.models import Identity, Mapping
from astropy.modeling.statistic import (
le... |
d90d2c729499b77af8b81183783c26720970d39791adbe98b138dd6693d22ce9 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test sky projections defined in WCS Paper II"""
# pylint: disable=invalid-name, no-member
import os
import unittest.mock as mk
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_almost_equal
from astropy import units a... |
a3b82f09857bd8d74e0e224bae65291a2dd58e37f389fa34ad1d066965221610 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides functions to help with testing against iraf tasks
"""
import numpy as np
from astropy.logger import log
iraf_models_map = {1.0: "Chebyshev", 2.0: "Legendre", 3.0: "Spline3", 4.0: "Spline1"}
def get_records(fname):
"""
... |
512b699eaed7eb7fc5513a55ddb086946024fd46c9971a9c69f52779e0db5a0a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Here are all the test parameters and values for the each
`~astropy.modeling.FittableModel` defined. There is a dictionary for 1D and a
dictionary for 2D models.
Explanation of keywords of the dictionaries:
"parameters" : list or dict
Model parame... |
642757d8cb83bf3e0060ec796ba5fe7566b2c344345f0000353faab65179285e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Module to test fitting routines
"""
# pylint: disable=invalid-name
import os.path
import unittest.mock as mk
from importlib.metadata import EntryPoint
from itertools import combinations
from unittest import mock
import numpy as np
import pytest
from n... |
d16657e731c5be86982601be09cdea2aeb1003c1eedf9047bd3129c581d3cbb1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal, assert_array_less
from astropy import units as u
from astropy.coordinates import Angle
from astropy.modeling import InputParame... |
70b03ad37c4d278fb38cb870ee37a975a927f8b46877e78dfc10fc98ced27191 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
import re
from inspect import Parameter
import numpy as np
import pytest
from astropy.modeling.utils import (
_SpecialOperatorsDict,
_validate_domain_window,
get_inputs_and_params,
poly_map_domain,
)
def t... |
7a64109eec60eb5872a91b3ca88e4ed98a9bec1ab9f3530a3d18542dcab0f544 | # Licensed under a 3-clause BSD style license - see LICENSE.rst:
"""
Tests for model evaluation.
Compare the results of some models with other programs.
"""
import unittest.mock as mk
import numpy as np
# pylint: disable=invalid-name, no-member
import pytest
from numpy.testing import assert_allclose, assert_equal
i... |
2e1911b3af1b7c84f51947032d7f8bc315a78048e8c0e3bac49db9809e09c945 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module tests model set evaluation and fitting for some common use cases.
"""
import numpy as np
# pylint: disable=invalid-name
import pytest
from numpy.testing import assert_allclose
from astropy.modeling.core import Model
from astropy.modeling.... |
55ddc2d714f91ca6a18e3348603645bb86ecdfb36e29b6511345274588452db3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name, no-member
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy import units as u
from astropy.modeling import models
from astropy.tests.helper import assert_quantity_allclose
from astropy... |
60bb7196a87dd85374eab6fb76079cc3192cb9f70525a4aa0f3b3a78a957aa7e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests that relate to evaluating models with quantity parameters
"""
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy import units as u
from astropy.modeling.core import Model
from astropy.modeling.models import ... |
ab88de85cecbb2e7de6087c328633de2f45e4570b9d89121f19381ab311afef7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests that relate to fitting models with quantity parameters
"""
import numpy as np
import pytest
from astropy import units as u
from astropy.modeling import fitting, models
from astropy.modeling.core import Fittable1DModel
from astropy.modeling.param... |
05fa27460baf8a09bd539c4c0dd6d43e477c409c075178e1583210283bd60b52 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module tests fitting and model evaluation with various inputs
"""
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy.modeling import fitting, models
from astropy.modeling.core import Fittable1DModel, Fittable... |
9dca12bf8c6179864e43d47eec83ea351ef95e51ff308e0113a5fd43956cb57b | # 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... |
ffc2693f99e6237ae4b4569d03cbd33865434b808dbab8a2b374746a6608cb69 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for polynomial models."""
# pylint: disable=invalid-name
import os
import unittest.mock as mk
import warnings
from itertools import product
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy import conf, wcs... |
ad563a25fbe4e0e7af8a38f40edb8bf4cd6e7b40f8db61c10445b9f2eddc9558 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import unittest.mock as mk
import numpy as np
import pytest
import astropy.units as u
from astropy.coordinates import SpectralCoord
from astropy.modeling.bounding_box import (
CompoundBoundingBox,
ModelBoundingBox,
_BaseInterval,
_BaseSel... |
d7efeca6330e5448b4a4a49173e25af05af7fb744cd2108888ce5a28deea2e90 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name, pointless-statement
import pickle
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
import astropy.units as u
from astropy.modeling.core import CompoundModel, Model, ModelDefin... |
07ba68d8be063009a7eaa7b3e6164c9f2b6b491b213dce2812c56cd5ecacca1c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
import numpy as np
import pytest
from astropy.convolution import convolve_models_fft
from astropy.modeling.models import Const1D, Const2D
from astropy.utils.compat.optional_deps import HAS_SCIPY
@pytest.mark.skipif(not HAS... |
2541de074b7b78651bf8e3182f5b37b9fa4f049f5b58e02b1cf0e80a5840d6d5 | # 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.modeling.core import Model, fix_inputs
from astropy.modeling.models import Polynomial1D
class _ExampleModel(Model):
n_inputs = 1
n_outputs = 1
def __init__(self):
... |
ae4af84abbb0439cee03ed191d19d39a287d32c47849b2270cd95a4a602e8d57 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
import os
import subprocess
import sys
import unittest.mock as mk
from inspect import signature
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
import astropy
import astropy.modeling... |
ccbb3e0bbec6cf9121cc60fbbce524ecf8a35b7badac81e12b31d96f3a88c36d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for spline models and fitters"""
import unittest.mock as mk
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy.modeling.core import FittableModel, ModelDefinitionError
from astropy.modeling.fitting import (
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.