File: unified_image.rst

package info (click to toggle)
astropy 7.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 33,816 kB
  • sloc: python: 237,392; ansic: 55,195; lex: 8,621; sh: 3,317; xml: 2,399; makefile: 191
file content (36 lines) | stat: -rw-r--r-- 1,189 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
.. _io_unified_image:

Image Data
==========

Reading and writing CCD image data in the unified I/O interface is supported
though the :ref:`CCDData class <ccddata>` using FITS file format:

.. doctest-skip::

    >>> # Read CCD image
    >>> from astropy.nddata import CCDData
    >>> ccd = CCDData.read('image.fits')

.. doctest-skip::

    >>> # Write back CCD image
    >>> ccd.write('new_image.fits')

Note that the unit is stored in the ``BUNIT`` keyword in the header on saving,
and is read from the header if it is present.

Detailed help on the available keyword arguments for reading and writing
can be obtained via the ``help()`` method as follows::

    >>> from astropy.nddata import CCDData
    >>> CCDData.read.help('fits')  # Get help on the CCDData FITS reader # doctest: +ELLIPSIS
    =========================================
    CCDData.read(format='fits') documentation
    =========================================
    ...
    >>> CCDData.write.help('fits')  # Get help on the CCDData FITS writer  # doctest: +ELLIPSIS
    ==========================================
    CCDData.write(format='fits') documentation
    ==========================================
    ...