hash
stringlengths
64
64
content
stringlengths
0
1.51M
59301ddda75f17d50d66a7e143911a2cb41d241d3d945d64e71396c9a60b2ebb
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.utils.decorators import format_doc from astropy.coordinates.representation import CartesianRepresentation, CartesianDifferential from astropy.coordinates.baseframe import BaseCoordinateFrame, base_doc from astropy.coordinates.attributes impor...
e5b90a706af5fc055d8157791f16c14ab97516f52b23b2649ec55851dd03fc7e
import numpy as np import erfa from astropy import units as u from astropy.coordinates.matrix_utilities import rotation_matrix, matrix_transpose from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.transformations import FunctionTransformWithFiniteDifference from astropy.coordinates....
f37dd91e453351047431da8fd32fbbb619c9b2fcf7f03272b6a780580a8b79a2
from contextlib import nullcontext import astropy.units as u import numpy as np from numpy.testing import assert_allclose import pytest from astropy import time from astropy.constants import c from astropy.table import Table from astropy.time import Time from astropy.utils import iers from astropy.coordinates import ...
4c9d24af65310ea39ee6cbb12618b6519c29fa838accf6c4ba19149925627226
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Accuracy tests for GCRS coordinate transformations, primarily to/from AltAz. """ import os import warnings from importlib import metadata import pytest import numpy as np import erfa from astropy import units as u from astropy.tests.helper import ass...
929f60453c2e2b29d3798f1a46a33eab571d218f4d4a33539fab3b3b3b24f023
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This includes tests for the Distance class and related calculations """ import pytest import numpy as np from numpy import testing as npt from astropy import units as u from astropy.units import allclose as quantity_allclose from astropy.coordinates ...
aaba4919712a7a76060c454c6b5c85ea098fc2c24e3a02281a65d32bcc77f341
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Facilities for diffing two FITS files. Includes objects for diffing entire FITS files, individual HDUs, FITS headers, or just FITS data. Used to implement the fitsdiff program. """ import fnmatch import glob import io import operator import os import...
4c7b8eeda2d23eefc444c06d99e7f5fc728db016c9941911ebf3a7397925bf33
# Licensed under a 3-clause BSD style license - see PYFITS.rst import copy import operator import re import sys import warnings import weakref import numbers from functools import reduce from collections import OrderedDict from contextlib import suppress import numpy as np from numpy import char as chararray from ....
1045c57a26df72578515253e89e81c75e79aca1744880675948c25f8f303b28d
# Licensed under a 3-clause BSD style license - see PYFITS.rst import copy import operator import warnings import weakref from contextlib import suppress from functools import reduce import numpy as np from numpy import char as chararray from .column import (ASCIITNULL, FITS2NUMPY, ASCII2NUMPY, ASCII2STR, ColDefs,...
9529cb91c6421b8bd015321aa469c3f986a6d9eeb5565d761641e9774252b90e
# Licensed under a 3-clause BSD style license - see PYFITS.rst import gzip import itertools import os import re import shutil import sys import warnings import numpy as np from . import compressed from .base import _BaseHDU, _ValidHDU, _NonstandardHDU, ExtensionHDU from .groups import GroupsHDU from .image import Pr...
e854851dd982e935a835b8a8c22e75b060e93d0dd964272bf065c4543b846c6f
# Licensed under a 3-clause BSD style license - see PYFITS.rst import contextlib import copy import gc import pickle import re import sys import warnings import pytest import numpy as np from numpy import char as chararray try: import objgraph HAVE_OBJGRAPH = True except ImportError: HAVE_OBJGRAPH = Fals...
dc6b17912ac92237fe1afa3c07d87ee250a74773d3edbb4fe57faf0af7083690
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from astropy.io.fits.column import Column from astropy.io.fits.diff import (FITSDiff, HeaderDiff, ImageDataDiff, TableDataDiff, HDUDiff) from astropy.io.fits.hdu import HDUList, PrimaryHDU...
e61423a539d109c6426d0869aca1910066ddc4a1e38e4efdf218ce39f2834e15
"""Testing :mod:`astropy.cosmology.units`.""" ############################################################################## # IMPORTS import pytest import astropy.cosmology.units as cu import astropy.units as u from astropy.cosmology import Planck13, default_cosmology from astropy.tests.helper import assert_quantit...
d0b19936fc07cc613e040958520c284418c4f657515d89db3d6b47c9885c0a29
#!/usr/bin/env python # Licensed under a 3-clause BSD style license - see LICENSE.rst # NOTE: The configuration for the package, including the name, version, and # other information are set in the setup.cfg file. import sys # First provide helpful messages if contributors try and run legacy commands # for tests or d...
5a78048f138b91ad2fd31b70e2134422889f20c5a65918b898c023a452f4e018
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file is the main file used when running tests with pytest directly, # in particular if running e.g. ``pytest docs/``. import os import tempfile import hypothesis from astropy import __version__ try: from pytest_astropy_header.display import...
06178ec181388c9f14a79e030cc36d36c5954210c077a2c462fa32cbebd4d684
# NOTE: First try _dev.scm_version if it exists and setuptools_scm is installed # This file is not included in astropy wheels/tarballs, so otherwise it will # fall back on the generated _version module. try: try: from ._dev.scm_version import version except ImportError: from ._version import ver...
fae2e15ae57c8148f284d5da889fe5715ad3009fe8167fd52de86a0dd5a3298f
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astropy is a package intended to contain core functionality and some common tools needed for performing astronomy and astrophysics research with Python. It also provides an index for other astronomy packages and tools for managing them. """ import os ...
82ce22576d0cbf0c7f9adfebba05b3e88ca044e525757e0099b748bcf40e8f79
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This file contains pytest configuration settings that are astropy-specific (i.e. those that would not necessarily be shared by affiliated packages making use of astropy's test runner). """ import builtins import os import sys import tempfile import wa...
79fda3234b5b9e553a4dd1557195a675431c0a6eb146223e417b31f325b7a84a
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module defines a logging class based on the built-in logging module. .. note:: This module is meant for internal ``astropy`` usage. For use in other packages, we recommend implementing your own logger instead. """ import inspect import ...
a50ec06a43b41fd3a7ccdd5ab5fe14de7564666d645554ff36f6e1ffa850b207
# Licensed under a 3-clause BSD style license - see LICENSE.rst # # Astropy documentation build configuration file. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this file. # # All configuration values have a default...
bd7143eaa3b20174671c856bd9a2162f26f8d6fed421b306980082c15baf5c3f
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file needs to be included here to make sure commands such # as ``pytest docs/...`` works, since this # will ignore the conftest.py file at the root of the repository # and the one in astropy/conftest.py import os import tempfile import pytest # ...
d23437760dbb6d7d92b9d7b7b3c5ad7618850ebf76c7dd51afd2756aad94c3b3
import os import shutil import sys import erfa # noqa: F401 import matplotlib import pytest import astropy # noqa: F401 if len(sys.argv) == 3 and sys.argv[1] == "--astropy-root": ROOT = sys.argv[2] else: # Make sure we don't allow any arguments to be passed - some tests call # sys.executable which beco...
14ebfed90ad0cc86cb55a54105048432772669f6956d4b1cd0f685c3b4781977
""" ======================== Title of Example ======================== This example <verb> <active tense> <does something>. The example uses <packages> to <do something> and <other package> to <do other thing>. Include links to referenced packages like this: `astropy.io.fits` to show the astropy.io.fits or like this ...
0d4e57caf18cfd93b45eb7ea3eba4fcafbdf3f1b6bc444889c32bf3a617a01b9
""" ======================================================================== Transforming positions and velocities to and from a Galactocentric frame ======================================================================== This document shows a few examples of how to use and customize the `~astropy.coordinates.Galacto...
8448f597e96dd1a565d20bfe1ea8b6caf23531d2e99e81c1fd723e6ccd7f3129
""" =================================================================== Determining and plotting the altitude/azimuth of a celestial object =================================================================== This example demonstrates coordinate transformations and the creation of visibility curves to assist with obser...
fa696a84a04c2bf7e9d439cfd33685071eee8633b6df74a3a7bdb5af6aee3c30
""" ================================================================ Convert a radial velocity to the Galactic Standard of Rest (GSR) ================================================================ Radial or line-of-sight velocities of sources are often reported in a Heliocentric or Solar-system barycentric reference...
7ef96384215c25fdded5109f770d6bdb87fa86fbadfa15e6ee3804adfb78ead3
r""" ========================================================== Create a new coordinate class (for the Sagittarius stream) ========================================================== This document describes in detail how to subclass and define a custom spherical coordinate frame, as discussed in :ref:`astropy:astropy-c...
51e8664af769c49b9fd938ea4fabc8d8083275e145b9f7c56aaa04d3cb02ba8e
""" ===================================================== Create a multi-extension FITS (MEF) file from scratch ===================================================== This example demonstrates how to create a multi-extension FITS (MEF) file from scratch using `astropy.io.fits`. *By: Erik Bray* *License: BSD* """ ...
0b0d3551bf49108fdc8ad2bd73bcf056f03e2d5ed4b7becc21c05b9be78a849a
""" ================== Edit a FITS header ================== This example describes how to edit a value in a FITS header using `astropy.io.fits`. *By: Adrian Price-Whelan* *License: BSD* """ from astropy.io import fits from astropy.utils.data import get_pkg_data_filename ########################################...
f0a9c8c2045828483baf41056c9d2a713b4276104f34192366feeb452f71edc8
""" ======================================= Read and plot an image from a FITS file ======================================= This example opens an image stored in a FITS file and displays it to the screen. This example uses `astropy.utils.data` to download the file, `astropy.io.fits` to open the file, and `matplotlib....
8e93c233288805502afdd5d26cb6aaeb47d123b5b0e8cf9e2145f9b156b2b256
""" ========================================== Create a very large FITS file from scratch ========================================== This example demonstrates how to create a large file (larger than will fit in memory) from scratch using `astropy.io.fits`. *By: Erik Bray* *License: BSD* """ ######################...
9eba23a2f3259c331c61da0df98f75c5970516fa260d03cbcfba8f52da0afb1a
""" ===================================================================== Accessing data stored as a table in a multi-extension FITS (MEF) file ===================================================================== FITS files can often contain large amount of multi-dimensional data and tables. This example opens a FITS...
f3dba67320d45736520e92c6dda0de55582acd7ff3ab8c5a2657f7537e0df3c1
""" ===================================================== Convert a 3-color image (JPG) to separate FITS images ===================================================== This example opens an RGB JPEG image and writes out each channel as a separate FITS (image) file. This example uses `pillow <https://python-pillow.org>`...
e1d3e32d9a2d5513730be2ae3e2b4490dab455d1fa510caa582a33dda01dd718
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings import numpy as np from numpy.core.multiarray import normalize_axis_index from astropy.stats._fast_sigma_clip import _sigma_clip_fast from astropy.stats.funcs import mad_std from astropy.units import Quantity from astropy.utils import is...
c151da4fed9add2294bd9c44325c6b41f8577bc51dee25f9563be316d4a1d98e
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Bayesian Blocks for Time Series Analysis ======================================== Dynamic programming algorithm for solving a piecewise-constant model for various datasets. This is based on the algorithm presented in Scargle et al 2013 [1]_. This cod...
57229797b75922ac534dba62e95731ad639aa670e7674ba99f70a0840a4031fc
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains statistical tools provided for or used by Astropy. While the `scipy.stats` package contains a wide range of statistical tools, it is a general-purpose package, and is missing some that are particularly useful to astronomy or a...
dc167e1a0881902612fe938890b721dc0ba5be80f44287c80b8809d7ac87536e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import numpy from setuptools import Extension SRCDIR = os.path.join(os.path.relpath(os.path.dirname(__file__)), "src") SRCFILES = ["wirth_select.c", "compute_bounds.c", "fast_sigma_clip.c"] SRCFILES = [os.path.join(SRCDIR, srcfile) for srcfi...
8735381a662faba6c6b78abc164b291e81beef627e0a94a20c7dc9090731fd98
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains simple functions for dealing with circular statistics, for instance, mean, variance, standard deviation, correlation coefficient, and so on. This module also cover tests of uniformity, e.g., the Rayleigh and V tests. The Maximum L...
19d5f76c728a4025828987c9493a2ca4d0fafe8c0811613d130d01d703dbcbde
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module implements functions and classes for spatial statistics. """ import math import numpy as np __all__ = ["RipleysKEstimator"] class RipleysKEstimator: """ Estimators for Ripley's K function for two-dimensional spatial data. ...
b4567fe29b36bad15691f39d0bc05543eb609d0e90c10150286614ea6685b478
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains simple statistical algorithms that are straightforwardly implemented as a single python function (or family of functions). This module should generally not be used directly. Everything in `__all__` is imported into `astropy.stats...
baaa26faabe23962c02503ad83fd2b0239d7939d921bdc84e464268930258497
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains simple functions for model selection. """ import numpy as np __all__ = [ "bayesian_info_criterion", "bayesian_info_criterion_lsq", "akaike_info_criterion", "akaike_info_criterion_lsq", ] __doctest_requires__ = {...
1352c7995d537c60b6f956cc0c4117e90836b58d25d4f8950a8c845a3cac5c1e
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains functions for computing robust statistics using Tukey's biweight function. """ import numpy as np from .funcs import median_absolute_deviation __all__ = [ "biweight_location", "biweight_scale", "biweight_midvariance"...
5922da9f9c120eb66c07607f51acd5cfa90d0d53f3af44e8360556f9551ca422
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Methods for selecting the bin width of histograms Ported from the astroML project: https://www.astroml.org/ """ import numpy as np from .bayesian_blocks import bayesian_blocks __all__ = [ "histogram", "scott_bin_width", "freedman_bin_w...
433cbaa59bc1495290f8de0f371f101083ef3029bc44d9150e13971c14f94e3e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np __all__ = ["jackknife_resampling", "jackknife_stats"] __doctest_requires__ = {"jackknife_stats": ["scipy"]} def jackknife_resampling(data): """Performs jackknife resampling on numpy arrays. Jackknife resampling is a techniqu...
af73d6cdef0f57c1c25f01f541b30be1c341014e78c0323bd5fafb94b5a73413
""" Table property for providing information about table. """ import os # Licensed under a 3-clause BSD style license - see LICENSE.rst import sys from contextlib import contextmanager from inspect import isclass import numpy as np from astropy.utils.data_info import DataInfo __all__ = ["table_info", "TableInfo", "...
a652155f7a377f14d3fea56486b3ff682f5432ddc090b50be624f9a7e9b6d720
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The Index class can use several implementations as its engine. Any implementation should implement the following: __init__(data, row_index) : initialize index based on key/row list pairs add(key, row) -> None : add (key, row) to existing data remove(...
ba84d7311082045bb5e21709525921392c447fc3bf8b520018f5391b6d851696
# Licensed under a 3-clause BSD style license - see LICENSE.rst from os.path import abspath, dirname, join import astropy.config as _config import astropy.io.registry as io_registry from astropy import extern from .table import Table class Conf(_config.ConfigNamespace): """ Configuration parameters for `as...
25d53a8a21f85932bb6358a1cae42cfe7e242a030af9b3fa531278fa60bf0e54
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.io import registry from .info import serialize_method_as __all__ = ["TableRead", "TableWrite"] __doctest_skip__ = ["TableRead", "TableWrite"] class TableRead(registry.UnifiedReadWrite): """Read and parse a data table and return as a T...
aa2f0c6d514473e3cd254fb02e58cbb8152136f1e455e171d71122e36a2dce0b
# Licensed under a 3-clause BSD style license - see LICENSE.rst import collections from collections import OrderedDict from operator import index as operator_index import numpy as np class Row: """A class to represent one row of a Table object. A Row object is returned when a Table object is indexed with a...
6d92ac37413ec8766df47faa1ab565de2059a0e14ad9867f0ae3e017ae210b88
# Licensed under a 3-clause BSD style license - see LICENSE.rst import platform import warnings import numpy as np from astropy.utils.exceptions import AstropyUserWarning from .index import get_index_by_names __all__ = ["TableGroups", "ColumnGroups"] def table_group_by(table, keys): # index copies are unnece...
0e8b0a5b31293a302347c221ed6448c2f2402ce384b625aada5067ac94de25c2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import itertools import sys import types import warnings import weakref from collections import OrderedDict, defaultdict from collections.abc import Mapping from copy import deepcopy import numpy as np from numpy import ma from astropy import log from as...
0be78b1f8a74b82ff19afbffd77d5ef2d03fc94231fcee54c0928630ce425bdd
# 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, ColumnInfo, MaskedColumn, StringTruncateWarning __all__ = [ "BST", "Column", "ColumnGroups", "ColumnInfo", "Conf", "JSVie...
6ab54645bd0958735b8989ab44b3774a1d7c1b3560a0bb28ad1132ca78225551
# Licensed under a 3-clause BSD style license - see LICENSE.rst import itertools import warnings import weakref from copy import deepcopy import numpy as np from numpy import ma from astropy.units import Quantity, StructuredUnit, Unit from astropy.utils.console import color_print from astropy.utils.data_info import ...
6363fd946e150f0e7bef695a2d1c32ee379c3dc0db71b0ffc8ae653d20a08b65
# Licensed under a 3-clause BSD style license - see LICENSE.rst import operator __all__ = ["BST"] class MaxValue: """ Represents an infinite value for purposes of tuple comparison. """ def __gt__(self, other): return True def __ge__(self, other): return True def __lt__(...
9fd99f90582be0d7119a0a0ddb22a804ac1654ca95b18493b6aad5d3ce579dfb
# Licensed under a 3-clause BSD style license - see LICENSE.rst import fnmatch import os import re import sys import numpy as np from astropy import log from astropy.utils.console import Getch, color_print, conf, terminal_size from astropy.utils.data_info import dtype_info_name __all__ = [] def default_format_fun...
1306f31ef35375957c51a2c077b81d884b0b6d78a7cbd43f599d85549f567e73
""" High-level table operations: - join() - setdiff() - hstack() - vstack() - dstack() """ # Licensed under a 3-clause BSD style license - see LICENSE.rst import collections import itertools from collections import Counter, OrderedDict from collections.abc import Mapping, Sequence from copy import deepcopy import nu...
0cc3033ea923f90dfb3a4232c6c12deae541731bee00250ad742553848b9548b
""" High-level operations for numpy structured arrays. Some code and inspiration taken from numpy.lib.recfunctions.join_by(). Redistribution license restrictions apply. """ import collections from collections import Counter, OrderedDict from collections.abc import Sequence import numpy as np __all__ = ["TableMergeE...
e5e019565d9fce0cde649bb981ed2ddefe3a7184d15d84cde5d60e12dded52f8
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import numpy from setuptools import Extension ROOT = os.path.relpath(os.path.dirname(__file__)) def get_extensions(): sources = ["_np_utils.pyx", "_column_mixins.pyx"] include_dirs = [numpy.get_include()] exts = [ Extens...
9b350c3524fc443294dc204040c93d471d5ba0632cec49d12530374f783b605d
import copy import json import textwrap from collections import OrderedDict import numpy as np import yaml __all__ = ["get_header_from_yaml", "get_yaml_from_header", "get_yaml_from_table"] class ColumnOrderList(list): """ List of tuples that sorts in a specific order that makes sense for astropy table c...
efb190c105bd67e038f0ad90ae12b73b4bb60f68676e2e706611d653e33bdd04
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np def _searchsorted(array, val, side="left"): """ Call np.searchsorted or use a custom binary search if necessary. """ if hasattr(array, "searchsorted"): return array.searchsorted(val, side=side) # Python ...
6adb99bd781ebd40bee533177fa2f03f6f98c9feb08c928b1f4ffa3128d3f027
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import OrderedDict from copy import deepcopy from importlib import import_module import numpy as np from astropy.units.quantity import QuantityInfo from astropy.utils.data_info import MixinInfo from .column import Column, MaskedColumn f...
01cd2644d020208eff5a745ea065d04c7fb31cb7e400c093d4e32dc6ad465c50
ascii_coded = ( "Ò♙♙♙♙♙♙♙♙♌♐♐♌♙♙♙♙♙♙♌♌♙♙Ò♙♙♙♙♙♙♙♘♐♐♐♈♙♙♙♙♙♌♐♐♐♔Ò♙♙♌♈♙♙♌♐♈♈♙♙♙♙♙♙♙♙♈♐♐♙Ò♙♐♙♙♙♐♐♙♙♙" "♙♙♙♙♙♙♙♙♙♙♙♙Ò♐♔♙♙♘♐♐♙♙♌♐♐♔♙♙♌♌♌♙♙♙♌Ò♐♐♙♙♘♐♐♌♙♈♐♈♙♙♙♈♐♐♙♙♘♔Ò♐♐♌♙♘♐♐♐♌♌♙♙♌♌♌♙♈♈♙♌♐" "♐Ò♘♐♐♐♌♐♐♐♐♐♐♌♙♈♙♌♐♐♐♐♐♔Ò♘♐♐♐♐♐♐♐♐♐♐♐♐♈♈♐♐♐♐♐♐♙Ò♙♘♐♐♐♐♈♐♐♐♐♐♐♙♙♐♐♐♐♐♙♙Ò♙♙♙♈♈♈♙♙♐" "♐♐♐♐♔♙♐♐♐♐♈♙♙Ò♙♙♙♙♙♙♙♙♙♈♈♐♐♐♙♈♈♈♙♙♙♙Ò"...
6e8da45ed9493f8dfeeb586f562a7dc488745876e7c50677a8c0e29fe489883b
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Helper functions for table development, mostly creating useful tables for testing. """ import string from itertools import cycle import numpy as np from astropy.utils.data_info import ParentDtypeInfo from .table import Column, Table class Timin...
46d14c07ecafad6aae352015194fe4c993f1b805c453c10bb19fc8424d441ab1
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The SCEngine class uses the ``sortedcontainers`` package to implement an Index engine for Tables. """ from collections import OrderedDict from itertools import starmap from astropy.utils.compat.optional_deps import HAS_SORTEDCONTAINERS if HAS_SORTE...
c6d16323f6cf4df554c2261181e838c4ece9e50b2740f8d2c231bb6bac3085cb
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.utils.data_info import ParentDtypeInfo class NdarrayMixinInfo(ParentDtypeInfo): _represent_as_dict_primary_data = "data" def _represent_as_dict(self): """Represent Column as a dict that can be serialized...
5d97f9727cc0d35a9cedd2a510ee86b87384b26a2a38f7ef7217fc0bcd12e92e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import math import numpy as np from astropy.modeling import models from astropy.modeling.core import Fittable1DModel, Fittable2DModel from .core import Kernel, Kernel1D, Kernel2D from .utils import has_even_axis, raise_even_kernel_exception __all__ = ...
ac36fce012b3d3ef966584b377c940e27e691250efb5a0f0c13f62e136d3df73
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains the convolution and filter functionalities of astropy. A few conceptual notes: A filter kernel is mainly characterized by its response function. In the 1D case we speak of "impulse response function", in the 2D case we call it "po...
46427387fd8cfd9dcc16e41628e53d3d8482b53df505280284198b26b7e818cb
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .convolve import ( convolve, convolve_fft, convolve_models, convolve_models_fft, interpolate_replace_nans, ) from .core import * from .kernels import * from .utils import *
d58832d69e7cc2d1625ac72db516d110b176e1e93f968b753fdc8f0257d61f77
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import sys import numpy from setuptools import Extension C_CONVOLVE_PKGDIR = os.path.relpath(os.path.dirname(__file__)) extra_compile_args = ["-UNDEBUG"] if not sys.platform.startswith("win"): extra_compile_args.append("-fPIC") def get_...
b90018ade96adb97db6558f29b0b6054cb2198887bc17ed1517a4b6b2f6042f9
# Licensed under a 3-clause BSD style license - see LICENSE.rst 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 KernelSizeErro...
7fd773c1f14cc6a1288df104d6484a408d2ed024613674fa4fa2561ab12e6ae7
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings from functools import partial import numpy as np from astropy import units as u from astropy.modeling.convolution import Convolution from astropy.modeling.core import SPECIAL_OPERATORS, CompoundModel from astropy.nddata import support_nd...
208399b07d0119d5350420bf5546aace7821a75eaec74eab56b3fca932a61266
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains configuration and setup utilities for the Astropy project. """ from .configuration import * from .paths import *
1b5f44de79362e1bafff9b15e49dcaaf6d8ebd5246175b2037f9f7b55b6364b0
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module contains classes and functions to standardize access to configuration files for Astropy and affiliated packages. .. note:: The configuration system makes use of the 'configobj' package, which stores configuration in a text format li...
a2943d3936e0f64f43e7a4028f44eddc9dc9cbc2dd6df0d1704f77ba2508eb45
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains functions to determine where configuration and data/cache files used by Astropy should be placed. """ import os import shutil import sys from functools import wraps __all__ = ["get_config_dir", "get_cache_dir", "set_temp_config",...
c71ce72fcf6edaf77039354e7993601e933b7a683bd5c8166d3c6435d574b588
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Distribution class and associated machinery. """ import builtins import numpy as np from astropy import stats from astropy import units as u __all__ = ["Distribution"] # we set this by hand because the symbolic expression (below) requires scipy #...
c52d4796a37b91c4ad5671d5d2ebad6e4e1a3ae72e8cdd33544921b68d46befd
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Built-in distribution-creation functions. """ from warnings import warn import numpy as np from astropy import units as u from .core import Distribution __all__ = ["normal", "poisson", "uniform"] def normal( center, *, std=None, var=None, iv...
c3f5035dadb7b7044ff24338d4683e4baa7948636265b9f1ac3c672941aa0935
# 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...
cb34baffbc7c3e1341d9bce63108f27230d21ce5e0b57a597206ac31ad400535
# 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...
ea153ac685b17c9c92714cd974026edcbaf85015949df4e4f9c94f83344620b7
# 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...
454dcc5014d83e368796e6a1531a4b66221dc2ab05ca92ed4aee54aa6bd065e8
# 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 CompoundModel class Convolution(CompoundModel): """ Wrapper class for a convolution model. Param...
32650f299da513a7ce971d1541c8cce546e7d417854f9bfb9a9d8a8524b281da
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Creates a common namespace for all pre-defined models. """ from . import math_functions as math from .core import custom_model, fix_inputs, hide_inverse from .functional_models import * from .mappings import * from .physical_models import * from .pol...
f0875d6ace542b3ed062eb456bcedb4c0e8da62c7b196285e592e27de54b437e
""" 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...
418f01364212098c5a43d2c26742c85308ccf21a9a61dbc379ec7cfbd239ff8f
# 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 ...
4e359dec38b73818e8d71ab9f694131f8e5e5a66173febaad4c9b5844d0138d5
# 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"] #...
1d94ee5c25f35f736f6ba0f1e72216c40a475f072eaa8eb4fd6d2a608a99bf86
# 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...
b0f949c3badf7fb1c22720148c7583735f8effc58fb3a8d90c28601dad36e094
# 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 trig_ufuncs = [ "sin", "cos", "tan", "arcsin", "arccos", "arctan", "arctan2", "hypot", "sinh", "cosh", "tanh", ...
9d58e68473b21e9c863fb656554d1418ce96d08f43f3d2e61854c0ad74c43702
# 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_...
d616643fec572904004888f515f2cdd57883789ca2cbd2882d006cc27fb171ee
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module provides utility functions for the models package. """ import warnings # pylint: disable=invalid-name from collections import UserDict from collections.abc import MutableMapping from inspect import signature import numpy as np from astr...
f0c1a92106fefbd762c90e39dc368f261936067a0717d6b0161a8e3d2019cbe7
# 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...
01c897946e29e50ea10882e0cb712d7c2a78d7f72035792ac35b7ad005d7f75b
# 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...
c4f573db1d98c9a6b340dc40850bc8cfb9998dea93d558817cbc8a29ef5fd9a2
# Licensed under a 3-clause BSD style license - see LICENSE.rst # pylint: disable=invalid-name """ Implements projections--particularly sky projections defined in WCS Paper II [1]_. All angles are set and and displayed in degrees but internally computations are performed in radians. All functions expect inputs and out...
7a1a4eb56fb404a006615ff7f5bf8f334a723fa4d3a32893e0652f7b1c9b9a5d
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains models representing polynomials and polynomial series. """ # pylint: disable=invalid-name from math import comb import numpy as np from astropy.utils import check_broadcast, indent from .core import FittableModel, Model from .f...
e3c058627a089df2d1ec0f4222ef30ec4e9d47d2b2f358032c17cc056b721a37
# 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.], ... ...
65760a2a32c81fa47160d762f87ece40048ef3df3a48e4d359d5ea4e92bc171f
# 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 ....
92d8418b94b677869043c17fa045191f4c7cbc5e99392a9f20aa384e7428170e
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Statistic functions used in `~astropy.modeling.fitting`. """ # pylint: disable=invalid-name import numpy as np __all__ = ["leastsquare", "leastsquare_1d", "leastsquare_2d", "leastsquare_3d"] def leastsquare(measured_vals, updated_model, weights, *x...
f8f6105373ff9a36ed4891f139c6c767e37eb52316beeb4e35880d85eea85f3e
# 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 Magnitude, Quantity, UnitsError, dimensionless_unscaled, mag from .core import Fittable1DModel from .parameters import InputParameterError, Param...
8924ee41df6e158985c8efe96fc0d7d7bd821b93602a43336388468ef5355e5d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import os import queue import select import socket import threading import time import uuid import warnings import xmlrpc.client as xmlrpc from urllib.parse import urlunparse from astropy import log from .constants import SAMP_STATUS_OK, __...
23651ba10013bcb227fcf1724289eab76bfe0eb0cf3c01c0ade0e081d822e8cc
# Licensed under a 3-clause BSD style license - see LICENSE.rst # TODO: this file should be refactored to use a more thread-safe and # race-condition-safe lockfile mechanism. import datetime import os import stat import warnings import xmlrpc.client as xmlrpc from contextlib import suppress from urllib.parse import ...
c18c05ce94e03e0fe182ae7895b4e4e1d775736619bc3a5ee05033bebb1eb6cf
# Licensed under a 3-clause BSD style license - see LICENSE.rst import argparse import copy import sys import time from astropy import __version__, log from .hub import SAMPHubServer __all__ = ["hub_script"] def hub_script(timeout=0): """ This main function is executed by the ``samp_hub`` command line to...
4e1027ddcacecccdf5ffddcf2eb8d2a7b113a6ffabbff517d584a409295d1192
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Defines custom errors and exceptions used in `astropy.samp`. """ import xmlrpc.client as xmlrpc from astropy.utils.exceptions import AstropyUserWarning __all__ = ["SAMPWarning", "SAMPHubError", "SAMPClientError", "SAMPProxyError"] class SAMPWarni...
abb7f417479bd09623dbe7f750598db285f719a35bcc3f2799d435b5d2adb8f7
# Licensed under a 3-clause BSD style license - see LICENSE.rst from urllib.parse import parse_qs from urllib.request import urlopen from astropy.utils.data import get_pkg_data_contents from .standard_profile import SAMPSimpleXMLRPCRequestHandler, ThreadingXMLRPCServer __all__ = [] CROSS_DOMAIN = get_pkg_data_con...