|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
[fitsbits] Clarification of EXTEND, please
Without naming names, I just today hit a conflict between two pieces of
software. One created a FITS file with only a single HDU whose header contained the line 'EXTEND = F'. A second piece of software interpreted the presence of the EXTEND keyword in the primary HDU as meaning it should check for extensions, tried to fseek() beyond the end of the primary HDU and data array, and died. Who did what right and wrong in this scenario? I'll send bug reports with the correct answers to the software authors. -- Stephen Walton Dept. of Physics & Astronomy, Cal State Northridge |
#2
|
|||
|
|||
[fitsbits] Clarification of EXTEND, please
Stephen, the standard is pretty clear on this e.g. http://archive.stsci.edu/fits/fits_standard/node39.html Even if EXTEND = T, it only means that there *may* be further extensions, so doing something that will die if extensions are not present is always incorrect. You should be prepared to handle the possibility of EOF when checking for extensions; it's not that hard to do. EXTEND=F is in fact a guarantee that further extensions are NOT present and by my reading of the standard is a perfectly legal thing to do. - Jonathan McDowell |
#3
|
|||
|
|||
[fitsbits] Clarification of EXTEND, please
Stephen, the standard is pretty clear on this e.g. http://archive.stsci.edu/fits/fits_standard/node39.html Even if EXTEND = T, it only means that there *may* be further extensions, so doing something that will die if extensions are not present is always incorrect. You should be prepared to handle the possibility of EOF when checking for extensions; it's not that hard to do. EXTEND=F is in fact a guarantee that further extensions are NOT present and by my reading of the standard is a perfectly legal thing to do. - Jonathan McDowell |
#4
|
|||
|
|||
[fitsbits] Clarification of EXTEND, please
On Fri, 2004-05-14 at 10:31, Thierry Forveille wrote:
the presence of the EXTEND keyword in the primary HDU as meaning it should check for extensions, tried to fseek() beyond the end of the primary HDU and data array, and died. The second piece did wrong, twice :-) EXTEND indicates only that the file may contain an extension, not that it does, and then only when set to T. It looks like they took two unwarranted shortcuts... Time to name names. The offending piece of software is the fitsread.m which The Mathworks distributes with MATLAB. In addition to above problem, Mathworks's FITS software contains another bug, this one in fitsinfo.m: it seeks 2880 bytes past an HDU which is exactly n*2880 bytes in length before trying to read data, and thus skips the first 2880 bytes of actual data. I have a patch for the second problem which I'd be happy to share; I haven't tried to fix the first one yet, but it is probably a simple matter of checking for EXTEND = T rather than the mere existence of EXTEND. Thanks to all. -- Stephen Walton Dept. of Physics & Astronomy, Cal State Northridge |
#5
|
|||
|
|||
[fitsbits] Clarification of EXTEND, please
On Fri, 2004-05-14 at 10:31, Thierry Forveille wrote:
the presence of the EXTEND keyword in the primary HDU as meaning it should check for extensions, tried to fseek() beyond the end of the primary HDU and data array, and died. The second piece did wrong, twice :-) EXTEND indicates only that the file may contain an extension, not that it does, and then only when set to T. It looks like they took two unwarranted shortcuts... Time to name names. The offending piece of software is the fitsread.m which The Mathworks distributes with MATLAB. In addition to above problem, Mathworks's FITS software contains another bug, this one in fitsinfo.m: it seeks 2880 bytes past an HDU which is exactly n*2880 bytes in length before trying to read data, and thus skips the first 2880 bytes of actual data. I have a patch for the second problem which I'd be happy to share; I haven't tried to fix the first one yet, but it is probably a simple matter of checking for EXTEND = T rather than the mere existence of EXTEND. Thanks to all. -- Stephen Walton Dept. of Physics & Astronomy, Cal State Northridge |
#6
|
|||
|
|||
[fitsbits] Clarification of EXTEND, please
Stephen Walton writes:
Time to name names. The offending piece of software is the fitsread.m which The Mathworks distributes with MATLAB. In addition to above problem, Mathworks's FITS software contains another bug, this one in fitsinfo.m: it seeks 2880 bytes past an HDU which is exactly n*2880 bytes in length before trying to read data, and thus skips the first 2880 bytes of actual data. I have a patch for the second problem which I'd be happy to share; I haven't tried to fix the first one yet, but it is probably a simple matter of checking for EXTEND = T rather than the mere existence of EXTEND. That's a first step, but even if EXTEND is present and set to T it remains legal to not have any extension, and there could also be multiple extensions. FITS reading software should really be prepared to recover if it does not find an extension. |
#7
|
|||
|
|||
[fitsbits] Clarification of EXTEND, please
Stephen Walton writes:
Time to name names. The offending piece of software is the fitsread.m which The Mathworks distributes with MATLAB. In addition to above problem, Mathworks's FITS software contains another bug, this one in fitsinfo.m: it seeks 2880 bytes past an HDU which is exactly n*2880 bytes in length before trying to read data, and thus skips the first 2880 bytes of actual data. I have a patch for the second problem which I'd be happy to share; I haven't tried to fix the first one yet, but it is probably a simple matter of checking for EXTEND = T rather than the mere existence of EXTEND. That's a first step, but even if EXTEND is present and set to T it remains legal to not have any extension, and there could also be multiple extensions. FITS reading software should really be prepared to recover if it does not find an extension. |
#8
|
|||
|
|||
[fitsbits] Clarification of EXTEND, please
On Fri, 2004-05-14 at 09:57, Jonathan McDowell wrote:
Stephen, the standard is pretty clear on this e.g. http://archive.stsci.edu/fits/fits_standard/node39.html I have sent a bug report to the Mathworks about fitsinfo.m, specifically that it should not treat the absence of an extension on an otherwise legal FITS file as a fatal error even if EXTEND=T is stated in the primary HDU. I'll see what response I get. Thanks to everyone who responded. -- Stephen Walton Dept. of Physics & Astronomy, Cal State Northridge |
#9
|
|||
|
|||
[fitsbits] Clarification of EXTEND, please
On Fri, 2004-05-14 at 09:57, Jonathan McDowell wrote:
Stephen, the standard is pretty clear on this e.g. http://archive.stsci.edu/fits/fits_standard/node39.html I have sent a bug report to the Mathworks about fitsinfo.m, specifically that it should not treat the absence of an extension on an otherwise legal FITS file as a fatal error even if EXTEND=T is stated in the primary HDU. I'll see what response I get. Thanks to everyone who responded. -- Stephen Walton Dept. of Physics & Astronomy, Cal State Northridge |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[fitsbits] Dataset identifications. | Thierry Forveille | FITS | 12 | March 12th 04 02:33 PM |
[fitsbits] Dataset identifications. | Thomas McGlynn | FITS | 0 | March 10th 04 07:20 PM |
Rings Around The Planets: Recycling Of Material May Extend Ring Lifetimes(Forwarded) | Andrew Yee | Astronomy Misc | 0 | December 10th 03 03:59 PM |
Telescope Game | Kevin Rehberg | Amateur Astronomy | 8 | November 15th 03 11:02 PM |
To C8 Orange Tube Owners: Fork Clarification | Roy Dionne | Amateur Astronomy | 0 | September 16th 03 04:43 AM |