PixInsight DSLR Workflow – Part 1a, Bias Frames

Andromeda Galaxy – M31

This is the first in a series of posts explaining the general workflow I follow when using PixInsight. We will be looking at my Andromeda image in this post but will bring in other images later. This is certainly not the ultimate workflow and there are some problems I have not resolved which I will point out along the way, but hopefully it will be of some help for fellow DSLR imagers in combating the rather noisy images that these uncooled cameras produce.

I undertake all of my processing in PixInsight (PI).  I am not ‘anti-PhotoShop’ and I know many great imagers use it for the processing, often in combination with other packages.  Personally I find PI suits my working style; as a computer scientist by training I like repeatable processes that I can analyse, refine and re-use in the future, and PI allows me to do this.  It does have a steep learning curve, but having spent about 300 hours using it over the past two years, including 200 hours of painstaking testing and learning on my Markarian’s Chain image, I think I have started to get to grips with it.

Read on for Part 1 of my PixInsight DSLR workflow.

Purpose of Bias Frames

The first thing I recommend is creating a good master bias frame.  It is worth getting this right as the bias frame is re-used many times over during image calibration, and a poor bias will do more harm than good if it ends up adding unnecessary noise to the image.

Strictly speaking, Bias is a fixed amount of voltage that is added to each pixel’s electron well in the camera sensor just prior to the start of an exposure. In earlier generations of CCD cameras, it was necessary to manually subtract this bias voltage from the image using a bias frame. Images from modern cameras (especially the CMOS sensors used in DSLRs) do not contain a bias voltage. Instead a correlated double sampling process is used.

Nonetheless, the camera electronics can add a significant amount of fixed pattern noise to an image. It is possible to remove this fixed pattern by following the traditional bias frame subtraction process. The term ‘bias subtraction’ is still in common usage and I will continue to use it even though it is not technically accurate for DSLR cameras.

Taking a Bias Frame

Making a single bias frame is pretty easy.  One simply covers the camera (as if taking a dark frame) and shoots the shortest possible exposure the camera will allow.  In the case of my Canon EOS 500D, that is 1/4000th of a second.  I always set the camera ISO to the same value as I use to shoot my light frames (usually ISO 400); I don’t know if it really matters but I can’t see any reason to use a different ISO and risk any variation in the fixed pattern noise that we are trying to capture.

One bias frame is not really sufficient as it will be pretty much random noise and not really representative of the fixed pattern noise we want to subtract when calibrating our images. The answer is to shoot a bunch of bias frames and stack (integrate) them to make a master bias frame. The random noise should increase as the square root of the signal. in this case the “signal” is the the fixed pattern noise (it may seems odd to think of noise as signal but since it is a fixed pattern it builds up in the same way as a signal rather than random noise).

How Many Frames?

The question is how many bias frames are enough?  I know many people shoot 20 or 30 bias frames, but this really isn’t sufficient.  What I did was shoot and integrate different numbers of bias frames to figure out how many I really needed for my camera.

Different Sized Stacks of Bias Frames
As you can see from the image above, one bias frame alone is just noise.  30 bias frames stacked looks better as a clear pattern of vertical stripes is emerging, and you may be able to tell that 80 looks slightly better again.  The fixed pattern is what we want to remove from our other frames.  Once we get to 180 and 330 frames it is very hard to tell by eye if they are any better than the earlier versions.

Update: Apparently not all DSLRs are created equal, and I have since read reports that some Canon models (e.g. 550D/T2i) do not produce a noticeable pattern even when stacking 1,000 frames. I have not verified this but you can easily test your camera to check.
 
So how many bias frames is enough? The solution is to resort to statistics (not the kind used by politicians, real sciency-type statistics!) I simply ran the PixInsight Statistics process, and selected the image that I was interested in. The figure we want is the ‘Standard Deviation’ which is a reasonably good indicator of how much random noise there is in an image (there are better ones, as we’ll see later). I just measured the standard deviation of each of the master bias frames and plotted them on a scatter graph in Excel (other spreadsheets are available).
Standard Deviation (noise) vs number of Bias Frames
As you can see the standard deviation reduces markedly when we go from one bias frame to a stack of 30 frames.  After that there is an improvement up to somewhere in the region of 160-180 bias frames, and not much after that.  This is what mathematicians would call an ‘asymptote‘, which means that the Signal to Noise Raito (SNR) will continue to improve with more frames, but by ever decreasing amounts making it practically pointless to continue too far.  This ties in nicely with the visual images above, in that we can see the pattern developing early on, but as we add more and more frames, it becomes very hard to see any improvement.


You can ignore the bump in the graph at 80 frames; if I had done more intermediate stacks with different numbers of frames the curve would have been smoother.  In fact the noise in the master bias frame is proportional to the number of bias frames stacked.  You can plot the SNR improvement (ΔSNR) of stacking one more frame as ΔSNR = √ n – √ (n -1) where n is the number of bias frames.  I’ve plotted this below so you can see the direct link between theory and empirical evidence:

Improvement in SNR as a Function of Subs

(My thanks to Ouroboros of SGL for pointing out this relationship).

I have used my 330 frame master bias for subsequent processes since I already have it. Realistically I could have stopped somewhere around 180 frames and it would not have made much difference to the end result.  It is worth stacking a large bias frame as:

  • The bias is used most often during calibration and therefore has the most opportunities to contribute noise to the final image.
  • It doesn’t take long to make a bigger bias.  I estimate it would take me about two hours to create a master bias of 50 frames, but only two and half hours to create a 300 frame master.

Making the Master Bias

The next question is how do we stack a big master bias in PixInsight?  I have followed the standard PI tutorials on this, but there are a couple of wrinkles to point out.

Firstly you should convert all your CR2 (Canon RAW) files to FITS files before you start the stacking process.  This does not alter the content of the images, but PI is able to read FITS files in to memory progressively (in bite-sized chunks), whereas it has to load the whole RAW file in one gulp.  When stacking several hundred frames, you will rapidly run out of memory on a typical PC and things will grind to a halt as the computer frantically swaps real memory to disk and back again.  You do this using the BatchFormatConversion script as follows:

BatchFormatConversion Script Settings

Just select all your bias frames and output them as FITS files.  Easy.

The next step is to stack the frames using the ImageIntegration process.  I just followed the recommended PI settings for making a master bias as shown below.

ImageIntegration Settings for Stacking a Master Bias
The main tip here is to follow the settings I have shown above but to adjust the ‘Buffer Size’ and ‘Stack Size’ values to match your PC’s memory constraints.  I went for a 4MB buffer and 2GB Stack size after a bit of trial and error.  These are smaller than the PI defaults and worked okay for me (the point is not to go for really big values otherwise you will end up swapping memory to disk eventually and the system will grind to a halt).  I should probably have selected ‘Close previous images’ as well but didn’t need to with these settings.
 
Finally I just saved the master bias that was generated as a FITS for use in subsequent processes.  You really only have to do this task once as you can re-use the master bias for all your images in future unless there is some significant change in your camera response.
 
In the next instalment I will look at improving the master bias even further, before moving on to dark frames.

2 Responses to PixInsight DSLR Workflow – Part 1a, Bias Frames

  1. mark casto 18th September 2013 at 09:13 #

    Very helpful and interesting thank you.

  2. paul howard 1st October 2013 at 21:34 #

    superb. cheers for sharing. another 1 for my favs!

Leave a Reply