Flat Fields S. Eikenberry Obs Tech 23 Sep 2014
Review median combination Basic algorithm: Read in im1, im2, im3,, im9 Loop over 1 array dimension, index i Loop over 2 nd dimension, index j imf(i,j)=median([im1(i,j), ([i im9(i,j)]) Write imf w/modified header
Now what? Median-combined Sky frames contain all effects except star flux, cosmic rays Subtracting it removes all effects except those that multiply the star flux (and CRs) How do we get rid of the multiplicative factors? 2 parts: relative and absolute calibration Relative calibration Flat fields
What s a flatfield? A flatfield is an image which contains the normalized photon response of the instrument. Huh? Each pixel in a flatfield image has the value of the relative response of that pixel to a uniform source of light includes relative g, QE, etc. Divide by the flatfield flatten the image
How do you make a flatfield? First, get a uniform source of light One possibility sky (sans stars) Another possibility dome lamp and flatfield screen We ll discuss the screen first
Dome flats - I Take multiple exposures of dome screen illuminated by lamp (why multiple?) Take multiple exposures with cold shutter closed (why cold shutter?), same integration time Median combine each lamp and dark frames
Lamp and Dark frames Dark frame Lamp frame
Difference Image Dif = Lamp Dark What info does dif contain? Why is it a flatfield?
Dome Flats - II We now need to normalize the image This simplifies comparison to other images downstream doesn t shift the overall level of the image How? Divide by its median Flat = Dif / median(dif)
Flatfield normalization It s not always so simple Here, only part of the array is illuminated (called vignetting ) Need to select the illuminate portion imf(x1:x2,y1:y2) and calculate its median
Dome flats another approach Another way lamp_ on lamp_ off (versus lamp_on dark_frame) Why? Stray light may contaminate lamp_on but not dark_frame contaminates flatfield Stray light contributes to lamp_off as well subtracts out, and thus removed from flatfield But in K-band, no lamp used (why?)
Sky Flats - Motivation Dome flats are OK, and can do any time but dome screen is not perfectly smooth and not uniformly illuminated not a perfectly flat light source Twilight sky uniform illumination overall; sky is flat But stars there, and need the right light level (daytime saturates, nighttime dim)
Sky Flats How? Point telescope at fixed position in the sky (no tracking) Take exposures as twilight occurs (evening high-to-low flux; morning reverse) Multiple exposures at different light levels subtraction removes all but sky flux (and star flux) Divide each difference image by its own median several flats (and stars) Median-combine these proto-flats removes stars (ala dithering)
Flatfields How much is enough? Flatfielding error contributes to flux measurement error need to control it Equation on board for Poisson difference If we want flat <1% per pixel, need S/N>100 Therefore
Cosmic Rays, Dead Pixels, Hot Pixels (Oh, My!)
Physical Processes: Cosmic Rays: They're everywhere! (illustrate) Ionize semiconductor sites fills wells, saturates amplifier Typically single-pixel or lines; time-variable Hot pixels: High (often variable) ID Due to structural defects Dead pixels: 0% QE Broken electronic connection (often In bump bond)
Cosmic Rays Often (not always) multiple pixels Usually saturated pixels Charge may "bleed" into neighboring pixels (charge transfer in multiplexer)
Pick out CRs and isolated ltdbps by comparison to their neighbors (more later) But, BPs often come in clusters What to do? Bad Pixels
Flagging Dead Pixels Flat field image has pixel gain*qe product Dead pixel has low QE shows up as low value in flat field Flag all pixels with flat<0.1 gets dead pixels j = where(flat le 0.1) flat2=fltarr(1024,1024) flat2(j)=1.0
Flat Versus Dead Pixel Map
Ui Using the Dead dpixel lmap If pixel is isolated, we want to interpolate over it replace with median of its neighbors in a given frame (sky, target, etc.) If pixel is not isolated, hard to extract info flag it as "bad" in future analysis Thus, we generate a "Skip pixel map" Loop over flat2(i,j) If n_elements(where(flat2(i elements(where(flat2(i-1:i+1,j-1:j+1) eq 1.)) gt 1 then skip pixel
Isolated Bad Pixels Including cosmic rays (time-variable badness) Identify by comparison to neighbors Loop over im(i,j) Calculate median, std. dev. of pixel+neighbors & look for points >+5 or <-5 from median (why median instead of average?) If found, replace im(i,j) with median of its ou d, ep ace (,j) w t ed a o ts neighbors
Not-quite-isolated isolated Bad Pixels Example: CR line We want to use these pixels via interpolation Bur, simple scheme gives large std. dev. misses the "lesser evil" [illustrate] Solution: do multiple passes for bad pixels (say 3?) First pass gets big spike; second gets smaller spikes; third does final cleanup
Bad Pixel Removal (Review of Processing Steps)