[fitsbits] Output array type when BZERO is an integer {External}
Seaman, Robert Lewis - (rseaman)
rseaman at arizona.edu
Tue Mar 12 11:55:23 EDT 2024
Hi Paul,
* I find section 4.4.2.5 of v4.0 of the FITS standard, including table 11 to be pretty clear. For most computer languages, I don’t know about Julia, equation 3 would imply scaling before adding BZERO, but the rest of that section covers the special case for integer pixel types in which case BSCALE = 1.0 (the default) and BZERO is one of 32768 or the three less frequent values of -128 or 2^31 or 2^63. (Footnote 9 suggests alternate handling for these cases that avoids your issue entirely.) Other than those values, there is nothing special about expressing BZERO as an integer, and one should interpret it as a floating-point number.
Others are encouraged to correct or extend my remarks.
* FITS is certainly not mandated by NASA’s Planetary Data System. We have submitted many tile-compressed FITS files but could have archived other image formats. Some of our tables are FITS binary tables, but more are other formats. That said, pressure from a funding agency is not exactly peer pressure. And I am unaware of any funding agencies mandating 2880-byte ASCII header records.
* As I think you imply, Julia’s competitor is Python, not C/C++ or FORTRAN. If Julia or Numba/NumPy can directly handle Rice compressed tiles as a native numerical format, I may switch myself, especially if it can be deployed as functions called from PostgreSQL or MariaDB queries.
Rob
On 3/12/24, 7:58 AM, "Barrett, Paul" wrote:
I'll ask this question one more time and then I'll let it go.
I understand that the default behaviour for BZERO and BSCALE creates a floating point array because of the typical upconversion rules. However, I'm not clear about the data type for the special case where BZERO is an integer. In this case, it appears that BZERO is added first to the integer array before converting it to a floating point array, because BSCALE = 1.0 implies upconversion. Is this correct?
As for your comments:
* I disagree with your first comment. FITS is used because of peer pressure. It is mandated by NASA. That means a large sector of the community HAS to use it.
* Yes, dynamic languages are dynamic enough. In the case of Julia, it can do everything that C/C++, FORTRAN, and Python can do. Think of Julia as Python with Numba built-in.
-- Paul
On Tue, Mar 12, 2024 at 9:39 AM Seaman, Robert Lewis - (rseaman) via fitsbits <fitsbits at listmgr.nrao.edu<mailto:fitsbits at listmgr.nrao.edu>> wrote:
Howdy,
It is always good to see a spirited FITS discussion! A few more peppy points:
· There is always an assertion that it would be preferable to use a “modern” format
o Yet projects often end up using FITS
o This choice does not result from peer pressure
· There is nothing magic about IEEE floating point or twos-complement integers
o Efficient (compressed) data representations may not even be binary (Rice is unary)
o Are dynamically typed languages dynamic enough?
· A tile-compressed image is a simple binary table
o My first encounter with FITS data (c. 1983) was writing a FITS image reader from scratch by consulting the original journal article(s) (possibly also my first encounter with C)
o I am confident young Rob could have written a reader for tile-compressed binary data with little more effort (or code) just from reading the current FITS standard
· FITS documentation is pretty good
o (Comments about other projects’ documentation omitted)
· Most FITS discussions/disagreements are about metadata
o Only a small minority of FITS metadata is strictly required to enforce the structure of each extension
o Science metadata (astronomical and computer science) would be legal (and trivial) to represent, using any schema you like, in a binary table structure, described in a convention or appendix or chapter of the standard
o Schemata could also include language-specific pragma, for data-typing purposes or otherwise
· It is perhaps peer pressure that pushes projects to use 80-char ASCII header keywords in 2880-byte records
o Consider, rather, what is the optimal tiled representation for your project, and separately
o How can your project’s (and community) metadata best be represented in a schema realized as a binary table?
Rob
_______________________________________________
fitsbits mailing list
fitsbits at listmgr.nrao.edu<mailto:fitsbits at listmgr.nrao.edu>
https://listmgr.nrao.edu/mailman/listinfo/fitsbits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listmgr.nrao.edu/pipermail/fitsbits/attachments/20240312/b7bca281/attachment-0001.html>
More information about the fitsbits
mailing list