; NAME: ; BADPIXVAL ; ; PURPOSE: ; Returns a bad pixel frames with bad pixels having nonzero values ; ; CALLING SEQUENCE: ; Result = BADPIXVAL (badmask, maxval) ; ; INPUTS: ; Badmask = The bad pixel mask ; Maxval = The maxium value to use for bad pixel values ; ; OUTPUT: ; Returns a frame with bad pixel values calculated by raising the ; maxval to a uniform random power between 0 and 1, or a very low val ; ; PROCEDURE: ; Get the locations of the bad pixel values, chose a set fraction ; of them to be low values, and return a frame with low values ; set to 0, and high values linearly distributed ; less than maxval ; ; MODIFICATION HISTORY: ; created Jun 14 2003 by John Dermody function badpixval, badmask, maxval ; make bad pixels badframe = 1. - float(badmask) badloc = where(badframe eq 1) if (badloc eq [-1]) then return, badframe nbad = (size(badloc))[1] badframe[badloc] = randomu(seed, nbad) ; frequency of lows flow = 0.25 lowloc = where(badframe[badloc] lt flow) if (lowloc ne [-1]) then lowloc = badloc[lowloc] nlow = (size(lowloc))[1] highloc = where(badframe[badloc] gt flow) if (highloc ne [-1]) then highloc = badloc[highloc] nhigh = (size(highloc))[1] ; dead pixels if (nlow ne 0) then begin badframe[lowloc] = 0. endif ; gauss related to rdnoise if (nhigh ne 0) then begin badframe[highloc] = maxval * (randomu(seed, nhigh)) endif return, badframe end