signals among the noise

One of the points I always liked about the Bayesian approach to data is the emphasis on extracting as much information as possible from whatever data you have. This principle of making use of what you have seems obvious at first, but in the case of astronomy it is generally a case of setting limits - what sources do we have above a certain flux limit, below which we're unsure due to noise? We generally set a sigma (noise) level, and ignore everything below it because at that point you can't tell the difference between signal and noise.

But I'm going to describe here an interesting technique that astronomers use which allows real sources to be found way below the noise in an image. It involves stacking images, something that amateur astronomy photographers combating the Earth's atmosphere are more than familiar with (see here for an explanation). In this case, though, it's not necessarily images of the same region of sky that get stacked! Given a few constraints and assumptions, you can stack completely different regions of sky and still pull out a signal, even if the signal is essentially indistinguishable from noise in an individual image. That's pretty cool, right?

A key assumption that goes into stacking is that the noise in the image/s (be it from the atmosphere, interstellar medium, instrument, etc) is random. What does this mean? Well, ideally, it means that you have a distribution of positive and negative-valued noise that fluctuates around 0 (probably Gaussian), such that the average of the noise is zero. In this case, if you stack several images of random noise, you should find that the values within the stacked image approach zero (the mean of a series of random positive and negative numbers following a Gaussian distribution). This allows you to 'beat down the noise', forcing it to zero based on its property of Gaussian randomness. However, a true signal (or source) that appears in the same position in several images will be boosted in amplitude because there is always going to be a positive bias at that position, regardless of how dim the signal might be. So if you stack in the same way, you end up with a much higher signal-to-noise ratio which allows you to see the signal better than a signal image. That's the basic principle behind stacking.

#### experiment

So let's do an experiment to see this in action. This experiment is not specific to any wavelength or any type of source, it's a general demonstration of how we can get a signal out of a set of noisy images. In this case we're going to look for very faint sources in noisy data based on knowing beforehand that there might be a signal at the centre of each image we input. In a real-life example, astronomers get this kind of information from multi-wavelength data - for example, radio data might confirm the existence of a pulsar at a certain position, and if an astronomer is searching for x-rays associated with that pulsar but the signal-to-noise ratio is extremely low, they can use the positional information as a basis for stacking x-ray data. So, we assume that we know there is 'something' in the middle of the image, because we have prior information from multi-wavelength data or otherwise.

Here's how we go about doing it.

1. Generate a series of images of Gaussian noise at a chosen noise level.
2. Insert a Gaussian object of a set amplitude at the centre of each image.
3. Add all of these images together and divide by the number of images.
4. Check to see if the inserted sources are detected.

To do this, I used Miriad's cool imgen and maths functions - free to download if you're that way inclined!

Case 1: Signal = Noise
If our signal is the same as the noise distribution (images #1), we can just see the source in the individual image with the Gaussian inserted (image #2). But if we stack 100 of these individual images, the noise falls away and the signal becomes much stronger (image #3)! Note that we also recover a peak similar to that of our inserted Gaussian (96%), as expected since we have inserted a Gaussian of particular amplitude and then averaged the results. To get the actual value of the peak, we divide by the number of images. But this just changes the scale, not the signal-to-noise ratio.

Above: 1) noise, 2) noise + gaussian and 3) stacked (n=100).

Case 2: Signal = 0.5 x Noise
If our signal is the half the intensity of the noise distribution (images #1), it's much harder to see the source in the individual image with the Gaussian inserted (image #2) - you can see it if you look very closely. If we stack 100 of these individual images, the signal does come out (image #3) but it's not as obvious as in the case above.

Above: 1) noise, 2) noise + gaussian and 3) stacked (n=100).

If we try stacking 1000 images instead, sending the noise closer to its mean of zero, we bring the signal back up and can better recover the properties of the source (image #4). So you can already see that there is a relation between the strength of the signal and the number of images you'll need (with signal) to bring that weak signal out through stacking.

Above: 4) stacked (n=1000).

Case 3: Signal = 0.1 x Noise
If our signal is quite weak and only a tenth of the intensity of the noise distribution (images #1), I'm betting you cannot see any hint of the inserted Gaussian source (image #2). If we stack 100 of these individual images, we don't recover the signal this time (image #3).

Above: 1) noise, 2) noise + gaussian and 3) stacked (n=100).

Even stacking 1000 images only brings out a weak and distorted signal (image #4).

Above: 4) stacked (n=1000).

If we stack 10000 images instead, we recover the signal more clearly (image #5). But this is factor of ten higher in number of images for a factor of five improvement on the sensitivity. So the weaker the signal, the harder it gets to draw it out using a reasonable number of images.

Above: 5) stacked (n=10000).

#### assumptions + constraints

There are some important assumptions and constraints going into this basic experiment here.

• We are using Gaussian noise - this approximation may not necessarily be true for all data, especially astronomical data which often involves noise artifacts that don't follow a Gaussian distribution at all
• We have inserted a source of the same amplitude in each image - a real class of sources might follow a distribution nor might they be Gaussian, so we have to be careful about what we say about the underlying distribution of an averaged set
• We're not searching blind - we've used positional information from some other source such that we expect the source to lie in the centre of the image, which is necessary for this technique to work
• This is only a model - real data won't just be as simple as signal-we-want + noise, there will be other real sources in the field as well which will affect the stacking and in general must be dealt with during the stacking process

#### conclusion

Overall, stacking is a really interesting astronomical technique of extracting data even when there is significant noise. It's most effective if the signal is fairly close to the noise limit, but otherwise retrieving fainter and fainter signals requires more and more images stacked to average out the noise. Still, it's quite amazing that such faint signals can be retrieved at all, since their effect on the noise in an individual image is basically negligible.

You can try stacking for yourself by using the burst mode on a normal digital camera at night (pick a night where it's reasonably cloud-free) to take zoomed-in (noisy, probably roughly Gaussian) photos centred on the Moon - if you use some image-editing software to add all of your images up and then divide by the number of images, you should be able to get a nicer image of the Moon!