| 1 | \documentclass[12pt,preprint]{aastex} |
|---|
| 2 | \newcounter{address} |
|---|
| 3 | \setcounter{address}{1} |
|---|
| 4 | \begin{document} |
|---|
| 5 | |
|---|
| 6 | \title{What bandwidth do I need for my image?} |
|---|
| 7 | \author{ |
|---|
| 8 | Adrian~M.~Price-Whelan\altaffilmark{\ref{CCPP}}, |
|---|
| 9 | David~W.~Hogg\altaffilmark{\ref{CCPP},\ref{email}} |
|---|
| 10 | } |
|---|
| 11 | |
|---|
| 12 | \altaffiltext{\theaddress}{\stepcounter{address}\label{CCPP} Center |
|---|
| 13 | for Cosmology and Particle Physics, Department of Physics, New York |
|---|
| 14 | University, 4 Washington Place, New York, NY 10003} |
|---|
| 15 | \altaffiltext{\theaddress}{\stepcounter{address}\label{email} To whom |
|---|
| 16 | correspondence should be addressed: \texttt{david.hogg@nyu.edu}} |
|---|
| 17 | |
|---|
| 18 | \begin{abstract} |
|---|
| 19 | Computer representations of real numbers are necessarily discrete, |
|---|
| 20 | with some finite resolution. This resolution cannot be made |
|---|
| 21 | arbitrarily fine in real-time systems (such as camera read-outs) or |
|---|
| 22 | where transmission is expensive (such as with space telescopes). We |
|---|
| 23 | demonstrate experimentally that essentially all of the scientific |
|---|
| 24 | information in an astronomical image can be preserved or transmitted |
|---|
| 25 | in a representation with discreteness only slightly finer than the |
|---|
| 26 | root-variance of the additive per-pixel noise. Adopting a resolution |
|---|
| 27 | this coarse can preserve dynamic range for the measurement of bright |
|---|
| 28 | sources and reduce valuable bandwidth without sacrificing any |
|---|
| 29 | information for down-stream data analysis, including of very faint |
|---|
| 30 | sources far below the individual-image detection limit. |
|---|
| 31 | \end{abstract} |
|---|
| 32 | |
|---|
| 33 | \section{Introduction} |
|---|
| 34 | Computers operate on bits and collections of bits; the numbers stored |
|---|
| 35 | by a computer are necessarily discrete; finite in both range and |
|---|
| 36 | resolution. Computer-mediated measurements or quantitative |
|---|
| 37 | observations of the world are therefore only approximately |
|---|
| 38 | real-valued. This means that choices must be made, in the design of a |
|---|
| 39 | computer instrument or a computational representation of data, about |
|---|
| 40 | the range and resolution of represented numbers. |
|---|
| 41 | |
|---|
| 42 | In astronomy this limitation is keenly felt at the present day in |
|---|
| 43 | optical imaging systems, where the analog-to-digital convertersion of |
|---|
| 44 | CCD or equivalent detector read-out happens in real time and is |
|---|
| 45 | severely limited in bandwidth. This is even more constrained in space |
|---|
| 46 | missions, where it is not just the bandwidth of real-time electronics |
|---|
| 47 | but the bandwidth of telemetry of data from space to ground that is |
|---|
| 48 | limited. |
|---|
| 49 | |
|---|
| 50 | Fortunately, the information content of any astronomical image is |
|---|
| 51 | limited \emph{naturally} by the fact that the image contains |
|---|
| 52 | \emph{noise}. That is, tiny differences between pixel |
|---|
| 53 | values---differences much smaller than the amplitude of any additive |
|---|
| 54 | noise added into the signal---do not carry very much astronomical |
|---|
| 55 | information. For this reason, the discreteness of computer |
|---|
| 56 | representations of pixel values do not have to limit the scientific |
|---|
| 57 | information content in a computer-recorded image. All that is |
|---|
| 58 | required is that the noise in the image be \emph{resolved} by the |
|---|
| 59 | representation. What this means, quantitatively, for the design of |
|---|
| 60 | imaging systems is the subject of this \textsl{Article}; we are asking |
|---|
| 61 | this question: ``What bandwidth is required to deliver the scientific |
|---|
| 62 | information content of a computer-recorded image?'' |
|---|
| 63 | |
|---|
| 64 | We answer this question, in some sense, \emph{experimentally}. We |
|---|
| 65 | perform experiments with artificial data, varying the bandwidth of the |
|---|
| 66 | representation---the size of the smallest representable difference $\Delta$ in |
|---|
| 67 | pixel values---and measuring properties of scientific interest in the |
|---|
| 68 | image, such as the fluxes and centroids of compact sources, the mean |
|---|
| 69 | and variance in extended regions, and the properties of sources |
|---|
| 70 | fainter than the detection limit. The higher the bandwidth, the |
|---|
| 71 | better these measurements become, in precision and in accuracy. We |
|---|
| 72 | find, not surprisingly, that the smallest representable difference $\Delta$ |
|---|
| 73 | should be on the order of the root-variance of the noise level in the |
|---|
| 74 | image. More specifically, we find that about \emph{two bits should |
|---|
| 75 | span the FWHM of the noise distribution} if the computer |
|---|
| 76 | representation is to deliver the information content of the image. |
|---|
| 77 | This rule-of-thumb is obvious in retrospect. |
|---|
| 78 | |
|---|
| 79 | Of course, tiny differences in pixel values, even those much smaller |
|---|
| 80 | than the noise amplitude, \emph{do} contain \emph{extremely valuable} |
|---|
| 81 | information, as is clear when many short exposures (for example) of |
|---|
| 82 | one patch of the sky are co-added or analyzed simultaneously. |
|---|
| 83 | ``Blank'' or noise-dominated parts of the individual images become |
|---|
| 84 | signal-dominated in the co-added image. In what follows, we |
|---|
| 85 | explicitly include this ``below-the-noise'' information as part of the |
|---|
| 86 | information content of the image. Perhaps surprisingly, \emph{all} of |
|---|
| 87 | the information can be preserved about sources far fainter than the |
|---|
| 88 | discreteness of the computer representation, provided that the |
|---|
| 89 | discreteness is finer than the amplitude of the noise. |
|---|
| 90 | |
|---|
| 91 | Our results have some relationship to the study of \emph{stochastic |
|---|
| 92 | resonance}, where it has been shown that signals of low dynamic |
|---|
| 93 | range can be better detected in the presence of noise than in the |
|---|
| 94 | absence of noise \cite{dykman-1993}. These studies show |
|---|
| 95 | that if a signal is below the minimum representable difference $\Delta$, it is |
|---|
| 96 | visible in the data only when the digitization of the signal is noisy. |
|---|
| 97 | A crude summary of this literature is that the optimal noise amplitude |
|---|
| 98 | is comparable to the mininmum representable difference $\Delta$. We turn the |
|---|
| 99 | stochastic resonance problem on its head; the counterintuitive result |
|---|
| 100 | that weak signals become detectable only when the digitization is |
|---|
| 101 | noisy becomes (in our context) the relatively obvious result that so |
|---|
| 102 | long as the minimum representable difference $\Delta$ is comparable to or |
|---|
| 103 | smaller than the noise, signals are transmitted at the maximum |
|---|
| 104 | fidelity possible in the data set. |
|---|
| 105 | |
|---|
| 106 | \section{Method} |
|---|
| 107 | \subsection{Artificial Images} |
|---|
| 108 | The images we created were all made with the same basic parameters and processes. To begin we wrote a simple Python class that creates image objects (of type NBImage) that was built specifically for this project. When instantiated, the NBImage objects are empty data arrays of user specified dimensions, but for our purposes we chose to use square 16 by 16 pixel images for the experiments to follow based on processing time restrictions. The images were constructed by creating blank 16 by 16 pixel images and then adding noise to simulate the sky level. A random number generator chooses a mean $\nu_{n}$ for this Gaussian noise within the range 0 - 100 but with a constant variance $\sigma_{n}$ of 1. We then add a randomly placed 'star' with a Gaussian spread somewhere within a few pixel radius of the center of the image. The intensity of the star is given by eq.~(\ref{intensity}), where $(x_{0}, y_{0})$ is a randomly selected center of the star, and $(x, y)$ are the image coordinates. The variance of the star $\sigma_{s}$ is set to 1 for convenience, and $A$ is a measure of the flux of the star. |
|---|
| 109 | |
|---|
| 110 | \begin{equation}\label{intensity} |
|---|
| 111 | I(x,y) = A e^{-\frac{((x-x_0)^2+(y-y_0)^2)}{(2 \sigma^2)}} |
|---|
| 112 | \end{equation} |
|---|
| 113 | |
|---|
| 114 | The method for setting the minimum representable difference $\Delta$ for the artificial images is used extensively in the experiments to follow, and therefore it is important to understand the process. We define an array of values from $log_{2}(-4)$ to $log_{2}(8)$ in increments of $log_{2}(\frac{1}{4})$ and multiply the image data by each of these values in the array, thus scaling the image data by each value in the array. The data is then truncated to integer values, and the factor is divided out. For convenience, we will call this 'snap to integer' procedure the SNIP method. fig.~\ref{fig:twelvepanel} shows the increasing bit depth for different multiplication factors, which is the same image data multiplied by the values in the scaling array and then truncated to integer values. |
|---|
| 115 | |
|---|
| 116 | \section{Plain Gaussian Noise} |
|---|
| 117 | In what follows, we will briefly return to the discussion about determining how well we measure the variance in a 100 by 100 pixel image of pure Gaussian noise. For this experiment we simply created an image, added Gaussian noise, and applied the SNIP procedure - then plotted up the measured variance against the bit resolution. As expected, the measured variance increases in accuracy as the bit resolution increases (fig.~\ref{fig:variance}). |
|---|
| 118 | |
|---|
| 119 | \section{Adding a Randomly Placed Star to Gaussian Noise} |
|---|
| 120 | Following the measurement of the variance after multiplying our data by various factors and snapping it to integer values, we wanted to show the same results but instead by adding a star to the image and asking how well we can centroid its location. To do this we used the same routine as described above, but instead with a randomly placed 'star' somewhere within a 25 pixel radius of the center of the image. We chose to use a Gaussian spread for the star, and so the intensity of the star is given by eq.~(\ref{intensity}), where \((x_{0}, y_{0})\) is the randomly selected center of the star, and \((x, y)\) are the image coordinates. \(\sigma\) is set to 1.0 for convenience, and \(A\) is a measure of the flux of the star. We save the true location, and proceed to multiply the image by various factors, snap the data to integer, and then centroid the star. |
|---|
| 121 | |
|---|
| 122 | \indent Our technique for centroiding the star does not locate the star within the image. The function takes the real position of the star as input variables, and simply looks at a 3 by 3 section of the image data with the center of this array as the center of the star. It then looks for the highest intensity pixel value, and re-centers the 3 by 3 array around this pixel. We perform a simple least squares fit on this data, using eq.~(\ref{surface}) as our surface model, where our experimentally found star center is the maximum of this surface. |
|---|
| 123 | \begin{equation}\label{surface} |
|---|
| 124 | S(x,y) = a + b x + c y + d x^2 + e x y + f y^2 |
|---|
| 125 | \end{equation} |
|---|
| 126 | The offset is then simply given by eq.~(\ref{offset}), where \((x_{1}, y_{1})\) is the calculated position of the star. |
|---|
| 127 | \begin{equation}\label{offset} |
|---|
| 128 | \mathrm{Offset} = \sqrt{(x_{1} - x_{0})^{2} + (y_{1} - y_{0})^{2}} |
|---|
| 129 | \end{equation} |
|---|
| 130 | \indent What we can expect from a measurement like this is that with a star of high flux compared to the noise level, we will measure the offset very accurately even at the lowest bit truncation value \((2^{-3})\). For lower values of the flux, we should get a curve that converges to some value near ~\((2^{1})\) that depends on the flux, but for smaller bit truncation values we would expect the offset to get larger. These somewhat obvious intuitions are confirmed by (fig.~\ref{fig:bitsoffset256}) and (fig.~\ref{fig:bitsoffset8}). For both plots, the process is tried on 1024 images and the resultant data is all shown on the same plot. As expected, for a large value of the flux (256) the median values (indicated by a black circle) form a virtually straight line at a very low offset, with a lot of data points below the median, and some above. The effect of modulating our noise such that it can vary from 0 to 100 is that it gets closer and farther from the flux value, producing an occasional outlier for high and low noise levels. |
|---|
| 131 | |
|---|
| 132 | \section{Low Value Bit Truncation and Coadding Images} |
|---|
| 133 | As mentioned previously, tiny variations in pixel values, even those smaller than the noise amplitude, do contain valuable information - which is demonstrated by simply coadding a number of noise-dominated images of the same region of the sky. The test we perform is to take 1024 images, add a faint source (below the noise) to the image, apply the SNIP method for the same range of bit values, and then coadd the images and measure the star offsets. Perhaps the most interesting result here is we are able to show that even for stars of flux = \(\frac{1}{8}\), significantly lower than the root variance of the noise, after truncating and coadding many images containing these faint sources we are still able to measure the centroid accurately. |
|---|
| 134 | |
|---|
| 135 | \section{Discussion} |
|---|
| 136 | The methods we propose and examine in this paper would formally be classified as 'lossy image compression techniques,' but with that aside it is shown that no \emph{science} is lost in the compression of this data. Our experiment on just measuring the variance of plain Gaussian noise as we truncate the pixel values at different bit depths gave us confidence that our initial intuition was correct, and also provided an idea about what we should expect from the more complicated experiments that followed. As shown on fig.~\ref{fig:variance}, even with a minimum representable difference $\Delta = 1.0$, the measured variance is off by less than 10\% from the theoretical value. |
|---|
| 137 | |
|---|
| 138 | ADRIAN: Describe results, one at a time, in a big paragraph. |
|---|
| 139 | |
|---|
| 140 | ADRIAN: Re-state the rule of thumb in the introduction. |
|---|
| 141 | |
|---|
| 142 | HOGG: Comment on applications where bandwidth is limited and we might |
|---|
| 143 | have done better. For example, what is the HST bit depth? |
|---|
| 144 | |
|---|
| 145 | \begin{figure} |
|---|
| 146 | \includegraphics[width=\textwidth]{twelve-panel.png} |
|---|
| 147 | \caption{Starting from top left and moving to bottom right we show 16x16 images of increasing bit depth. The original images are identical but snapped to integer as described in the text. The images are labeled by the ratio of noise root-variance $\sigma$ to the minimum representable difference $\Delta$. At bit depths $\frac{1}{\Delta} > 2^{0}$, the images become virtually indistinguishable from the high bandwidth images.\label{fig:twelvepanel}} |
|---|
| 148 | \end{figure} |
|---|
| 149 | |
|---|
| 150 | \begin{figure} |
|---|
| 151 | \includegraphics[width=\textwidth]{1024ImsNoStarINT_Variance.png} |
|---|
| 152 | \caption{Measurement of image noise variance as a function of bit depth $\frac{1}{\Delta}$ for images with a randomly chosen mean level and gaussian noise with true variance $\sigma^{2} = 1.0$. Each data point has been dithered horizontally to make the distribution visible. Black circles show medians for each value of the multiplicative factor. The variance is well measured as long as the noise root-variance $\sigma$ is twice the minimum representable difference $\Delta$. \label{fig:variance}} |
|---|
| 153 | \end{figure} |
|---|
| 154 | |
|---|
| 155 | \begin{figure} |
|---|
| 156 | \includegraphics[width=\textwidth]{BitsvsOffset_1024ims_flux8.png} |
|---|
| 157 | \caption{Plot of measured star offset (astrometric error in pixels) as a function of bit depth. The black circles show the median values. We set an upper bound on the offset of \(2^{0}\) reasoning that anything outside of 2 pixels is essentially infinity. The points are generated by generating 1024 images with noise variance $\sigma^{2} = 1.0$ and a gaussian star randomly placed with flux = 8.0., fwhm = 2.35 pix. We centroid the star and measure the offset between this position and the known location of the star.\label{fig:bitsoffset8}} |
|---|
| 158 | \end{figure} |
|---|
| 159 | |
|---|
| 160 | \begin{figure} |
|---|
| 161 | \includegraphics[width=\textwidth]{BitsvsOffset_1024ims_flux256.png} |
|---|
| 162 | \caption{Same as fig.~\ref{fig:bitsoffset8} except flux of star = 256.0.\label{fig:bitsoffset256}} |
|---|
| 163 | \end{figure} |
|---|
| 164 | |
|---|
| 165 | \begin{figure} |
|---|
| 166 | \includegraphics[width=\textwidth]{four-panel.png} |
|---|
| 167 | \caption{Four 16x16 pixel images that demonstrate coadding procedure. The top left image shows a single image with noise variance $\sigma^{2}$ = 1.0 and a gaussian star with flux = 8.0, fwhm = 2.35 pix. The top right image is the same as the top left, but with the pixel values snapped to integer at bit depth \(2^{-1}\) or minimum representable difference $\Delta = 2.0$. The bottom left image represents coadding 1024 images of flux = 8.0, fwhm = 2.35 pix without snapping to integer, whereas the bottom right image is after coadding 1024 images of flux = 8.0, fwhm = 2.35 pix \emph{after} snapping each individual image data to integer values. The similarities of the images indicates that information has been preserved. \label{fig:fourpanel}} |
|---|
| 168 | \end{figure} |
|---|
| 169 | |
|---|
| 170 | \begin{figure} |
|---|
| 171 | \includegraphics[width=\textwidth]{prove-coadd.png} |
|---|
| 172 | \caption{Four 16x16 images showing that coadding a number of images with faint sources will produce a visible source, even for a source flux much lower than the root variance $\sigma$ of the noise and lower than the minimum representable difference $\Delta$. Same as fig.~\ref{fig:fourpanel} except flux = 0.25. \label{fig:provecoadd}} |
|---|
| 173 | \end{figure} |
|---|
| 174 | |
|---|
| 175 | \begin{figure} |
|---|
| 176 | \includegraphics[width=\textwidth]{BitsvsOffset_1024ims_flux025_Coadded.png} |
|---|
| 177 | \caption{Same as fig.~\ref{fig:bitsoffset8} except for flux = 0.25, and coadding 1024 exposures after snap-to-integer to make the source detectable. \label{fig:bitsoffsetcoadd1}} |
|---|
| 178 | \end{figure} |
|---|
| 179 | |
|---|
| 180 | \begin{figure} |
|---|
| 181 | \includegraphics[width=\textwidth]{BitsvsOffset_1024ims_flux8_Coadded.png} |
|---|
| 182 | \caption{Same as fig.~\ref{fig:bitsoffsetcoadd1} except for flux = 8.0. \label{fig:bitsoffsetcoadd2}} |
|---|
| 183 | \end{figure} |
|---|
| 184 | |
|---|
| 185 | \bibliographystyle{amsplain} |
|---|
| 186 | \bibliography{refs} |
|---|
| 187 | \end{document} |
|---|