37
- The ``Header`` object has been significantly reworked, and ``CardList``
38
objects are now deprecated (their functionality folded into the ``Header``
39
class). See API Changes below for more details.
41
- Memory maps are now used by default to access HDU data. See API Changes
42
below for more details.
44
- Now includes a new version of the ``fitsdiff`` program for comparing two
45
FITS files, and a new FITS comparison API used by ``fitsdiff``. See New
51
- The ``Header`` class has been rewritten, and the ``CardList`` class is
52
deprecated. Most of the basic details of working with FITS headers are
53
unchanged, and will not be noticed by most users. But there are differences
54
in some areas that will be of interest to advanced users, and to application
55
developers. For full details of the changes, see the "Header Interface
56
Transition Guide" section in the PyFITS documentation. See ticket #64 on
57
the PyFITS Trac for futher details and background. Some highlights are
60
* The Header class now fully implements the Python dict interface, and can
61
be used interchangably with a dict, where the keys are header keywords.
63
* New keywords can be added to the header using normal keyword assignment
64
(previously it was necessary to use ``Header.update`` to add new
65
keywords). For example::
67
>>> header['NAXIS'] = 2
69
will update the existing 'FOO' keyword if it already exists, or add a new
70
one if it doesn't exist, just like a dict.
72
* It is possible to assign both a value and a comment at the same time using
75
>>> header['NAXIS'] = (2, 'Number of axes')
77
* To add/update a new card and ensure it's added in a specific location, use
80
>>> header.set('NAXIS', 2, 'Number of axes', after='BITPIX')
82
This works the same as the old ``Header.update()``. ``Header.update()``
83
still works in the old way too, but is deprecated.
85
* Although ``Card`` objects still exist, it generally is not necessary to
86
work with them directly. ``Header.ascardlist()``/``Header.ascard`` are
87
deprecated and should not be used. To directly access the ``Card``
88
objects in a header, use ``Header.cards``.
90
* To access card comments, it is still possible to either go through the
91
card itself, or through ``Header.comments``. For example::
93
>>> header.cards['NAXIS'].comment
95
>>> header.comments['NAXIS']
98
* ``Card`` objects can now be used interchangeably with
99
``(keyword, value, comment)`` 3-tuples. They still have ``.value`` and
100
``.comment`` attributes as well. The ``.key`` attribute has been renamed
101
to ``.keyword`` for consistency, though ``.key`` is still supported (but
104
- Memory mapping is now used by default to access HDU data. That is,
105
``pyfits.open()`` uses ``memmap=True`` as the default. This provides better
106
performance in the majority of use cases--there are only some I/O intensive
107
applications where it might not be desirable. Enabling mmap by default also
108
enabled finding and fixing a large number of bugs in PyFITS' handling of
109
memory-mapped data (most of these bug fixes were backported to PyFITS
112
* A new ``pyfits.USE_MEMMAP`` global variable was added. Set
113
``pyfits.USE_MEMMAP = False`` to change the default memmap setting for
114
opening files. This is especially useful for controlling the behavior in
115
applications where pyfits is deeply embedded.
117
* Likewise, a new ``PYFITS_USE_MEMMAP`` environment variable is supported.
118
Set ``PYFITS_USE_MEMMAP = 0`` in your environment to change the default
121
- The ``size()`` method on HDU objects is now a ``.size`` property--this
122
returns the size in bytes of the data portion of the HDU, and in most cases
123
is equivalent to ``hdu.data.nbytes`` (#83)
125
- ``BinTableHDU.tdump`` and ``BinTableHDU.tcreate`` are deprecated--use
126
``BinTableHDU.dump`` and ``BinTableHDU.load`` instead. The new methods
127
output the table data in a slightly different format from previous versions,
128
which places quotes around each value. This format is compatible with data
129
dumps from previous versions of PyFITS, but not vice-versa due to a parsing
130
bug in older versions.
132
- Likewise the ``pyfits.tdump`` and ``pyfits.tcreate`` convenience function
133
versions of these methods have been renamed ``pyfits.tabledump`` and
134
``pyfits.tableload``. The old deprecated, but currently retained for
135
backwards compatibility. (r1125)
137
- A new global variable ``pyfits.EXTENSION_NAME_CASE_SENSITIVE`` was added.
138
This serves as a replacement for ``pyfits.setExtensionNameCaseSensitive``
139
which is not deprecated and may be removed in a future version. To enable
140
case-sensitivity of extension names (i.e. treat 'sci' as distict from 'SCI')
141
set ``pyfits.EXTENSION_NAME_CASE_SENSITIVE = True``. The default is
144
- A new global configuration variable ``pyfits.STRIP_HEADER_WHITESPACE`` was
145
added. By default, if a string value in a header contains trailing
146
whitespace, that whitespace is automatically removed when the value is read.
147
Now if you set ``pyfits.STRIP_HEADER_WHITESPACE = False`` all whitespace is
150
- The old ``classExtensions`` extension mechanism (which was deprecated in
151
PyFITS 3.0) is removed outright. To our knowledge it was no longer used
154
- Warning messages from PyFITS issued through the Python warnings API are now
155
output to stderr instead of stdout, as is the default. PyFITS no longer
156
modifies the default behavior of the warnings module with respect to which
157
stream it outputs to. (r1319)
159
- The ``checksum`` argument to ``pyfits.open()`` now accepts a value of
160
'remove', which causes any existing CHECKSUM/DATASUM keywords to be ignored,
161
and removed when the file is saved.
166
- Added support for the proposed "FITS" extension HDU type. See
167
http://listmgr.cv.nrao.edu/pipermail/fitsbits/2002-April/001094.html. FITS
168
HDUs contain an entire FITS file embedded in their data section. `FitsHDU`
169
objects work like other HDU types in PyFITS. Their ``.data`` attribute
170
returns the raw data array. However, they have a special ``.hdulist``
171
attribute which processes the data as a FITS file and returns it as an
172
in-memory HDUList object. FitsHDU objects also support a
173
``FitsHDU.fromhdulist()`` classmethod which returns a new `FitsHDU` object
174
that embeds the supplied HDUList. (#80)
176
- Added a new ``.is_image`` attribute on HDU objects, which is True if the HDU
177
data is an 'image' as opposed to a table or something else. Here the
178
meaning of 'image' is fairly loose, and mostly just means a Primary or Image
179
extension HDU, or possibly a compressed image HDU (#71)
181
- Added an ``HDUList.fromstring`` classmethod which can parse a FITS file
182
already in memory and instantiate and ``HDUList`` object from it. This
183
could be useful for integrating PyFITS with other libraries that work on
184
FITS file, such as CFITSIO. It may also be useful in streaming
185
applications. The name is a slight misnomer, in that it actually accepts
186
any Python object that implements the buffer interface, which includes
187
``bytes``, ``bytearray``, ``memoryview``, ``numpy.ndarray``, etc. (#90)
189
- Added a new ``pyfits.diff`` module which contains facilities for comparing
190
FITS files. One can use the ``pyfits.diff.FITSDiff`` class to compare two
191
FITS files in their entirety. There is also a ``pyfits.diff.HeaderDiff``
192
class for just comparing two FITS headers, and other similar interfaces.
193
See the PyFITS Documentation for more details on this interface. The
194
``pyfits.diff`` module powers the new ``fitsdiff`` program installed with
195
PyFITS. After installing PyFITS, run ``fitsdiff --help`` for usage details.
197
- ``pyfits.open()`` now accepts a ``scale_back`` argument. If set to
198
``True``, this automatically scales the data using the original BZERO and
199
BSCALE parameters the file had when it was first opened, if any, as well as
200
the original BITPIX. For example, if the original BITPIX were 16, this
201
would be equivalent to calling ``hdu.scale('int16', 'old')`` just before
202
calling ``flush()`` or ``close()`` on the file. This option applies to all
203
HDUs in the file. (#120)
205
- ``pyfits.open()`` now accepts a ``save_backup`` argument. If set to
206
``True``, this automatically saves a backup of the original file before
207
flushing any changes to it (this of course only applies to update and append
208
mode). This may be especially useful when working with scaled image data.
214
- Warnings from PyFITS are not output to stderr by default, instead of stdout
215
as it has been for some time. This is contrary to most users' expectations
216
and makes it more difficult for them to separate output from PyFITS from the
217
desired output for their scripts. (r1319)
222
- Fixed ``pyfits.tcreate()`` (now ``pyfits.tableload()``) to be more robust
223
when encountering blank lines in a column definition file (#14)
225
- Fixed a fairly rare crash that could occur in the handling of CONTINUE cards
226
when using Numpy 1.4 or lower (though 1.4 is the oldest version supported by
229
- Fixed ``_BaseHDU.fromstring`` to actually correctly instantiate an HDU
230
object from a string/buffer containing the header and data of that HDU.
231
This allowed for the implementation of ``HDUList.fromstring`` described
234
- Fixed a rare corner case where, in some use cases, (mildly, recoverably)
235
malformatted float values in headers were not properly returned as floats.
238
- Fixed a corollary to the previous bug where float values with a leading zero
239
before the decimal point had the leading zero unnecessarily removed when
240
saving changes to the file (eg. "0.001" would be written back as ".001" even
241
if no changes were otherwise made to the file). (#137)
243
- When opening a file containing CHECKSUM and/or DATASUM keywords in update
244
mode, the CHECKSUM/DATASUM are updated and preserved even if the file was
245
opened with checksum=False. This change in behavior prevents checksums from
246
being unintentionally removed. (#148)
248
- Fixed a bug where ``ImageHDU.scale(option='old')`` wasn't working at all--it
249
was not restoring the image to its original BSCALE and BZERO values. (#162)
251
- Fixed a bug when writing out files containing zero-width table columns,
252
where the TFIELDS keyword would be updated incorrectly, leaving the table
253
largely unreadable. This fix will be backported to the 3.0.x series in
254
version 3.0.10. (#174)
260
This is a bug fix release for the 3.0.x series.
265
- Fixed ``Header.values()``/``Header.itervalues()`` and ``Header.items()``/
266
``Header.iteritems()`` to correctly return the different values for
267
duplicate keywords (particularly commentary keywords like HISTORY and
268
COMMENT). This makes the old Header implementation slightly more compatible
269
with the new implementation in PyFITS 3.1. (#127)
272
This fix did not change the existing behavior from earlier PyFITS
273
versions where ``Header.keys()`` returns all keywords in the header with
274
duplicates removed. PyFITS 3.1 changes that behavior, so that
275
``Header.keys()`` includes duplicates.
277
- Fixed a bug where ``ImageHDU.scale(option='old')`` wasn't working at all--it
278
was not restoring the image to its original BSCALE and BZERO values. (#162)
280
- Fixed a bug where opening a file containing compressed image HDUs in
281
'update' mode and then immediately closing it without making any changes
282
caused the file to be rewritten unncessarily. (#167)
284
- Fixed two memory leaks that could occur when writing compressed image data,
285
or in some cases when opening files containing compressed image HDUs in
286
'update' mode. (#168)
31
289
3.0.8 (2012-06-04)
290
---------------------
34
292
Changes in Behavior
37
295
- Prior to this release, image data sections did not work with scaled
38
296
data--that is, images with non-trivial BSCALE and/or BZERO values.