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/io/ascii/latex.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""An extensible ASCII table reader and writer.
latex.py:
Classes to read and write LaTeX tables
:Copyright: Smithsonian Astrophysical Observatory (2011)
:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)
"""
import re
from collections.abc import G... | 541 | 19,148 |
astropy | astropy/io/ascii/fastbasic.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import re
from astropy.table import Table
from astropy.utils.misc import _set_locale
from . import core, cparser
class FastBasic(metaclass=core.MetaBaseReader):
"""
This class is intended to handle the same format addressed by the
... | 427 | 16,272 |
astropy | astropy/io/ascii/cds.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""An extensible ASCII table reader and writer.
cds.py:
Classes to read CDS / Vizier table format
:Copyright: Smithsonian Astrophysical Observatory (2011)
:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)
"""
import fnmatch
import itertools
import... | 428 | 17,749 |
astropy | astropy/io/ascii/core.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""An extensible ASCII table reader and writer.
core.py:
Core base classes and functions for reading and writing tables.
:Copyright: Smithsonian Astrophysical Observatory (2010)
:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)
"""
from __future__... | 1,862 | 66,606 |
astropy | astropy/io/ascii/tests/test_c_reader.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import io
import os
import re
import sys
from contextlib import nullcontext
from io import BytesIO
from textwrap import dedent
import numpy as np
import pytest
from numpy import ma
from numpy.testing import assert_allclose
from astropy.... | 1,749 | 59,983 |
astropy | astropy/io/ascii/tests/test_compressed.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.io.ascii import read
# NOTE: Python can be built without bz2 or lzma
from astropy.utils.compat.optional_deps import HAS_BZ2, HAS_LZMA, HAS_UNCOMPRESSPY
from astrop... | 48 | 1,956 |
astropy | astropy/io/ascii/tests/test_tdat.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module tests some methods related to ``tdat`` format
reader/writer.
Requires `pyyaml <https://pyyaml.org/>`_ to be installed.
"""
import copy
import warnings
from collections import OrderedDict
from io import StringIO
import numpy as np
import ... | 819 | 27,143 |
astropy | astropy/io/ascii/tests/test_write.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import os
import pathlib
from contextlib import nullcontext
from io import StringIO
from string import Template
import numpy as np
import pytest
from astropy import table
from astropy import units as u
from astropy.io import ascii
from astro... | 1,005 | 31,785 |
astropy | astropy/io/ascii/tests/test_connect.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy.table import Column, Table
from astropy.table.table_helpers import simple_table
from astropy.utils.compat.optional_deps import HAS_BS4
from astropy.utils.data import get_pkg_data_filename
files = [
"data/... | 147 | 3,802 |
astropy | astropy/io/ascii/tests/test_mesa.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for MESA stellar evolution code file format reader/writer.
Test Data Files
---------------
Test data files are located in astropy/io/ascii/tests/data/:
- history_mesa.data : MESA history file with 25 models and 3 columns
(truncated from a rea... | 242 | 10,094 |
astropy | astropy/io/ascii/tests/test_ipac_definitions.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import re
from io import StringIO
import pytest
from astropy.io import ascii
from astropy.io.ascii.core import masked
from astropy.io.ascii.ipac import IpacFormatError, IpacFormatErrorDBMS
from astropy.io.ascii.ui import read
from astropy.table import C... | 170 | 4,596 |
astropy | astropy/io/ascii/tests/test_ecsv.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module tests some of the methods related to the ``ECSV``
reader/writer.
"""
import copy
import io
import os
import sys
from contextlib import nullcontext
from io import StringIO
from pprint import pformat
import numpy as np
import pytest
import... | 1,397 | 42,628 |
astropy | astropy/io/ascii/tests/test_fixedwidth.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from io import StringIO
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy.io import ascii
from astropy.io.ascii.core import InconsistentTableError
from .common import assert_equal_splitlines
def test_read_normal... | 629 | 17,702 |
astropy | astropy/io/ascii/tests/test_qdp.py | .py | import numpy as np
import pytest
from astropy.io import ascii
from astropy.io.ascii.qdp import _get_lines_from_file, _read_table_qdp, _write_table_qdp
from astropy.table import Column, MaskedColumn, Table
from astropy.utils.exceptions import AstropyUserWarning
def test_get_tables_from_qdp_file(tmp_path):
example... | 264 | 9,484 |
astropy | astropy/io/ascii/tests/common.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
from pathlib import Path
__all__ = [
"setup_function",
"teardown_function",
]
CWD = Path.cwd()
TEST_DIR = Path(__file__).parent
def setup_function(function):
os.chdir(TEST_DIR)
def teardown_function(function):
os.chdir(CWD)... | 26 | 443 |
astropy | astropy/io/ascii/tests/test_cds.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module tests some methods related to ``CDS`` format
reader/writer.
Requires `pyyaml <https://pyyaml.org/>`_ to be installed.
"""
from io import StringIO
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy im... | 559 | 28,006 |
astropy | astropy/io/ascii/tests/test_cds_header_from_readme.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
from astropy import units as u
from astropy.io import ascii
from astropy.table import Table
from .common import (
setup_function, # noqa: F401
teardown_function, # noqa... | 282 | 9,008 |
astropy | astropy/io/ascii/tests/test_types.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from io import StringIO
import numpy as np
import pytest
from astropy.io import ascii
def test_types_from_dat():
converters = {"a": [ascii.convert_numpy(float)], "e": [ascii.convert_numpy(str)]}
dat = ascii.read(
["a b c d e", "1 1 c... | 126 | 3,580 |
astropy | astropy/io/ascii/tests/test_html.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module tests some of the methods related to the ``HTML``
reader/writer and aims to document its functionality.
Requires `BeautifulSoup <http://www.crummy.com/software/BeautifulSoup/>`_
to be installed.
"""
import os
from io import StringIO
from... | 840 | 23,882 |
astropy | astropy/io/ascii/tests/test_rst.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from io import StringIO
import numpy as np
from numpy.testing import assert_allclose
import astropy.units as u
from astropy.io import ascii
from astropy.table import QTable
from .common import assert_equal_splitlines
def test_read_normal():
"""No... | 213 | 5,643 |
astropy | astropy/io/ascii/tests/test_read.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import locale
import pathlib
import platform
import re
from io import BytesIO, StringIO
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy import table
from astropy.io import ascii
from astropy.io.ascii import core
fr... | 2,220 | 70,841 |
astropy | astropy/io/fits/header.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import collections
import copy
import itertools
import numbers
import os
import re
import warnings
import numpy as np
from astropy.utils.exceptions import AstropyUserWarning
from ._utils import parse_header
from .card import KEYWORD_LENGTH, UNDEFINED, C... | 2,278 | 79,989 |
astropy | astropy/io/fits/column.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import copy
import math
import numbers
import re
import sys
import warnings
import weakref
from collections import OrderedDict
from contextlib import suppress
from itertools import pairwise
from textwrap import indent
import numpy as np
from astropy.util... | 2,865 | 104,848 |
astropy | astropy/io/fits/diff.py | .py | # 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
impor... | 1,568 | 59,616 |
astropy | astropy/io/fits/util.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import gzip
import io
import mmap
import operator
import os
import signal
import sys
import tempfile
import textwrap
import threading
import warnings
import weakref
from contextlib import contextmanager, suppress
from functools import wraps
import numpy a... | 861 | 27,726 |
astropy | astropy/io/fits/__init__.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
"""
A package for reading and writing FITS files and manipulating their
contents.
A module for reading and writing Flexible Image Transport System
(FITS) files. This file format was endorsed by the International
Astronomical Union in 1999 and mandated by... | 105 | 3,397 |
astropy | astropy/io/fits/connect.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import re
import warnings
from copy import deepcopy
from itertools import pairwise
import numpy as np
from astropy import units as u
from astropy.io import registry as io_registry
from astropy.table import Column, MaskedColumn, Table, meta, s... | 528 | 19,802 |
astropy | astropy/io/fits/verify.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import operator
import warnings
from textwrap import indent
from astropy.utils.exceptions import AstropyUserWarning
class VerifyError(Exception):
"""
Verify exception class.
"""
class VerifyWarning(AstropyUserWarning):
"""
Verify w... | 178 | 5,506 |
astropy | astropy/io/fits/fitsrec.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import copy
import math
import warnings
import weakref
from contextlib import suppress
import numpy as np
from astropy.utils import lazyproperty
from astropy.utils.compat import chararray, get_chararray
from astropy.utils.exceptions import AstropyUserWar... | 1,589 | 65,612 |
astropy | astropy/io/fits/file.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import errno
import gzip
import http.client
import io
import math
import mmap
import os
import re
import sys
import tempfile
import warnings
import zipfile
import numpy as np
# NOTE: Python can be built without bz2.
from astropy.utils.compat.optional_dep... | 790 | 29,016 |
astropy | astropy/io/fits/card.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import re
import warnings
import numpy as np
from astropy.utils.exceptions import AstropyUserWarning
from . import conf
from .util import _is_int, _str_to_num, _words_group, translate
from .verify import VerifyError, VerifyWarning, _ErrList, _Verify
__... | 1,333 | 50,087 |
astropy | astropy/io/fits/convenience.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
"""Convenience functions for working with FITS files.
Convenience functions
=====================
The functions in this module provide shortcuts for some of the most basic
operations on FITS files, such as reading and updating the header. They are
inclu... | 1,188 | 42,687 |
astropy | astropy/io/fits/fitstime.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import re
import warnings
from collections import OrderedDict, defaultdict
import numpy as np
from astropy import units as u
from astropy.coordinates import EarthLocation
from astropy.table import Column, MaskedColumn
from astropy.table.column import co... | 664 | 24,593 |
astropy | astropy/io/fits/_logical_helpers.py | .py | """Helpers for handling FITS logical (``'L'``) variable-length array data."""
import warnings
import numpy as np
from astropy.utils.exceptions import AstropyDeprecationWarning
_VALID_LOGICAL_BYTES = (ord("T"), ord("F"), 0)
def _validate_logical_input(row):
"""Validate user input for a FITS logical column.
... | 154 | 5,813 |
astropy | astropy/io/fits/hdu/table.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import csv
import math
import operator
import os
import re
import textwrap
import warnings
from contextlib import suppress
import numpy as np
# This module may have many dependencies on astropy.io.fits.column, but
# astropy.io.fits.column has fewer depe... | 1,568 | 60,945 |
astropy | astropy/io/fits/hdu/hdulist.py | .py | # 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
from textwrap import indent
import numpy as np
from astropy.io.fits.file import FILE_MODES, _File
from astropy.io.fits.header import _pad_length
from astropy.io.fit... | 1,631 | 60,364 |
astropy | astropy/io/fits/hdu/__init__.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
from .base import BITPIX2DTYPE, DELAYED, DTYPE2BITPIX, register_hdu, unregister_hdu
from .compressed import CompImageHDU
from .groups import Group, GroupData, GroupsHDU
from .hdulist import HDUList
from .image import ImageHDU, PrimaryHDU
from .nonstandard ... | 30 | 710 |
astropy | astropy/io/fits/hdu/image.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import mmap
import sys
import warnings
import numpy as np
from astropy.io.fits.header import Header
from astropy.io.fits.util import (
_is_dask_array,
_is_int,
_is_pseudo_integer,
_pseudo_zero,
)
from astropy.io.fits.verify import VerifyW... | 1,301 | 49,068 |
astropy | astropy/io/fits/hdu/groups.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import math
import sys
import numpy as np
from astropy.io.fits.column import FITS2NUMPY, ColDefs, Column
from astropy.io.fits.fitsrec import FITS_rec, FITS_record
from astropy.io.fits.util import _is_int, _is_pseudo_integer, _pseudo_zero
from astropy.uti... | 621 | 21,191 |
astropy | astropy/io/fits/hdu/nonstandard.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import gzip
import io
from astropy.io.fits.file import _File
from astropy.io.fits.header import Header, _pad_length
from astropy.io.fits.util import fileobj_name
from astropy.utils import lazyproperty
from .base import NonstandardExtHDU
from .hdulist imp... | 129 | 4,189 |
astropy | astropy/io/fits/hdu/streaming.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import gzip
import os
from astropy.io.fits.file import _File
from astropy.io.fits.header import _pad_length
from astropy.io.fits.util import fileobj_name
from .base import BITPIX2DTYPE, _BaseHDU
from .hdulist import HDUList
from .image import PrimaryHDU
... | 223 | 7,586 |
astropy | astropy/io/fits/hdu/base.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import datetime
import numbers
import os
import sys
import warnings
from contextlib import suppress
from inspect import Parameter, signature
import numpy as np
from astropy.io.fits import conf
from astropy.io.fits.file import _File
from astropy.io.fits.... | 1,616 | 58,787 |
astropy | astropy/io/fits/hdu/compressed/compbintable.py | .py | from astropy.io.fits.hdu.table import BinTableHDU
__all__ = ["_CompBinTableHDU"]
class _CompBinTableHDU(BinTableHDU):
_load_variable_length_data = False
"""
We don't want to always load all the tiles so by setting this option
we can then access the tiles as needed.
"""
_manages_own_heap = Tr... | 18 | 397 |
astropy | astropy/io/fits/hdu/compressed/header.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import re
import warnings
from astropy.io.fits.column import KEYWORD_NAMES as TABLE_KEYWORD_NAMES
from astropy.io.fits.column import TDEF_RE, ColDefs, Column
from astropy.io.fits.hdu.compressed.compbintable import _CompBinTableHDU
from astropy.io.fits.he... | 705 | 24,041 |
astropy | astropy/io/fits/hdu/compressed/section.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from astropy.io.fits.hdu.base import BITPIX2DTYPE
from astropy.io.fits.hdu.compressed._tiled_compression import (
decompress_image_data_section,
)
from astropy.io.fits.hdu.compressed.utils import _n_tiles
from astropy.utils.shapes ... | 132 | 4,598 |
astropy | astropy/io/fits/hdu/compressed/utils.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
from math import ceil
import numpy as np
from astropy.utils.exceptions import AstropyUserWarning
__all__ = ["_validate_tile_shape"]
def _validate_tile_shape(*, tile_shape, compression_type, image_header):
naxis = image_header["NAX... | 156 | 5,465 |
astropy | astropy/io/fits/hdu/compressed/_quantization.py | .py | """
This file contains the code for Quantizing / Dequantizing floats.
"""
import numpy as np
from astropy.io.fits.hdu.base import BITPIX2DTYPE
from astropy.io.fits.hdu.compressed._compression import (
quantize_double_c,
quantize_float_c,
unquantize_double_c,
unquantize_float_c,
)
__all__ = ["Quantize... | 143 | 3,988 |
astropy | astropy/io/fits/hdu/compressed/_codecs.py | .py | """
This module contains the FITS compression algorithms in numcodecs style Codecs.
"""
from gzip import compress as gzip_compress
from gzip import decompress as gzip_decompress
import numpy as np
from astropy.io.fits.hdu.compressed._compression import (
compress_hcompress_1_c,
compress_plio_1_c,
compres... | 454 | 13,838 |
astropy | astropy/io/fits/hdu/compressed/setup_package.py | .py | # Licensed under a 3-clause BSD style license
import os
from setuptools import Extension
SRC_DIR = os.path.relpath(os.path.join(os.path.dirname(__file__), "src"))
def get_extensions():
return [
Extension(
"astropy.io.fits.hdu.compressed._compression",
sources=[
o... | 26 | 860 |
astropy | astropy/io/fits/hdu/compressed/_tiled_compression.py | .py | """
This module contains low level helper functions for compressing and
decompressing buffer for the Tiled Table Compression algorithms as specified in
the FITS 4 standard.
"""
import sys
import warnings
from math import prod
import numpy as np
from astropy.io.fits.hdu.base import BITPIX2DTYPE
from astropy.utils.exc... | 742 | 27,247 |
astropy | astropy/io/fits/hdu/compressed/compressed.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import ctypes
import math
import time
import warnings
import numpy as np
from astropy.io.fits.fitsrec import FITS_rec
from astropy.io.fits.hdu.base import BITPIX2DTYPE, DELAYED
from astropy.io.fits.hdu.compressed._quantization import DITHER_METHODS
from... | 744 | 33,091 |
astropy | astropy/io/fits/hdu/compressed/settings.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# Quantization dithering method constants; these are right out of fitsio.h
NO_DITHER = -1
SUBTRACTIVE_DITHER_1 = 1
SUBTRACTIVE_DITHER_2 = 2
QUANTIZE_METHOD_NAMES = {
NO_DITHER: "NO_DITHER",
SUBTRACTIVE_DITHER_1: "SUBTRACTIVE_DITHER_1",
SUBTRAC... | 46 | 993 |
astropy | astropy/io/fits/hdu/compressed/tests/test_checksum.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import numpy as np
from astropy.io import fits
from astropy.io.fits.tests.test_checksum import BaseChecksumTests
class TestChecksumFunctions(BaseChecksumTests):
# All checksums have been verified against CFITSIO
def test_compressed_image_data(s... | 148 | 6,795 |
astropy | astropy/io/fits/hdu/compressed/tests/test_compressed.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import io
import math
import os
import pickle
import re
import time
import warnings
from io import BytesIO
import numpy as np
import pytest
from hypothesis import given
from hypothesis.extra.numpy import basic_indices
from numpy.testing import assert_allc... | 1,636 | 59,455 |
astropy | astropy/io/fits/hdu/compressed/tests/test_fitsio.py | .py | """
This test file uses the https://github.com/esheldon/fitsio package to verify
our compression and decompression routines against the implementation in
cfitsio.
*Note*: The fitsio library is GPL licensed, therefore it could be interpreted
that so is this test file. Given that this test file isn't imported anywhere
... | 485 | 17,269 |
astropy | astropy/io/fits/hdu/compressed/tests/test_tiled_compression.py | .py | import hashlib
from pathlib import Path
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
from astropy.io import fits
from astropy.io.fits.hdu.compressed._codecs import PLIO1
from astropy.io.fits.hdu.compressed._compression import CfitsioException
from astropy.utils.exceptions i... | 288 | 10,552 |
astropy | astropy/io/fits/hdu/compressed/tests/test_compression_failures.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.hdu.compressed._tiled_compression import compress_image_data
from astropy.io.fits.tests.conftest import FitsTestCase
MAX_INT = np.iinfo(np.intc).max
MAX_LONG = np.iinfo(int... | 262 | 11,086 |
astropy | astropy/io/fits/hdu/compressed/tests/conftest.py | .py | import itertools
import numpy as np
import pytest
COMPRESSION_TYPES = [
"GZIP_1",
"GZIP_2",
"RICE_1",
"HCOMPRESS_1",
"PLIO_1",
"NOCOMPRESS",
]
def fitsio_param_to_astropy_param(param):
# Convert fitsio kwargs to astropy kwargs
_map = {"qlevel": "quantize_level", "qmethod": "quantize_... | 115 | 2,911 |
astropy | astropy/io/fits/tests/test_fsspec.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Can `astropy.io.fits.open` access (remote) data using the fsspec package?"""
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from astropy.io import fits
from astropy.nddata import Cutout2D
from astropy.ta... | 147 | 6,493 |
astropy | astropy/io/fits/tests/test_core.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import errno
import gzip
import http.client
import io
import mmap
import os
import pathlib
import shutil
import sys
import urllib.request
import zipfile
from unittest.mock import Mock, patch
import numpy as np
import pytest
from astropy.io import fits
fr... | 1,699 | 62,188 |
astropy | astropy/io/fits/tests/test_convenience.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import io
import os
import pathlib
import warnings
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from astropy import units as u
from astropy.io import fits
from astropy.io.fits import printdiff
from astropy.io.fits.connect... | 535 | 19,425 |
astropy | astropy/io/fits/tests/test_fitsheader.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy import __version__ as version
from astropy.io import fits
from astropy.io.fits.scripts import fitsheader
from .conftest import FitsTestCase
class TestFITSheader_script(FitsTestCase):
def test_help(self):
with pyt... | 248 | 8,807 |
astropy | astropy/io/fits/tests/test_checksum.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import warnings
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.hdu.base import _ValidHDU
from .conftest import FitsTestCase
from .test_table import comparerecords
class BaseChecksumTests(FitsTestCase):
def setup_... | 529 | 23,763 |
astropy | astropy/io/fits/tests/test_header.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import collections
import copy
import warnings
from io import BytesIO, StringIO
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.card import _pad
from astropy.io.fits.header import _pad_length
from astropy.io.fits.scripts... | 3,308 | 123,443 |
astropy | astropy/io/fits/tests/test_fitsinfo.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy import __version__ as version
from astropy.io import fits
from astropy.io.fits.scripts import fitsinfo
from .conftest import FitsTestCase
class TestFitsinfo(FitsTestCase):
def test_help(self):
with pytest.raises(... | 64 | 2,247 |
astropy | astropy/io/fits/tests/test_tilde_path.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import os
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.scripts import fitsheader
from astropy.utils.misc import _NOT_OVERWRITING_MSG_MATCH
from .conftest import FitsTestCase
class TestTildePaths(FitsTestCase):
... | 175 | 6,151 |
astropy | astropy/io/fits/tests/test_connect.py | .py | import contextlib
import gc
import warnings
from io import BytesIO
from pathlib import Path
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
from astropy import units as u
from astropy.io import fits
from astropy.io.fits import (
BinTableHDU,
HDUList,
ImageHDU... | 1,213 | 44,093 |
astropy | astropy/io/fits/tests/test_uint.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import platform
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from astropy.io import fits
from .conftest import FitsTestCase
class TestUintFunctions(FitsTestCase):
@classmethod
def setup_class(cls):
cls.... | 149 | 6,058 |
astropy | astropy/io/fits/tests/test_util.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import gzip
import os
import signal
import sys
import threading
import numpy as np
import pytest
from numpy.testing import assert_equal
from astropy.io.fits import util
from astropy.io.fits.util import _rstrip_inplace, ignore_sigint
from astropy.utils.c... | 202 | 7,079 |
astropy | astropy/io/fits/tests/test_structured.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import sys
import numpy as np
from astropy.io import fits
from .conftest import FitsTestCase
def compare_arrays(arr1in, arr2in, verbose=False):
"""
Compare the values field-by-field in two sets of numpy arrays or
recarrays.
"""
ar... | 104 | 3,116 |
astropy | astropy/io/fits/tests/test_hdulist.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import copy
import io
import os
import subprocess
import sys
from contextlib import nullcontext
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.hdu.base import _NonstandardHDU, _ValidHDU
from astropy.io.fits.verify impor... | 1,282 | 46,932 |
astropy | astropy/io/fits/tests/test_fitsdiff.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import numpy as np
import pytest
from astropy import __version__ as version
from astropy.io import fits
from astropy.io.fits import FITSDiff, HDUList, Header, ImageHDU
from astropy.io.fits.convenience import writeto
from astropy.io.fits.hdu im... | 392 | 13,027 |
astropy | astropy/io/fits/tests/test_fitscheck.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import re
import numpy as np
import pytest
from astropy import __version__ as version
from astropy.io import fits
from astropy.io.fits.scripts import fitscheck
from astropy.utils.exceptions import AstropyUserWarning
from .conftest import FitsTestCase
... | 131 | 4,442 |
astropy | astropy/io/fits/tests/test_image_dask.py | .py | # Tests related to writing dask arrays to FITS files in an efficient way
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits import ImageHDU, PrimaryHDU
da = pytest.importorskip("dask.array")
@pytest.fixture
def dask_array_in_mem():
return da.random.uniform(-1000, 1000, (1322, 755... | 172 | 5,708 |
astropy | astropy/io/fits/tests/test_image.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import math
import os
import time
import numpy as np
import pytest
from numpy.testing import assert_equal
from astropy.io import fits
from astropy.utils.compat import NUMPY_LT_2_5
from astropy.utils.data import get_pkg_data_filename
from astropy.utils.ex... | 1,215 | 46,962 |
astropy | astropy/io/fits/tests/test_diff.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy.io import fits
from astropy.io.fits.column import Column
from astropy.io.fits.diff import (
FITSDiff,
HDUDiff,
HeaderDiff,
ImageDataDiff,
TableDataDiff,
)
from astropy.io.fits.hdu import HD... | 955 | 36,036 |
astropy | astropy/io/fits/tests/test_table.py | .py | # 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 numpy as np
import pytest
try:
import objgraph
HAVE_OBJGRAPH = True
except ImportError:
HAVE_OBJGRAPH = False
from astropy.io import fits
from... | 4,532 | 177,615 |
astropy | astropy/io/fits/tests/test_division.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import numpy as np
from astropy.io import fits
from .conftest import FitsTestCase
class TestDivisionFunctions(FitsTestCase):
"""Test code units that rely on correct integer division."""
def test_rec_from_string(self):
with fits.open(se... | 40 | 1,115 |
astropy | astropy/io/fits/tests/test_groups.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import time
import numpy as np
import pytest
from astropy.io import fits
from astropy.utils.misc import _NOT_OVERWRITING_MSG_MATCH
from .conftest import FitsTestCase
from .test_table import comparerecords
class TestGroupsFunctions(FitsTestC... | 253 | 9,057 |
astropy | astropy/io/fits/tests/test_logical_helpers.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.io.fits._logical_helpers import (
_detect_legacy_logical_vla_heap,
_logical_to_fits_bytes,
_logical_vla_heap_has_null,
_validate_logical_input,
)
f... | 143 | 5,121 |
astropy | astropy/io/fits/tests/test_nonstandard.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import numpy as np
from astropy.io import fits
from .conftest import FitsTestCase
class TestNonstandardHdus(FitsTestCase):
def test_create_fitshdu(self):
"""
A round trip test of creating a FitsHDU, adding a FITS file to it,
... | 70 | 2,325 |
astropy | astropy/io/fits/tests/test_fitstime.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy.coordinates import EarthLocation
from astropy.io import fits
from astropy.io.fits.fitstime import (
GLOBAL_TIME_INFO,
is_time_column_keyword,
time_to_fits,
)
from astropy.table import Column, QTab... | 584 | 22,079 |
astropy | astropy/io/fits/tests/conftest.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import os
import pathlib
import shutil
import stat
import tempfile
import time
import pytest
from astropy.io import fits
@pytest.fixture(
params=[False, "str", "pathlib"], ids=["", "home_is_data", "home_is_data, pathlib"]
)
def home_is_data(request... | 167 | 6,139 |
astropy | astropy/io/fits/scripts/fitsdiff.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import argparse
import glob
import logging
import os
import sys
from astropy import __version__
from astropy.io import fits
from astropy.io.fits.util import fill
log = logging.getLogger("fitsdiff")
DESCRIPTION = """
Compare two FITS image files and rep... | 439 | 14,061 |
astropy | astropy/io/fits/scripts/__init__.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage contains implementations of command-line scripts that are
included with Astropy.
The actual scripts that are installed in bin/ are simple wrappers for these
modules that will run in any Python version.
"""
| 9 | 291 |
astropy | astropy/io/fits/scripts/fitsheader.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
``fitsheader`` is a command line script based on astropy.io.fits for printing
the header(s) of one or more FITS file(s) to the standard output in a human-
readable format.
Example uses of fitsheader:
1. Print the header of all the HDUs of a .fits fil... | 515 | 17,178 |
astropy | astropy/io/fits/scripts/fitsinfo.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
``fitsinfo`` is a command-line script based on astropy.io.fits for
printing a summary of the HDUs in one or more FITS files(s) to the
standard output.
Example usage of ``fitsinfo``:
1. Print a summary of the HDUs in a FITS file::
$ fitsinfo file... | 77 | 2,142 |
astropy | astropy/io/fits/scripts/fitscheck.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
``fitscheck`` is a command line script based on astropy.io.fits for verifying
and updating the CHECKSUM and DATASUM keywords of .fits files. ``fitscheck``
can also detect and often fix other FITS standards violations. ``fitscheck``
facilitates re-wri... | 273 | 8,285 |
astropy | astropy/io/tests/safeio.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
class CatchZeroByteWriter(io.BufferedWriter):
"""File handle to intercept 0-byte writes."""
def write(self, buffer):
nbytes = super().write(buffer)
if nbytes == 0:
raise ValueError("This writer does not all... | 14 | 360 |
astropy | astropy/io/tests/mixin_columns.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Mixin columns for use in ascii/tests/test_ecsv.py, fits/tests/test_connect.py,
and misc/tests/test_hdf5.py.
All columns should have length 2.
"""
import numpy as np
from astropy import coordinates, table, time
from astropy import units as u
el = co... | 275 | 7,633 |
astropy | astropy/io/misc/pickle_helpers.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains simple input/output related functionality that is not
part of a larger framework or standard.
"""
import pickle
from astropy.utils.decorators import deprecated
__all__ = ["fnpickle", "fnunpickle"]
@deprecated(since="6.0", mess... | 109 | 3,316 |
astropy | astropy/io/misc/parquet.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains functions for reading and writing Parquet
tables that are not meant to be used directly, but instead are
available as readers/writers in `astropy.table`. See
:ref:`astropy:table_io` for more details.
"""
import os
import warning... | 701 | 26,780 |
astropy | astropy/io/misc/__init__.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains miscellaneous utility functions for data
input/output with astropy.
"""
from .pickle_helpers import *
| 8 | 193 |
astropy | astropy/io/misc/hdf5.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains functions for reading and writing HDF5 tables that are
not meant to be used directly, but instead are available as readers/writers in
`astropy.table`. See :ref:`astropy:table_io` for more details.
"""
import os
import warnings
fr... | 402 | 14,705 |
astropy | astropy/io/misc/ecsv.py | .py | """
ECSV Engine Module
--------------------------
This module provides functionality for reading and writing Enhanced Character Separated
Values (ECSV) files using various backends, including:
- `PyArrow <https://arrow.apache.org/docs/python/>`_
- `pandas <https://pandas.pydata.org/>`_
- `Astropy's ASCII engine <https:... | 1,284 | 46,673 |
astropy | astropy/io/misc/connect.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file connects any readers/writers defined in io.misc to the
# astropy.table.Table class
from astropy.io.misc.ecsv import register_ecsv_table
from astropy.io.misc.pyarrow.csv import register_pyarrow_csv_table
from . import hdf5, parquet
hdf5.regis... | 15 | 444 |
astropy | astropy/io/misc/yaml.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Functions for serializing astropy objects to YAML.
It provides functions `~astropy.io.misc.yaml.dump`,
`~astropy.io.misc.yaml.load`, and `~astropy.io.misc.yaml.load_all` which
call the corresponding functions in `PyYaml <https://pyyaml.org>`_ but use ... | 408 | 13,263 |
astropy | astropy/io/misc/pyarrow/csv.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides functionality to read CSV files into Astropy Tables using PyArrow.
"""
import datetime
import io
import os
from typing import TYPE_CHECKING, BinaryIO, Literal, Union
import numpy as np
from numpy.typing import DTypeLike, NDArray
... | 543 | 20,259 |
astropy | astropy/io/misc/pyarrow/tests/test_csv.py | .py | import contextlib
import datetime
import decimal
import io
import sys
import textwrap
from pathlib import Path
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from astropy.io.misc.pyarrow.csv import strip_comment_lines
from astropy.table import Table
from astropy.utils.compat.optional_de... | 769 | 22,937 |
astropy | astropy/io/misc/tests/test_hdf5.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import numpy as np
import pytest
from astropy.io.misc.hdf5 import meta_path
from astropy.table import Column, QTable, Table
from astropy.table.table_helpers import simple_table
from astropy.units import allclose as quantity_allclose
from astro... | 890 | 29,059 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.