hash
stringlengths
64
64
content
stringlengths
0
1.51M
d288641660d82530ccf5edfea711c8740ad0ef57b2cae2bee222770cbe03b313
# 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 .base import DELAYED, ExtensionHDU, BITPIX2DTYPE, DTYPE2BITPIX from .image import ImageHDU from .table impo...
81d1e03552c55b106daeed83f83353ef8c890c40b5dcb52925ad8e481b62268b
# Licensed under a 3-clause BSD style license - see PYFITS.rst import datetime import os import sys import warnings from contextlib import suppress from inspect import signature, Parameter import numpy as np from astropy.io.fits import conf from astropy.io.fits.file import _File from astropy.io.fits.header import (...
c5387e5fa75f436c7fe2841eb597ddebada774466689baba6d083ad0ede2bd77
# 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 pytest import numpy as np from numpy import char as chararray try: import objgraph HAVE_OBJGRAPH = True except ImportError: HAVE_OBJGRAPH = Fals...
beeaa29a57453ca9b2530874fcce91b8a9529b669f192e13d5a8544e413343d4
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see PYFITS.rst import copy import collections import warnings from io import StringIO, BytesIO import pytest import numpy as np from astropy.io import fits from astropy.io.fits.verify import VerifyWarning, VerifyError from astropy.utils.excepti...
afdea4237857b60b77c8229f38536f38fb7e61a5459fe9043215597bbb9ddcda
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest import os from . import FitsTestCase from astropy.io.fits.convenience import writeto from astropy.io.fits.hdu import PrimaryHDU, hdulist from astropy.io.fits import Header, ImageHDU, HDUList, FITSDiff from astropy.io.fits...
21054c4d1a1ee36f96b354ba85412d972042a48b1e5c5b4b4ddef48cfcac233a
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from . import FitsTestCase from astropy.io.fits.scripts import fitsheader from astropy import __version__ as version class TestFITSheader_script(FitsTestCase): def test_help(self): with pytest.raises(SystemExit) as e: ...
f6a16fb425ae4ff9a489d1983a9d574fb8f1a219c9c6da8f4d5ea8b6d396a5d5
import gc import pathlib import warnings import pytest import numpy as np from numpy.testing import assert_allclose, assert_array_equal from astropy.io.fits.column import (_parse_tdisp_format, _fortran_to_python_format, python_to_tdisp) from astropy.io.fits import HDUList, Primary...
bcdd9962ce45a165a53b519b97cf85819fa78fcfc991fc62666f0529560ebbd8
# Licensed under a 3-clause BSD style license - see PYFITS.rst import math import os import re import time import pytest import numpy as np from numpy.testing import assert_equal from astropy.io import fits from astropy.io.fits.hdu.compressed import SUBTRACTIVE_DITHER_1, DITHER_SEED_CHECKSUM from astropy.utils.excep...
2a77e90ee415211b80c0143a75d598247fc36b760125df9aad8516582d486ec7
# Licensed under a 3-clause BSD style license - see LICENSE.rst import io import os import functools from contextlib import nullcontext from io import BytesIO import re from textwrap import dedent import pytest import numpy as np from numpy import ma from astropy.table import Table, MaskedColumn from astropy.io imp...
5ae30bd38e8b60a4a3e178f30dbe117368fc2695c76de7c6ffddbe46e89f7da4
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module tests some of the methods related to the ``ECSV`` reader/writer. """ from astropy.table.column import MaskedColumn import os import copy import sys from io import StringIO from contextlib import nullcontext import pytest import numpy as n...
a5466a9a80d72b5df63bfe7499a008153617d75c60ab336a958e2c77c1a54711
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.io.ascii.core import convert_numpy import re from io import BytesIO, open from collections import OrderedDict import locale import platform from io import StringIO import pathlib import pytest import numpy as np from...
11b3f5e29a6c6c8020186ff1c53c72bffe4ffce6fd8d55599facf7c733d1c28d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import copy from contextlib import nullcontext from io import StringIO from itertools import chain import pathlib import pytest import numpy as np from astropy.io import ascii from astropy import table from astropy.table.table_helpers import s...
7999d27da4d811fe76c174b1092b556dacd15431ae7c1f769223603bfbcb614f
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import pytest import numpy as np from astropy.table import Table, QTable, Column from astropy.table.table_helpers import simple_table from astropy.units import allclose as quantity_allclose from astropy.units.quantity import QuantityInfo from ...
f93a3143abf4c4aff8ce6ac615037aba762a24fd94f378fc72450309395b777e
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import pytest asdf = pytest.importorskip('asdf') import warnings from packaging.version import Version import numpy as np from asdf import util from asdf.tests import helpers from asdf import AsdfFile import asdf import astrop...
9c7fb6fb8c8d3c705865fdd5e1597047634494d07966bc01db5e449346b3b7e2
# Licensed under a 3-clause BSD style license - see LICENSE.rst from datetime import datetime import pytest from numpy.testing import assert_equal, assert_allclose from astropy.table import Table, Column from astropy.time import Time, TimeDelta from astropy import units as u from astropy.units import Quantity from ...
02d4ad1bee15f0358377837ae5423c76c623c4062dc6949100c829753400c554
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ["BoxLeastSquares", "BoxLeastSquaresResults"] import numpy as np from astropy import units from astropy.time import Time, TimeDelta from astropy.timeseries.periodograms.lombscargle.core import has_units, strip_units fro...
9a5d66b20e38744b035823fa6eb12dad83a620038191a6bd5dbe527e28ee1bf1
"""Main Lomb-Scargle Implementation""" import numpy as np from .implementations import lombscargle, available_methods from .implementations.mle import periodic_fit, design_matrix from . import _statistics from astropy import units from astropy.time import Time, TimeDelta from astropy import units as u from astropy.ti...
7e9f17b60939bec98dcb4048292271465fcd113842034f86b27b48f2d6b0d93e
import numpy as np def lombscargle_scipy(t, y, frequency, normalization='standard', center_data=True): """Lomb-Scargle Periodogram This is a wrapper of ``scipy.signal.lombscargle`` for computation of the Lomb-Scargle periodogram. This is a relatively fast version of the naive O...
9cbffadcc8a18f20e920f5f8c2f8a7bc3cfaf5fb4c53b5a8f7dd7a9fbbd1e5a7
from math import factorial import numpy as np def bitceil(N): """ Find the bit (i.e. power of 2) immediately greater than or equal to N Note: this works for numbers up to 2 ** 64. Roughly equivalent to int(2 ** np.ceil(np.log2(N))) """ return 1 << int(N - 1).bit_length() def extirpolate(x, y...
1f001177aa72c31dae3684d1e73fdb2eed34ef95b570a8672bea1b38c84bf9e2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy from collections import defaultdict from astropy.cosmology.connect import convert_registry from astropy.cosmology.core import Cosmology from astropy.table import QTable, Row from .mapping import from_mapping def from_row(row, *, move_to_me...
3873e7280eb12cf6b2a2e7a44496caff33fbb8b9714f9ab22196991f571f3837
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.cosmology.connect import convert_registry from astropy.cosmology.core import Cosmology from astropy.table import Column, QTable, Table from .mapping import to_mapping from .row import from_row from .utils import convert_p...
86c43aad8a06dbdc54a524e3a3a33da1ffa677f0383123b6d656105879a1b92f
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Read/Write/Interchange methods for `astropy.cosmology`. **NOT public API**. """ # Import to register with the I/O machinery from . import cosmology, ecsv, mapping, model, row, table, yaml # noqa: F401, F403
02b2eb6fa25cf379e5ecc925a6ca4b3113845557b8f3f9a08ed5caa7beb2f593
# 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...
350729c8e8eeb10899f95c053889abb7002cb06158c05958ee6b48576e3fef57
# Licensed under a 3-clause BSD style license - see LICENSE.rst from math import inf import numpy as np import pytest from astropy.cosmology.utils import aszarr, inf_like, vectorize_if_needed, vectorize_redshift_method from astropy.utils.exceptions import AstropyDeprecationWarning from .test_core import _zarr, inva...
ed4cb31cce82d2ad4ca59b9e2869fbd7775e69bb4b0d8466713d7c1cea4751f5
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Configure the tests for :mod:`astropy.cosmology`.""" from astropy.cosmology.tests.helper import clean_registry # noqa: F401, F403 from astropy.tests.helper import pickle_protocol # noqa: F401, F403
0a1d44a8559cd06dde22165736d686255dbd412094603e4ddf06fc7b4a5b52bd
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.parameter`.""" ############################################################################## # IMPORTS # STDLIB import inspect # THIRD PARTY import numpy as np import pytest # LOCAL import astropy.units as u from as...
4b2271edb5fa6b3e8aaa6d648154b0db6a704e87cdf58e560e06ce3d98150c95
# -*- coding: utf-8 -*- """Testing :mod:`astropy.cosmology.units`.""" ############################################################################## # IMPORTS import pytest import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology import Planck13, default_cosmology from astropy.tests.hel...
8215065b6ddd3637368a86c2de6169387ff8e251db2b1aaed56f7927ab2d3a54
# Licensed under a 3-clause BSD style license - see LICENSE.rst import inspect import os import pytest from astropy import cosmology from astropy.cosmology import Cosmology, w0wzCDM from astropy.cosmology.connect import readwrite_registry from astropy.cosmology.io.tests import ( test_cosmology, test_ecsv, test_j...
7057d35c3e886aa7fe3dd282326f89e2181c0770fa0c134a54a02e13a3c2e8dd
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.core`.""" ############################################################################## # IMPORTS # STDLIB import abc import inspect import pickle # THIRD PARTY import numpy as np import pytest # LOCAL import astrop...
f114fb7f20b414a4ad9a8221bd3c0d43d9cea1c8dbdb48bc7769c6ea775739ac
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Stand-alone overall systems tests for :mod:`astropy.cosmology`.""" from io import StringIO import numpy as np import pytest import astropy.constants as const import astropy.units as u from astropy.cosmology import flrw from astropy.cosmology.realiza...
eae35d636e0514ecbe6476ff1b24f2f1f0d79ca8421d70d84d8a6f9716894903
# Licensed under a 3-clause BSD style license - see LICENSE.rst # STDLIB import pickle # THIRD PARTY import pytest # LOCAL import astropy.cosmology.units as cu import astropy.units as u from astropy import cosmology from astropy.cosmology import parameters, realizations from astropy.cosmology.realizations import Pla...
5749259abf7b2ef7ec32731f25db05bb609a370854dace1dc4c893489590c01b
# Licensed under a 3-clause BSD style license - see LICENSE.rst import inspect import sys from io import StringIO import numpy as np import pytest from astropy import units as u from astropy.cosmology import core, flrw from astropy.cosmology.funcs import _z_at_scalar_value, z_at_value from astropy.cosmology.realizat...
37c13cc86415a41bc03b9e1b1405bdcba258996ae650226dc907ac0fe878320c
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Astropy FLRW classes.""" from . import base, lambdacdm, w0cdm, w0wacdm, w0wzcdm, wpwazpcdm from .base import * # noqa: F401, F403 from .lambdacdm import * # noqa: F401, F403 from .w0cdm import * # noqa: F401, F403 from .w0wacdm import * # noqa: F40...
b4e4109aaf23c28fb9e0fada49118e15bda26bc55ac2342cf7f12a2c20164023
# 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 Any, Mapping, Optional, TypeVar import numpy as np from numpy import inf, sin imp...
15171d788d147c683150bb3e565fc386afc3c13b613d494edb11fe973eb34d11
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from numpy import sqrt import astropy.units as u from astropy.cosmology.parameter import Parameter from astropy.cosmology.utils import aszarr from . import scalar_inv_efuncs from .base import FLRW, FlatFLRWMixin __all__ = ["wCDM", "F...
76aa25e1d8114940de2416e0d9aa0bf94daf320315d137e7800244d8d41f9564
# Licensed under a 3-clause BSD style license - see LICENSE.rst from math import acos, cos, inf, sin, sqrt from numbers import Number import numpy as np from numpy import log import astropy.units as u from astropy.cosmology.utils import aszarr from astropy.utils.compat.optional_deps import HAS_SCIPY from . import s...
a78d80aab99d48fc89ecf0edc15ca7390d4b0c13426398ce19c9bffeb925c8d3
# Licensed under a 3-clause BSD style license - see LICENSE.rst from numpy import exp import astropy.units as u from astropy.cosmology.parameter import Parameter from astropy.cosmology.utils import aszarr from . import scalar_inv_efuncs from .base import FLRW, FlatFLRWMixin __all__ = ["w0waCDM", "Flatw0waCDM"] __d...
729cfd9b0f559170349750da34a0dd17e3b567fdafa8e0d5f1a24cc658b70c8a
# Licensed under a 3-clause BSD style license - see LICENSE.rst # THIRD PARTY import pytest # LOCAL from astropy.cosmology import Cosmology from astropy.cosmology.core import _COSMOLOGY_CLASSES from astropy.cosmology.io.table import from_table, to_table from astropy.table import QTable, Table, vstack from .base impo...
1b3e7496abd3c968b331d63307ca25756d9b64eb053a87826982ea38df48047b
# Licensed under a 3-clause BSD style license - see LICENSE.rst # STDLIB # THIRD PARTY import pytest # LOCAL import astropy.units as u from astropy.cosmology import Cosmology, FlatLambdaCDM, Planck18 from astropy.cosmology import units as cu from astropy.cosmology.io.yaml import from_yaml, to_yaml, yaml_constructor,...
8ad2c754b71f7e11646b650d90abd43ed0f5a8c06a6510e8264b393ad04c4e1e
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test that all expected methods are present, before I/O tests import. This file is weirdly named so that it's the first test of I/O. """ from astropy.cosmology.connect import convert_registry, readwrite_registry def test_expected_readwrite_io(): ...
af84892ba7d15306ba37229c3b368067eba5293a65a6b0bcd1b6a84a1fa6271e
# 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...
bc3e4a725e541a562a62c76f0d39488b09145a86317d2b699e087cf390ecbc5a
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.flrw.lambdacdm`.""" ############################################################################## # IMPORTS # STDLIB # THIRD PARTY import pytest # LOCAL import astropy.units as u from astropy.cosmology import FlatLa...
e53bccca2454bfeb4019ae4f3a86c23410a7960f346231cf3aadf49da59c8627
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.flrw.__init__.py`.""" ############################################################################## # IMPORTS import pytest from astropy.utils import resolve_name from astropy.utils.exceptions import AstropyDeprecati...
582b1529816c54f0c5117c49c7aaf49afb27019de6ff013ead7a8533502f6e25
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.flrw.base`.""" ############################################################################## # IMPORTS # STDLIB import abc import copy # THIRD PARTY import numpy as np import pytest import astropy.constants as const...
d01f6d86c79e60c9ebb3dc03c4d2cad5630b6eb235bf2bb29679cf7110e43ea4
# 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 os ...
a819a7c7d10835366d1bc9634ca23a7a7bbb50c8c8a2d96e453b2ded3c65740c
# 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...
8c462b979fc22b71353c58b42f33cd78f1ef8b91f025f52ff7e1da9268ecc436
""" ======================== Title of Example ======================== This example <verb> <active tense> <does something>. The example uses <packages> to <do something> and <other package> to <do other thing>. Include links to referenced packages like this: `astropy.io.fits` to show the astropy.io.fits or like this ...
28adfc4c66c336922ebae96b7f968744b732c1d13a8b047efce5dfcf2a62417e
""" ======================================================================== 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...
9fb1adf27f1b0d176bd8379a46583440f1a6b600a4eb216d4d86fdee9f51660d
""" =================================================================== Determining and plotting the altitude/azimuth of a celestial object =================================================================== This example demonstrates coordinate transformations and the creation of visibility curves to assist with obser...
c03e7111429f164f582d899ced1d410302cad7afe926a0ac23f2577be2fd4b71
""" ================================================================ 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...
05aa2b55ee2905abe731867c7c027d8fd21dc5e6b04c605e07045a7501508441
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...
8642e8dc8eaf9a057bc6aedc7aa2de06ae2e6ebddb22b76ea5bf79edabe62129
""" ===================================================== Create a multi-extension FITS (MEF) file from scratch ===================================================== This example demonstrates how to create a multi-extension FITS (MEF) file from scratch using `astropy.io.fits`. *By: Erik Bray* *License: BSD* """ ...
b89c61fff37b9bda317b3e4695e3a2145befddb5f218bcf1e5fb25837755c03e
""" ================== Edit a FITS header ================== This example describes how to edit a value in a FITS header using `astropy.io.fits`. *By: Adrian Price-Whelan* *License: BSD* """ from astropy.io import fits ############################################################################## # Download a F...
8e3a662ea20c769c5879616b0333356d69efb42bf12e301e65f237e4a910bfab
""" ======================================= Read and plot an image from a FITS file ======================================= This example opens an image stored in a FITS file and displays it to the screen. This example uses `astropy.utils.data` to download the file, `astropy.io.fits` to open the file, and `matplotlib....
9d0c109debb4f6a76d04580fd4a019af360fe26f188be4264d3bb7ba2c8a2a2f
""" ========================================== Create a very large FITS file from scratch ========================================== This example demonstrates how to create a large file (larger than will fit in memory) from scratch using `astropy.io.fits`. *By: Erik Bray* *License: BSD* """ ######################...
3746afad4111a09da3c6cf3c5e6bf33e892ba956ce2410e6a7c461d407b486f2
""" ===================================================================== Accessing data stored as a table in a multi-extension FITS (MEF) file ===================================================================== FITS files can often contain large amount of multi-dimensional data and tables. This example opens a FITS...
90b047a9970bc5e95f14844e634c0258de5d20a57e475710f0e7175c633ae8c4
""" ===================================================== Convert a 3-color image (JPG) to separate FITS images ===================================================== This example opens an RGB JPEG image and writes out each channel as a separate FITS (image) file. This example uses `pillow <https://python-pillow.org>`...
612e9cb9f959326bcdaf05711ac31acd460f8cbc6822518b6aec8ee65ca628ff
# 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.units import Quantity from astropy.utils import isiterable from astropy.utils.exceptions import AstropyUserWarning from astropy.stats._fast_sigma_clip...
37dbbb5faecb79ccc968b7f2681a4afc39e7330456ec836f199554cc2842c8fc
# 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...
bca752d42ff289f3819f1f2ddc33e3eb32119afce14784323cd47073646c37a6
""" Table property for providing information about table. """ # Licensed under a 3-clause BSD style license - see LICENSE.rst import sys import os from contextlib import contextmanager from inspect import isclass import numpy as np from astropy.utils.data_info import DataInfo __all__ = ['table_info', 'TableInfo', 'se...
13480af1696a9b56f3bc00815d4b2540e7ddd3d8b2daefda408ad68e4c6a76a7
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The Index class can use several implementations as its engine. Any implementation should implement the following: __init__(data, row_index) : initialize index based on key/row list pairs add(key, row) -> None : add (key, row) to existing data remove(...
b2dff52a059c47dfea519e01040c91a39202ee66927cf2455b94a95eb57db5df
# Licensed under a 3-clause BSD style license - see LICENSE.rst from os.path import abspath, dirname, join from .table import Table import astropy.io.registry as io_registry import astropy.config as _config from astropy import extern class Conf(_config.ConfigNamespace): """ Configuration parameters for `as...
8204912dcabfd5b979127115e5ae6b008547d0b34fec4ee53cbaafdeef58ebd8
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .index import SlicedIndex, TableIndices, TableLoc, TableILoc, TableLocIndices import sys from collections import OrderedDict, defaultdict from collections.abc import Mapping import warnings from copy import deepcopy import types import itertools impo...
deab9063a209316a2a3e17398b31d6ea96b6774b4922d6c734de6e2180c201e2
# 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 Unit, Quantity, StructuredUnit from astropy.utils.console import color_print from astropy.utils.metadata import ...
c3fd7d4698c09f396b842a127f3ca38c0fd79ea8b72a67442031a802f3aa27b0
""" High-level table operations: - join() - setdiff() - hstack() - vstack() - dstack() """ # Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import deepcopy import collections import itertools from collections import OrderedDict, Counter from collections.abc import Mapping, Sequence import nu...
5d6ff74b9036ffb71dfcca78df065df8b7f1d2fa8e0d7f6f7cac39b25e8bae90
""" 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 OrderedDict, Counter from collections.abc import Sequence import numpy as np __all__ = ['TableMergeE...
f34cd94e9a7bde95e968184ac9c4e7b5c1af54e50ef4e094d09fb8722b7c7545
# 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 ...
f530888282f8265940b34f15a93cb2e19859160828a8f2e2d1b5f5ac75f7c495
ascii_coded = ('Ò♙♙♙♙♙♙♙♙♌♐♐♌♙♙♙♙♙♙♌♌♙♙Ò♙♙♙♙♙♙♙♘♐♐♐♈♙♙♙♙♙♌♐♐♐♔Ò♙♙♌♈♙♙♌♐♈♈♙♙♙♙♙♙♙♙♈♐♐♙Ò♙♐♙♙♙♐♐♙♙♙' '♙♙♙♙♙♙♙♙♙♙♙♙Ò♐♔♙♙♘♐♐♙♙♌♐♐♔♙♙♌♌♌♙♙♙♌Ò♐♐♙♙♘♐♐♌♙♈♐♈♙♙♙♈♐♐♙♙♘♔Ò♐♐♌♙♘♐♐♐♌♌♙♙♌♌♌♙♈♈♙♌♐' '♐Ò♘♐♐♐♌♐♐♐♐♐♐♌♙♈♙♌♐♐♐♐♐♔Ò♘♐♐♐♐♐♐♐♐♐♐♐♐♈♈♐♐♐♐♐♐♙Ò♙♘♐♐♐♐♈♐♐♐♐♐♐♙♙♐♐♐♐♐♙♙Ò♙♙♙♈♈♈♙♙♐' '♐♐♐♐♔♙♐♐♐♐...
91d032043675a1d9b5956b77cda5ae68738a8ee669e9525744dcaa4de8033044
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The SCEngine class uses the ``sortedcontainers`` package to implement an Index engine for Tables. """ from collections import OrderedDict from itertools import starmap from astropy.utils.compat.optional_deps import HAS_SORTEDCONTAINERS if HAS_SORTED...
f11b5c7ab83394980209c930ad687c2454095a0976f54ee8c45d3e8290f000b4
# 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__ = ...
23265052cbd2d68a29da09e1df35eed138f44b07f76f90a301b34e6c11ee69fe
# 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...
1e165f60b427b0bab9f2508652237668126556579c24c8e09131a3eda4345399
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .convolve import (convolve, convolve_fft, convolve_models, convolve_models_fft, interpolate_replace_nans) from .core import * from .kernels import * from .utils import *
26ed6e9f1361689957f6abaa7b1419996eeeab8ff1fe68fff96ac3a698de1e29
# 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...
29350890288ed98dcf8259f35eec8d61d12d29fdaf37e367344a90f90d70aeb0
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Distribution class and associated machinery. """ import builtins import numpy as np from astropy import units as u from astropy import stats __all__ = ['Distribution'] # we set this by hand because the symbolic expression (below) requires scipy #...
e17b00c3b571b615d3ad768661fbcd9f7da3825565a17f8d2ccc6961355ae088
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Built-in distribution-creation functions. """ from warnings import warn import numpy as np from astropy import units as u from .core import Distribution __all__ = ['normal', 'poisson', 'uniform'] def normal(center, *, std=None, var=None, ivar=Non...
05b8cfa95cb2804190faa3deeda92a1bd9cc650cc49f6db0266c1448e2a9f41d
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This sub-package contains classes and functions for creating distributions that work similar to `~astropy.units.Quantity` or array objects, but can propagate uncertainties. """ from .core import * from .distributions import *
01d4661cd76d3b63cbe4636614807a4aea16a680e9d773f2462dfeb3115720b1
# 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...
7947fa9d7997b70f7b58046a766adaa2f13792dabc39b33fa276fd0642875ebf
# 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...
3f6cb456d23cf03b918fb81d9353e0786d024ef04d3dddfa4281a599efa31b0b
# 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"] #...
4654aaf9bef6a41064355277f3f55a3d0be8dbac78af3234e79a5fa0c4c21ec9
# 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...
c53be2a8b4e6b85d2da43b3804a73f67ad534dfdad3922db288c16345c306dee
# 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...
1f3b3feeb30b763b9b8f9a23b470420a9087f51f5116a27945d83b5c9b2383f2
# 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...
5e131c7ded1b76bf02847450f36f69b9568cc77d5ecdee3014114381dca22dd7
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains models representing polynomials and polynomial series. """ # pylint: disable=invalid-name import numpy as np from astropy.utils import check_broadcast, indent from .core import FittableModel, Model from .functional_models import...
6bcbc2a8ea0f19d1d77e4c24521eb0e7ed00399b5e6c505dd178c65b4d094d4a
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tabular models. Tabular models of any dimension can be created using `tabular_model`. For convenience `Tabular1D` and `Tabular2D` are provided. Examples -------- >>> table = np.array([[ 3., 0., 0.], ... [ 0., 2., 0.], ... ...
05a0be61992613aea3bbf90faab11731a210c77b02f10201ec64ec2271b2baaf
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import os import select import socket import threading import time import uuid import warnings import queue import xmlrpc.client as xmlrpc from urllib.parse import urlunparse from astropy import log from .constants import SAMP_STATUS_OK fro...
02fd21dbaac256d48118bf83409dd3514902d3456f33074cd6f62c3853a461ad
# Licensed under a 3-clause BSD style license - see LICENSE.rst # TODO: this file should be refactored to use a more thread-safe and # race-condition-safe lockfile mechanism. import datetime import os import socket import stat import warnings from contextlib import suppress from urllib.parse import urlparse import x...
34571a3e95074cf768729ab702ffb4c6b31a13f34628bf76bb358742a417483e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import os import select import socket import threading import warnings from urllib.parse import urlunparse from .constants import SAMP_STATUS_OK, SAMP_STATUS_WARNING from .hub import SAMPHubServer from .errors import SAMPClientError, SAMPWar...
3dc7eabd7bbc3c70d2a985795abc8edef7c1f3b3cc72fb62589f6e0c1ef9fdf7
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Sundry function and class decorators.""" import functools import inspect import textwrap import threading import types import warnings from inspect import signature from .exceptions import (AstropyDeprecationWarning, AstropyUserWarning, ...
e1a05478c073ff232837c38de2801ebfa1695a657565bdd6f1f1400251ab726a
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Utilities for generating new Python code at runtime.""" import inspect import itertools import keyword import os import re import textwrap from .introspection import find_current_module __all__ = ['make_function_with_signature'] _ARGNAME_RE = re....
094806b2a15b6cf5ef7180ca262d196a0a8390390771fd4d1e2851985099c0c3
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Utilities for console input and output. """ import codecs import locale import re import math import multiprocessing import os import struct import sys import threading import time # concurrent.futures imports moved inside functions using them to avoi...
b0940860684cadd4f41ed6a0a504e46249a6f597212fab4b4b592ce0e4f46886
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Functions related to Python runtime introspection.""" import collections import inspect import os import sys import types import importlib from importlib import metadata from packaging.version import Version from astropy.utils.decorators import deprec...
a523aaf8cdaea28e9c8c33ebc316f60b4f9fa0622b9fb7bcfd6549910835ac53
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains helper functions and classes for handling metadata. """ from functools import wraps import warnings from collections import OrderedDict from collections.abc import Mapping from copy import deepcopy import numpy as np from astro...
850a9b3251b525cc3c16e0b6ee40ecf7a0818be91cdb4e856e0e269cc7d0ca25
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module contains functions and methods that relate to the DataInfo class which provides a container for informational attributes as well as summary info methods. A DataInfo object is attached to the Quantity, SkyCoord, and Time classes in astropy....
e64c19f220ec3a7efb3073f208effb7d20e7dc992979a1c7173f94b09ab103dd
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Wrappers for PLY to provide thread safety. """ import contextlib import functools import re import os import threading __all__ = ['lex', 'ThreadSafeParser', 'yacc'] _TAB_HEADER = """# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style lic...
13269084e7493cb18bdd1ea11ef627c757989cd1234530b8f6795cf99bdfe4df
# 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 functools import hashlib import os import io import re import shutil # import ssl moved inside functions using ssl to a...
9db3169917e820a119d9d28099e9b609a905f139870598184148d1b252c80a81
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ A "grab bag" of relatively small general-purpose utilities that don't have a clear module/package to live in. """ import abc import contextlib import difflib import inspect import json import os import signal import sys import traceback import unicode...
eef8dbbca4d3ff9591503be63fb5229b6218a95b3a23d760128f1de592566ff9
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np __doctest_skip__ = ['quantity_support'] def quantity_support(format='latex_inline'): """ Enable support for plotting `astropy.units.Quantity` instances in matplotlib. May be (optionally) used with a ``with`` stateme...
d6176d0d3e938b40bd06fb85a83be8c8cea48f0a25dc65e2412e21cd62d3b6ff
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from datetime import datetime from astropy.time import Time from astropy import units as u __all__ = ['time_support'] __doctest_requires__ = {'time_support': ['matplotlib']} UNSUPPORTED_FORMATS = ('datetime', 'datetime64') YMDHMS_F...
31b7fe928f6335ccd03fcd3f6323ecd148db3e6255b0e1a6d307137dec81215f
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module includes helper functions for array operations. """ import numpy as np from .decorators import support_nddata __all__ = ['reshape_as_blocks', 'block_reduce', 'block_replicate'] def _process_block_inputs(data, block_size): data = np...
6831ea9108bf990e01cabafc9d87ad54fe09aaa28244042c571550f4fb2a3b0b
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module implements the base CCDData class.""" import itertools import numpy as np from .compat import NDDataArray from .nduncertainty import ( StdDevUncertainty, NDUncertainty, VarianceUncertainty, InverseVariance) from astropy.io import fits...