repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
astropy
astropy/coordinates/builtin_frames/skyoffset.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from functools import cache from astropy import units as u from astropy.coordinates.attributes import CoordinateAttribute, QuantityAttribute from astropy.coordinates.baseframe import BaseCoordinateFrame, frame_transform_graph from astropy.coordinates.mat...
197
8,120
astropy
astropy/coordinates/builtin_frames/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains functions/values used repeatedly in different modules of the ``builtin_frames`` package. """ import warnings import erfa import numpy as np from astropy import units as u from astropy.coordinates.earth import EarthLocation from ...
423
14,566
astropy
astropy/coordinates/builtin_frames/cirs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.attributes import EarthLocationAttribute, TimeAttribute from astropy.coordinates.baseframe import base_doc from astropy.utils.decorators import format_doc from .baseradec import BaseRADecFrame, doc_components from .utils import D...
99
4,284
astropy
astropy/coordinates/builtin_frames/icrs_cirs_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains the transformation functions for getting from ICRS/HCRS to CIRS and anything in between (currently that means GCRS). """ import numpy as np from astropy import units as u from astropy.coordinates.baseframe import frame_transform_graph from a...
285
11,194
astropy
astropy/coordinates/builtin_frames/itrs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.attributes import EarthLocationAttribute, TimeAttribute from astropy.coordinates.baseframe import BaseCoordinateFrame, base_doc from astropy.coordinates.earth import EarthLocation from astropy.coordinates.representation import ( ...
93
4,268
astropy
astropy/coordinates/builtin_frames/itrs_observed_transforms.py
.py
import erfa import numpy as np from astropy import units as u from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.matrix_utilities import matrix_transpose, rotation_matrix from astropy.coordinates.representation import CartesianRepresentation from astropy.coordinates.transformation...
145
5,630
astropy
astropy/coordinates/builtin_frames/fk4_fk5_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.matrix_utilities import matrix_transpose from astropy.coordinates.transformations import DynamicMatrixTransform from .fk4 import FK4NoETerms fro...
76
2,730
astropy
astropy/coordinates/builtin_frames/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package contains the coordinate frames implemented by astropy. Users shouldn't use this module directly, but rather import from the `astropy.coordinates` module. While it is likely to exist for the long-term, the existence of this package and de...
244
7,623
astropy
astropy/coordinates/builtin_frames/icrs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.baseframe import base_doc from astropy.utils.decorators import format_doc from .baseradec import BaseRADecFrame, doc_components __all__ = ["ICRS"] @format_doc(base_doc, components=doc_components, footer="") class ICRS(BaseRADe...
25
892
astropy
astropy/coordinates/builtin_frames/baseradec.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates import representation as r from astropy.coordinates.baseframe import ( BaseCoordinateFrame, RepresentationMapping, base_doc, ) from astropy.utils.decorators import format_doc __all__ = ["BaseRADecFrame"] doc_compone...
53
2,017
astropy
astropy/coordinates/builtin_frames/lsr.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import units as u from astropy.coordinates import representation as r from astropy.coordinates.attributes import CartesianRepresentationAttribute from astropy.coordinates.baseframe import ( BaseCoordinateFrame, RepresentationMapping, ...
288
11,268
astropy
astropy/coordinates/builtin_frames/icrs_observed_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains the transformation functions for getting to "observed" systems from ICRS. """ import erfa from astropy import units as u from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.builtin_frames.utils import atc...
134
4,874
astropy
astropy/coordinates/builtin_frames/galactic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import units as u from astropy.coordinates import Angle from astropy.coordinates import representation as r from astropy.coordinates.baseframe import ( BaseCoordinateFrame, RepresentationMapping, base_doc, ) from astropy.utils.dec...
102
4,082
astropy
astropy/coordinates/builtin_frames/ecliptic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import units as u from astropy.coordinates import representation as r from astropy.coordinates.attributes import QuantityAttribute, TimeAttribute from astropy.coordinates.baseframe import BaseCoordinateFrame, base_doc from astropy.utils.decor...
270
9,891
astropy
astropy/coordinates/builtin_frames/hadec.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import units as u from astropy.coordinates import representation as r from astropy.coordinates.attributes import ( EarthLocationAttribute, QuantityAttribute, TimeAttribute, ) from astropy.coordinates.baseframe import ( BaseCoo...
143
5,830
astropy
astropy/coordinates/builtin_frames/galactic_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.matrix_utilities import matrix_transpose, rotation_matrix from astropy.coordinates.transformations import DynamicMatrixTransform from .fk4 import FK4NoETerms from .f...
44
1,697
astropy
astropy/coordinates/builtin_frames/cirs_observed_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains the transformation functions for getting to "observed" systems from CIRS. """ import erfa import numpy as np from astropy import units as u from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.erfa_astrom ...
107
3,824
astropy
astropy/coordinates/builtin_frames/icrs_fk5_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.matrix_utilities import matrix_transpose, rotation_matrix from astropy.coordinates.transformations import DynamicMatrixTransform from .fk5 import FK5 from .icrs impo...
45
1,429
astropy
astropy/coordinates/builtin_frames/supergalactic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import units as u from astropy.coordinates import representation as r from astropy.coordinates.baseframe import ( BaseCoordinateFrame, RepresentationMapping, base_doc, ) from astropy.utils.decorators import format_doc from .galac...
69
2,589
astropy
astropy/coordinates/builtin_frames/fk5.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import erfa from astropy.coordinates.attributes import TimeAttribute from astropy.coordinates.baseframe import base_doc, frame_transform_graph from astropy.coordinates.transformations import DynamicMatrixTransform from astropy.utils.decorators import for...
72
2,311
astropy
astropy/coordinates/builtin_frames/hcrs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.attributes import TimeAttribute from astropy.coordinates.baseframe import base_doc from astropy.utils.decorators import format_doc from .baseradec import BaseRADecFrame, doc_components from .utils import DEFAULT_OBSTIME __all__ ...
49
1,610
astropy
astropy/coordinates/builtin_frames/supergalactic_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.matrix_utilities import matrix_transpose, rotation_matrix from astropy.coordinates.transformations import StaticMatrixTransform from .galactic import Galactic from ....
23
801
astropy
astropy/coordinates/builtin_frames/altaz.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy import units as u from astropy.coordinates import representation as r from astropy.coordinates.attributes import ( EarthLocationAttribute, QuantityAttribute, TimeAttribute, ) from astropy.coordinates.baseframe ...
145
5,707
astropy
astropy/coordinates/angles/formats.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module includes files automatically generated from ply (these end in # _lextab.py and _parsetab.py). To generate these files, remove them from this # folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace #...
453
13,967
astropy
astropy/coordinates/angles/errors.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Custom angle errors and exceptions used in :mod:`astropy.coordinates.angles`.""" __all__ = [ "BoundsError", "IllegalHourError", "IllegalHourWarning", "IllegalMinuteError", "IllegalMinuteWarning", "IllegalSecondError", "Ille...
174
3,928
astropy
astropy/coordinates/angles/utils.py
.py
# 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 use externally. """ __all__ = [ "angular_separation", "golden_spiral_grid", "offset_by", ...
231
7,679
astropy
astropy/coordinates/angles/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for celestial coordinates of astronomical objects. It also contains a framework for conversions between coordinate systems. """ from .core import * from .errors import * from .utils import *
12
308
astropy
astropy/coordinates/angles/angle_lextab.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file was automatically generated from ply. To re-generate this file, # remove it from this folder, then build astropy and run the tests in-place: # # python setup.py build_ext --inplace # pytest astropy/coordinates/angles # # You can then commi...
21
4,304
astropy
astropy/coordinates/angles/core.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains the fundamental classes used for representing coordinates in astropy. """ import functools from typing import NamedTuple import numpy as np from astropy import units as u from astropy.units import SpecificTypeQuantity from . i...
742
27,882
astropy
astropy/extern/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This packages contains python packages that are bundled with Astropy but are external to Astropy, and hence are developed in a separate source tree. Note that this package is distinct from the /cextern directory of the source code distribution, as tha...
11
457
astropy
astropy/extern/_strptime.py
.py
"""Strptime-related classes and functions. CLASSES: LocaleTime -- Discovers and stores locale-specific time information TimeRE -- Creates regexes for pattern matching a string of text containing time information FUNCTIONS: _getlang -- Figure out what language is being used for the locale ...
530
22,516
astropy
astropy/extern/configobj/configobj.py
.py
# configobj.py # A config file reader/writer that supports nested sections in config files. # Copyright (C) 2005-2014: # (name) : (email) # Michael Foord: fuzzyman AT voidspace DOT org DOT uk # Nicola Larosa: nico AT tekNico DOT net # Rob Dennis: rdennis AT gmail DOT com # Eli Courtwright: eli AT courtwright DOT org #...
2,473
87,358
astropy
astropy/extern/configobj/validate.py
.py
# validate.py # A Validator object # Copyright (C) 2005-2014: # (name) : (email) # Michael Foord: fuzzyman AT voidspace DOT org DOT uk # Mark Andrews: mark AT la-la DOT com # Nicola Larosa: nico AT tekNico DOT net # Rob Dennis: rdennis AT gmail DOT com # Eli Courtwright: eli AT courtwright DOT org # This software is l...
1,473
46,678
astropy
astropy/extern/ply/yacc.py
.py
# ----------------------------------------------------------------------------- # ply: yacc.py # # Copyright (C) 2001-2018 # David M. Beazley (Dabeaz LLC) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions ar...
3,434
135,305
astropy
astropy/extern/ply/cpp.py
.py
# ----------------------------------------------------------------------------- # cpp.py # # Author: David Beazley (http://www.dabeaz.com) # Copyright (C) 2007 # All rights reserved # # This module implements an ANSI-C style lexical preprocessor for PLY. # --------------------------------------------------------------...
915
33,639
astropy
astropy/extern/ply/lex.py
.py
# ----------------------------------------------------------------------------- # ply: lex.py # # Copyright (C) 2001-2018 # David M. Beazley (Dabeaz LLC) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are...
1,099
42,905
astropy
astropy/extern/ply/__init__.py
.py
# PLY package # Author: David Beazley (dave@dabeaz.com) __version__ = '3.11' __all__ = ['lex','yacc']
6
103
astropy
astropy/extern/ply/ctokens.py
.py
# ---------------------------------------------------------------------- # ctokens.py # # Token specifications for symbols in ANSI C and C++. This file is # meant to be used as a library in other tokenizers. # ---------------------------------------------------------------------- # Reserved words tokens = [ # Li...
128
3,155
astropy
astropy/extern/ply/ygen.py
.py
# ply: ygen.py # # This is a support program that auto-generates different versions of the YACC parsing # function with different features removed for the purposes of performance. # # Users should edit the method LRParser.parsedebug() in yacc.py. The source code # for that method is then used to create the other meth...
70
2,246
astropy
astropy/cosmology/traits.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Traits for building ``astropy`` :class:`~astropy.cosmology.Cosmology` classes.""" __all__ = ( "BaryonComponent", "CriticalDensity", "CurvatureComponent", "DarkEnergyComponent", "DarkMatterComponent", "HubbleParameter", "Matt...
33
736
astropy
astropy/cosmology/realizations.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Built-in cosmologies. See :attr:`~astropy.cosmology.realizations.available` for a full list. """ __all__ = [ # noqa: F822, RUF022 "available", "default_cosmology", # ---- "WMAP1", "WMAP3", "WMAP5", "WMAP7", "WMAP9", ...
76
1,684
astropy
astropy/cosmology/io.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """I/O subpackage for cosmology. This subpackage contains classes and functions for reading, writing and converting cosmology objects to and from various formats. User access to the I/O functionality is provided through the methods on the `~astropy.cosmo...
34
985
astropy
astropy/cosmology/parameters.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module contains dictionaries with sets of parameters for a given cosmology. The list of cosmologies available are given by the tuple `available`. """ import sys from types import MappingProxyType from .realizations import available __all__ = ( ...
43
1,033
astropy
astropy/cosmology/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Cosmology with Astropy. :mod:`~astropy.cosmology` contains classes and functions for cosmological distance measures and other cosmology-related calculations. See the :ref:`astropy-cosmology` for more detailed usage examples and references. """ __all_...
89
1,921
astropy
astropy/cosmology/units.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Cosmological units and equivalencies.""" __all__ = ( # redshift equivalencies "dimensionless_redshift", "littleh", "redshift", "redshift_distance", "redshift_hubble", "redshift_temperature", # other equivalencies "wi...
45
1,281
astropy
astropy/cosmology/_src/scipy_compat.py
.py
"""Scipy compatibility.""" __all__ = ("ellipkinc", "hyp2f1", "quad") from typing import Any, Never from astropy.utils.compat.optional_deps import HAS_SCIPY if HAS_SCIPY: from scipy.integrate import quad from scipy.special import ellipkinc, hyp2f1 else: def quad(*args: Any, **kwargs: Any) -> Never: ...
23
635
astropy
astropy/cosmology/_src/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__: tuple[str, ...] = () # nothing is publicly scoped import functools from collections.abc import Callable from numbers import Number from typing import Any, Final, ParamSpec, Protocol, TypeAlias, TypeVar, overload import numpy as np from numpy.t...
140
4,335
astropy
astropy/cosmology/_src/default.py
.py
"""Default Cosmology.""" # Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ("default_cosmology",) from typing import ClassVar from astropy.utils.state import ScienceState # isort: split from astropy.cosmology._src.core import Cosmology class default_cosmology(ScienceState): """The def...
110
2,991
astropy
astropy/cosmology/_src/setup_package.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import sys from os.path import relpath from pathlib import Path from setuptools import Extension ASTROPY_COSMOLOGY_SRC_ROOT = Path(__file__).parent if sys.platform.startswith("win"): # on windows, -Werror (and possibly -Wall too) isn't recognized ...
30
872
astropy
astropy/cosmology/_src/__init__.py
.py
"""Astropy Cosmology. **NOT public API**. The public API is provided by `astropy.cosmology`. """ # Licensed under a 3-clause BSD style license - see LICENSE.rst
6
162
astropy
astropy/cosmology/_src/units_equivalencies.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Cosmological unit equivalencies.""" __all__ = ( # redshift equivalencies "dimensionless_redshift", "redshift_distance", "redshift_hubble", "redshift_temperature", # other equivalencies "with_H0", "with_redshift", ) imp...
370
12,527
astropy
astropy/cosmology/_src/typing.py
.py
"""Static typing for :mod:`astropy.cosmology`. PRIVATE API.""" # Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ("CosmoMeta", "FArray", "_CosmoT") from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeAlias, TypeVar import numpy as np from numpy.typing import NDArray...
23
691
astropy
astropy/cosmology/_src/units.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Cosmological units.""" __all__ = ("littleh", "redshift") from typing import Final import astropy.units as u _ns = globals() # This is not formally a unit, but is used in that way in many contexts, and # an appropriate equivalency is only possible ...
36
1,046
astropy
astropy/cosmology/_src/core.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # Originally authored by Andrew Becker (becker@astro.washington.edu), # and modified by Neil Crighton (neilcrighton@gmail.com), Roban Kramer # (robanhk@gmail.com), and Nathaniel Starkman (n.starkman@mail.utoronto.ca). # Many of these adapted from Hogg 199...
661
24,655
astropy
astropy/cosmology/_src/funcs/optimize.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Convenience functions for `astropy.cosmology`.""" __all__ = ("z_at_value",) import warnings from collections.abc import Callable from typing import TYPE_CHECKING, Any, NotRequired, Protocol, TypeAlias, TypedDict import numpy as np import numpy.typing...
483
19,648
astropy
astropy/cosmology/_src/funcs/comparison.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Comparison functions for `astropy.cosmology.Cosmology`. This module is **NOT** public API. To use these functions, import them from the top-level namespace -- :mod:`astropy.cosmology`. This module will be moved. """ import functools import inspect fro...
366
13,386
astropy
astropy/cosmology/_src/tests/test_core.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.core`.""" import abc import inspect import pickle import numpy as np import pytest from numpy.typing import NDArray import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology import Cosmolog...
508
17,617
astropy
astropy/cosmology/_src/tests/test_realizations.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pickle import pytest 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 default_cosmology def test_reali...
106
3,589
astropy
astropy/cosmology/_src/tests/test_parameters.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from types import MappingProxyType import numpy as np import pytest from astropy.cosmology import parameters, realizations def test_realizations_in_dir(): """Test the realizations are in ``dir`` of :mod:`astropy.cosmology.parameters`.""" d = d...
45
1,406
astropy
astropy/cosmology/_src/tests/test_units.py
.py
"""Testing :mod:`astropy.cosmology.units`.""" import pytest import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology import Planck13, default_cosmology from astropy.tests.helper import assert_quantity_allclose from astropy.utils.compat.optional_deps import HAS_SCIPY #####################...
373
14,589
astropy
astropy/cosmology/_src/tests/test_scipy_compat.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.cosmology._src.flrw.base import quad from astropy.utils.compat.optional_deps import HAS_SCIPY @pytest.mark.skipif(HAS_SCIPY, reason="scipy is installed") def test_optional_deps_functions(): """Test stand-in functions when...
14
464
astropy
astropy/cosmology/_src/tests/helper.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module provides the tools used to internally run the cosmology test suite from the installed astropy. It makes use of the |pytest| testing framework. """ __all__ = ("clean_registry", "get_redshift_methods") import inspect import pytest from ...
108
3,482
astropy
astropy/cosmology/_src/tests/test_utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest import astropy.units as u from astropy.cosmology._src.utils import ( aszarr, deprecated_keywords, vectorize_redshift_method, ) from astropy.utils.compat.optional_deps import HAS_PANDAS from .test_core import ...
178
5,588
astropy
astropy/cosmology/_src/tests/funcs/test_funcs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import inspect import sys from contextlib import nullcontext from io import StringIO import numpy as np import pytest from astropy import units as u from astropy.cosmology import ( WMAP1, WMAP3, WMAP5, WMAP7, WMAP9, CosmologyErro...
427
13,206
astropy
astropy/cosmology/_src/tests/funcs/test_comparison.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for :mod:`astropy.cosmology.comparison`""" import re import numpy as np import pytest from astropy.cosmology import Cosmology, FlatCosmologyMixin, Planck18, cosmology_equal from astropy.cosmology._src.funcs.comparison import ( _CANT_BROADC...
347
11,797
astropy
astropy/cosmology/_src/tests/traits/test_trait_matter.py
.py
import numpy as np import pytest from numpy.testing import assert_allclose from astropy.cosmology._src.traits.matter import MatterComponent from .helper import is_positional_only class DummyMatter(MatterComponent): Om0 = 0.3 def inv_efunc(self, z): return np.ones_like(np.asarray(z)) class ZeroMat...
57
1,189
astropy
astropy/cosmology/_src/tests/traits/test_trait_curvature.py
.py
import numpy as np import pytest from numpy.testing import assert_allclose from astropy.cosmology._src.traits.curvature import CurvatureComponent from .helper import is_positional_only class DummyCurvature(CurvatureComponent): def __init__(self, ok0): self._ok0 = ok0 @property def Ok0(self): ...
43
969
astropy
astropy/cosmology/_src/tests/traits/test_trait_tcmb.py
.py
import pytest import astropy.units as u from astropy.cosmology._src.traits.tcmb import TemperatureCMB from astropy.tests.helper import assert_quantity_allclose class DummyTcmb(TemperatureCMB): Tcmb0 = 2.7 * u.K @pytest.fixture def dummy_tcmb(): return DummyTcmb() def test_tcmb_behavior_and_signature(dumm...
23
496
astropy
astropy/cosmology/_src/tests/traits/__init__.py
.py
"""Test package for cosmology trait tests.""" __all__ = []
4
60
astropy
astropy/cosmology/_src/tests/traits/test_trait_rhocrit.py
.py
import numpy as np import pytest import astropy.units as u from astropy.cosmology._src.traits.rhocrit import CriticalDensity from astropy.tests.helper import assert_quantity_allclose class DummyRho(CriticalDensity): critical_density0 = 1.0 * u.kg / (u.m**3) def efunc(self, z): return np.ones_like(np...
25
583
astropy
astropy/cosmology/_src/tests/traits/test_trait_totalcomponent.py
.py
import numpy as np import pytest from numpy.testing import assert_allclose from astropy.cosmology._src.traits.totalcomponent import TotalComponent class DummyTotal(TotalComponent): @property def Otot0(self): return 1.0 def Otot(self, z, /): z = np.asarray(z) return np.ones_like(z...
25
482
astropy
astropy/cosmology/_src/tests/traits/test_trait_neutrino.py
.py
import numpy as np import pytest import astropy.units as u from astropy.cosmology._src.traits.neutrino import NeutrinoComponent from astropy.tests.helper import assert_quantity_allclose class DummyNeutrino(NeutrinoComponent): Tcmb0 = 2.7255 * u.K Ogamma0 = 5e-5 @property def has_massive_nu(self): ...
40
919
astropy
astropy/cosmology/_src/tests/traits/test_trait_hubble.py
.py
import numpy as np import pytest import astropy.units as u from astropy.cosmology._src.traits.hubble import HubbleParameter from astropy.tests.helper import assert_quantity_allclose class DummyHubble(HubbleParameter): H0 = 70 * u.km / (u.s * u.Mpc) def efunc(self, z): return np.ones_like(np.asarray(...
32
737
astropy
astropy/cosmology/_src/tests/traits/test_trait_scale_factor.py
.py
import pytest from numpy.testing import assert_allclose from astropy.cosmology._src.traits.scale_factor import ScaleFactor from .helper import is_positional_only class DummyScale(ScaleFactor): pass @pytest.fixture def dummy_scale(): return DummyScale() def test_scale_factor_behavior_and_signature(dummy_...
40
940
astropy
astropy/cosmology/_src/tests/traits/test_trait_photoncomponent.py
.py
import numpy as np import pytest from astropy.cosmology._src.traits.photoncomponent import PhotonComponent from astropy.tests.helper import assert_quantity_allclose from .helper import is_positional_only class DummyPhoton(PhotonComponent): Ogamma0 = 1e-4 def inv_efunc(self, z): return np.ones_like(...
26
633
astropy
astropy/cosmology/_src/tests/traits/test_trait_darkenergy.py
.py
import numpy as np import pytest from astropy.cosmology._src.traits.darkenergy import DarkEnergyComponent from .helper import is_positional_only class MinimalDarkEnergy(DarkEnergyComponent): Ode0 = 0.7 def w(self, z, /): return -1.0 class ConcreteDarkEnergy(DarkEnergyComponent): Ode0 = 0.7 ...
49
1,117
astropy
astropy/cosmology/_src/tests/traits/test_trait_baryons.py
.py
import numpy as np import pytest from numpy.testing import assert_allclose from astropy.cosmology._src.traits.baryons import BaryonComponent from .helper import is_positional_only class DummyBaryon(BaryonComponent): Ob0 = 0.05 def inv_efunc(self, z): return np.ones_like(np.asarray(z)) @pytest.fix...
26
584
astropy
astropy/cosmology/_src/tests/traits/helper.py
.py
import inspect from collections.abc import Callable def is_positional_only(func: Callable, /, param: str) -> bool: """Return True if ``param:str`` is a positional-only parameter. Parameters ---------- func: Callable Function to check whether parameter `param` is positional-only. param : s...
18
526
astropy
astropy/cosmology/_src/tests/traits/test_trait_darkmatter.py
.py
import numpy as np import pytest from numpy.testing import assert_allclose from astropy.cosmology._src.traits.darkmatter import DarkMatterComponent from .helper import is_positional_only class DummyDarkMatter(DarkMatterComponent): Odm0 = 0.25 def inv_efunc(self, z): return np.ones_like(np.asarray(z...
26
631
astropy
astropy/cosmology/_src/tests/flrw/test_parameters.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Parameter test mixin classes.""" import copy from inspect import BoundArguments import numpy as np import pytest import astropy.constants as const import astropy.units as u from astropy.cosmology import Cosmology, FlatFLRWMixin, Parameter from astro...
507
20,267
astropy
astropy/cosmology/_src/tests/flrw/test_w0cdm.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.w0cdm`.""" import numpy as np import pytest import astropy.units as u from astropy.cosmology import FlatwCDM, wCDM from astropy.cosmology._src.parameter import Parameter from astropy.cosmology._src.tests.test_core impo...
212
7,776
astropy
astropy/cosmology/_src/tests/flrw/test_w.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.FLRW` neutrinos.""" import numpy as np import pytest import astropy.units as u from astropy.cosmology import FLRW, wCDM from astropy.utils.compat.optional_deps import HAS_SCIPY ########################################...
90
2,916
astropy
astropy/cosmology/_src/tests/flrw/test_lambdacdm.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.flrw.lambdacdm`.""" import pathlib import re import numpy as np import pytest import astropy.constants as const import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology import FlatLambdaCD...
1,060
40,147
astropy
astropy/cosmology/_src/tests/flrw/test_flrw.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.FLRW`.""" from typing import final import pytest from astropy.cosmology import FLRW from astropy.cosmology._src.core import _COSMOLOGY_CLASSES, dataclass_decorator from astropy.cosmology._src.tests.helper import get_r...
113
3,834
astropy
astropy/cosmology/_src/tests/flrw/test_wpwazpcdm.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.wpwazpcdm`.""" import numpy as np import pytest import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology import FlatwpwaCDM, wpwaCDM from astropy.cosmology._src.parameter import Parameter f...
311
11,683
astropy
astropy/cosmology/_src/tests/flrw/test_base.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.flrw.base`. This module sets up the tests for subclasses of :class:`astropy.cosmology.FLRW`. The tests for the specific abstract class :class:`astropy.cosmology.FLRW` are in ``test_flrw``. """ import abc from functool...
569
20,866
astropy
astropy/cosmology/_src/tests/flrw/test_w0wzcdm.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.w0wzcdm`.""" import numpy as np import pytest import astropy.units as u from astropy.cosmology import Flatw0wzCDM, w0wzCDM from astropy.cosmology._src.parameter import Parameter from astropy.cosmology._src.tests.test_c...
304
11,093
astropy
astropy/cosmology/_src/tests/flrw/test_w0wacdm.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Testing :mod:`astropy.cosmology.w0wacdm`.""" import numpy as np import pytest import astropy.units as u from astropy.cosmology import Flatw0waCDM, Planck18, w0waCDM from astropy.cosmology._src.parameter import Parameter from astropy.cosmology._src.te...
285
10,089
astropy
astropy/cosmology/_src/tests/flrw/conftest.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Configure the tests for :mod:`astropy.cosmology`.""" from collections.abc import Iterable, Mapping, Sequence from typing import TypeVar from astropy.cosmology._src.tests.helper import clean_registry # noqa: F401 from astropy.tests.helper import pick...
33
956
astropy
astropy/cosmology/_src/tests/io/test_mapping.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import OrderedDict import numpy as np import pytest from astropy.cosmology import Cosmology from astropy.cosmology._src.io.builtin.mapping import from_mapping, to_mapping from .base import ToFromDirectTestBase, ToFromTestMixinBase ###...
241
9,427
astropy
astropy/cosmology/_src/tests/io/test_.py
.py
# 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.io import convert_registry, readwrite_registry def test_expected_readwrite_io(): """T...
34
855
astropy
astropy/cosmology/_src/tests/io/test_connect.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import inspect import sys import pytest from astropy import cosmology from astropy.cosmology import Cosmology, w0wzCDM from astropy.cosmology._src.tests.io import ( test_cosmology, test_ecsv, test_html, test_json, test_latex, tes...
304
10,624
astropy
astropy/cosmology/_src/tests/io/test_yaml.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import astropy.units as u from astropy.cosmology import Cosmology, FlatLambdaCDM, Planck18 from astropy.cosmology import units as cu from astropy.cosmology._src.io.builtin.yaml import ( from_yaml, to_yaml, yaml_constructor, ...
185
6,958
astropy
astropy/cosmology/_src/tests/io/test_cosmology.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.cosmology._src.io.builtin.cosmology import from_cosmology, to_cosmology from .base import IODirectTestBase, ToFromTestMixinBase ############################################################################### class ToFromCos...
58
2,308
astropy
astropy/cosmology/_src/tests/io/test_ecsv.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.cosmology._src.core import _COSMOLOGY_CLASSES from astropy.cosmology._src.io.builtin.ecsv import read_ecsv, write_ecsv from astropy.table import QTable, Table, vstack from .base import ReadWriteDirectTestBase, ReadWriteTestMix...
231
8,260
astropy
astropy/cosmology/_src/tests/io/test_latex.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.cosmology._src.io.builtin.latex import _FORMAT_TABLE, write_latex from astropy.io.registry.base import IORegistryError from astropy.table import QTable, Table from .base import ReadWriteDirectTestBase, ReadWriteTestMixinBase ...
87
3,639
astropy
astropy/cosmology/_src/tests/io/test_table.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.cosmology import Cosmology from astropy.cosmology._src.core import _COSMOLOGY_CLASSES from astropy.cosmology._src.io.builtin.table import from_table, to_table from astropy.table import QTable, Table, vstack from .base import T...
259
9,833
astropy
astropy/cosmology/_src/tests/io/test_row.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.cosmology._src.core import _COSMOLOGY_CLASSES, Cosmology from astropy.cosmology._src.io.builtin.row import from_row, to_row from astropy.table import Row from .base import ToFromDirectTestBase, ToFromTestMixinBase ###########...
146
5,437
astropy
astropy/cosmology/_src/tests/io/test_json.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import json import os from pathlib import Path import pytest import astropy.units as u from astropy.cosmology import Cosmology from astropy.cosmology import units as cu from astropy.cosmology.io import readwrite_registry from .base import ReadWriteDire...
168
6,033
astropy
astropy/cosmology/_src/tests/io/test_mrt.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # THIRD PARTY import pytest from astropy.cosmology import Planck18 from astropy.cosmology._src.io.builtin.mrt import ( read_mrt, write_mrt, ) from astropy.table import QTable, Table from .base import ReadWriteDirectTestBase, ReadWriteTestMixinB...
202
7,130