Skip to content

Commit 705ccb4

Browse files
committed
Remove MEF example and improve the MEF section in docs
1 parent 83f6f00 commit 705ccb4

2 files changed

Lines changed: 9 additions & 72 deletions

File tree

‎docs/io/fits/index.rst‎

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -660,11 +660,11 @@ file consisting of only the primary HDU with image data.
660660
First, we create a ``numpy`` object for the data part::
661661

662662
>>> import numpy as np
663-
>>> n = np.arange(100.0) # a simple sequence of floats from 0.0 to 99.9
663+
>>> data = np.arange(100.0) # a simple sequence of floats from 0.0 to 99.9
664664

665665
Next, we create a :class:`PrimaryHDU` object to encapsulate the data::
666666

667-
>>> hdu = fits.PrimaryHDU(n)
667+
>>> hdu = fits.PrimaryHDU(data=data)
668668

669669
We then create an :class:`HDUList` to contain the newly created primary HDU, and write to
670670
a new file::
@@ -760,27 +760,20 @@ additional data or header keywords in the primary HDU you may still create a
760760
:class:`PrimaryHDU` object and build up the FITS file manually using an
761761
:class:`HDUList`, as described in the next section.
762762

763-
Creating a File with Multiple Extensions
764-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
763+
Creating a Multi-Extension FITS (MEF) file
764+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
765765

766766
In the previous examples we created files with a single meaningful extension (a
767767
:class:`PrimaryHDU` or :class:`BinTableHDU`). To create a file with multiple
768768
extensions we need to create extension HDUs and append them to an :class:`HDUList`.
769769

770-
First, we create some data for Image extensions::
770+
First, we create some data for Image extensions and we place the data into
771+
separate :class:`PrimaryHDU` and :class:`ImageHDU` objects::
771772

772773
>>> import numpy as np
773-
>>> n = np.ones((3, 3))
774-
>>> n2 = np.ones((100, 100))
775-
>>> n3 = np.ones((10, 10, 10))
776-
777-
Note that the data shapes of the different extensions do not need to be the same.
778-
Next, place the data into separate :class:`PrimaryHDU` and :class:`ImageHDU`
779-
objects::
780-
781-
>>> primary_hdu = fits.PrimaryHDU(n)
782-
>>> image_hdu = fits.ImageHDU(n2)
783-
>>> image_hdu2 = fits.ImageHDU(n3)
774+
>>> primary_hdu = fits.PrimaryHDU(data=np.ones((3, 3)))
775+
>>> image_hdu = fits.ImageHDU(data=np.ones((100, 100)), name="MYIMAGE")
776+
>>> image_hdu2 = fits.ImageHDU(data=np.ones((10, 10, 10)), name="MYCUBE")
784777

785778
A multi-extension FITS file is not constrained to be only imaging or table data, we
786779
can mix them. To show this we'll use the example from the previous section to make a
@@ -832,10 +825,6 @@ We then create an HDUList containing both the primary HDU and any other HDUs wan
832825

833826
>>> hdul = fits.HDUList([empty_primary, image_hdu2, table_hdu])
834827

835-
.. topic:: Examples:
836-
837-
See also :ref:`sphx_glr_generated_examples_io_create-mef.py`.
838-
839828
Convenience Functions
840829
---------------------
841830

‎examples/io/create-mef.py‎

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)