<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><DIV>On Aug 16, 2007, at 8:30 AM, Steve Allen wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">On Thu 2007-08-16T17:22:29 +0200, eggpap hath writ:</DIV> <BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">how to know programmatically if a fit/fits extension file is a true fit</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">file?</DIV> </BLOCKQUOTE><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The quickest test is the one Jeff Uphoff wrote for the /etc/magic</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">or /usr/share/magic file which is used by the unix "file" program.</DIV></BLOCKQUOTE></DIV><BR><DIV>I might add that several million NOAO "save the bits" files have been classified very handily using this magic number scheme ("SIMPLE" is just hex 53 49 4d 50 4c 45).  Identifying non-FITS is even more important since we then run a converter.  We look for that silly little "T", too:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">     </SPAN><FONT class="Apple-style-span" face="Courier" size="4"><SPAN class="Apple-style-span" style="font-size: 14px;">0       string  SIMPLE  =                    T  THIS_IS_FITS</SPAN></FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>This is certainly more reliable than just relying on a file extension, especially when paired with a variety of reality checks downstream during handling that amount to a validation against minimal FITS compliance.  A lot of instruments would have a hard time meeting a formal FITS compliance requirement.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>- Rob</DIV><DIV><BR class="khtml-block-placeholder"></DIV></BODY></HTML>