hash
stringlengths
64
64
content
stringlengths
0
1.51M
e60a388b9f59b3ec28d8c3d8da4e91171769d8537c5836ecf7b335bc10ed759d
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astronomical and physics constants in cgs units. See :mod:`astropy.constants` for a complete listing of constants defined in Astropy. """ import itertools from .constant import Constant from . import codata2014, iau2015 for _nm, _c in itertools.cha...
fbeda3e7dfbc977ade53fd2fb43d3f9bcbb3543e01aa09bbcd2288fca59c2292
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import types import warnings import numpy as np from ..units.core import Unit, UnitsError from ..units.quantity import Quantity from ..utils import lazyproperty from ..utils.exceptions import AstropyUserWarning from ..utils.misc import I...
e2de0414178ec0968eb53bc5462bac62db72a58c9a87a4478641362d2b4bf0f0
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astronomical and physics constants in SI units. See :mod:`astropy.constants` for a complete listing of constants defined in Astropy. """ import itertools from .constant import Constant from . import codata2014, iau2015 for _nm, _c in itertools.ch...
1e6b5d7aebdaea118d16b80cbf625f6b0b18bd374f9690988f071c8c99cdfd80
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains dictionaries with sets of parameters for a given cosmology. Each cosmology has the following parameters defined: ========== ===================================== Oc0 Omega cold dark matter at z=0 Ob0 ...
1354a4d6ece8a9079ee722c28be21744041ae3aa6f674d97d80afdf23b40070e
# Licensed under a 3-clause BSD style license - see LICENSE.rst import sys from math import sqrt, pi, exp, log, floor from abc import ABCMeta, abstractmethod from inspect import signature import numpy as np from . import scalar_inv_efuncs from .. import constants as const from .. import units as u from ..utils imp...
08874872cc35038346f2e60a1763fe703fe73a2724a6c16d5796436c5fd14038
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ astropy.cosmology contains classes and functions for cosmological distance measures and other cosmology-related calculations. See the `Astropy documentation <http://docs.astropy.org/en/latest/cosmology/index.html>`_ for more detailed usage examples an...
2881e90fe7b522f60f3007975a0fbf46ff742c10720202bfeff31211b2dc5b99
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Convenience functions for `astropy.cosmology`. """ import warnings import numpy as np from .core import CosmologyError from ..units import Quantity __all__ = ['z_at_value'] __doctest_requires__ = {'*': ['scipy.integrate']} def z_at_value(func, fv...
181465fee7877fbffbeae8e71ec6078dc21e51d077ed750d17e24947a0374d14
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import assert_equal from numpy.testing.utils import assert_allclose try: import scipy # pylint: disable=W0611 except ImportError: HAS_SCIPY = False else: HAS_SCIPY = True from ..jackknif...
d13b4b97493ca818854d90491f3bfaabcd8ea9ceb5597e196bbb665632110868
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import assert_allclose from .. import histogram, scott_bin_width, freedman_bin_width, knuth_bin_width try: import scipy # pylint: disable=W0611 except ImportError: HAS_SCIPY = False else: ...
f6277e7c5dd8d266a3dd3c9741a0ef97964378c117e31f6f812363be76da3058
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.random import randn from numpy.testing import assert_equal, assert_allclose try: from scipy import stats # used in testing except ImportError: HAS_SCIPY = False else: HAS_SCIPY = True from ..sig...
a00037ada68ee1767301a48202cb121893bf0439d66b14c76a43e8c5a5c5b791
from numpy.testing.utils import assert_allclose from ..info_theory import bayesian_info_criterion, bayesian_info_criterion_lsq from ..info_theory import akaike_info_criterion, akaike_info_criterion_lsq def test_bayesian_info_criterion(): # This test is from an example presented in Ref [1] lnL = (-176.4, -17...
0ed6487d0d11474c394151239db96229df0774ae2a18cef11fb126d413fe228e
import pytest import numpy as np from numpy.testing import assert_equal from numpy.testing.utils import assert_allclose from astropy import units as u try: import scipy.stats except ImportError: HAS_SCIPY = False else: HAS_SCIPY = True from ..circstats import _length, circmean, circvar, circmoment, cir...
9efac287544f8ce4ab27db275ab81e37c59530dc59da9fe6c4577e7663a3ecb4
import numpy as np import pytest from numpy.testing.utils import assert_allclose from ..spatial import RipleysKEstimator from ...utils.misc import NumpyRNGContext a = np.array([[1, 4], [2, 5], [3, 6]]) b = np.array([[-1, 1], [-2, 2], [-3, 3]]) @pytest.mark.parametrize("points, x_min, x_max", [(a, 0, 10), (b, -5, ...
1c832163ee1f202eec541f019c6890613b6b33ddd997f4bc40375a3f3187bd3d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import assert_allclose from .. import bayesian_blocks, RegularEvents def test_single_change_point(rseed=0): rng = np.random.RandomState(rseed) x = np.concatenate([rng.rand(100), ...
c2b9a942a046b5215ac144303cb414c8ce8562f5e5b304f1fdec8d2c29ceb14f
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.random import randn, normal from numpy.testing import assert_equal from numpy.testing.utils import assert_allclose try: import scipy # pylint: disable=W0611 except ImportError: HAS_SCIPY = False else:...
cf8b6ab9acdde18350685635ba735a919cb24cd15b6ebfcd262e9ff919ddd04d
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.random import randn, normal from numpy.testing import assert_equal from numpy.testing.utils import assert_allclose from ..biweight import (biweight_location, biweight_scale, biweight_mid...
3effe8113df40811fb015b372108c00e1f45cb655f6878a2c47918332ca29506
""" Utilities for computing periodogram statistics. This is an internal module; users should access this functionality via the ``false_alarm_probability`` and ``false_alarm_level`` methods of the ``astropy.stats.LombScargle`` API. """ from functools import wraps import numpy as np def _weighted_sum(val, dy): i...
c2128112166d9b4bb915ed8e28833e0221a024cf29d6f53907ed94153356b0d7
"""Main Lomb-Scargle Implementation""" import numpy as np from .implementations import lombscargle, available_methods from .implementations.mle import periodic_fit from . import _statistics from ... import units def has_units(obj): return hasattr(obj, 'unit') def get_unit(obj): return getattr(obj, 'unit',...
b9cd7111c3a6ff37fec6d42a638f4f5e392861626599614055458c14efa8a144
import numpy as np NORMALIZATIONS = ['standard', 'psd', 'model', 'log'] def compute_chi2_ref(y, dy=None, center_data=True, fit_mean=True): """Compute the reference chi-square for a particular dataset. Note: this is not valid center_data=False and fit_mean=False. Parameters ---------- y : array...
71c47c5cf5a20ba766bbd5551a213f54a3fa8bf513b1a5d7b0c21d1cfe6b1e7a
import numpy as np from .mle import design_matrix def lombscargle_chi2(t, y, dy, frequency, normalization='standard', fit_mean=True, center_data=True, nterms=1): """Lomb-Scargle Periodogram This implements a chi-squared-based periodogram, which is relatively slow but useful for val...
d07a16faf8d3f2bc10b6da34e3e66bfce56e47d3c3e40bbf27c6a71d52674d4a
""" Main Lomb-Scargle Implementation The ``lombscargle`` function here is essentially a sophisticated switch statement for the various implementations available in this submodule """ __all__ = ['lombscargle', 'available_methods'] import warnings import numpy as np from .slow_impl import lombscargle_slow from .fast...
73da10777209b7aac812f9d3077373f881a152069a0ffd8c43a501bfc7ca9acb
import numpy as np from .utils import trig_sum def lombscargle_fast(t, y, dy, f0, df, Nf, center_data=True, fit_mean=True, normalization='standard', use_fft=True, trig_sum_kwds=None): """Fast Lomb-Scargle Periodogram This implements the Press & ...
3798034e356f46d1249d40f537b29206d12d960e406668e2fe56b9d812341bde
import numpy as np def lombscargle_scipy(t, y, frequency, normalization='standard', center_data=True): """Lomb-Scargle Periodogram This is a wrapper of ``scipy.signal.lombscargle`` for computation of the Lomb-Scargle periodogram. This is a relatively fast version of the naive O...
7436101a122f30e3e5f49e83989906e69dbc01c0b30d6bbfdfcc1b58b393cc08
import warnings from math import factorial import numpy as np def bitceil(N): """ Find the bit (i.e. power of 2) immediately greater than or equal to N Note: this works for numbers up to 2 ** 64. Roughly equivalent to int(2 ** np.ceil(np.log2(N))) """ return 1 << int(N - 1).bit_length() def...
55601f0eca608fe7c24677eff9ad94787793294316233712fc8edd452b543b5b
import numpy as np def lombscargle_slow(t, y, dy, frequency, normalization='standard', fit_mean=True, center_data=True): """Lomb-Scargle Periodogram This is a pure-python implementation of the original Lomb-Scargle formalism (e.g. [1]_, [2]_), with the addition of the floating mean ...
cf63267c38d54e3f6f6f4244a4da5170244f95a6b0015b030760323d3484fce4
import numpy as np from .utils import trig_sum def lombscargle_fastchi2(t, y, dy, f0, df, Nf, normalization='standard', fit_mean=True, center_data=True, nterms=1, use_fft=True, trig_sum_kwds=None): """Lomb-Scargle Periodogram This implements a fast chi-squa...
f776e9efdbd436418be0150723f5621da099737958b0d3dd64847642fd8f838d
import numpy as np def design_matrix(t, frequency, dy=None, bias=True, nterms=1): """Compute the Lomb-Scargle design matrix at the given frequency This is the matrix X such that the periodic model at the given frequency can be expressed :math:`\\hat{y} = X \\theta`. Parameters ---------- t ...
3ba44a4055c92f6946877146b8dc6c693bc431a89d906651e88be8b5b5a3a1c4
import numpy as np import pytest from numpy.testing import assert_allclose try: import scipy except ImportError: HAS_SCIPY = False else: HAS_SCIPY = True from .. import LombScargle from .._statistics import (cdf_single, pdf_single, fap_single, inv_fap_single, METHODS) from ..uti...
d94f9a18e82772bf983c15205bc7817e07ccc6258b410d340d9bb4b46608485b
import numpy as np import pytest from numpy.testing import assert_allclose from ..utils import convert_normalization, compute_chi2_ref from ..core import LombScargle NORMALIZATIONS = ['standard', 'model', 'log', 'psd'] @pytest.fixture def data(N=100, period=1, theta=[10, 2, 3], dy=1, rseed=0): """Generate some...
fc3e234bb6fb1c2205d89403f9618d82093cc7611feb141e336cf3bf0195c3b3
import pytest import numpy as np from numpy.testing import assert_allclose from .... import units from ....tests.helper import assert_quantity_allclose from .. import LombScargle ALL_METHODS = LombScargle.available_methods ALL_METHODS_NO_AUTO = [method for method in ALL_METHODS if method != 'auto'] FAST_METHODS = [m...
a2f091d54c00b09e53cd9f73e0a0247e77bf0245baa331a5cfcb0c42db27e2ef
import pytest import numpy as np from numpy.testing import assert_allclose, assert_equal from ..utils import extirpolate, bitceil, trig_sum @pytest.mark.parametrize('N', 2 ** np.arange(1, 12)) @pytest.mark.parametrize('offset', [-1, 0, 1]) def test_bitceil(N, offset): assert_equal(bitceil(N + offset), ...
d79cf013de472b2a52b91b83fdf2b3df2447a99ddecf1e8cf16299ff37b06e12
import pytest import numpy as np from numpy.testing import assert_allclose from ..mle import design_matrix, periodic_fit @pytest.fixture def t(): rand = np.random.RandomState(42) return 10 * rand.rand(10) @pytest.mark.parametrize('freq', [1.0, 2]) @pytest.mark.parametrize('dy', [None, 2.0]) @pytest.mark.pa...
ac698e303b5ef5e1e02ab95c076e688559d7360d7ac7d14d69ed36ae0fe81815
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from ..sorted_array import SortedArray from ..table import Table @pytest.fixture def array(): # composite index col0 = np.array([x % 2 for x in range(1, 11)]) col1 = np.array([x for x in range(1, 11)]) t...
26be662daced380ef6dbf0228950a7296202478da860d9112e2789f1666bb70a
import numpy as np from .. import np_utils def test_common_dtype(): """ Test that allowed combinations are those expected. """ dtype = [(str('int'), int), (str('uint8'), np.uint8), (str('float32'), np.float32), (str('float64'), np.float64), (str('st...
21e9872d97b51031377a647d75040a6a8f373d1ed6d000671e8c513e9e817a95
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import gc import sys import copy from io import StringIO from collections import OrderedDict import pytest import numpy as np from numpy.testing import assert_allclose from ...io import fits from ...tests.helper import (assert_fo...
c9e8c05bb563366f68c77aa283cdc7f4036469d2481478e88bac8db222e6519b
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings from io import StringIO from collections import OrderedDict import numpy as np from ... import units as u from ... import time from ... import coordinates from ... import table from ...utils.data_info import data...
01827df83e0ae065132cc5b2b95721451331b1019ec46be4a5b4f6a8809d0a53
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from .test_table import SetupData from ..bst import BST, FastRBT, FastBST from ..sorted_array import SortedArray from ..table import QTable, Row, Table from ... import units as u from ...time import Time from ..column imp...
5689876df26b02b5f99e5d20f350bfe133ee9126c301dcc64ba2162dc689dab2
from os.path import abspath, dirname, join import textwrap import pytest from ..table import Table from ... import extern from ...utils.xml.writer import HAS_BLEACH try: import IPython # pylint: disable=W0611 except ImportError: HAS_IPYTHON = False else: HAS_IPYTHON = True EXTERN_DIR = abspath(dirname(...
c67998bc4cfad931c8f7fe00d893cd45473027341e2d52b6aef168023e3752e6
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import OrderedDict, Mapping, UserDict import pytest import numpy as np from ...table import Column, TableColumns class TestTableColumnsInit(): def test_init(self): """Test initialisation with lists, tuples, dicts of arra...
fc412da36ace23b6257053b5f9fcd6cf2e19d52888a30613861b0862494f1a7c
import os import re from ..scripts import showtable from ...utils.compat import NUMPY_LT_1_14 ROOT = os.path.abspath(os.path.dirname(__file__)) ASCII_ROOT = os.path.join(ROOT, '..', '..', 'io', 'ascii', 'tests') FITS_ROOT = os.path.join(ROOT, '..', '..', 'io', 'fits', 'tests') VOTABLE_ROOT = os.path.join(ROOT, '..', ...
d3b39d372f96e28929fd7375afced7d3ebb3a1490b865425069d7496d1086345
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from ...tests.helper import catch_warnings from ...table import Table, Column from ...utils.exceptions import AstropyUserWarning def sort_eq(list1, list2): return sorted(list1) == sorted(list2) def test_column_gr...
260d43fdc52f0bfdc2a116ee5c17f588827e8cac63934c473188123ecee65a63
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test behavior related to masked tables""" import pytest import numpy as np import numpy.ma as ma from ...table import Column, MaskedColumn, Table class SetupData: def setup_method(self, method): self.a = MaskedColumn(name='a', data=[1,...
882dbb46fd90e43c59e227c530440cb1421cef6aec69b92052e0776100f524d8
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Verify item access API in: https://github.com/astropy/astropy/wiki/Table-item-access-definition """ import pytest import numpy as np @pytest.mark.usefixtures('table_data') class BaseTestItems(): pass @pytest.mark.usefixtures('table_data') cl...
b0176f266ebcc0eb9b3d97a94f0f1ddfe44c69ab56ff6e111877b401ef4733a7
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from ... import table from .. import pprint class MyRow(table.Row): def __str__(self): return str(self.as_void()) class MyColumn(table.Column): pass class MyMaskedColumn(table.MaskedColumn): pass class ...
9fa59ae5500ae24d37a3fe3aa9525c0fcdf079adabf821cb3a9b3c6f890ec73c
import numpy as np import pickle from ...table import Table, Column, MaskedColumn, QTable from ...table.table_helpers import simple_table from ...units import Quantity, deg from ...time import Time from ...coordinates import SkyCoord def test_pickle_column(protocol): c = Column(data=[1, 2], name='a', format='%0...
52fcdbf130817c84b9f39854d1e617f12cb9e5e23f6e8f2b9f87d6e8733496da
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ All of the py.test fixtures used by astropy.table are defined here. The fixtures can not be defined in the modules that use them, because those modules are imported twice: once with `from __future__ import unicode_literals` and once without. py.test...
34e4e27db0d54fca1fb0929ef311724dae8def3179999e88c90b103c9c37030e
# Licensed under a 3-clause BSD style license - see LICENSE.rst from collections import OrderedDict import pytest import numpy as np from ...tests.helper import catch_warnings from ...table import Table, QTable, TableMergeError from ...table.operations import _get_out_class from ... import units as u from ...utils ...
1b0acdfda14eaa45237caed2f6332e51e48a90cda46c9563faf5effda08741b7
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import operator import pytest import numpy as np from ...tests.helper import assert_follows_unicode_guidelines, catch_warnings from ... import table from ... import units as u class TestColumn(): def test_subclass(self, C...
da9927052930ba446948717a707ff65c5ddc50c7c519dc50ab4e1e315b46bae8
# Licensed under a 3-clause BSD style license - see LICENSE.rst import sys import pytest import numpy as np from ... import table from ...table import Row from ... import units as u from .conftest import MaskedTable def test_masked_row_with_object_col(): """ Numpy < 1.8 has a bug in masked array that prev...
59d31f974be779429dcadb9150c63bcf914755b841e9d6097de45994ca299130
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst try: import h5py # pylint: disable=W0611 except ImportError: HAS_H5PY = False else: HAS_H5PY = True try: import yaml # pylint: disable=W0611 HAS_YAML = True except ImportError: HAS_YAML = False import co...
7d9592c0438956ca8b697c96f3f52a1b2d66f54804543074c7266a8a5d0d0047
# This Python file uses the following encoding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from ... import table from ...table import Table, QTable from ...table.table_helpers import simple_table from ... import units as u from ...utils import console BIG_...
8b53974b9b1fef5899db55c99d3fcec3e98a8450cda7ed4a55363a3865fd26fd
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from ..bst import BST def get_tree(TreeType): b = TreeType([], []) for val in [5, 2, 9, 3, 4, 1, 6, 10, 8, 7]: b.add(val) return b @pytest.fixture def tree(): return get_tree(BST) r''' 5 / \...
c5321cdb3cad032187d4c0ff5fcb151da08044ed6df93dd099054453756efcd1
# Licensed under a 3-clause BSD style license - see LICENSE.rst import itertools import pytest import numpy as np from numpy.testing import assert_array_almost_equal_nulp, assert_allclose from ..convolve import convolve_fft from ...tests.helper import catch_warnings from ...utils.exceptions import AstropyUserWarning...
4a77be2b3e6ce61adf50dcc623a5a4170a5bc7727e7fd7b84e21bc49801ddecb
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from ... import convolution as conv from ...tests.helper import pickle_protocol, check_pickling_recovery # noqa @pytest.mark.parametrize(("name", "args", "kwargs", "xfail"), [(conv.CustomKernel...
d95b2ae72a9a0107dba9085a5ca1dba775c57ef78724cb66cd952f42c5876da3
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from ..convolve import convolve, convolve_fft from ..kernels import Gaussian2DKernel from ...nddata import NDData def test_basic_nddata(): arr = np.zeros((11, 11)) arr[5, 5] = 1 ndd = NDData(arr) test_ke...
4fe5f1d85ec122e54d8e52dfd5364d0395aedf49c9b80181ecb4e6f8ced02ac5
# Licensed under a 3-clause BSD style license - see LICENSE.rst import itertools import pytest import numpy as np from numpy.testing import assert_almost_equal from ..convolve import convolve, convolve_fft from ..kernels import Gaussian2DKernel, Box2DKernel, Tophat2DKernel from ..kernels import Moffat2DKernel SHAP...
e23511e301fb07336c3f357cc365e53a9dccde48ee667864d939c6be25df0e69
# Licensed under a 3-clause BSD style license - see LICENSE.rst import itertools import pytest import numpy as np from numpy.testing import assert_almost_equal, assert_allclose from ..convolve import convolve, convolve_fft from ..kernels import ( Gaussian1DKernel, Gaussian2DKernel, Box1DKernel, Box2DKernel, ...
8e47004cb750a65dd0f4cb602d4c03091d8cef8338fe5092646d10b01cfcc728
# Licensed under a 3-clause BSD style license - see LICENSE.rst import itertools import pytest import numpy as np from numpy.testing import assert_allclose from ..utils import discretize_model from ...modeling.functional_models import ( Gaussian1D, Box1D, MexicanHat1D, Gaussian2D, Box2D, MexicanHat2D) from ...mo...
d6f78ac6f3c1e0eb5e080517cf4a50027dd44a79cf6b4f6674ebc5a9f8156988
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from ..convolve import convolve, convolve_fft from numpy.testing import assert_array_almost_equal_nulp, assert_array_almost_equal import itertools VALID_DTYPES = [] for dtype_array in ['>f4', '<f4', '>f8', '<f8']: ...
6a1f796a40df07daba1a6a0d7b88e79943a8dec41df60a4a72912039b4e66151
# Licensed under a 3-clause BSD style license - see LICENSE.rst import math import numpy as np import pytest from ..convolve import convolve, convolve_fft, convolve_models from ...modeling import models, fitting from ...utils.misc import NumpyRNGContext from numpy.testing import assert_allclose, assert_almost_equal ...
862ba0a8c26a04774c87e1070a8547a65ad6034282221765ebb0e125b5796dde
# Licensed under a 3-clause BSD style license - see LICENSE.rst import timeit import numpy as np # pylint: disable=W0611 # largest image size to use for "linear" and fft convolutions max_exponents_linear = {1: 15, 2: 7, 3: 5} max_exponents_fft = {1: 15, 2: 10, 3: 7} if __name__ == "__main__": for ndims in [1,...
642359996d5757d9847a4208dd0d28b13dd267f117cc2805c1b58a69a19738b5
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import os import sys import subprocess import pytest from ...tests.helper import catch_warnings from ...utils.data import get_pkg_data_filename from .. import configuration from .. import paths from ...utils.exceptions import A...
6071c3406ac8f54469f6ee256a0ac3dd7b0ac36e8941c636e46c9d29d5219733
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test sky projections defined in WCS Paper II""" import os import pytest import numpy as np from numpy.testing import utils from .. import projections from ..parameters import InputParameterError from ... import units as u from ...io import fits fro...
789a070244327612401aea54d3eaf45d637df6b5070d8b6f4aec2d24119030e9
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module provides functions to help with testing against iraf tasks """ from ...logger import log import numpy as np iraf_models_map = {1.: 'Chebyshev', 2.: 'Legendre', 3.: 'Spline3', 4.: ...
8444cdb5499741c7a7e0102016e47a8c3893caf0ee8079fe8adb0495b2b1573c
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for blackbody model and functions.""" import pytest import numpy as np from ..blackbody import BlackBody1D, blackbody_nu, blackbody_lambda, FNU from ..fitting import LevMarLSQFitter from ...tests.helper import assert_quantity_allclose, catch_wa...
e834e5b2ba333ec89fee479e387a5f09fe226e4fd3a01ae2099c6c7e95e71710
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Here are all the test parameters and values for the each `~astropy.modeling.FittableModel` defined. There is a dictionary for 1D and a dictionary for 2D models. Explanation of keywords of the dictionaries: "parameters" : list or dict Model parame...
6e62862e8cbb29b81fc8b1813331a7e4600bd55c33b97c2d943cfdf40201a879
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Module to test fitting routines """ import os.path import pytest import numpy as np from numpy import linalg from numpy.testing.utils import assert_allclose, assert_almost_equal from unittest import mock from . import irafutil from .. import models...
22d4199ea6f967467003eda1d207ac59cf2670b142d1ef7514ab9a391eee981b
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import assert_allclose, assert_array_equal from .. import models, InputParameterError from ...coordinates import Angle from .. import fitting from ...tests.helper import catch_warnings from ...utils.ex...
7eedb0bfd98c0467c72a205cf354de8c9f6a00ad8b2ab66a11b275fb7afdb692
# Licensed under a 3-clause BSD style license - see LICENSE.rst import operator import numpy as np from ..utils import ExpressionTree as ET, ellipse_extent from ..models import Ellipse2D def test_traverse_postorder_duplicate_subtrees(): """ Regression test for a bug in `ExpressionTree.traverse_postorder` ...
ea90c80944c6526e7566dde6a3d9b83e60922c658e0791157cef76e9dea7fe7c
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for model evaluation. Compare the results of some models with other programs. """ try: import cPickle as pickle except ImportError: import pickle import pytest import numpy as np from numpy.testing import utils from .example_models...
9ce65d2de3baf99093fb64060977faed7ea90ec8b9757e1e121dd92661b36255
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import utils from ...wcs import wcs from .. import models from ... import units as u from ...tests.helper import assert_quantity_allclose @pytest.mark.parametrize(('inp'), [(0, 0), (4000, -20.56), (-...
828454abf5598806df52f18316004d61bc79ddf216f169b6001a8f9a8c52ff2b
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests that relate to evaluating models with quantity parameters """ import numpy as np import pytest from numpy.testing import assert_allclose from ..core import Model from ..models import Gaussian1D from ... import units as u from ...units import...
17d0e5f146f144cda41b9d4cfa35a4afc4aa8d385b9203a5019cb06ae2763e28
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests that relate to fitting models with quantity parameters """ import numpy as np import pytest from ..models import Gaussian1D from ... import units as u from ...units import UnitsError from ...tests.helper import assert_quantity_allclose from ....
5155557de111856bdfb43c1934063f6f4b596f8c433891c85c8694209fe92d44
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module tests fitting and model evaluation with various inputs """ import pytest import numpy as np from numpy.testing.utils import assert_allclose from .. import models from .. import fitting from ..core import Model, FittableModel, Fittable1DM...
e6dd3a49c71d2a4f9cb53672c624d86f75bac4a8f5142cfa691f2c3115babb85
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests that relate to using quantities/units on parameters of models. """ import numpy as np import pytest from ..core import Model, Fittable1DModel, InputParameterError from ..parameters import Parameter, ParameterDefinitionError from ..models impo...
10af7adeaa71da384b48b3fe37231f24855b4aad038fa336fdce7b8b2bad8327
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for polynomial models.""" import os from itertools import product import pytest import numpy as np from numpy.testing.utils import assert_allclose from .. import fitting from ... import wcs from ...io import fits from ..polynomial import (Ch...
84c1f7797d2977703bc839f4cfde9f8a7e63c323a57d52a5ce165939b24f6197
# Licensed under a 3-clause BSD style license - see LICENSE.rst import inspect from copy import deepcopy import pickle import pytest import numpy as np from numpy.testing.utils import assert_allclose, assert_array_equal from ..core import Model, ModelDefinitionError from ..parameters import Parameter from ..model...
497a0ce00324bf549f06b747a81d46e1d95b24f08510b10e4076cc0f4a5309a9
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from inspect import signature from numpy.testing.utils import assert_allclose from ..core import Model, custom_model from ..parameters import Parameter from .. import models class NonFittableModel(Model): """An ex...
d8e764c2519fa078cd276e8d74d86d39e92b9ab094fa1a7bfbae1fa61621c890
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test separability of models. """ import pytest import numpy as np from numpy.testing import assert_allclose from .. import models from ..models import Mapping from .. separable import (_coord_matrix, is_separable, _cdot, _cs...
5250600817b8f3a277718909c119e1e71162419dff7c67caaa61f5b53a348fea
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import contextlib import warnings from ...tests.helper import catch_warnings @contextlib.contextmanager def ignore_non_integer_warning(): # We need to ignore this warning on Scipy < 0.14. # When our minimum version of Sc...
91aadc2ff7ff8b57de275d534ecf51e88ce3b9e00882dd96cbe37b31141ab5ee
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests models.parameters """ import itertools import pytest import numpy as np from numpy.testing import utils from . import irafutil from .. import models, fitting from ..core import Model, FittableModel from ..parameters import Parameter, InputPar...
35bc8a017ab5f1b554fae340cf024774ffe7dc2440ced86793cf7ad606617317
# Licensed under a 3-clause BSD style license - see LICENSE.rst from math import cos, sin import pytest import numpy as np from numpy.testing import utils from .. import models from ...wcs import wcs @pytest.mark.parametrize(('inp'), [(0, 0), (4000, -20.56), (-2001.5, 45.9), (0, 90), (0, -90), (np.mgrid[:4, :6])]...
fe180042a337f84ae7b873e208b39ed3bbd51517989b50248863839a85543690
# Licensed under a 3-clause BSD style license - see LICENSE.rst import types import pytest import numpy as np from numpy.testing import utils from numpy.random import RandomState from ..core import Fittable1DModel from ..parameters import Parameter from .. import models from .. import fitting from .utils import ig...
1c5b4e1bf0ffd9754f5fb233c2132dd9a39bac449121a300a584cd3acc271a4f
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing.utils import assert_allclose, assert_array_equal from ..fitting import LevMarLSQFitter from ..models import Shift, Rotation2D, Gaussian1D, Identity, Mapping from ...utils import NumpyRNGContext try: ...
c91d273e0fc91e7a107e5350526060370f329dacc624aee87b245ec241a92fd1
# Various tests of models not related to evaluation, fitting, or parameters from ...tests.helper import assert_quantity_allclose from ... import units as u from ..functional_models import Gaussian1D def test_gaussian1d_bounding_box(): g = Gaussian1D(mean=3 * u.m, stddev=3 * u.cm, amplitude=3 * u.Jy) bbox = g...
cece9c02979a047d989442012aafc9837ecd201bfc07ebe823a864171a9d9007
from collections import OrderedDict import pytest import numpy as np from ... import units as u from ...tests.helper import assert_quantity_allclose from ..functional_models import (Gaussian1D, Sersic1D, Sine1D, Linear1D, Lorentz1D, Voigt1D, Const1D, ...
78631017985928b18f74ef15f46ff31954a184503bfca744893445a9c3a57588
# Licensed under a 3-clause BSD style license - see LICENSE.rst from ..errors import SAMPHubError, SAMPClientError, SAMPProxyError # By default, tests should not use the internet. from .. import conf def setup_module(module): conf.use_internet = False def test_SAMPHubError(): """Test that SAMPHubError can...
2dbca54c82243cbc2424ed108ac5bdf7af595fe83a14d27ea94877711f4ab29e
import ssl import tempfile import pytest from ...utils.data import get_pkg_data_filename from ..hub import SAMPHubServer from ..integrated_client import SAMPIntegratedClient from ..errors import SAMPProxyError # By default, tests should not use the internet. from .. import conf from .test_helpers import random_par...
f13089c16b3f84e04832093203978dc86736d8ce60c36ae47b3ce972d802f6a2
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from ..hub_proxy import SAMPHubProxy from ..client import SAMPClient from ..integrated_client import SAMPIntegratedClient from ..hub import SAMPHubServer # By default, tests should not use the internet. from .. import conf def setup_modu...
a87257f13e836991385def9972696a6ad4fcc6c76fdd4ebc428317adf6fd9a74
import sys from ..hub_script import hub_script from .. import conf 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(function): sys.argv = function.sys_argv_orig def test_hub_script(...
e941b05be4c22b0aa2cdbe1da8722d30b81993236dce4a99474f83b20ebdf01c
from ..hub_proxy import SAMPHubProxy from ..hub import SAMPHubServer from .. import conf def setup_module(module): conf.use_internet = False class TestHubProxy: def setup_method(self, method): self.hub = SAMPHubServer(web_profile=False, mode='multiple', pool_size=1) self.hub.start() ...
af73cc9f4fa7517ef1b54d26d13bc3a47b6eaf6858be825cdb3e9712a970b008
""" 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 os import threading import tempfile from urllib.request import Req...
d71d9fdbc20071c880b4510bb9b437b2c85329b6a4e75a7e3ae2aa9c2a72a9bc
import os import time import pickle import random import string from .. 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') ...
0cc7dfa00c37ff0bf92c43fdbf866a5930971112cae82a916ab1bd9366339a79
import time import threading import xmlrpc.client as xmlrpc from ..hub import WebProfileDialog from ..hub_proxy import SAMPHubProxy from ..client import SAMPClient from ..integrated_client import SAMPIntegratedClient from ..utils import ServerProxyPool from ..errors import SAMPClientError, SAMPHubError class AlwaysA...
3fca71fac501cb184272df3bdc716a0967118cfab529c7d98bd05f3b8a3747f8
# Licensed under a 3-clause BSD style license - see LICENSE.rst import time from ..hub import SAMPHubServer from .. import conf def setup_module(module): conf.use_internet = False def test_SAMPHubServer(): """Test that SAMPHub can be instantiated""" SAMPHubServer(web_profile=False, mode='multiple', p...
c92f32de255b98686b22a94bd627098143818c940b4392826000e60d71d10759
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The astropy.utils.iers package provides access to the tables provided by the International Earth Rotation and Reference Systems Service, in particular allowing interpolation of published UT1-UTC values for given times. These are used in `astropy.time`...
013446fdd07bdef6b2d568e41ca62c74cd1e662309d985c43f2d0722358a2591
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ A collection of functions for checking various XML-related strings for standards compliance. """ import re import urllib.parse def check_id(ID): """ Returns `True` if *ID* is a valid XML ID. """ return re.match(r"^[A-Za-z_][A-Za-z0-...
c6a37290e0b33fe71b7d7d023e61a7a4fd246424fb832b21570f14a15dea2d8d
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains a class that makes it simple to stream out well-formed and nicely-indented XML. """ # STDLIB import contextlib import textwrap try: import bleach HAS_BLEACH = True except ImportError: HAS_BLEACH = False try: from . import _i...
1b70e35f9d7e769a14f33ed3c57d3e81da1dc50648183a66721b85fd163ca2f8
# Licensed under a 3-clause BSD style license - see LICENSE.rst from distutils.core import Extension from os.path import join import sys from astropy_helpers import setup_helpers def get_external_libraries(): return ['expat'] def get_extensions(build_type='release'): XML_DIR = 'astropy/utils/xml/src' ...
d7f37b1ba8312265baaa1e217fc0287c7da270f87ce3790f0561045c0ecc1c56
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module includes a fast iterator-based XML parser. """ # STDLIB import contextlib import io import sys # ASTROPY from .. import data __all__ = ['get_xml_iterator', 'get_xml_encoding', 'xml_readlines'] @contextlib.contextmanager def _convert_t...