hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
442cef8841d4d4898ffc07dd96d02a299ceea8c8a6d7fb92fb9a7644d9480269 | import numpy as np
import pytest
from numpy.testing import assert_allclose
import astropy.units as u
from astropy.timeseries.periodograms.lombscargle import LombScargle
from astropy.timeseries.periodograms.lombscargle._statistics import (fap_single, inv_fap_single,
... |
71683ea31aa82936ea45f401b3d67f1775910904a341044ac19b314f91eb55a8 | import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy.timeseries.periodograms.lombscargle.utils import convert_normalization, compute_chi2_ref
from astropy.timeseries.periodograms.lombscargle.core import LombScargle
NORMALIZATIONS = ['standard', 'model', 'log', 'psd']
@pytest.fixt... |
54fb41b96b697591c79bb4abaf5169fb3226a13a7d4122f750788666decf5ecf | import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.time import Time, TimeDelta
from astropy import units as u
from astropy.tests.helper import assert_quantity_allclose
from astropy.timeseries.periodograms.lombscargle import LombScargle
ALL_METHODS = LombScargle.available_methods
... |
0dc25c34e5cb7909ea1c3b6bc8964db019e4370d531671a42886f126888f4253 |
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_equal
from astropy.timeseries.periodograms.lombscargle.implementations.utils import extirpolate, bitceil, trig_sum
@pytest.mark.parametrize('N', 2 ** np.arange(1, 12))
@pytest.mark.parametrize('offset', [-1, 0, 1])
def test_bitceil(N... |
dc26c96cb953c53ea121c45db27ebc03838eb56696fe43605cca89c450abbb18 | import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.timeseries.periodograms.lombscargle.implementations.mle import design_matrix, periodic_fit
@pytest.fixture
def t():
rand = np.random.default_rng(42)
return 10 * rand.random(10)
@pytest.mark.parametrize('freq', [1.0, 2])... |
68ce65092ae845e38aaf9d5b03c79c4d695af00e61f6d1a0e17bf7eb1a48c404 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from unittest import mock
import pytest
from astropy.io.fits import HDUList, Header, PrimaryHDU, BinTableHDU
from astropy.utils.data import get_pkg_data_filename
from astropy.timeseries.io.kepler import kepler_fits_reader
def fake_header(extver, vers... |
91b64d684e89238d2d9277ebb30f6ff1f3ccd2614f81710519dd50c776246a73 | import pytest
import astropy.constants as const
from astropy import astronomical_constants, physical_constants
def test_version_match():
pversion = physical_constants.get()
refpversion = const.h.__class__.__name__.lower()
assert pversion == refpversion
aversion = astronomical_constants.get()
refa... |
78447a7d4d0a8554a6d876e85f1ff7564960fef10caf956e742c02b33e6c250a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy import constants as const
from astropy.tests.helper import check_pickling_recovery, pickle_protocol # noqa
originals = [const.Constant('h_fake', 'Not Planck',
0.0, 'J s', 0.0, 'fakeref',
... |
fe4409d88a7c1bdbca9e2995ecbc16b8ce22b504b9da462010fc51429d73e0f4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import pytest
import numpy as np
from astropy.constants import Constant
from astropy.units import Quantity as Q
def test_c():
from astropy.constants.codata2010 import c
# c is an exactly defined constant, so it shouldn't be chan... |
8c8259efa0f8b56f16f1dafb6d1ab8a2837fa0c97a12608ffb0b563ac7f38242 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import pytest
from astropy.constants import Constant
from astropy.units import Quantity as Q
def test_c():
from astropy.constants import c
# c is an exactly defined constant, so it shouldn't be changing
assert c.value == 2.99... |
d5babde091b0ba629fa9b46cff42ea5b987dbd4ed63ae6e762dd30c03d528ea2 | # 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... |
abdb2924228a28210b64bbc1897b9e092a8b115374200a26821988d6263999e1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
from collections import defaultdict
import numpy as np
from astropy.table import Row, QTable
from astropy.cosmology.connect import convert_registry
from astropy.cosmology.core import Cosmology
from .mapping import from_mapping
def from_ro... |
070f80f061a7d265bdd9aa07673170ddf2996e0287c60045c12eff57ffc695a7 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The following are private functions. These functions are registered into
:meth:`~astropy.cosmology.Cosmology.to_format` and
:meth:`~astropy.cosmology.Cosmology.from_format` and should only be accessed
via these methods.
"""
from astropy.cosmology.cor... |
4027dbbe8a4e7d489367b0ab7fec33828972602365e6f9577ab4f0f67a54e8a8 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import numpy as np
from astropy.cosmology.connect import convert_registry
from astropy.cosmology.core import Cosmology
from astropy.table import QTable, Table, Column
from .mapping import to_mapping
from .row import from_row
from .utils imp... |
5e0c2af75a172ac1701fd71ad2a219234401f98575c13df96fed6ed318b8c543 | # -*- 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 ecsv, mapping, model, row, table, yaml # noqa: F403
|
cc87197252fbb0038ac59759d2af9fbe2f2434a696e2de0a00d52daed7a5986a | # 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... |
9f8db9567dee38715272f4d045633877c8885ab0bf44510c0beb21c22e50d967 | # 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... |
a6048ad5f228f005b937f639d09b1102a9cfea8a99bb85d88f792f5094d3bc22 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from astropy.cosmology.parameter import Parameter
from astropy.table import Column
from astropy.modeling import Parameter as ModelParameter
def convert_parameter_to_column(parameter, value, meta=None):
"""Convert a |Cosmology| Pa... |
7905fd21052c86f4e0146a20a2e330d07d42a3172c3b322734e4899895df937c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import astropy.cosmology.units as cu
import astropy.units as u
from astropy.table import QTable
from astropy.cosmology.connect import readwrite_registry
from astropy.cosmology.core import Cosmology
from .table import from_table, to_table
def read_ecsv(... |
888b82cd2f6f268839ae957f162f1fd45e215ddfa7e98e3d76d5106d1bd52813 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Testing :mod:`astropy.cosmology.flrw`."""
##############################################################################
# IMPORTS
# STDLIB
import abc
import copy
# THIRD PARTY
import pytest
import numpy as np
import astropy.constants as const
# L... |
55a99faf675e56f65fafa645c08beb10135ec1f51dc28908155b7591fa77e82a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from math import inf
import pytest
import numpy as np
from astropy.cosmology.utils import aszarr, vectorize_redshift_method
from astropy.cosmology.utils import inf_like, vectorize_if_needed
from astropy.utils.exceptions import AstropyDeprecationWarning... |
a23140512ee2a9e5617ec6436bb4ebf92f0e6071b93b251f82d1a55294495282 | import os
import sys
sys.path.insert(0, os.path.dirname(__file__)) # allows import of "mypackage"
# isort split
import mypackage
|
6b478d6c99b8de9a293371986197ba74d4c4bbffa96fca329364431c113d72c3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Configure the tests for :mod:`astropy.cosmology`."""
##############################################################################
# IMPORTS
# STDLIB
import inspect
# THIRD-PARTY
import pytest
# LOCAL
from astropy.cosmology import core
from astrop... |
cb099a40d6c36fe9a72d7fbcb6863f94d3aceeeea2b1a24a53da7a56c2e9f8a1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Testing :mod:`astropy.cosmology.parameter`."""
##############################################################################
# IMPORTS
# STDLIB
import ast
import inspect
import sys
# THIRD PARTY
import pytest
import numpy as np
# LOCAL
import ast... |
db0eec731304570c317d1e3efe84e8829736e37c57f025c1c1dbaf1a86f31921 | # -*- coding: utf-8 -*-
"""Testing :mod:`astropy.cosmology.units`."""
##############################################################################
# IMPORTS
import contextlib
import pytest
import astropy.cosmology.units as cu
import astropy.units as u
from astropy.cosmology import Planck13, default_cosmology, fl... |
a26e4c1b783546b3ea7ab7e6434d2f7b5ae14df12f5e4c564038df1fb43f9a1c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import inspect
import os
import pytest
from astropy import cosmology
from astropy.cosmology import Cosmology, w0wzCDM
from astropy.cosmology.connect import CosmologyRead, readwrite_registry
from astropy.cosmology.core import Cosmology
from a... |
e8bfac1d907a80c3e55ec883ed929c664f143ae084754b152abf485bc747a02e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Testing :mod:`astropy.cosmology.core`."""
##############################################################################
# IMPORTS
# STDLIB
import abc
import inspect
import pickle
from types import MappingProxyType
# THIRD PARTY
import pytest
impor... |
ac4e7e7d6d97d23121bf59cbb622d15222b642ce1664e0fe5fb871077a5a64e5 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
from types import MappingProxyType
# THIRD PARTY
import numpy as np
import pytest
# LOCAL
from astropy.cosmology import parameters, realizations
def test_realizations_in_dir():
"""Test the realizations are in ``dir`` of :mod:`astropy.cosm... |
8dc8430fcc4ac60343a7ac71cce4aa79ec37f23e3b6d9e70df443028e3247d9a | # 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 pytest
import numpy as np
import astropy.constants as const
import astropy.units as u
from astropy.cosmology import Cosmology, flrw, funcs
from astrop... |
a3fe34355508974352a910919ecfd0b464fcb10d0f46c70d829727f529e64fd0 | # 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... |
aae6169062dec76847ab293b42670c4faef6f34ff28772478b344b1438702f0f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import inspect
import sys
from io import StringIO
import pytest
import numpy as np
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.realiza... |
874a86a65ac6bc6b360e99c3f21cd5efff76ced070e74f4f247f5fc4a31e355c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import inspect
import random
# THIRD PARTY
import pytest
import numpy as np
# LOCAL
from astropy.cosmology.core import _COSMOLOGY_CLASSES, Cosmology
from astropy.cosmology.io.model import _CosmologyModel, from_model, to_model
from astropy.cosm... |
289388e0762e40ed21521154d68fcf44ccc527939c7a5ce616f7f2dfd01f1173 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import copy
import inspect
from collections import OrderedDict
# THIRD PARTY
import numpy as np
import pytest
# LOCAL
from astropy.cosmology import Cosmology
from astropy.cosmology.core import _COSMOLOGY_CLASSES
from astropy.cosmology.io.mappin... |
3a617e60d6d8dbf4b9064399320ec050cd5e5acfa19cf0f233a8dfb1e2cc7c84 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# THIRD PARTY
import pytest
# LOCAL
from astropy.cosmology import Cosmology, Planck18
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 ... |
2b3709d64454a220fb6ddf60ca978a4b2725d74998368c0749f27fb19306ff95 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import inspect
# 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, ya... |
41205ec476d7a4f40aed14b0d8900a7fe83e0518009912d20d97a543c75fad51 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# THIRD PARTY
import pytest
# LOCAL
import astropy.units as u
from astropy.cosmology.core import _COSMOLOGY_CLASSES
from astropy.cosmology.io.ecsv import read_ecsv, write_ecsv
from astropy.table import QTable, Table, vstack
from .base import ReadWriteDi... |
c291643b8de475530b5484c007bc63bfa8e96068b2b7bed7a1937a0561918041 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# THIRD PARTY
import pytest
# LOCAL
import astropy.units as u
from astropy.cosmology import Cosmology, Parameter, realizations
from astropy.cosmology import units as cu
from astropy.cosmology.core import _COSMOLOGY_CLASSES
from astropy.cosmology.realizat... |
1fea6bb2cc37412ed918e0f5124e80a144ea652d106511960826f96366cfb9f2 | # 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
#######... |
1c4b5cdb71c97bd8fe82298cb31a2767f0324a342f2dab403e8bba98f72f322e | # 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_CLASSES, Cosmol... |
7a665f07bef138a80d4ef3ae0a814c525abf45d73c067022e54046f062ad0c23 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# THIRD PARTY
import pytest
# LOCAL
from astropy.cosmology import Cosmology
from astropy.cosmology.io.cosmology import from_cosmology, to_cosmology
from .base import ToFromTestMixinBase, IODirectTestBase
###############################################... |
808016887f737d3989c75cf258de4b2abfa50427b3a98ffb8da15aefbd52ddc4 | # -*- coding: utf-8 -*-
"""Cosmology classes and instances for package ``mypackage``."""
# STDLIB
from collections import UserDict
# THIRD PARTY
import numpy as np
class MyCosmology(UserDict):
"""Cosmology, from ``mypackage``.
Parameters
----------
**kw
values for `MyCosmology`.
"""
... |
3716b438eb2f0524ed5d1f70f259c3431726794a929a0921e281f85b1419de61 | from . import cosmology, io
|
1df69f480d3d3e4c7b86ec7551812d43b879abb3fc3b4b5433070a0d7a84f23e | # -*- coding: utf-8 -*-
# STDLIB
import json
import os
# THIRD PARTY
import numpy as np
# LOCAL
from mypackage.cosmology import MyCosmology
def file_reader(filename):
"""Read files in format 'myformat'.
Parameters
----------
filename : str, bytes, or `~os.PathLike`
Returns
-------
`~m... |
56547f67ccbe20c5abae405330a32d39f7272ffdcc3a5366cb590c3ddcf3a50f | # -*- coding: utf-8 -*-
"""
Readers, Writers, and I/O Miscellany.
"""
__all__ = ["file_reader", "file_writer"] # from `mypackage`
# e.g. a file reader and writer for ``myformat``
# this will be used in ``astropy_io.py``
from .core import file_reader, file_writer
# Register read and write methods into Astropy:
# de... |
bc5282bae41ff11a7f203c34d8a454652cdd8f8f4577c7613c71f40cdd584cc6 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see Astropy LICENSE.rst
"""
Register conversion methods for cosmology objects with Astropy Cosmology.
With this registered, we can start with a Cosmology from
``mypackage`` and convert it to an astropy Cosmology instance.
>>> from mypackage.... |
2d064dcaba3ed3c63781551840b2ff8545f1d1a52bed3a07b3f58be3ffead1d2 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see Astropy LICENSE.rst
"""
Register Read/Write methods for "myformat" (JSON) with Astropy Cosmology.
With this format registered, we can start with a Cosmology from
``mypackage``, write it to a file, and read it with Astropy to create an
astropy... |
23d408e689a9d6e7cd9efb9793a2de87cf55e10ff04e32419450a3ef48d05e22 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# THIRD PARTY
import pytest
# LOCAL
from mypackage.io import ASTROPY_GE_5
@pytest.fixture(scope="session", autouse=True)
def teardown_mypackage():
"""Clean up module after tests."""
yield # to let all tests within the scope run
if ASTROP... |
6919cf48a30c4aee62e1795acac114307458363ea8651a74b68ee81d6050c7f9 | # -*- coding: utf-8 -*-
"""
Test that the conversion interface with Astropy works as expected.
"""
# STDLIB
import os
# THIRD PARTY
import pytest
# LOCAL
from mypackage.cosmology import MyCosmology, myplanck
# skip all tests in module if import is missing
astropy = pytest.importorskip("astropy", minversion="4.3") ... |
b45ec3e61aa875af14e335bcd2f10d77e2d2fa849b533e5177991fcd057be722 | # -*- coding: utf-8 -*-
"""
Test that the interface with Astropy works as expected.
"""
# STDLIB
import os
# THIRD PARTY
import pytest
# LOCAL
from mypackage.cosmology import myplanck
from mypackage.io import file_reader
# skip all tests in module if import is missing
astropy = pytest.importorskip("astropy", minve... |
1fdb025eee151dcd6c7aa0f8e374779370b8f3e96a614e8e05974bc36517be0d | # Download an example FITS file, create a 2D cutout, and save it to a
# new FITS file, including the updated cutout WCS.
from astropy.io import fits
from astropy.nddata import Cutout2D
from astropy.utils.data import download_file
from astropy.wcs import WCS
def download_image_save_cutout(url, position, size):
# D... |
839026e538d2ac6883513804183bb95eb43f906603ed3d0ba8a29873e8c52d6d | # Load the WCS information from a fits header, and use it
# to convert pixel coordinates to world coordinates.
import numpy as np
from astropy import wcs
from astropy.io import fits
import sys
def load_wcs_from_file(filename):
# Load the FITS hdulist using astropy.io.fits
hdulist = fits.open(filename)
#... |
63316d80f43a6920cf6a0e0f61b924cfabadfde0818e7ceaa3ada73e3c6efd1e | # Set the WCS information manually by setting properties of the WCS
# object.
import numpy as np
from astropy import wcs
from astropy.io import fits
# Create a new WCS object. The number of axes must be set
# from the start
w = wcs.WCS(naxis=2)
# Set up an "Airy's zenithal" projection
# Vector properties may be set... |
76f4e3289aabfe27ae56e8785af13d17cc0dca6f3e6a5d72a9ed9887d158df9f | # Define the astropy.wcs.WCS object using a Python dictionary as input
import astropy.wcs
wcs_dict = {
'CTYPE1': 'WAVE ', 'CUNIT1': 'Angstrom', 'CDELT1': 0.2, 'CRPIX1': 0, 'CRVAL1': 10, 'NAXIS1': 5,
'CTYPE2': 'HPLT-TAN', 'CUNIT2': 'deg', 'CDELT2': 0.5, 'CRPIX2': 2, 'CRVAL2': 0.5, 'NAXIS2': 4,
'CTYPE3': 'HPLN-TAN', ... |
c07338c94a815b26b8846754da892de4c0e1b22dde30525e9980609aeaba4861 | # NOTE: this hook should be added to
# https://github.com/pyinstaller/pyinstaller-hooks-contrib
# once that repository is ready for pull requests
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('skyfield')
|
95f267c0d172fc33e841eb2a4a6d509b2bdd77dbabff6ad2309186383f6db52a | # -*- coding: utf-8 -*-
# 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 configurati... |
a2076d6f7fec9ca455b82c8b927c90f3ee8ebde69d44d7eadd60291e5933216b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import astropy.config as _config
from astropy.utils.compat import optional_deps
from .column import Column, MaskedColumn, StringTruncateWarning, ColumnInfo
__all__ = ['BST', 'Column', 'ColumnGroups', 'ColumnInfo', 'Conf',
'JSViewer', 'MaskedCo... |
23d665a34fb026a203c3d0b68ecd88812c21606766629426f1d591e31ee5c89f | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import ctypes
import numpy as np
from astropy.modeling.core import Model, custom_model
__all__ = ['discretize_model', 'KernelSizeError']
class DiscretizationError(Exception):
"""
Called when discretization of models goes wrong.
"""
class... |
e63d52ca3d13b31d866ffb97cd1b32a72f50792feff7f1b8f47c42ee6486ffd8 | # 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... |
8d303ef2839341a6e887eb4b0f78c060a51e6d407de103f487adc8f7d57a65e6 | # 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... |
4e70ac2e0c9a0a247306bc28446853f7c4fe5b8ccacd461abea6b7c50be2e1cf | # 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... |
85cf63cf9d73faa6a41b70e0b661b3d35e16dee181c65736cab7896232e9d29b | # 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 SPECIAL_OPERATORS, CompoundModel
class Convolution(CompoundModel):
"""
Wrapper class for a convolutio... |
a79eb0a5a2c34995fd2d8df8bcdbf6d6568ecd5e4dded59a27aebde9178cd1bf | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage provides a framework for representing models and
performing model evaluation and fitting. It supports 1D and 2D models
and fitting with parameter constraints. It has some predefined models
and fitting routines.
"""
from . import fitti... |
efb055ba5d6c2b05b0e3b0ea25973ee67aafdc613212f2b2fe11b40df22f29a4 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Creates a common namespace for all pre-defined models.
"""
# pylint: disable=unused-wildcard-import, unused-import, wildcard-import
from . import math_functions as math
from .core import custom_model, fix_inputs, hide_inverse # pylint: disable=W061... |
8e0d234be06fc901c88f52d1e8a0bf625ba29ea969c429e2c31062ac66f5cda9 | """
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... |
e5f22bc145a3296853fb04d8fdedccce4ffaae5908e754cad844a5f846d9022d | # 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 ... |
3dbad1d8ad2b3c167566fbc44823eb5bd8333efd2884e083021c637851fd22d8 | # 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"]
#... |
66ca7890dabf1d575ae134ea53b9d3897d06f1ba79d2be75b97fb7e85b31f125 | # 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... |
4d9028672dd5ed8e5551df7fa81e9aa96de2e1177ceda10ad9539beec4960d02 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Define Numpy Ufuncs as Models.
"""
import numpy as np
from astropy.modeling.core import Model
from astropy.utils.exceptions import AstropyUserWarning
trig_ufuncs = ["sin", "cos", "tan", "arcsin", "arccos", "arctan", "arctan2",
"hypot",... |
b68e156aa20a4ab6c9fada59c7f18cfc4a1249d31eff93d892dc9671660bea78 | # 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_... |
fac3476e78df776525ebf9ffea7ff0063b2f5b10bfa7b2ee6520a1daae1fe3b1 | # 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 astro... |
8da004d14652272a72c1e70568f614f85771987c6c6cfe23e4eabbfe46c9ac00 | # 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... |
0b772a3daa920beaec426dd65dd664b09639dc83bb94a3bced3831b617057a67 | # 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... |
1d0cb41dab8446c3052cdeac7933e6c3cc9a6879f5381ff915ef9a86ee8cbc3b | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
# 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 functio... |
f193ef523f6f686b431bba80736283f617ca13ecaa730f866f1a1c73841f898d | # 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... |
ee05fcda396fd52fc8a29ae3b6d92273b72688794478596e13758ef77d9fe72d | # 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.],
... ... |
56de15bce30e82a717220df8cc6fdcf517d6c41842efc6562a25ec337f154fc2 | # 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 .... |
53d95b7f1dd523f8834a1c14c6a5373720505aa485d3884af12b5512aff8f93e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Power law model variants
"""
# pylint: disable=invalid-name
import numpy as np
from astropy.units import Quantity
from .core import Fittable1DModel
from .parameters import InputParameterError, Parameter
__all__ = ['PowerLaw1D', 'BrokenPowerLaw1D', '... |
a24c87fc4d7097b2728b59ba9d3a92c26a3f8daa882c504bf142d8bc95f68e19 | # -*- coding: utf-8 -*-
# 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 func... |
4dd3659a9f66fea3689716b7e67189a60e9e3db06117355455ab324e2916ce01 | """
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
... |
c50286266d50e15af8660da9a90d0feaee76de238b555c89483df63c6857bd80 | # 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... |
b3a5e3250cb39cddd1b82b8aaee0fec243b5b99b7a63ac392e05508473003561 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import os
from os.path import join
import os.path
import shutil
import sys
from collections import defaultdict
from setuptools import Extension
from setuptools.dep_util import newer_group
import numpy
from extension_helpers import import_file... |
83709722e3696901f263dfc3e0a4f29d4cb7d81e31b5417dfe50f0123b63652e | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package defines the CGS units. They are also available in the
top-level `astropy.units` namespace.
"""
from fractions import Fraction
from . import si
from .core import UnitBase, def_unit
_ns = globals()
def_unit(['c... |
6a7a7ae3af3af261e0b6e993d3f904e2f3becbc8084b1cbd81b412a118c49a0c | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains convenience functions for retrieving solar system
ephemerides from jplephem.
"""
from urllib.parse import urlparse
import os.path
import numpy as np
import erfa
from .sky_coordinate import SkyCoord
from astropy.utils.data import... |
4819e9deb9afb7cf99d8ecd5571be22d1806c44c1b2c1c81476acfeb6f8aef40 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Utililies used for constructing and inspecting rotation matrices.
"""
from functools import reduce
import numpy as np
from astropy import units as u
from .angles import Angle
def matrix_product(*matrices):
"""Matrix mult... |
998b9f0e7c806bb9754acbecfda3033c32a472e87b96f56d0dc37b05e0665421 | import re
import copy
import warnings
import operator
import numpy as np
import erfa
from astropy.utils.compat.misc import override__dir__
from astropy import units as u
from astropy.constants import c as speed_of_light
from astropy.utils.data_info import MixinInfo
from astropy.utils import ShapedLikeNDArray
from ast... |
f4ee688a0561fdd05ae48895493a30af67c9acda8a94fac15196e560fd730c9b | """
In this module, we define the coordinate representation classes, which are
used to represent low-level cartesian, spherical, cylindrical, and other
coordinates.
"""
import abc
import functools
import operator
import inspect
import warnings
import numpy as np
import astropy.units as u
from erfa import ufunc as erf... |
6c61ed429d9626e1a07896f97ee06d3234a440011cf2afc6486b6a32652b9945 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains utility functions for working with angles. These are both
used internally in astropy.coordinates.angles, and of possible
"""
__all__ = ['angular_separation', 'position_angle', 'offset_by',
'golde... |
c5c5952a060b137476d732a5c8f21468af41ef37e208596d90bc9f7be3c83c66 | # 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... |
8931907d160e3ebb83ebc7ecb5426f5086eba9cc6864645387aace0e1b9ee1f2 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains the classes and utility functions for distance and
cartesian coordinates.
"""
import warnings
import numpy as np
from astropy import units as u
from astropy.utils.exceptions import AstropyWarning
from .angles import Angle
__al... |
3437ac942617574b4c51dfb2c3f0b280b71f6cf468cee880d9c497553edf8824 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains convenience functions for coordinate-related functionality.
This is generally just wrapping around the object-oriented coordinates
framework, but it is useful for some users who are used to more functional
interfaces.
"""
import... |
43599a377a0eabec14c984534e2b5096fbb6883bc0ede3e7adda6d57b8920487 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Framework and base classes for coordinate frames/"low-level" coordinate
classes.
"""
# Standard library
import copy
import inspect
from collections import namedtuple, defaultdict
import warnings
# Dependencies
import numpy as... |
dcc38bcd2c9a08806adc2e0d2c0da0c2456bd35d1d2100e581de4be94c43ade3 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from warnings import warn
import collections
import socket
import json
import urllib.request
import urllib.error
import urllib.parse
import numpy as np
import erfa
from astropy import units as u
from astropy import constants as consts
from astropy.units... |
c4a417909607b11d14b1dbeccbb6197420fc1e80d5ce8a6a70a4c7a050d3e1f2 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains the fundamental classes used for representing
coordinates in astropy.
"""
import warnings
from collections import namedtuple
import numpy as np
from . import angle_formats as form
from astropy import uni... |
ea900ec49e8a14ba6dddea4c367b1e624ef6e71c5d3ad9b0eaaf8e7765bf6804 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.cosmology import units as cu
from astropy.io import registry as io_registry
from astropy.units import add_enabled_units
__all__ = ["CosmologyRead", "CosmologyWrite",
"CosmologyFromFormat", "CosmologyToFormat"]
__doctest_skip__ = _... |
c01d296ad1cc278475de924a15d8967a0b17913524abf30fb2458992cef69111 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import abc
import inspect
import numpy as np
from astropy.io.registry import UnifiedReadWriteMethod
from astropy.utils.decorators import classproperty
from astropy.utils.metadata import MetaData
from .connect import CosmologyFromFormat, CosmologyRead, ... |
db93cbcd8ef3788ad9c903c7992c68c90427a0c589df4d86cbccb1781ea65f13 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
""" astropy.cosmology contains classes and functions for cosmological
distance measures and other cosmology-related calculations.
See the `Astropy documentation
<https://docs.astropy.org/en/latest/cosmology/index.html>`_ for more
detailed usage examples a... |
a2ca785caa73053baefab103e8e3fba80b02c3926d645f511b6a825d1795f81d | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import astropy.units as u
__all__ = ["Parameter"]
class Parameter:
r"""Cosmological parameter (descriptor).
Should only be used with a :class:`~astropy.cosmology.Cosmology` subclass.
Parameters
----------
derived : bool (optional,... |
b0199086878b0617196ea9d663af0d3cdc4d5b666d63967d6eeecdea354cb70f | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Cosmological units and equivalencies.
""" # (newline needed for unit summary)
import astropy.units as u
from astropy.units.utils import generate_unit_summary as _generate_unit_summary
__all__ = ["littleh", "redshift",
... |
1b8f3351a6e6db01bec608380dc58d0d7474c8d56cc9cd3ca828b067494ca727 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import pathlib
import sys
# LOCAL
from astropy.utils.data import get_pkg_data_path
from astropy.utils.decorators import deprecated
from astropy.utils.state import ScienceState
from .core import Cosmology
_COSMOLOGY_DATA_DIR = pathlib.Path(get_... |
fdedce9cd0f7a884a074af48dca7c62f96114287fb66786176fe6b21f1ed9a9a | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.table.table_helpers import ArrayWrapper
from astropy.coordinates.earth import EarthLocation
from astropy.units.quantity import Quantity
from collections import OrderedDict
from contextlib import nullcontext
import pytest
import numpy as np
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.