<p>Raw data from detectors is usually some sort of integer type, giving the number of &quot;counts&quot; detected during an integration period. So the values could be [0,65535] for 16-bit data, or [0,4294967295] for 32-bit data. But you are probably working with processed data rather than raw data.</p>
<p>Processed astronomical data can have all sorts of corrections applied, but the most basic are dark subtraction (for read noise), sky subtraction (for sky/observatory background), and flat-fielding (for detector spatial variation).</p>
<p>Negative values in FITS images often happen due to the subtraction steps. For example, correction for sky background and <a href="https://en.wikipedia.org/wiki/Image_noise#Gaussian_noise" rel="nofollow noreferrer">readout noise</a> should produce data evenly distributed about zero. This means that an image of a completely dark scene will have an <em>average</em> value of zero, even though most of the values are not equal to zero.</p>
<p>The flat-fielding step involved division by a number close to 1, so the processed data are going to have to be float type, not integer type.</p>
<p>Also note that while image display programs such as matplotlib often only display floats in the range [0, 1), the values in a FITS image usually depend on the units of the image (DN, photons, radiance, etc).</p>

CC BY-SA 4.0
2023-03-06T15:28:53.707Z
So if I want to wind most darker(black) pixels in grayscale fits, I need to search within the values which have values close to 0 and negative???
TatevAram
CC BY-SA 4.0
2023-03-05T21:34:55.823Z
2023-03-13T17:41:06.840Z
2023-03-13T17:41:06.840Z
Roy Smart
<p>I am using FITS images, and noticed negative values in value matrix. What they mean? For example, for one of the images, the minimum value is -0.34472656 and the maximum = 552.0. The data type(format) is <code>float32</code>. I know <em>float</em> data values should be in a range of [0.0, 1.0]. How can I convert them to [0.0, 1.0]?</p>

CC BY-SA 4.0
2023-03-06T07:15:55.210Z
You need to provide more information on how the image was obtained, what it is of and what processing has been applied. Floating point numbers can be negative. Raw CCD data are integers.
ProfRob
CC BY-SA 4.0
2023-03-06T15:26:07.213Z
I just opened fits file with Python Astropy lib. Image is in grayscale.  I got the primary hdu's data... I noticed that more dark pixels is close to *minimum value*=-0.34472656and and more bright(white) piels` to the maximum=552.0. But why the -0.3 can be 'black'?
TatevAram
<fits><flux>
What do the negative values in FITS images mean?
TatevAram
# What do the negative values in FITS images mean?

(Asked by: username_0 on 2023-03-05)

I am using FITS images, and noticed negative values in value matrix. What they mean? For example, for one of the images, the minimum value is -0.34472656 and the maximum = 552.0. The data type(format) is `float32`. I know *float* data values should be in a range of [0.0, 1.0]. How can I convert them to [0.0, 1.0]?

**Tags:** fits, flux

> **Comments:**
> **username_1**: You need to provide more information on how the image was obtained, what it is of and what processing has been applied. Floating point numbers can be negative. Raw CCD data are integers.  
> **username_0**: I just opened fits file with Python Astropy lib. Image is in grayscale.  I got the primary hdu's data... I noticed that more dark pixels is close to *minimum value*=-0.34472656and and more bright(white) piels` to the maximum=552.0. But why the -0.3 can be 'black'?  

---

## 1 answers

### Answer by username_2 on 2023-03-05. Score: 4

Raw data from detectors is usually some sort of integer type, giving the number of "counts" detected during an integration period. So the values could be [0,65535] for 16-bit data, or [0,4294967295] for 32-bit data. But you are probably working with processed data rather than raw data.

Processed astronomical data can have all sorts of corrections applied, but the most basic are dark subtraction (for read noise), sky subtraction (for sky/observatory background), and flat-fielding (for detector spatial variation).

Negative values in FITS images often happen due to the subtraction steps. For example, correction for sky background and [readout noise](https://en.wikipedia.org/wiki/Image_noise#Gaussian_noise) should produce data evenly distributed about zero. This means that an image of a completely dark scene will have an *average* value of zero, even though most of the values are not equal to zero.

The flat-fielding step involved division by a number close to 1, so the processed data are going to have to be float type, not integer type.

Also note that while image display programs such as matplotlib often only display floats in the range [0, 1), the values in a FITS image usually depend on the units of the image (DN, photons, radiance, etc).

> **Comments:**
> **username_0**: So if I want to wind most darker(black) pixels in grayscale fits, I need to search within the values which have values close to 0 and negative???  

---

