hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
2ecd54550a06ccf673008281a2dba4fc98fae70e88e5d8e8f8100815bb387027 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import ctypes
import gc
import itertools
import math
import re
import time
import warnings
from contextlib import suppress
import numpy as np
from astropy.io.fits import conf
from astropy.io.fits._tiled_compression import compress_hdu, decompress_hdu
fro... |
a237902ce0d26f002282eed7932ddec71908799c782b1a53b0ec3e9ef21c9afa | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import datetime
import os
import sys
import warnings
from contextlib import suppress
from inspect import Parameter, signature
import numpy as np
from astropy.io.fits import conf
from astropy.io.fits.file import _File
from astropy.io.fits.header import H... |
5e50c363000cf87d6bbfeb94a9019cd7bb140c24bc36515c4c058b1ea7b1c701 | # 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... |
69e6d3752a69735f48c1ac7c0dab35896fb738a52177741a8749236f95fc1a61 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import gzip
import os
from astropy.io.fits.file import _File
from astropy.io.fits.header import _pad_length
from astropy.io.fits.util import fileobj_name
from .base import BITPIX2DTYPE, _BaseHDU
from .hdulist import HDUList
from .image import PrimaryHDU
... |
3d20822b86bdcee91cb20aef54e358302ebcf31db25197ad1d9c4f79790ea148 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import contextlib
import copy
import gc
import pickle
import re
import sys
import warnings
import numpy as np
import pytest
from numpy import char as chararray
try:
import objgraph
HAVE_OBJGRAPH = True
except ImportError:
HAVE_OBJGRAPH = Fal... |
def8cc4358262b7134fd622df25dccb4c5db3091171c9f1b720f596ab03d0bc2 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import copy
import io
import os
import subprocess
import sys
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.hdu.base import _NonstandardHDU, _ValidHDU
from astropy.io.fits.verify import VerifyError, VerifyWarning
from a... |
0e46e72ffdb2c8a33add9cc05da5ac4a077cd67310402e1f68ff7d1811a41a2e | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import os
import pathlib
import shutil
import stat
import tempfile
import time
import pytest
from astropy.io import fits
@pytest.fixture(
params=[False, "str", "pathlib"], ids=["", "home_is_data", "home_is_data, pathlib"]
)
def home_is_data(request... |
6b3ff616f7f875ee7b466d5f231bfbcae2032a4828800992cd7515a8f910a2fa | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import collections
import copy
import warnings
from io import BytesIO, StringIO
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.card import _pad
from astropy.io.fits.header import _pad_length
from astropy.io.fits.util im... |
7592310cab65924e6591edd86dedeb3196f79d2312e79a6d93003f2f3e3b611f | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits._tiled_compression import compress_hdu
from .conftest import FitsTestCase
MAX_INT = np.iinfo(np.intc).max
MAX_LONG = np.iinfo(int).max
MAX_LONGLONG = np.iinfo(np.longlong)... |
f53e26b7259705fdb110c8c1e77db129f80632222b26d7e77ace3e50cccd8095 | import gc
import warnings
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from astropy import units as u
from astropy.io import fits
from astropy.io.fits import BinTableHDU, HDUList, ImageHDU, PrimaryHDU, table_to_hdu
from astropy.io.fits.column import (
_fortran_to_... |
d3c54d1e265c5d114615eda6f853287c5364c6f4712275d27b2f6e1038527302 | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import errno
import gzip
import io
import mmap
import os
import pathlib
import shutil
import sys
import urllib.request
import zipfile
from unittest.mock import patch
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.conven... |
115bc8f35152bf31c9f0e3f19abc4458111f42c994780aa7058c5c67d1b8bbcd | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import math
import os
import re
import time
import numpy as np
import pytest
from numpy.testing import assert_equal
from astropy.io import fits
from astropy.io.fits.hdu.compressed import DITHER_SEED_CHECKSUM, SUBTRACTIVE_DITHER_1
from astropy.utils.data ... |
3ba67ff64ec3fdf5667bd5404058c35ad142b27bea3a6451fa3b330768db941e | """
This test file uses the https://github.com/esheldon/fitsio package to verify
our compression and decompression routines against the implementation in
cfitsio.
*Note*: The fitsio library is GPL licensed, therefore it could be interpreted
that so is this test file. Given that this test file isn't imported anywhere
... |
7880039b0a9bcd7854ee581f3ac5e6c79169cd208e6823500a92bbaa2fd6e976 | import itertools
import numpy as np
import pytest
COMPRESSION_TYPES = [
"GZIP_1",
"GZIP_2",
"RICE_1",
"HCOMPRESS_1",
"PLIO_1",
]
def fitsio_param_to_astropy_param(param):
# Convert fitsio kwargs to astropy kwargs
_map = {"qlevel": "quantize_level", "qmethod": "quantize_method"}
param... |
0fba6b8247dd8f78963b5b9f1dfeebd35c399a3090e76f70eae661abf4c050f0 | from pathlib import Path
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
from astropy.io import fits
from astropy.io.fits._tiled_compression.codecs import PLIO1
from .conftest import fitsio_param_to_astropy_param
@pytest.fixture
def canonical_data_base_path():
return Pa... |
a643de49e88bc6c2a3542771a02cac743062239b7152010855a0eef4697a793e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import io
import os
import re
from contextlib import nullcontext
from io import BytesIO
from textwrap import dedent
import numpy as np
import pytest
from numpy import ma
from astropy.io import ascii
from astropy.io.ascii.core import (
... |
fa4a05b195ee1deec5da38e6542430007335cf726ca7e0e08a8a25bfefe8c628 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module tests some of the methods related to the ``HTML``
reader/writer and aims to document its functionality.
Requires `BeautifulSoup <http://www.crummy.com/software/BeautifulSoup/>`_
to be installed.
"""
from io import StringIO
import numpy ... |
3b1f56dff0ed7a019b342c704a553ee090dcb712f56eedc499d26d7fde4a10ca | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import locale
import pathlib
import platform
import re
from collections import OrderedDict
from io import BytesIO, StringIO
import numpy as np
import pytest
from astropy import table
from astropy.io import ascii
from astropy.io.ascii import core
from as... |
ce2857974461da5653be496c34dee5bdf51dbb17b73611cff4961f63ea2ece47 | # 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.io import ascii
from .common import setup_function # noqa: F401
from .common import teardown_function # noqa: F401
from .common import assert_almost_equal, assert_equal
def... |
eb07c62c45f3410c4119867211be9f16a979db2d7d80a9c47a69ef0ec1ef767e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from io import StringIO
import numpy as np
import astropy.units as u
from astropy.io import ascii
from astropy.table import QTable
from .common import assert_almost_equal, assert_equal
def assert_equal_splitlines(arg1, arg2):
assert_equal(arg1.sp... |
189467ea7af45f1beae8db9a1f5817610c0ee3000a0e7890defc7590d32f7f3e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file connects ASDF to the astropy.table.Table class
import warnings
from astropy.io import registry as io_registry
from astropy.io.misc.asdf.deprecation import create_asdf_deprecation_warning
from astropy.table import Table
from astropy.utils.compa... |
b0a14c3bc2757fdd7ddc123164c8b3f9b975a4519f90cd7ed0bb9d3b57331f45 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
from asdf.extension import AsdfExtension, BuiltinExtension
from asdf.util import filepath_to_url
# Make sure that all tag implementations are imported by the time we create
# the extension class so that _astropy_asdf_types is populated correct... |
e33b1fde8af781cbcad08a8e3e9f9654ca8380847a00307d5a7e86643dc932b5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import (
Angle,
CartesianRepresentation,
EarthLocation,
Latitude,
Longitude,
SkyCoord,
SphericalCosLatDifferential,
SphericalRepresen... |
a3417c4b0b8999c21067a62dbe95a79bc417850aea3ac7be614e5c5f293b9b56 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.io.misc.asdf.tags.transform.basic import TransformType
from astropy.modeling import math_functions
from astropy.modeling.math_functions import *
from astropy.modeling.math_functions import __all__ as math_classes
__all__ = ["NpUfuncType"]
c... |
94460a564868273f7f02bd57aaee9ff4f81b3f3242dac49eacb3d0de1a8df1df | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from asdf.tags.core import NDArrayType
from astropy.coordinates.spectral_coordinate import SpectralCoord
from astropy.io.misc.asdf.tags.unit.unit import UnitType
from astropy.io.misc.asdf.types import AstropyType
__all__ = ["SpectralCoordType"]
class S... |
b9a8180d0ff4be05fa35a694f562629315b835c5c45bcafd940a3e64672f0f14 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
# LOCAL
from astropy.io.votable import converters, exceptions, tree
def test_reraise():
def fail():
raise RuntimeError("This failed")
with pytest.raises(RuntimeError, match="From here"):
try:
fail()
... |
1e170b088cf54453388ccd700c7312a0d80d1726a0a5e36dcdab50e3876bd405 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
A set of tests for the util.py module.
"""
import pytest
from astropy.io.votable import util
def test_range_list():
assert util.coerce_range_list_param((5,)) == ("5.0", 1)
def test_range_list2():
assert util.coerce_range_list_param((5e-7, ... |
9bf026e9f2682f2fbaf68f5032cd817462626046ab0b259e14f3fae6d414a8b7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is a set of regression tests for vo.
"""
# STDLIB
import difflib
import gzip
import io
import pathlib
import sys
from unittest import mock
import numpy as np
# THIRD-PARTY
import pytest
from numpy.testing import assert_array_equal
from astropy... |
d2a0b4745db28ed33d00569fe309bd138cdbc1a1f048db5009fd24759aa41cbf | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Test the conversion to/from astropy.table.
"""
import io
import os
import pathlib
import numpy as np
import pytest
from astropy.config import reload_config, set_temp_config
from astropy.io.votable import conf, from_table, is_votable, tree, validate
f... |
f0b93ebc2a7372ea5b1b9309f7f53357b40487d302759389c0257e1e9fa668ee | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import pytest
from astropy.io.votable import tree
from astropy.io.votable.exceptions import W07, W08, W21, W41
from astropy.io.votable.table import parse
from astropy.io.votable.tree import Resource, VOTableFile
from astropy.utils.data import g... |
7e59cc8c083f4de6e52d787751e493806feb1938382b49e744bfebac1bebcc65 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
# THIRD-PARTY
import numpy as np
import pytest
from numpy.testing import assert_array_equal
# LOCAL
from astropy.io.votable import converters, exceptions, tree
from astropy.io.votable.table import parse_single_table
from astropy.utils.data imp... |
32f1caebf640a5968ec08cca8fc6ad5579a4ddc54e2b6892bcbd904436830d63 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import contextlib
import os
import re
from math import ceil
from astropy import online_docs_root
from astropy.io.votable import exceptions
from astropy.utils.xml.writer import XMLWriter, xml_escape
html_header = """<?xml version="1.0" encoding=... |
5d67ebf834036042f33e264abcb7614d9bd39c027508d3b86562b523bc42ce46 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from functools import wraps
import pytest
from astropy.utils.compat.optional_deps import HAS_PYTEST_MPL
def figure_test(*args, **kwargs):
"""
A decorator that defines a figure test.
This automatically decorates tests with mpl_image_compar... |
51e584d1853e3faf879161f082f312e28b78c83ebf3acec41028978ff366917b | import abc
import numpy as np
from astropy.timeseries.binned import BinnedTimeSeries
from astropy.timeseries.sampled import TimeSeries
__all__ = ["BasePeriodogram"]
class BasePeriodogram:
@abc.abstractmethod
def __init__(self, t, y, dy=None):
pass
@classmethod
def from_timeseries(
... |
ee917013cc14f9edc90a81b0819f315943a3e8aa17527919f561df299d80dea7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
from astropy.io import fits, registry
from astropy.table import MaskedColumn, Table
from astropy.time import Time, TimeDelta
from astropy.timeseries.sampled import TimeSeries
__all__ = ["kepler_fits_reader"]
def kepl... |
5fbe8cbc64e3b7de7bdde230795078c42edfe50123c38ced5af376d9d211dd22 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
__all__ = ["bls_fast", "bls_slow"]
from functools import partial
import numpy as np
from ._impl import bls_impl
def bls_slow(t, y, ivar, period, duration, oversample, use_likelihood):
"""Compute the periodogram using a brute force reference metho... |
6eacdfde769206434ce2ba463cfaf19831497155f9ee435ef2d1be3e2dbe12fc | # Licensed under a 3-clause BSD style license - see LICENSE.rst
__all__ = ["BoxLeastSquares", "BoxLeastSquaresResults"]
import numpy as np
from astropy import units
from astropy import units as u
from astropy.time import Time, TimeDelta
from astropy.timeseries.periodograms.base import BasePeriodogram
from astropy.ti... |
f8023d7a925a359313d1f8a40dbd2fae310fa70033e1277ad85bbd6130951a01 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Box Least Squares Algorithms.
Box Least Squares
=================
AstroPy-compatible reference implementation of the transit periorogram used
to discover transiting exoplanets.
"""
__all__ = ["BoxLeastSquares", "BoxLeastSquaresResults"]
from .core... |
8ac927ba8fc677ec666dff47435db77c8b6a821ef90e6e91a4e9a96521bfe294 | """
Utilities for computing periodogram statistics.
This is an internal module; users should access this functionality via the
``false_alarm_probability`` and ``false_alarm_level`` methods of the
``astropy.timeseries.LombScargle`` API.
"""
from functools import wraps
import numpy as np
from astropy import units as ... |
61cc1ba3164724287c284977f6abc98c5a0a9f99b3d6dfd13abd9bf19f7fae24 | """Main Lomb-Scargle Implementation."""
import numpy as np
from astropy import units
from astropy import units as u
from astropy.time import Time, TimeDelta
from astropy.timeseries.periodograms.base import BasePeriodogram
from . import _statistics
from .implementations import available_methods, lombscargle
from .imp... |
5e6aa3fc148a4171797aa0f1e4d2dba5ad3581a80ea24c3ae1fe63284414e91d | import numpy as np
from .mle import design_matrix
def lombscargle_chi2(
t,
y,
dy,
frequency,
normalization="standard",
fit_mean=True,
center_data=True,
nterms=1,
):
"""Lomb-Scargle Periodogram.
This implements a chi-squared-based periodogram, which is relatively slow
but ... |
bf0c5527943439877ad37c2606deeacdfcab6b0c53fd046b537fb3bb3fec8467 | """
Main Lomb-Scargle Implementation.
The ``lombscargle`` function here is essentially a sophisticated switch
statement for the various implementations available in this submodule
"""
__all__ = ["lombscargle", "available_methods"]
import numpy as np
from .chi2_impl import lombscargle_chi2
from .cython_impl import l... |
d1f0a7a26a491f320e5709fd8aa9809706e7c68bec151f5303a39aaa3d419b4c | """Various implementations of the Lomb-Scargle Periodogram."""
from .chi2_impl import lombscargle_chi2
from .fast_impl import lombscargle_fast
from .fastchi2_impl import lombscargle_fastchi2
from .main import available_methods, lombscargle
from .scipy_impl import lombscargle_scipy
from .slow_impl import lombscargle_sl... |
257d5a8fdf9479f3fe7d189c89a3f03567d7eeb33c3bfe6a72a35e0e5f919dbf | import numpy as np
from .utils import trig_sum
def lombscargle_fast(
t,
y,
dy,
f0,
df,
Nf,
center_data=True,
fit_mean=True,
normalization="standard",
use_fft=True,
trig_sum_kwds=None,
):
"""Fast Lomb-Scargle Periodogram.
This implements the Press & Rybicki method ... |
62352c8af1d5d54a04dc03507d7dc72d90eee5a064e01df7706a80ab5d48d226 | 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[N^2] algorithm, but c... |
9f425c6b61f8751ca8e035d9d464da1e33711f0d3a49db02f7042d7f9024afe6 | 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,... |
132380bfcabe1ef65a10e79122209a7a2d020c4c96cafe4bbdaf28dd69350f90 | import numpy as np
def lombscargle_slow(
t, y, dy, frequency, normalization="standard", fit_mean=True, center_data=True
):
"""Lomb-Scargle Periodogram.
This is a pure-python implementation of the original Lomb-Scargle formalism
(e.g. [1]_, [2]_), with the addition of the floating mean (e.g. [3]_)
... |
b3ec34fdf9076c6c4fb8469f37f07861c669e4d96a15322a5a4fe061fe9de85c | import numpy as np
from .utils import trig_sum
def lombscargle_fastchi2(
t,
y,
dy,
f0,
df,
Nf,
normalization="standard",
fit_mean=True,
center_data=True,
nterms=1,
use_fft=True,
trig_sum_kwds=None,
):
"""Lomb-Scargle Periodogram.
This implements a fast chi-squ... |
3e5c1f5d5f3d5011df879d0cf3b0d1cf26cc68ca4a32aaeba4d84f8b9897d8f8 | import numpy as np
def design_matrix(t, frequency, dy=None, bias=True, nterms=1):
"""Compute the Lomb-Scargle design matrix at the given frequency.
This is the matrix X such that the periodic model at the given frequency
can be expressed :math:`\\hat{y} = X \\theta`.
Parameters
----------
t ... |
954b44c0a83e51a1c24f5d94795b3c22515175c99c0bb1ba243684c617c3fcb4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Convenience functions for `astropy.cosmology`.
"""
import warnings
import numpy as np
from astropy.cosmology import units as cu
from astropy.cosmology.core import CosmologyError
from astropy.units import Quantity
from astropy.utils.exceptions import... |
6b1f5bdf18bc86fdeec98d1acc18eec6c27f27c4f057659b89fea8b370ce3129 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The following are private functions, included here **FOR REFERENCE ONLY** since
the io registry cannot be displayed. These functions are registered into
:meth:`~astropy.cosmology.Cosmology.to_format` and
:meth:`~astropy.cosmology.Cosmology.from_format... |
8629ccfb8c49edf549571fa5adb3ab395b26d03032352adbed25ca531ea825d0 | # 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... |
11883df81326dba53dd4c1c982a3b20418a7e198c34947d24e55a3980f4cd2b8 | # 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 *
from .lambdacdm import *
from .w0cdm import *
from .w0wacdm import *
from .w0wzcdm import *
from .wpwazpcdm import *
__all__ = (
base.__... |
bdaa1af1758ecd572bdf98b9bfb7913418fee80172d0f801617156425549651f | # 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, TypeVar
import numpy as np
from numpy import inf, sin
import astrop... |
9e5a172cb62fecbf5b9dcefba82b6a97ac10a8d6f902da31d74bb06f6f027126 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import inspect
import random
# THIRD PARTY
import numpy as np
import pytest
# LOCAL
from astropy.cosmology.core import Cosmology
from astropy.cosmology.io.model import _CosmologyModel, from_model, to_model
from astropy.cosmology.tests.helper im... |
12682d68b34adb8134af074e0c1639a5ffd3aa59e82b3f3037730aa2cdad5e88 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import inspect
from collections import OrderedDict
# THIRD PARTY
import numpy as np
import pytest
# LOCAL
from astropy.cosmology import Cosmology
from astropy.cosmology.io.mapping import from_mapping, to_mapping
from .base import ToFromDirectT... |
929f06808fc8ef2b12e92ece4770566e5e9ac20f5e5ed048abfa3d128c8c8c39 | # 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... |
74baa3766e6ba62e63f09bdd8b4d8b8e565ad99bc9e051263af74e6876696b83 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# THIRD PARTY
import pytest
# LOCAL
from astropy.cosmology.core import _COSMOLOGY_CLASSES, Cosmology
from astropy.cosmology.io.row import from_row, to_row
from astropy.table import Row
from .base import ToFromDirectTestBase, ToFromTestMixinBase
#######... |
bf4c0fbddd8ba3c4609194191bf1e34a0a0f94ec80f64d902e8bac0c3aabafcb | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Testing :mod:`astropy.cosmology.flrw.wpwazpcdm`."""
##############################################################################
# IMPORTS
import numpy as np
# THIRD PARTY
import pytest
# LOCAL
import astropy.cosmology.units as cu
import astropy.... |
09a5f987e537d019b99ba67303095fedff033cac847e7013f6f08be5efdb7300 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Testing :mod:`astropy.cosmology.flrw.lambdacdm`."""
##############################################################################
# IMPORTS
# STDLIB
# THIRD PARTY
import pathlib
import numpy as np
import pytest
# LOCAL
import astropy.constants as... |
8ff0e4f796ebeedbf73519f38c30a67709d840d6caf3dcb471a69a68299eddf6 | # 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... |
11761a795e6d06b7eb106cb6be4aa2f9c1fd938ec585f3ff524e6ba363eb1278 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Testing :mod:`astropy.cosmology.flrw.lambdacdm`."""
##############################################################################
# IMPORTS
import numpy as np
import pytest
import astropy.units as u
from astropy.cosmology import FLRW, wCDM
from ast... |
f7e960f34f4d0d05d1875c9b3cbcac877058c341b76ca231f7aaa0fc21c565e4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Testing :mod:`astropy.cosmology.flrw.w0wzcdm`."""
##############################################################################
# IMPORTS
# THIRD PARTY
import numpy as np
import pytest
# LOCAL
import astropy.units as u
from astropy.cosmology import... |
4a0518e3525e6a9427be52aa5df022e8f973a6f110c3aa820e79f0751d91d096 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Testing :mod:`astropy.cosmology.flrw.w0wacdm`."""
##############################################################################
# IMPORTS
# THIRD PARTY
import numpy as np
import pytest
# LOCAL
import astropy.units as u
from astropy.cosmology import... |
384df2eb0e619f0fb11aa7a67483ed08c02b6ac857b5828f0633703593a3fcaa | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Testing :mod:`astropy.cosmology.flrw.w0cdm`."""
##############################################################################
# IMPORTS
# THIRD PARTY
import numpy as np
import pytest
# LOCAL
import astropy.units as u
from astropy.cosmology import F... |
71779147f5095cc4c83cc8183eb3bd7bcf8fb82361a0cd77ed2ef581878fffbe | # 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... |
3f14e1570388983ced21600b79ed91908b11fe420669b69093dc706ac5129c3f | # 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 ... |
410221e340f78c1157cbc805be2da6984d3f8bb7c94cf4dd113cdf618a34e318 | # 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... |
29c0e0e78aab377708e10974a0bb43658d0721e0f1cf78fbadc90e6d04b2f332 | import os
import shutil
import sys
import erfa # noqa: F401
import matplotlib
import pytest
import astropy # noqa: F401
if len(sys.argv) == 3 and sys.argv[1] == "--astropy-root":
ROOT = sys.argv[2]
else:
# Make sure we don't allow any arguments to be passed - some tests call
# sys.executable which beco... |
391c67bc27fecf9ee7f4dd8a6b745b441b4ad3bd61aab7b68a344e2883576f36 | """
===================================================================
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... |
fbd28ab7bdfa9a10d297d8800754668ef058e7c6f2ae907dcf81cdd82e53ae90 | 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... |
27742ef99beef54313e8618d3404661dae9f708f77b78909458fff27957a13ff | """
==========================================
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*
"""
######################... |
4aea8766341cf46517eea41d8e6201e6058d3fe87298d8eef394782c91168c37 | # 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... |
ba8c37608528b7d9752712495e3d112551183e310d92048a6daad7ee2df05baa | # 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... |
e0e4ce8b4d980fa76250d1133c0b2f32cc1e06b64d3d251d44068f092c929757 | # 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... |
7b19eb5445ba358ac09c2d72a480df0522d714e5aeab3a80c6248b25eae9791f | # 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_... |
b6e76f6e0835647dc485d3879d7536a7050f4051d0b37a6cecc79d4117e6c048 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from os.path import abspath, dirname, join
import astropy.config as _config
import astropy.io.registry as io_registry
from astropy import extern
from .table import Table
class Conf(_config.ConfigNamespace):
"""
Configuration parameters for `as... |
a41fda542d6831b299f45d7d9587226a517c844dbe8e6d3bd0f13726496e048a | # 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... |
844af8d0550ba2e472ae5c3c982a0b0d71dbdf7921e8dd0b4d5415af534d335f | """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... |
30929d6e5451165417488bc3832240f2df197ec413907084d1c07723a9a955f5 | 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... |
2112c4f068a977666cdfddac9748013ded5d96561bc75081b4d5838204248c93 | # 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__ = ... |
68398ae98226a3ef96de377e1ab458df9ac68f18d86c3953253956358672cf1c | # 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... |
c06908ce7c48dd3ea235bce8780057bbe7d909c0db4e30397fe0b971252ecc9e | # 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", ... |
e65a4afa8e6c943858fc374b7bccf58e7d7d512bc38fb56f658e23abc65a06a8 | # 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 stats
from astropy import units as u
__all__ = ["Distribution"]
# we set this by hand because the symbolic expression (below) requires scipy
#... |
ccd29fff73bdee3488394c967273ec22d06b634c9d00e7078919d107e5b078f3 | # 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... |
0338b341818ceb8edc5e221a8896b18edf9126a13ebd0031a3ef175f071c1d81 | # 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... |
decc975998cb985da59a5146a60c07a247a9aa58bd8f8ecd487f1fed1d178602 | """
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... |
eda0a52a913cef9eb1bf031c124784624c1f9a7f3e2cf511484ca002b7a29276 | # 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_... |
e7093d69029631646d50de3a2ec5656dc786da85d32faf781adf774200ead52f | # 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... |
7caa7bfb5ccf1fdae3e97d9c0a8f4e02e7dd1432badc05640993ec6137366e72 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Mathematical models."""
# pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name
import warnings
import numpy as np
from astropy import units as u
from astropy.units import Quantity, UnitsError
from astropy.utils.compat.optio... |
0afc396a0f6634996cf82511ee3e58fb7bd779e8ca7f2131fb4b3b62a56aa98d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains models representing polynomials and polynomial series.
"""
# pylint: disable=invalid-name
from math import comb
import numpy as np
from astropy.utils import check_broadcast, indent
from .core import FittableModel, Model
from .f... |
88658d4ca3706535da59e92fd7d3c715eed3a79f4b0d7713ab765ebdb6e49e00 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Models that have physical origins.
"""
# pylint: disable=invalid-name, no-member
import warnings
import numpy as np
from astropy import constants as const
from astropy import units as u
from astropy.utils.exceptions import AstropyUserWarning
from .... |
61f389b337ef8e554599cda9ca89e30949bb1366d54df23a3b9c8f89183aed18 | # 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,
AstropyPendingDeprecatio... |
5e2d661c89612753488a8688272ec96da2fb036039530809c03b8e78fe6645fe | """
A simple class to manage a piece of global science state. See
:ref:`astropy:config-developer` for more details.
"""
__all__ = ["ScienceState"]
class _ScienceStateContext:
def __init__(self, parent, value):
self._value = value
self._parent = parent
def __enter__(self):
pass
... |
7919b42eedad45e539f2c7754a88fb999edeaa67719b04134d42d76c5cecd2b2 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Functions related to Python runtime introspection."""
import collections
import importlib
import inspect
import os
import sys
import types
from importlib import metadata
from packaging.version import Version
from astropy.utils.decorators import depre... |
3a612fc4f3c9f233aebf9eb17d7c82073bddc7e72de3f65e472fb6d1c313a665 | # 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.... |
666af9b9636ee27f597d54dbdf0ee469459f09239187cc9b831643d35c438180 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""The ShapedLikeNDArray mixin class and shape-related functions."""
import abc
import numbers
from itertools import zip_longest
import numpy as np
__all__ = [
"NDArrayShapeMethods",
"ShapedLikeNDArray",
"check_broadcast",
"IncompatibleS... |
6fe011d41d070c9fdf9e433a1a5be1da546c5562af0cd91e2978ac6291c57134 | # 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... |
a64c62a77dd8fd54912d7e0eae36e212bf7380b2f74373fe44903cee77c6975c | # 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 locale
import os
import re
import signal
import sys
import ... |
9e05e6c2db08712e0c9654a8540d607cb8e4153f7e43028512687ac5644fc3f3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Combine 3 images to produce a properly-scaled RGB image following Lupton et al. (2004).
The three images must be aligned and have the same pixel scale and size.
For details, see : https://ui.adsabs.harvard.edu/abs/2004PASP..116..133L
"""
import nump... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.