Precision loss during stacking when input is in integer FITS format
Posted: 10 Jun 2020, 17:08
Hi all,
The task I want to perform in AstroArt7 is the following:
I want to stack many (sometimes a lot) of FITS images, and then do photometry on them with an external software.
The input :
- Out of the camera: 16 bit integer FITS , light and dark frames
- A single master flat frame, 32 bit floating point .
I used to do "average" settings for darks and lights, and tell AA7 to retain the master flat and master dark image.
To my surprise, the stacked, averaged image has only integer pixel values. Even when using Edit -> Data-Format -> Floating point, you still have only integer values so it looks like at the end of the stacking, the output image is forced into the integer format of the light frames, losing some precision in the photometry you'll do on the resulting image.
Also the generated master dark is in integer pixel values.
The funny thing is this: if you convert all the light- and dark-frames into floating point FITS files up front, (without changing any of the information in them), and then stack the images with the exact same settings in AA7 as before, the stacked image will be in floating point format and will have the extra fractional pixel values from the averaging.
That is very inconvenient.
When you do photometry by stacking a ton of frames for faint stars with low pixel values, the difference from the quantization to integer values can really matter.
To partially fix this, the easiest thing seems to be (short of converting all input frames to floating point format up-front):
- use "sum" instead of average
- lookup in the log window how many frames were actually summed (some might have been rejected)
- switch output image to floating point
- divide image by that number,
- save to FITS file
This is still not 100% perfect. Even after the summing step, the real output should not have integer pixel values, as the input frames are first calibrated with the masterdark and master-flat field and then added, which will not generally result in integer values. The pixel values will just be higher so that the rounding to integer values is less harmful.
It would be so much more convenient to have an option that would tell AA7 to produce all data products of the stacking in floating point (the combined image and the master calibration frames).
Or do I miss something here? Even for pretty pictures, this forcing to integer values will be added quantization noise.
Clear Skies
HBE
The task I want to perform in AstroArt7 is the following:
I want to stack many (sometimes a lot) of FITS images, and then do photometry on them with an external software.
The input :
- Out of the camera: 16 bit integer FITS , light and dark frames
- A single master flat frame, 32 bit floating point .
I used to do "average" settings for darks and lights, and tell AA7 to retain the master flat and master dark image.
To my surprise, the stacked, averaged image has only integer pixel values. Even when using Edit -> Data-Format -> Floating point, you still have only integer values so it looks like at the end of the stacking, the output image is forced into the integer format of the light frames, losing some precision in the photometry you'll do on the resulting image.
Also the generated master dark is in integer pixel values.
The funny thing is this: if you convert all the light- and dark-frames into floating point FITS files up front, (without changing any of the information in them), and then stack the images with the exact same settings in AA7 as before, the stacked image will be in floating point format and will have the extra fractional pixel values from the averaging.
That is very inconvenient.
When you do photometry by stacking a ton of frames for faint stars with low pixel values, the difference from the quantization to integer values can really matter.
To partially fix this, the easiest thing seems to be (short of converting all input frames to floating point format up-front):
- use "sum" instead of average
- lookup in the log window how many frames were actually summed (some might have been rejected)
- switch output image to floating point
- divide image by that number,
- save to FITS file
This is still not 100% perfect. Even after the summing step, the real output should not have integer pixel values, as the input frames are first calibrated with the masterdark and master-flat field and then added, which will not generally result in integer values. The pixel values will just be higher so that the rounding to integer values is less harmful.
It would be so much more convenient to have an option that would tell AA7 to produce all data products of the stacking in floating point (the combined image and the master calibration frames).
Or do I miss something here? Even for pretty pictures, this forcing to integer values will be added quantization noise.
Clear Skies
HBE