Mosaic data has a default set of bad pixel masks, which include the gaps between chips, and not much else. The location of these bad pixel masks can be inferred from the raw data headers; likely they are somewhere in mscdb$noao/CCDMosaThina/CALXXXX (KPNO) or mscdb$noao/Mosaic2/CALXXXX/bpm. What we do is copy these into local files "bpnkpno1.pl", "bpnkpno2.pl", etc., and then modify them painfully by hand.
We begin by dividing a short exposure by a long exposure dome flats, and
displaying the results with the default bad pixel map overlayed.
We then identify bad columns and rows and update the bad pixel maps
accordingly, using "imreplace", i.e.,
imreplace bpnkpno1.pl[431:431,3631:3631] 1. (to indicate a bad pixel) and
imreplace bpnkpno2.pl[1354:1354,1:4096] 1. (to indicate a bad column)
Now, we need to make sure that we actually will USE these bad pixel masks:
hedit *.fits BPM bpnkpno1.pl veri- show+
hedit *.fits BPM bpnkpno2.pl veri- show+
hedit *.fits BPM bpnkpno3.pl veri- show+
hedit *.fits BPM bpnkpno4.pl veri- show+
hedit *.fits BPM bpnkpno5.pl veri- show+
hedit *.fits BPM bpnkpno6.pl veri- show+
hedit *.fits BPM bpnkpno7.pl veri- show+
hedit *.fits BPM bpnkpno8.pl veri- show+