hash
stringlengths
64
64
content
stringlengths
0
1.51M
e2fc8de3f02ab54c8d39945e7fec6eca5398d60123ab5b4c79b7e02099563cb6
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree # noqa: E402 from astropy import units as u # noqa: E402 from astropy.time import Time, TimeDelta # noqa: E402 @pytest.mark.parametrize("fmt", Tim...
898a27d86757e70daacd177486613d75d805e4eb113ee917c8500e0de9140cde
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") import datetime # noqa: E402 import asdf.schema as asdf_schema # noqa: E402 import numpy as np # noqa: E402 from asdf import AsdfFile, tagged, yamlutil # noqa: E402 from asdf.tests import helpers # ...
3ea7f405793c6941bac7917b058a4edde486321b729fd82ec05602aeaef9d6aa
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree # noqa: E402 from astropy import units # noqa: E402 from astropy.coordinates import FK5, ICRS, Angle, Latitude, Longitude # noqa: E402 def test_hc...
83916704a87acb2229af8f179c266880c5224b8a5a6a9ec27a16c5b3e851d922
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree # noqa: E402 from astropy import units as u # noqa: E402 from astropy.coordinates.angles import Latitude, Longitude # noqa: E402 from astropy.coordi...
aa0e27ce5a4e95f4993116f9f2f58b5ac4b72d9fd5377c874fdac0e5be6d30ee
# 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 FK4, ICRS, Galactic, Longitude, SkyCoord asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree # noqa: E402 # These tests...
80ea2e31e919b8ffcf334ad865300708cf7930cd0ecb678e4a048da9a18b9311
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree # noqa: E402 import astropy.units as u # noqa: E402 from astropy.coordinates import Angle, Latitude, Longitude # noqa: E402 def test_angle(tmpdir...
02e65c9455a23c977c7a7cb0494901512464508f09fa4fa9e4ba3822902ea40b
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree # noqa: E402 from numpy.random import randint, random # noqa: E402 import astropy.coordinates.representation as r # noqa: E402 import astropy.units ...
f8c99b26af4585a74a5402b7f3c9bd30154c665d37a9a0efa3007274e069826f
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy import units as u from astropy.coordinates import ICRS, Galactic, SpectralCoord from astropy.tests.helper import assert_quantity_allclose asdf = pytest.importorskip("asdf") from asdf.tests.helpers import assert_roundtrip_tree ...
ae46907f6ffc08bf4dba4b8560a3636b9ac466d57162ed12fc2af9a4b1becb02
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io import pytest asdf = pytest.importorskip("asdf") from asdf.tests import helpers # noqa: E402 from astropy import units as u # noqa: E402 # TODO: Implement defunit def test_unit(): yaml = """ unit: !unit/unit-1.0.0 "2.1798721 10-18k...
05d59328f3829bd25b3e9ad410a5e3eed6a4848d29ef4fdd52135df2fc1b086e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest asdf = pytest.importorskip("asdf") import io # noqa: E402 from asdf.tests import helpers # noqa: E402 from astropy import units # noqa: E402 def roundtrip_quantity(yaml, quantity): buff = helpers.yaml_to_asdf(yaml) with asdf...
d5b0facf28f09e7e318ced0a6a0c4bd34646abafd40190b97b1cc98419623989
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy import units as u from astropy.cosmology import Planck15 from astropy.cosmology.units import with_H0 from astropy.units import equivalencies as eq asdf = pytest.importorskip("asdf", minversion="2.3.0.dev0") from asdf.tests imp...
55bd7f7a861891097a14209caab5a902661b7ed745872df8fcee87fd1bf8f672
# 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...
a9e48ba89f4e1bd927d8f60e85fcc87b5006635915ed31051f28bb4d7424bd77
# 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...
50e2963985aa0f1d29e5424374f9f35f2db21baa3515e1b79338b4cdef818cc5
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module is to contain an improved bounding box """ import abc import copy import warnings from collections import namedtuple from typing import Any, Callable, Dict, List, Tuple import numpy as np from astropy.units import Quantity from astropy...
2a425a6f627ceda20897b0e61c5e66ee2f4057034fe773e788049382654fe0f1
# 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...
c3760ff93f5cd7b52b8b11d867225f7cfb251df6d74ad7b443a67955b1029b00
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Functions for accessing, downloading, and caching data files.""" import atexit import contextlib import errno import fnmatch import ftplib import functools import hashlib import io import os import re import shutil # import ssl moved inside functions...
7fc882edf9766ba9e34b6d684bc70b306bf1a22227e65491f46318dd3f1f308d
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module implements a class based on NDData with all Mixins. """ from .mixins.ndarithmetic import NDArithmeticMixin from .mixins.ndio import NDIOMixin from .mixins.ndslicing import NDSlicingMixin from .nddata import NDData __all__ = ["NDDataRef"...
b57c782ad7b96933323fe00edd04c560115e80077df2012f9ad4c75cadcbcb03
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import numpy as np import astropy.units as u from astropy.coordinates import ITRS, CartesianRepresentation, SphericalRepresentation from astropy.utils import unbroadcast from .wcs import WCS, WCSSUB_LATITUDE, WCSSUB_LONGITUDE __doctest_ski...
c51950b15016434dfcf1fbfec154046f47512b9eef17090e4792da5592b470dc
# Licensed under a 3-clause BSD style license - see LICENSE.rst # It gets to be really tedious to type long docstrings in ANSI C # syntax (since multi-line string literals are not valid). # Therefore, the docstrings are written here in doc/docstrings.py, # which are then converted by setup.py into docstrings.h, which ...
bcc02f2f3044a4633cd7b262acd698055737ec15e5ef808123c0bfc8f41bfd4d
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module defines structured units and quantities. """ from __future__ import annotations # For python < 3.10 # Standard library import operator import numpy as np from .core import UNITY, Unit, UnitBase __all__ = ["StructuredUnit"] DTYPE_OBJ...
11e933ffa47b8a496592b504e772ec76feeab45a4e36c796ed93851aa46cd60e
# 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...
4874886180260bbe601de476358369b0fc496d5e4bbf0ead3f6eae5fd26e776a
import copy import operator import re import warnings import erfa import numpy as np from astropy import units as u from astropy.constants import c as speed_of_light from astropy.table import QTable from astropy.time import Time from astropy.utils import ShapedLikeNDArray from astropy.utils.data_info import MixinInfo...
ce9bde1e5e8d38917f2634f166f8500c89a8d585b5b86298dc901a12c7b185dc
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains a general framework for defining graphs of transformations between coordinates, suitable for either spatial coordinates or more generalized coordinate systems. The fundamental idea is that each class is a node in the transformati...
a8661e5426a044b980d15e068a349591ee84ca9a59424a14ded6f3fd07d733bb
# 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...
6cb401fc3c6508ba50f23386f8feb610d9c5470df79e6f560e626b522391f94a
# 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...
86425870befb9805bc86904dab58f0964082f5555844bcdf3f2f629f80da8b58
# 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...
da8bd24a632c88b69c9cf0c6dfdfa4be68b50b113fe1af81ffa9d60256158292
# 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...
53617f41d82747529254061dc7fb7322c65e28645244caae18facce7826cb5da
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Helpers functions for different kinds of WCSAxes instances """ import numpy as np from mpl_toolkits.axes_grid1.anchored_artists import AnchoredEllipse, AnchoredSizeBar import astropy.units as u from astropy.wcs.utils import proj_plane_pixel_scales ...
9e46ea0ca6fd6a2604768240e2d0c5a94115c2cacb72ee50b9be3bc5fd830610
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module implements the Arithmetic mixin to the NDData class. import warnings from copy import deepcopy import numpy as np from astropy.nddata.nduncertainty import NDUncertainty from astropy.units import dimensionless_unscaled from astropy.utils im...
9c978b43b71432527a351910ffdf73c99b1e736bf5365660d738c0629d43c58c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_array_equal from astropy import units as u from astropy.nddata import NDDataRef from astropy.nddata import _testing as nd_testing from astropy.nddata.nduncertain...
0f581a4d580d8724a84c25ee8fd71bf2086559d272c04103c51ecde33d947192
# Note that we test the main astropy.wcs.WCS class directly rather than testing # the mix-in class on its own (since it's not functional without being used as # a mix-in) import warnings from itertools import product import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal from packagi...
178c676e333c1597848d8400958fdaa3356cf56f5b59ad42562362c936cfceb2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import itertools import operator from datetime import timedelta from decimal import Decimal import numpy as np import pytest from astropy import units as u from astropy.table import Table from astropy.time import ( STANDARD_TIME_SCAL...
2ef0ff8c6990f73b8bb9e2ad71c2fc249aec506d2f89974c8c9e4a9d74b5b8f8
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import datetime import functools import os from copy import deepcopy from decimal import Decimal, localcontext from io import StringIO import erfa import numpy as np import pytest from erfa import ErfaWarning from numpy.testing import assert_...
116a3b94f8e83329cdddd14fa350baa8bdbd5828cf06bd98cef7c3713e29a041
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import numpy as np import pytest from astropy import units as u from astropy.table import Column from astropy.time import Time, TimeDelta allclose_sec = functools.partial( np.allclose, rtol=2.0**-52, atol=2.0**-52 * 24 * 3600 ) # 2...
90318fa39eeac2cccf707fc9c39d1ef6d59c97b9cec206a53a6914b873484b7c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import itertools import warnings import numpy as np import pytest import astropy.units as u from astropy.time import Time from astropy.time.utils import day_frac from astropy.units.quantity_helper.function_helpers import ARRAY_FUNCTION_ENABL...
a5704e3d9bafa55dafc0df615302c89892cad74fcf52edfb7de4b8984cc53f2b
# 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__`. ...
95ed3362d65df5f6ae306f316fd428e0942d9d303d14ae1ce1b019457028eff7
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test the Logarithmic Units and Quantities """ import itertools import pickle import numpy as np import pytest from numpy.testing import assert_allclose from astropy import constants as c from astropy import units as u from astropy.tests.helper i...
4bb87b824b5fd48d20a0a03ba247e688ca308ad30e22db6873b711d2ee9fae99
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test the Quantity class and related.""" import copy import decimal import numbers import pickle from fractions import Fraction import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal f...
e85657d52a0837c636d8a43ff98f4c2ce7bb6a5859aabfcca43af8b64f867679
# 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...
db765043df2f0c2f73a12bd806e67c2eca44bae4db301d20e42e7298747184c7
# 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...
5d5b302f045430f2df54578b94cd7382381b73453b98e11a25f8ce9d6367ba31
# 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 ( Quantity, Unit, UnitBase, UnitConversionError, UnitsError, UnitTypeError, dimensionless_unscaled, ) ...
ee136f0a2e1635047737ac42100696a14bef6c9b30d93ac0782845c6b163ce54
# 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...
ee237cfa3d27e6758f757cced4a8a12fd5882e355b9555aaf24f5cb0381bb323
# 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 copy import io from contextlib import nullcontext import numpy as np import pytest from erfa import ErfaWarning from astropy import units as u f...
7d1f00f9d124edc42f4b6a5d0a3de03c17810716114bc29711bd905d8a615bdc
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for the SkyCoord class. Note that there are also SkyCoord tests in test_api_ape5.py """ import copy from copy import deepcopy import numpy as np import numpy.testing as npt import pytest from erfa import ErfaWarning from astropy import units...
ec457859582587b41041d0497056e50add23f59a9f420971c7e1447b2428ae76
# Licensed under a 3-clause BSD style license - see PYFITS.rst import gzip import io import itertools 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 funct...
f7abd3ff0d82f9ef013052e4b69823604568d6182b8b3d860b86962cb1e83332
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Classes to read AAS MRT table format Ref: https://journals.aas.org/mrt-standards :Copyright: Smithsonian Astrophysical Observatory (2021) :Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu), \ Suyog Garg (suyog7130@gmail.com) """ import re...
5c745506f870d7da988678210799b1693e8f6e4d918b7859c3ef330c41c3ab4f
# Licensed under a 3-clause BSD style license - see LICENSE.rst """An extensible ASCII table reader and writer. latex.py: Classes to read and write LaTeX tables :Copyright: Smithsonian Astrophysical Observatory (2011) :Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu) """ import re from . import core latexdi...
1093e0497b2b91e7515bcc66d6a11fb080273c260186763cef04d0b77157f6fb
# Licensed under a 3-clause BSD style license - see LICENSE.rst import abc import contextlib import re import warnings from collections import OrderedDict from operator import itemgetter import numpy as np __all__ = ["IORegistryError"] class IORegistryError(Exception): """Custom error for registry clashes.""" ...
fd87b13cd68c08f986406cba7d4bf83836e777879d3896e91c22a07886759b2a
# Licensed under a 3-clause BSD style license - see PYFITS.rst import gzip import itertools import os import re import shutil import sys import warnings import numpy as np from astropy.io.fits.file import FILE_MODES, _File from astropy.io.fits.header import _pad_length from astropy.io.fits.util import ( _free_sp...
eb5201073eb6e4270d025c368801c0ffc84004260e68f2368c58f228a3c56be5
# Licensed under a 3-clause BSD style license - see PYFITS.rst import io import os import pathlib import warnings import numpy as np import pytest from numpy.testing import assert_array_equal from astropy import units as u from astropy.io import fits from astropy.io.fits import printdiff from astropy.io.fits.connect...
faceb98eb4a2a3ebb26b3c322f667b0429b6a604830dbbdb7c8726609d5c2c52
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module tests some methods related to ``CDS`` format reader/writer. Requires `pyyaml <https://pyyaml.org/>`_ to be installed. """ from io import StringIO import numpy as np import pytest from astropy import units as u from astropy.coordinates im...
c841765a445a696d2afda8ada58cf9641a2c6d8f8148b32d542a00a4701632ff
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.io.misc import fnpickle, fnunpickle def test_fnpickling_simple(tmp_path): """ Tests the `fnpickle` and `fnupickle` functions' basic operation by pickling and unpickling a string, using both a filename and a fi...
80a036c40a5e62bb476d51dd2de6ee3c7e2eb80aef791e81f5b68185a8561769
# 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...
7b0853906c434a01bb824b1c252ddc90f1dbcdbb4211e13e4725565141d7bfc8
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Functions for `astropy.cosmology`.""" from .comparison import cosmology_equal # _z_at_scalar_value is imported for backwards compatibility from .optimize import _z_at_scalar_value, z_at_value __all__ = ["z_at_value", "cosmology_equal"]
4beef28d0603e661a91908f88c6949eab6aea12de84a16d664bc6df02a78c058
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.modeling import Parameter as ModelParameter from astropy.table import Column FULLQUALNAME_SUBSTITUTIONS = { "astropy.cosmology.flrw.base.FLRW": "astropy.cosmology.flrw.FLRW", "astropy.cosmology.flrw.lambdacdm.Lamb...
25238d863d5bc1c7194bbd9d8cad9779fad8a13f1c012237f6399787e30941d5
# Licensed under a 3-clause BSD style license - see LICENSE.rst # STDLIB import json import os # THIRD PARTY import pytest # LOCAL import astropy.units as u from astropy.cosmology import units as cu from astropy.cosmology.connect import readwrite_registry from astropy.cosmology.core import Cosmology from .base impo...
42c8cbd20b2da41ce7f38f905824b6ad92b2696b15570b0fee3cd4c7eebe1a09
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astropy is a package intended to contain core functionality and some common tools needed for performing astronomy and astrophysics research with Python. It also provides an index for other astronomy packages and tools for managing them. """ import sys...
6a5f339183ce60df9b18a9cfd201262a9b5a06590eb69beb57c8e76cfe34f92b
# 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...
09315792032cd9fdd651d00c2c9aad89e23c8ee73460c1bb83940d804a9191b8
# 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 ...
3f93427a52347a9b5e680d257c289e769955277c65de329b4ef0ee4766e4a682
# 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...
b9769a0ad61a5919a8dee879dffc830f8101bb790c9823f3c9c6fef04823f001
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file needs to be included here to make sure commands such # as ``pytest 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 tempfile import pytest # ...
82abdf5ca34f67e943209d86526f28e0a365498e0ab830869ca227ec44414ab3
r""" ========================================================== Create a new coordinate class (for the Sagittarius stream) ========================================================== This document describes in detail how to subclass and define a custom spherical coordinate frame, as discussed in :ref:`astropy:astropy-c...
2a38c2f8c885c2c41d94c234c4585eec3d7fe6786fe58788b40179a9b3c95f1e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings import numpy as np from numpy.core.multiarray import normalize_axis_index from astropy.stats._fast_sigma_clip import _sigma_clip_fast from astropy.stats.funcs import mad_std from astropy.units import Quantity from astropy.utils import is...
f2d12d78580a0541af11775188f05d1712298b17399755dc5920df9d55c506e0
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Bayesian Blocks for Time Series Analysis. Bayesian Blocks for Time Series Analysis ======================================== Dynamic programming algorithm for solving a piecewise-constant model for various datasets. This is based on the algorithm pres...
9f312e750b394860e595a5be75f7005212977ee44a166f95188410a08fe287e4
# 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...
0b98e5fd06be74e8e2985581099dba4263eb908521840f1095831432c8168e92
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module implements functions and classes for spatial statistics. """ import math import numpy as np __all__ = ["RipleysKEstimator"] class RipleysKEstimator: """ Estimators for Ripley's K function for two-dimensional spatial data. ...
94dc9a77f74b0622c774b2b4f982c8fa86cfcf8ae956e489bb3725e141dddec7
# 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...
43d698ae13b41173e91ca458e60bfa8c789523c8f24ecc348e9836af55e2b126
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains simple functions for model selection. """ import numpy as np __all__ = [ "bayesian_info_criterion", "bayesian_info_criterion_lsq", "akaike_info_criterion", "akaike_info_criterion_lsq", ] __doctest_requires__ = {...
e70b1e6d07d7f652ae5faa70db39293a0b149c7f3b6a72ef34d34daecde79ac3
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains functions for computing robust statistics using Tukey's biweight function. """ import numpy as np from .funcs import median_absolute_deviation __all__ = [ "biweight_location", "biweight_scale", "biweight_midvariance"...
7fc21e960b7d33e7f22d8c34b1d64fb76a9a9723c27ece8af59b3af6c5e3a009
# 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_...
f4a2b46309b514f5190f111ea51644c4bd3a17164db56eb14f256a3afc3a64b3
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np __all__ = ["jackknife_resampling", "jackknife_stats"] __doctest_requires__ = {"jackknife_stats": ["scipy"]} def jackknife_resampling(data): """Performs jackknife resampling on numpy arrays. Jackknife resampling is a techniqu...
fc8a08c24d795ce73a9f1dc3951f6349108fb28216255fb36257ff88bfaa1270
# 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...
184cdbe0abfd377bddc46d366818c6339cf760369e224d105e38d3aeea1cd36f
# 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...
9d4e315823d4f2b24fb272eded94add4c9d05429a3d92f25a4bc4f88f4983ed1
# 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...
d296025d03994204eb851e636c25564e04bb71b6c4daae6420153c274df84dec
# 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...
3046c87b4cfe8aa435a376de20c647d23fa16d9b4fc6996145750415497415c8
# 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 ...
d1e43ddf88b4898658d29210aeca47eacc5c8402dc234591e31c990980edcac4
# Licensed under a 3-clause BSD style license - see LICENSE.rst import fnmatch import os import re import sys import numpy as np from astropy import log from astropy.utils.console import Getch, color_print, conf, terminal_size from astropy.utils.data_info import dtype_info_name __all__ = [] def default_format_fun...
f21f7f2b9251c1c5ccba663f1273ddf0c4b181bbb8d6555994c289c88f49a6eb
"""High-level table operations. - join() - setdiff() - hstack() - vstack() - dstack() """ # Licensed under a 3-clause BSD style license - see LICENSE.rst import collections import itertools from collections import Counter, OrderedDict from collections.abc import Mapping, Sequence from copy import deepcopy import num...
1f61d8e322f6fe931542063af654c6a20dc06d9a1550fbada440918a6282d6b9
""" High-level operations for numpy structured arrays. Some code and inspiration taken from numpy.lib.recfunctions.join_by(). Redistribution license restrictions apply. """ import collections from collections import Counter, OrderedDict from collections.abc import Sequence import numpy as np __all__ = ["TableMergeE...
9675a95e63d7df383a1103cdc41b3c41cd403fb235902680f584c1a88e2d263d
import copy import json import textwrap from collections import OrderedDict import numpy as np import yaml __all__ = ["get_header_from_yaml", "get_yaml_from_header", "get_yaml_from_table"] class ColumnOrderList(list): """ List of tuples that sorts in a specific order that makes sense for astropy table c...
7ddf38407f2b485f2673d4b5c350a1399b1406c97e6a95b0a6a5303469b5c44c
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np def _searchsorted(array, val, side="left"): """ Call np.searchsorted or use a custom binary search if necessary. """ if hasattr(array, "searchsorted"): return array.searchsorted(val, side=side) # Python ...
b625905169ac7955e3be8c8c8dd306710c58251ef5d19bc5ffa1132d73c995ef
# 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...
8e2aca32e10d56a2bcb21149f7c6d5dfce7c58fde023397b163e3e96cb054a6f
# 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 has_even_axis, raise_even_kernel_exception __all__ = ...
9d72e9c381b173a7c7b99ef391e8ad12280f082ea152efc8834ee4866083701b
# 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...
ffc6d7e29bae9f147bb1cc52083c392c99f6f25d1d8d75aa5d294660e0b0ea83
# 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...
ed721760021421c5cf30abf6e76f17df2a189282a47d5374ccbbebf1c02cd9c5
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module contains classes and functions to standardize access to configuration files for Astropy and affiliated packages. .. note:: The configuration system makes use of the 'configobj' package, which stores configuration in a text format li...
1dc4d52d0bd47909fc36a44ebaeaf6fc0da45e522d041b8251d6ee785fc74909
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module contains functions to determine where configuration and data/cache files used by Astropy should be placed. """ import os import shutil import sys from functools import wraps __all__ = ["get_config_dir", "get_cache_dir", "set_temp_config", ...
f1d27eac270d4ea6dc04944ed53c5d1c9adf4c40b399a8f984db9d96028571ed
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module implements classes (called Fitters) which combine optimization algorithms (typically from `scipy.optimize`) with statistic functions to perform fitting. Fitters are implemented as callable classes. In addition to the data to fit, the ``__c...
35a57bf20da1418a7b3a4d99c8a7bb79677e6887c3c1de24845243711391e370
# 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...
784c5bb89c8729fe0e9148b9b09feb10249c44275fdec2e0e65a958597a84ddd
# 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...
52431158dc705e6d8d2c88900dd087e498148b09d04d414879c82fbd3134bbbb
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Convolution Model.""" # pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name import numpy as np from .core import CompoundModel class Convolution(CompoundModel): """ Wrapper class for a convolution model. Para...
0e1ecfa4eb55a4ebf8063c7779facb72c07afa4a4f287dae027641257deaa259
""" Special models useful for complex compound models where control is needed over which outputs from a source model are mapped to which inputs of a target model. """ # pylint: disable=invalid-name from astropy.units import Quantity from .core import FittableModel, Model __all__ = ["Mapping", "Identity", "UnitsMappi...
696b20a61c235b09d4df9e6203150685af7370fdbf49270a7335361d95935447
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Spline models and fitters.""" # pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name import abc import functools import warnings import numpy as np from astropy.utils import isiterable from astropy.utils.exceptions import ...
a00e634df69915e87d366cde6825f4f100438fcc453216871d1721ae5928a53a
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name """ Optimization algorithms used in `~astropy.modeling.fitting`. """ import abc import warnings import numpy as np from astropy.utils.exceptions import AstropyUserWarning __all__ = ["Optimization", "SLSQP", "Simplex"] #...
89a053799c5d19c3052c6615ca80c25498cd6af082212889c128de00ab0a10f6
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Implements rotations, including spherical rotations as defined in WCS Paper II [1]_. `RotateNative2Celestial` and `RotateCelestial2Native` follow the convention in WCS Paper II to rotate to/from a native sphere and the celestial sphere. The implement...
1ec925bc67072c57c25905b8e1f576046f10eca08e2839bb970363d1584a8314
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Functions to determine if a model is separable, i.e. if the model outputs are independent. It analyzes ``n_inputs``, ``n_outputs`` and the operators in a compound model by stepping through the transforms and creating a ``coord_matrix`` of shape (``n_...
7cd894427f2c8b7259119c34a3579b2157aa7677a1079a9d2c25649d7af162a5
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module provides utility functions for the models package. """ import warnings # pylint: disable=invalid-name from collections import UserDict from collections.abc import MutableMapping from inspect import signature import numpy as np from astr...
4ed31f4cb40b84a1faf2ed58e8f323ede862465d6227b78de4e44df88659938b
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module is to contain an improved bounding box. """ import abc import copy import warnings from collections import namedtuple from typing import Any, Callable, Dict, List, Tuple import numpy as np from astropy.units import Quantity from astrop...
9bf87b0d4b5644274ce5248fc3e5198f60679d9c0435c903c7ae25d53da2c5b7
# 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...
42c567ad3ae677aca3041015f65261f14bf23ed3ef2cabc92b7fbeb01f8dab9f
# 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...