About bias and overscan
Contents
2.1. About bias and overscan¶
2.1.1. Sample bias images¶
The images below are a single bias frame and an average 100 bias frames from an Andor Apogee Aspen CG16M, a low-end 4k × 4k CCD with a Kodak KAF-16803 sensor chip. That model camera has a typical bias level around 1000 and read noise around 10 \(e^-\), though the precise value varies from camera to camera and with temperature.
%load_ext autoreload
%autoreload 2
%matplotlib inline
import matplotlib.pyplot as plt
# Use custom style for larger fonts and figures
plt.style.use('guide.mplstyle')
from astropy.nddata import CCDData
from astropy.visualization import hist
import numpy as np
from convenience_functions import show_image
one_bias = CCDData.read('single_bias_thermoelectric.fit.bz2', unit='adu')
one_hundred_bias = CCDData.read('combined_bias_100_images.fit.bz2', unit='adu')
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 one_bias = CCDData.read('single_bias_thermoelectric.fit.bz2', unit='adu')
2 one_hundred_bias = CCDData.read('combined_bias_100_images.fit.bz2', unit='adu')
File /usr/share/miniconda/envs/test/lib/python3.8/site-packages/astropy/nddata/mixins/ndio.py:59, in NDDataRead.__call__(self, *args, **kwargs)
58 def __call__(self, *args, **kwargs):
---> 59 return self.registry.read(self._cls, *args, **kwargs)
File /usr/share/miniconda/envs/test/lib/python3.8/site-packages/astropy/io/registry/core.py:197, in UnifiedInputRegistry.read(self, cls, format, cache, *args, **kwargs)
195 try:
196 ctx = get_readable_fileobj(args[0], encoding='binary', cache=cache)
--> 197 fileobj = ctx.__enter__()
198 except OSError:
199 raise
File /usr/share/miniconda/envs/test/lib/python3.8/contextlib.py:113, in _GeneratorContextManager.__enter__(self)
111 del self.args, self.kwds, self.func
112 try:
--> 113 return next(self.gen)
114 except StopIteration:
115 raise RuntimeError("generator didn't yield") from None
File /usr/share/miniconda/envs/test/lib/python3.8/site-packages/astropy/utils/data.py:271, in get_readable_fileobj(name_or_obj, encoding, cache, show_progress, remote_timeout, sources, http_headers)
266 if is_url:
267 name_or_obj = download_file(
268 name_or_obj, cache=cache, show_progress=show_progress,
269 timeout=remote_timeout, sources=sources,
270 http_headers=http_headers)
--> 271 fileobj = io.FileIO(name_or_obj, 'r')
272 if is_url and not cache:
273 delete_fds.append(fileobj)
FileNotFoundError: [Errno 2] No such file or directory: 'single_bias_thermoelectric.fit.bz2'
fig, (ax_1_bias, ax_avg_bias) = plt.subplots(1, 2, figsize=(30, 15))
show_image(one_bias.data, cmap='gray', ax=ax_1_bias, fig=fig, input_ratio=8)
ax_1_bias.set_title('Single bias image')
show_image(one_hundred_bias.data, cmap='gray', ax=ax_avg_bias, fig=fig, input_ratio=8)
ax_avg_bias.set_title('100 bias images combined');
2.1.1.1. Note a few things¶
The bias level in this specific camera is about 1023 (the mid-range of the colorbar).
The image is brighter on the left and right edges. This “amplifier glow” is frequently present and caused by the CCD electronics (photosensors with an applied voltage are LEDs).
There are several vertical lines; these are columns for which the bias level is consistently higher.
There is noticeable “static” in the images; that is read noise.
None of the variations are particularly large.
Combining several bias images vastly reduces the read noise. This example is a little unrealistic in that 100 bias images were combined, but it still illustrates the idea that combining images reduces noise.
2.1.2. Impact of combining images on noise¶
As discussed at length in the notebook on combination, the reason for taking and combining several calibration images is to reduce the noise if the images are used for calibration. The difference between a single image and a combination of images is apparent in the images above. Another way to see the impact of combining images is in the histogram of pixel values. Notice that the distribution of values is much narrower for the combined image than for a single bias. Pixels near the edges, where the amplifier glow is large, are binned separately from the rest of the pixels to emphasize the uniformity of the chip away from the glow.
plt.figure(figsize=(20, 10))
hist(one_bias.data[:, 15:-30].flatten(), bins=800, alpha=0.4, label='One bias', color='deepskyblue')
hist(np.concatenate((one_bias.data[:, :15].flatten(), one_bias.data[:, -30:].flatten())), bins=400, alpha=0.2, label='One bias (edges only)', color='lightskyblue')
#hist(, bins=800, alpha=0.2, label='One bias (edges only)', color='darkblue')
hist(one_hundred_bias.data[:, 15:-30].flatten(), bins=800, alpha=0.4, label='One hundred bias images', color='darkgreen')
hist(np.concatenate((one_hundred_bias.data[:, :15].flatten(), one_hundred_bias.data[:, -30:].flatten())), bins=800, alpha=0.4, label='One hundred bias images (edges only)', color='lightgreen')
#hist(one_hundred_bias.data[:, :15].flatten(), bins=800, alpha=0.4, label='One hundred bias images', color='darkgreen')
plt.grid()
plt.xlim(975, 1400)
plt.legend()
plt.xlabel('Pixel value')
plt.ylabel('Number of pixels')
plt.semilogy();
2.1.3. Bias calibration overview¶
The progression here is to “calibrate” the bias images by subtracting overscan, if desired, trim the overscan from the bias images if it is present, and combine all of the bias images to make a “combined” bias (another common term for these images is “master” bias and occasionally “super” bias).