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/samp/integrated_client.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from .client import SAMPClient
from .hub_proxy import SAMPHubProxy
__all__ = ["SAMPIntegratedClient"]
__doctest_skip__ = ["SAMPIntegratedClient.*"]
class SAMPIntegratedClient:
"""
A Simple SAMP client.
This class is meant to simplify the... | 505 | 17,253 |
astropy | astropy/samp/tests/test_hub_proxy.py | .py | import platform
import pytest
from astropy.samp import conf
from astropy.samp.hub import SAMPHubServer
from astropy.samp.hub_proxy import SAMPHubProxy
def setup_module(module):
conf.use_internet = False
@pytest.mark.skipif(platform.system() == "Darwin", reason="Takes too long on OSX")
class TestHubProxy:
... | 54 | 1,381 |
astropy | astropy/samp/tests/test_client.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import platform
import warnings
import pytest
# By default, tests should not use the internet.
from astropy.samp import SAMPProxyError, SAMPWarning, conf
from astropy.samp.client import SAMPClient
from astropy.samp.hub import SAMPHubServer
from astropy.... | 79 | 2,604 |
astropy | astropy/samp/tests/test_errors.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# By default, tests should not use the internet.
from astropy.samp import conf
from astropy.samp.errors import SAMPClientError, SAMPHubError, SAMPProxyError
def setup_module(module):
conf.use_internet = False
def test_SAMPHubError():
"""Test t... | 25 | 617 |
astropy | astropy/samp/tests/web_profile_test_helpers.py | .py | import threading
import time
import xmlrpc.client as xmlrpc
from astropy.samp.client import SAMPClient
from astropy.samp.errors import SAMPClientError, SAMPHubError
from astropy.samp.hub import WebProfileDialog
from astropy.samp.hub_proxy import SAMPHubProxy
from astropy.samp.integrated_client import SAMPIntegratedCli... | 283 | 9,422 |
astropy | astropy/samp/tests/test_web_profile.py | .py | """
Test the web profile using Python classes that have been adapted to act like a
web client. We can only put a single test here because only one hub can run
with the web profile active, and the user might want to run the tests in
parallel.
"""
import threading
from urllib.request import Request, urlopen
import pyte... | 89 | 2,988 |
astropy | astropy/samp/tests/test_hub.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import platform
import time
import pytest
from astropy.samp import conf
from astropy.samp.hub import SAMPHubServer
def setup_module(module):
conf.use_internet = False
@pytest.mark.skipif(platform.system() == "Darwin", reason="Takes too long on O... | 48 | 1,224 |
astropy | astropy/samp/tests/test_standard_profile.py | .py | import pytest
# By default, tests should not use the internet.
from astropy.samp import conf
from astropy.samp.errors import SAMPProxyError
from astropy.samp.hub import SAMPHubServer
from astropy.samp.integrated_client import SAMPIntegratedClient
from astropy.tests.helper import CI
from .test_helpers import TEST_REPL... | 293 | 8,894 |
astropy | astropy/samp/tests/test_hub_script.py | .py | import logging
import platform
import sys
import pytest
from astropy.samp import conf
from astropy.samp.hub_script import hub_script
def setup_module(module):
conf.use_internet = False
def setup_function(function):
function.sys_argv_orig = sys.argv
sys.argv = ["samp_hub"]
def teardown_function(funct... | 36 | 891 |
astropy | astropy/samp/tests/test_helpers.py | .py | import os
import pickle
import random
import string
import time
from astropy.samp import SAMP_STATUS_OK
TEST_REPLY = {"samp.status": SAMP_STATUS_OK, "samp.result": {"txt": "test"}}
def write_output(mtype, private_key, sender_id, params):
filename = params["verification_file"]
f = open(filename, "wb")
pi... | 71 | 2,198 |
astropy | astropy/coordinates/errors.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""This module defines custom errors and exceptions used in astropy.coordinates."""
__all__ = [
"ConvertError",
"NonRotationTransformationError",
"NonRotationTransformationWarning",
"UnknownSiteException",
]
from typing import TYPE_CHECK... | 93 | 2,881 |
astropy | astropy/coordinates/polarization.py | .py | from collections.abc import Generator
from contextlib import contextmanager
from typing import NamedTuple
import numpy as np
from astropy.utils import unbroadcast
from astropy.utils.data_info import MixinInfo
from astropy.utils.shapes import ShapedLikeNDArray
__all__ = ["StokesCoord", "StokesSymbol", "custom_stokes_... | 259 | 8,111 |
astropy | astropy/coordinates/sky_coordinate.py | .py | import copy
import operator
import re
import warnings
from collections.abc import Callable
from typing import Union
import erfa
import numpy as np
from astropy import units as u
from astropy.constants import c as speed_of_light
from astropy.time import Time
from astropy.utils import ShapedLikeNDArray
from astropy.uti... | 1,870 | 78,816 |
astropy | astropy/coordinates/jparser.py | .py | """
Module for parsing astronomical object names to extract embedded coordinates
eg: '2MASS J06495091-0737408'.
"""
import re
import numpy as np
import astropy.units as u
from astropy.coordinates import SkyCoord
RA_REGEX = r"()([0-2]\d)([0-5]\d)([0-5]\d)\.?(\d{0,3})"
DEC_REGEX = r"([+-])(\d{1,2})([0-5]\d)([0-5]\d)\... | 68 | 1,865 |
astropy | astropy/coordinates/solar_system.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains convenience functions for retrieving solar system
ephemerides from jplephem.
"""
import os.path
import re
from inspect import cleandoc
from urllib.parse import urlparse
import erfa
import numpy as np
from astropy import units as... | 508 | 18,487 |
astropy | astropy/coordinates/sites.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Currently the only site accessible without internet access is the Royal
Greenwich Observatory, as an example (and for testing purposes). In future
releases, a canonical set of sites may be bundled into astropy for when the
online registry is unavailab... | 126 | 4,514 |
astropy | astropy/coordinates/sky_coordinate_parsers.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import re
from collections.abc import Sequence
import numpy as np
from astropy import units as u
from astropy.units import IrreducibleUnit, Unit
from .baseframe import (
BaseCoordinateFrame,
_get_diff_cls,
_get_repr_cls,
frame_transform... | 636 | 26,448 |
astropy | astropy/coordinates/baseframe.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Framework and base classes for coordinate frames/"low-level" coordinate
classes.
"""
__all__ = [
"BaseCoordinateFrame",
"CoordinateFrameInfo",
"GenericFrame",
"RepresentationMapping",
"frame_transform_graph",
]
import copy
import ... | 2,284 | 93,326 |
astropy | astropy/coordinates/calculation.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# Standard library
import re
import textwrap
import warnings
from datetime import datetime
from typing import Final
from urllib.request import Request, urlopen
# Third-party
from astropy import time as atime
from astropy.utils.console import _color_text... | 237 | 7,181 |
astropy | astropy/coordinates/funcs.py | .py | # 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... | 416 | 14,755 |
astropy | astropy/coordinates/erfa_astrom.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains a helper function to fill erfa.astrom struct and a
ScienceState, which allows to speed up coordinate transformations at the
expense of accuracy.
"""
import functools
import warnings
from typing import Final
import erfa
import num... | 374 | 13,119 |
astropy | astropy/coordinates/attributes.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# Dependencies
import numpy as np
# Project
from astropy import units as u
from astropy.time import Time
from astropy.utils import ShapedLikeNDArray
from .earth import EarthLocation
from .representation import BaseDifferential, CartesianRepresentation
... | 578 | 19,845 |
astropy | astropy/coordinates/spectral_coordinate.py | .py | import warnings
from textwrap import indent
import numpy as np
import astropy.units as u
from astropy.constants import c
from astropy.coordinates import (
ICRS,
CartesianDifferential,
CartesianRepresentation,
SkyCoord,
)
from astropy.coordinates.baseframe import BaseCoordinateFrame, frame_transform_gr... | 789 | 31,014 |
astropy | astropy/coordinates/matching.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains functions for matching coordinate catalogs.
"""
from typing import NamedTuple
import numpy as np
from numpy.typing import NDArray
from astropy.units import Quantity
from . import Angle
from .representation import UnitSpherical... | 493 | 19,913 |
astropy | astropy/coordinates/name_resolve.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains convenience functions for getting a coordinate object
for a named object by querying SESAME and getting the first returned result.
Note that this is intended to be a convenience, and is very simple. If you
need precise coordinates... | 216 | 7,217 |
astropy | astropy/coordinates/distances.py | .py | # 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
__a... | 267 | 9,209 |
astropy | astropy/coordinates/spectral_quantity.py | .py | import numpy as np
from astropy.units import Unit, si
from astropy.units import equivalencies as eq
from astropy.units.decorators import quantity_input
from astropy.units.quantity import Quantity, SpecificTypeQuantity
__all__ = ["SpectralQuantity"]
# We don't want to run doctests in the docstrings we inherit from Qu... | 324 | 12,384 |
astropy | astropy/coordinates/earth.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import json
import socket
import urllib.error
import urllib.parse
import urllib.request
from typing import NamedTuple
import numpy as np
from astropy import constants as consts
from astropy import units as u
from astropy.units.quantity import QuantityIn... | 887 | 34,705 |
astropy | astropy/coordinates/matrix_utilities.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Utililies used for constructing and inspecting rotation matrices.
"""
__all__ = ["is_rotation_or_reflection", "rotation_matrix"]
import numpy as np
from astropy import units as u
from astropy.utils.decorators import deprecated
from .angles import ... | 245 | 8,056 |
astropy | astropy/coordinates/transformations/affine.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Affine coordinate transformations."""
from abc import abstractmethod
import numpy as np
from astropy.coordinates.representation import (
CartesianDifferential,
RadialDifferential,
SphericalCosLatDifferential,
SphericalDifferential,
... | 353 | 14,187 |
astropy | astropy/coordinates/transformations/composite.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Module defining the class for a composited sequence of coordinate transformations.
This module contains the class :class:`~astropy.coordinates.CompositeTransform` that
combines a sequence of transformations into a single transformation. The class has ... | 258 | 10,643 |
astropy | astropy/coordinates/transformations/__init__.py | .py | """Coordinate transformations.
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 transformation graph,
and transitions from one no... | 29 | 946 |
astropy | astropy/coordinates/transformations/function.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Function-based coordinate transformations.
These are transformations that cannot be represented as an affine transformation.
"""
from warnings import warn
from astropy import units as u
from astropy.coordinates.representation import (
CartesianD... | 245 | 10,292 |
astropy | astropy/coordinates/transformations/base.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Coordinate transformations base class.
This module contains the abstract base class for coordinate transformations. For
concrete implementations, see the submodules
:mod:`~astropy.coordinates.transformations.affine`,
:mod:`~astropy.coordinates.transfo... | 110 | 4,056 |
astropy | astropy/coordinates/transformations/graph.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""The class that implements the framework for defining graphs of transformations.
The fundamental idea is that each class is a node in the transformation graph,
and transitions from one node to another are defined as functions (or methods)
wrapped in tr... | 755 | 27,815 |
astropy | astropy/coordinates/tests/test_polarization.py | .py | import numpy as np
import pytest
from numpy.testing import assert_equal
from astropy.coordinates.polarization import (
StokesCoord,
StokesSymbol,
custom_stokes_symbol_mapping,
)
from astropy.table import Table, vstack
from astropy.utils import unbroadcast
def test_scalar():
sk = StokesCoord(2)
as... | 182 | 5,580 |
astropy | astropy/coordinates/tests/test_iau_fullstack.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import erfa
import numpy as np
import pytest
from numpy import testing as npt
from astropy import units as u
from astropy.coordinates import EarthLocation, SkyCoord, golden_spiral_grid
from astropy.coordinates.builtin_frames import ICRS, AltAz
from astro... | 147 | 5,214 |
astropy | astropy/coordinates/tests/test_icrs_observed_transformations.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Accuracy tests for ICRS transformations, primarily to/from AltAz."""
import numpy as np
from astropy import units as u
from astropy.coordinates import (
CIRS,
ICRS,
AltAz,
EarthLocation,
HADec,
SkyCoord,
frame_transform_gra... | 81 | 2,863 |
astropy | astropy/coordinates/tests/test_separation.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for `position_angle()`, `separation()` and `separation_3d()` methods. They
are implemented in `BaseCoordinateFrame`, but are also exposed by `SkyCoord`
instances, so they should be tested on both.
"""
from contextlib import nullcontext
from typ... | 409 | 13,309 |
astropy | astropy/coordinates/tests/test_exceptions.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for custom error and warning messages in `astropy.coordinates`."""
from typing import NamedTuple
import pytest
from astropy import units as u
from astropy.coordinates import (
GCRS,
ICRS,
BaseCoordinateFrame,
Galactic,
NonR... | 127 | 4,041 |
astropy | astropy/coordinates/tests/test_representation.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from copy import deepcopy
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from astropy import units as u
from astropy.coordinates import Angle, Latitude, Longitude
from astropy.coordinates.distances import ... | 2,333 | 87,527 |
astropy | astropy/coordinates/tests/test_angle_generators.py | .py | """Unit tests for the :mod:`astropy.coordinates.angles.utils` module."""
import pytest
import astropy.units as u
from astropy.coordinates import (
golden_spiral_grid,
uniform_spherical_random_surface,
uniform_spherical_random_volume,
)
from astropy.utils import NumpyRNGContext
def test_golden_spiral_gri... | 38 | 1,086 |
astropy | astropy/coordinates/tests/test_frames_with_velocity.py | .py | # 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 builtin_frames as bf
from astropy.coordinates import galactocentric_frame_defaults
from astropy.coordinates import representation as r
from astropy.coordinate... | 342 | 12,739 |
astropy | astropy/coordinates/tests/test_frames.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import re
import typing
from copy import deepcopy
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import (
EarthLocation,
SkyCoord,
galactocentric_frame_defaults,
)
from astropy.coordinates import rep... | 1,796 | 58,888 |
astropy | astropy/coordinates/tests/test_masked.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_array_equal
import astropy.coordinates.representation as r
import astropy.units as u
from astropy.coordinates import FK5, SkyCoord
from astropy.coordinates.matrix_utilities import rotation... | 396 | 17,051 |
astropy | astropy/coordinates/tests/test_angles.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initialization and other aspects of Angle and subclasses"""
import pickle
import threading
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
import astropy.units as u
from astropy.coordinates import (... | 1,263 | 39,805 |
astropy | astropy/coordinates/tests/test_shape_manipulation.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from astropy import units as u
from astropy.coordinates import EarthLocation, Latitude, Longitude, SkyCoord
# test on frame with most complicated frame attributes.
from astrop... | 396 | 20,082 |
astropy | astropy/coordinates/tests/test_sky_coord.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for the SkyCoord class. Note that there are also SkyCoord tests in
test_api_ape5.py
"""
import copy
from copy import deepcopy
import numpy as np
import numpy.testing as npt
import pytest
from erfa import ErfaWarning
from astropy import units... | 2,148 | 73,239 |
astropy | astropy/coordinates/tests/test_regression.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Regression tests for coordinates-related bugs that don't have an obvious other
place to live
"""
import copy
import io
from contextlib import nullcontext
import numpy as np
import pytest
from erfa import ErfaWarning
from astropy import units as u
f... | 758 | 27,470 |
astropy | astropy/coordinates/tests/test_funcs.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for miscellaneous functionality in the `funcs` module
"""
import numpy as np
import pytest
from numpy import testing as npt
from astropy import units as u
from astropy.coordinates import FK5, ICRS, SkyCoord
from astropy.coordinates import repr... | 235 | 8,332 |
astropy | astropy/coordinates/tests/test_velocity_corrs.py | .py | import numpy as np
import pytest
from astropy import units as u
from astropy.constants import c as speed_of_light
from astropy.coordinates import Distance, EarthLocation, SkyCoord
from astropy.coordinates.sites import _GREENWICH
from astropy.table import Table
from astropy.tests.helper import assert_quantity_allclose
... | 344 | 16,570 |
astropy | astropy/coordinates/tests/test_spectral_coordinate.py | .py | from contextlib import nullcontext
import numpy as np
import pytest
from numpy.testing import assert_allclose
import astropy.units as u
from astropy import time
from astropy.constants import c
from astropy.coordinates import (
FK5,
GCRS,
ICRS,
CartesianDifferential,
CartesianRepresentation,
Ea... | 1,133 | 41,417 |
astropy | astropy/coordinates/tests/test_sky_coord_velocities.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for putting velocity differentials into SkyCoord objects.
Note: the skyoffset velocity tests are in a different file, in
test_skyoffset_transformations.py
"""
import numpy as np
import pytest
from astropy import units as u
from astropy.coordi... | 298 | 9,229 |
astropy | astropy/coordinates/tests/test_arrays.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy import testing as npt
from astropy import units as u
from astropy.coordinates import (
FK4,
FK5,
ICRS,
Angle,
CartesianRepresentation,
Galactic,
SkyCoord,
)
from astropy.tests.helper... | 277 | 8,386 |
astropy | astropy/coordinates/tests/test_matrix_utilities.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from astropy import units as u
from astropy.coordinates import Angle, is_rotation_or_reflection, rotation_matrix
from astropy.coordinates.matrix_utilities impor... | 167 | 5,529 |
astropy | astropy/coordinates/tests/test_atc_replacements.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test replacements for ERFA functions atciqz and aticq."""
import erfa
import pytest
import astropy.units as u
from astropy.coordinates import SphericalRepresentation
from astropy.coordinates.builtin_frames.utils import atciqz, aticq, get_jd12
from as... | 33 | 1,091 |
astropy | astropy/coordinates/tests/test_matching.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy import testing as npt
from astropy import units as u
from astropy.coordinates import (
ICRS,
Angle,
CartesianRepresentation,
Galactic,
SkyCoord,
match_coordinates_3d,
match_coordinat... | 457 | 15,761 |
astropy | astropy/coordinates/tests/test_solar_system.py | .py | from urllib.error import HTTPError
import numpy as np
import pytest
from astropy import units as u
from astropy.constants import c
from astropy.coordinates.builtin_frames import TETE
from astropy.coordinates.earth import EarthLocation
from astropy.coordinates.funcs import get_sun
from astropy.coordinates.representati... | 440 | 16,485 |
astropy | astropy/coordinates/tests/test_transformations.py | .py | # 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 (
AffineTransform,
DynamicMatrixTransform,
FunctionTransform,
FunctionTransformWithFiniteDifference,
StaticMatrixTransform,
TransformG... | 697 | 21,467 |
astropy | astropy/coordinates/tests/test_representation_arithmetic.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import operator
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import (
CartesianDifferential,
CartesianRepresentation,
CylindricalDifferential,
CylindricalRepresentation,
Latitude,
Longi... | 1,482 | 60,430 |
astropy | astropy/coordinates/tests/test_api_ape5.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is the APE5 coordinates API document re-written to work as a series of test
functions.
Note that new tests for coordinates functionality should generally *not* be
added to this file - instead, add them to other appropriate test modules in
this ... | 472 | 21,150 |
astropy | astropy/coordinates/tests/test_intermediate_transformations.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Accuracy tests for GCRS coordinate transformations, primarily to/from AltAz."""
import warnings
import erfa
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import (
CIRS,
GCRS,
HCRS,
ICRS,
... | 1,158 | 43,853 |
astropy | astropy/coordinates/tests/test_skyoffset_transformations.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from itertools import combinations
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import HCRS, Angle, EarthLocation, SkyCoord
from astropy.coordinates.builtin_frames import (
FK5,
ICRS,
AltAz,
Ga... | 379 | 13,685 |
astropy | astropy/coordinates/tests/test_formatting.py | .py | """
Tests the Angle string formatting capabilities. SkyCoord formatting is in
test_sky_coord
"""
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import Angle
def test_to_string_precision():
# There are already some tests in test_api.py, but this is a regression
# te... | 219 | 7,790 |
astropy | astropy/coordinates/tests/test_angular_separation.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for the projected separation stuff
"""
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import Angle
from astropy.coordinates.builtin_frames import ICRS
# lon1, lat1, lon2, lat2 in degrees
coords = [
... | 60 | 1,628 |
astropy | astropy/coordinates/tests/test_representation_methods.py | .py | # 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 (
Latitude,
Longitude,
SphericalDifferential,
SphericalRepresentation,
UnitSphericalRepresentation,
)
from .test_representation import r... | 455 | 18,765 |
astropy | astropy/coordinates/tests/test_distance.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This includes tests for the Distance class and related calculations
"""
import numpy as np
import pytest
from numpy import testing as npt
from astropy import units as u
from astropy.coordinates import CartesianRepresentation, Distance, Latitude, Long... | 333 | 10,660 |
astropy | astropy/coordinates/tests/test_pickle.py | .py | import pickle
import numpy as np
import pytest
import astropy.units as u
from astropy import coordinates as coord
from astropy.coordinates import (
ICRS,
Angle,
Distance,
DynamicMatrixTransform,
Latitude,
Longitude,
StaticMatrixTransform,
)
from astropy.tests.helper import check_pickling_r... | 88 | 2,247 |
astropy | astropy/coordinates/tests/test_unit_representation.py | .py | """
This file tests the behavior of subclasses of Representation and Frames
"""
from copy import deepcopy
import astropy.coordinates
import astropy.units as u
from astropy.coordinates import ICRS, Latitude, Longitude
from astropy.coordinates.baseframe import RepresentationMapping, frame_transform_graph
from astropy.c... | 79 | 2,745 |
astropy | astropy/coordinates/tests/test_celestial_transformations.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from itertools import combinations
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import (
CartesianDifferential,
CartesianRepresentation,
EarthLocation,
SkyCoord,
galactocentric_frame_defaul... | 432 | 15,354 |
astropy | astropy/coordinates/tests/helper.py | .py | """Test helper functions for coordinates."""
import numpy as np
def skycoord_equal(sc1, sc2):
"""SkyCoord equality useful for testing."""
if not sc1.is_equivalent_frame(sc2):
return False
if sc1.representation_type is not sc2.representation_type:
return False
if sc1.shape != sc2.shape... | 18 | 546 |
astropy | astropy/coordinates/tests/test_geodetic_representations.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test geodetic representations"""
from copy import deepcopy
import pytest
from astropy import units as u
from astropy.coordinates.representation import (
DUPLICATE_REPRESENTATIONS,
REPRESENTATION_CLASSES,
BaseBodycentricRepresentation,
... | 243 | 10,163 |
astropy | astropy/coordinates/tests/test_finite_difference_velocities.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy import constants
from astropy import units as u
from astropy.coordinates import (
CartesianDifferential,
CartesianRepresentation,
DynamicMatrixTransform,
FunctionTransformWithFiniteDifference... | 286 | 9,500 |
astropy | astropy/coordinates/tests/test_earth.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initialization of angles not already covered by the API tests"""
import pickle
import numpy as np
import pytest
from astropy import constants
from astropy import units as u
from astropy.coordinates import Latitude, Longitude
from astropy.coordi... | 412 | 16,723 |
astropy | astropy/coordinates/tests/test_utils.py | .py | import erfa
import pytest
from astropy.coordinates.builtin_frames.utils import (
get_offset_sun_from_barycenter,
get_polar_motion,
)
from astropy.coordinates.solar_system import get_body_barycentric_posvel
from astropy.tests.helper import assert_quantity_allclose
from astropy.time import Time
from astropy.util... | 53 | 1,850 |
astropy | astropy/coordinates/tests/test_sites.py | .py | import shutil
from pathlib import Path
from threading import Lock
import pytest
from astropy import units as u
from astropy.config import set_temp_cache
from astropy.coordinates import EarthLocation, Latitude, Longitude, UnknownSiteException
from astropy.coordinates.sites import SiteRegistry
from astropy.tests.helper... | 157 | 5,100 |
astropy | astropy/coordinates/tests/test_erfa_astrom.py | .py | import numpy as np
import pytest
import astropy.units as u
from astropy.coordinates import CIRS, GCRS, AltAz, EarthLocation, SkyCoord
from astropy.coordinates.erfa_astrom import (
ErfaAstrom,
ErfaAstromInterpolator,
erfa_astrom,
)
from astropy.time import Time
from astropy.utils.exceptions import AstropyWa... | 125 | 4,075 |
astropy | astropy/coordinates/tests/test_spectral_quantity.py | .py | import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy import units as u
from astropy.coordinates.spectral_quantity import SpectralQuantity
from astropy.tests.helper import assert_quantity_allclose
SPECTRAL_UNITS = (u.GHz, u.micron, u.keV, u.nm**-1, u.km / u.s)
SPECTRAL_UNITS_NO_VELOC... | 280 | 9,812 |
astropy | astropy/coordinates/tests/test_name_resolve.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains tests for the name resolve convenience module.
"""
import time
import urllib.request
import numpy as np
import pytest
from pytest_remotedata.disable_internet import no_internet
from astropy import units as u
from astropy.config... | 198 | 6,129 |
astropy | astropy/coordinates/tests/accuracy/test_altaz_icrs.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Accuracy tests for AltAz to ICRS coordinate transformations.
We use "known good" examples computed with other coordinate libraries.
"""
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import Angle, EarthLocati... | 214 | 8,701 |
astropy | astropy/coordinates/tests/accuracy/generate_ref_ast.py | .py | # /// script
# requires-python = ">=3.10"
# dependencies = [
# "starlink-pyast>=4.0.0",
# "numpy",
# "astropy",
# ]
# ///
"""
This series of functions are used to generate the reference CSV files
used by the accuracy tests. Running this as a command-line script will
generate them all.
"""
from pathlib imp... | 278 | 9,787 |
astropy | astropy/coordinates/tests/accuracy/__init__.py | .py | """
The modules in the accuracy testing subpackage are primarily intended for
comparison with "known-good" (or at least "known-familiar") datasets. More
basic functionality and sanity checks are in the main ``coordinates/tests``
testing modules.
"""
N_ACCURACY_TESTS = 10 # the number of samples to use per accuracy te... | 9 | 323 |
astropy | astropy/coordinates/tests/accuracy/test_fk4_no_e_fk5.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 angular_separation
from astropy.coordinates.builtin_frames import FK5, FK4NoETerms
from astropy.table import Table
from astropy.time import Time
from astropy.utils.data im... | 76 | 2,152 |
astropy | astropy/coordinates/tests/accuracy/test_fk4_no_e_fk4.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 angular_separation
from astropy.coordinates.builtin_frames import FK4, FK4NoETerms
from astropy.table import Table
from astropy.time import Time
from astropy.utils.data im... | 71 | 2,089 |
astropy | astropy/coordinates/tests/accuracy/generate_spectralcoord_ref.py | .py | # Script to generate random targets, observatory locations, and times, and
# run these using the Starlink rv command to generate reference values for the
# velocity frame corrections. This requires that Starlink is installed and that
# the rv command is in your PATH. More information about Starlink can be found
# at ht... | 101 | 3,637 |
astropy | astropy/coordinates/tests/accuracy/test_ecliptic.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Accuracy tests for Ecliptic coordinate systems.
"""
import numpy as np
import pytest
from astropy import units as u
from astropy.constants import R_earth, R_sun
from astropy.coordinates import SkyCoord
from astropy.coordinates.builtin_frames import (... | 274 | 10,139 |
astropy | astropy/coordinates/tests/accuracy/test_icrs_fk5.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 angular_separation
from astropy.coordinates.builtin_frames import FK5, ICRS
from astropy.table import Table
from astropy.time import Time
from astropy.utils.data import ge... | 68 | 1,880 |
astropy | astropy/coordinates/tests/accuracy/test_galactic_fk4.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 angular_separation
from astropy.coordinates.builtin_frames import FK4, Galactic
from astropy.table import Table
from astropy.time import Time
from astropy.utils.data impor... | 66 | 1,905 |
astropy | astropy/coordinates/representation/__init__.py | .py | """
In this module, we define the coordinate representation classes, which are
used to represent low-level cartesian, spherical, cylindrical, and other
coordinates.
"""
from .base import BaseDifferential, BaseRepresentation, BaseRepresentationOrDifferential
from .cartesian import CartesianDifferential, CartesianRepres... | 67 | 2,025 |
astropy | astropy/coordinates/representation/geodetic.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import erfa
import numpy as np
from astropy import units as u
from astropy.coordinates.angles import Latitude, Longitude
from astropy.utils.decorators import format_doc
from .base import BaseRepresentation
from .cartesian import CartesianRepresentation
... | 193 | 6,893 |
astropy | astropy/coordinates/representation/cylindrical.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Cylindrical representations and differentials."""
import operator
import numpy as np
import astropy.units as u
from astropy.coordinates.angles import Angle
from .base import BaseDifferential, BaseRepresentation
from .cartesian import CartesianRepres... | 176 | 6,118 |
astropy | astropy/coordinates/representation/cartesian.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Cartesian representations and differentials."""
import numpy as np
from erfa import ufunc as erfa_ufunc
import astropy.units as u
from .base import BaseDifferential, BaseRepresentation
class CartesianRepresentation(BaseRepresentation):
"""
... | 434 | 16,354 |
astropy | astropy/coordinates/representation/spherical.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Spherical representations and differentials."""
import operator
import numpy as np
from erfa import ufunc as erfa_ufunc
import astropy.units as u
from astropy.coordinates.angles import Angle, Latitude, Longitude
from astropy.coordinates.distances imp... | 1,493 | 59,776 |
astropy | astropy/coordinates/representation/base.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Base classes for representations and differentials."""
import abc
import functools
import operator
import warnings
from typing import ClassVar, Final
import numpy as np
import astropy.units as u
from astropy.coordinates.angles import Angle
from astro... | 1,654 | 64,985 |
astropy | astropy/coordinates/builtin_frames/intermediate_rotation_transforms.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Contains the transformation functions for getting to/from ITRS, TEME, GCRS, and CIRS.
These are distinct from the ICRS and AltAz functions because they are just
rotations without aberration corrections or offsets.
"""
import erfa
import numpy as np
f... | 305 | 11,778 |
astropy | astropy/coordinates/builtin_frames/fk4.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import math
import erfa
import numpy as np
from astropy import units as u
from astropy.coordinates.attributes import TimeAttribute
from astropy.coordinates.baseframe import base_doc, frame_transform_graph
from astropy.coordinates.matrix_utilities import... | 252 | 8,286 |
astropy | astropy/coordinates/builtin_frames/gcrs.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy import units as u
from astropy.coordinates.attributes import (
CartesianRepresentationAttribute,
TimeAttribute,
)
from astropy.coordinates.baseframe import base_doc
from astropy.utils.decorators import format_doc
from .baseradec impo... | 125 | 5,289 |
astropy | astropy/coordinates/builtin_frames/galactocentric.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
from collections.abc import MappingView
from types import MappingProxyType
import numpy as np
from astropy import units as u
from astropy.coordinates import Angle
from astropy.coordinates import representation as r
from astropy.coordinates.a... | 600 | 25,249 |
astropy | astropy/coordinates/builtin_frames/equatorial.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Coordinate frames tied to the Equator and Equinox of Earth.
TEME is a True equator, Mean Equinox coordinate frame used in NORAD TLE
satellite files.
TETE is a True equator, True Equinox coordinate frame often called the
"apparent" coordinates. It is ... | 118 | 4,865 |
astropy | astropy/coordinates/builtin_frames/ecliptic_transforms.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Contains the transformation functions for getting to/from ecliptic systems.
"""
import erfa
from astropy import units as u
from astropy.coordinates.baseframe import frame_transform_graph
from astropy.coordinates.errors import UnitsError
from astropy.... | 299 | 10,838 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.