Thanks Niall for the additional explanation.
So, when a 16bit unsigned FIT created in Maxim does not open correctly in CCDSTACK (saturated areas are black e.g star cores), then is this likely to be how Maxim writes the files or how CCDSTACK reads it?
Hi Martin,
That would be dependent on how the header and data sections of the Fits file have been created in Maxim.
Now, as I refer to my 'FITS Bible' (i.e. the notes I gathered on my long learning session, back on 21/10/07, Chapter One, Verse One):
There are 5 possible FITS Data Unit types
8-bit Unsigned Integers, where BITPIX=8
16-Bit Signed Integers, where BITPIX=16
32-Bit Signed Integers, where BITPIX=32
32-Bit Single Precision Floating-Point Real Numbers, where BITPIX=-32
64-Bit Double Precision Floating-Point Real Numbers, where BITPIX=-64
There is also a proposal to include the following (but I do not believe that it has, as yet, been ratified)
64-Bit Signed Integers, where BITPIX (would be)=64
As you can see , there is NO 'standard' for 16-Bit Unsigned Integers - which is unfortunate, because this is EXACTLY what current CCD imagers need.
However, the 'standard' can be 'expanded' to allow for 16-Bit Unsigned and 32-Bit Unsigned Integers as follows:-
Subtract 2
^(BITPIX-1) from every data value, before saving
Then save the data, using BITPIX=16 (or BITPIX=32, for 32-bit data),
but ALSO incorporate two extra FITS Header keywords; BSCALE=1 and BZERO=(2
^(BITPIX-1))
Now, when the image is to be opened, if the BSCALE=1 parameter is present,
Add 2
^(BITPIX-1) back to every stored data value as it is passed to the parent program
For 16-bit data, 2
^(BITPIX-1) = 32768 and for 32-bit data 2
^(BITPIX-1) = 2 147 483 648
Usually, what happens is that this crucial stage is either NOT implemented, or is implemented incorrectly (such as failure to include BOTH of the extra keywords, or failure to 'subtract before saving'). Alternatively, images might be saved correctly, but applications attempting to read the format have no idea how to process the incoming data.
In any case, however the failure occurs, it is just shabby programming, made worse by the failure to acknowledge the fact, and then worse still by the failure to do anything about the problem.
Hope this background helps.
Cheers,