boxflat.pro in IDL



Calling sequence : boxflat, flatinput, cleanlist=cleanlist

CLEANLIST >>> name of image list file. Defalut is "clean.list"

FLATINPUT >>> name of input specification file.
	Defalut is "flat.input" and there are many sample flat.input in
		!DEEPHOME/cleaning
	One can mark comment to be ignored by preceeded by ";". Blank
	lines or the order of lines make no difference. 
	It is deciphered by sxpar.pro which is a FITS header decipher
	routine. The first 8 characters are keyword field and next one
	character is "=" and actually doesn't matter. The tenth charater
	is the beginning of input value and a few blank spaces are OK.
EXAMPLE)
gain    =  2.5	;>>>> OK
gain     2.5	;>>>> OK
gain = 2.5	;>>>> not OK

	If a particularular input line is missing it is defaulted to be
	zero. The flatinput file should contain lines like these;
	(Upper case marks more important entries here)

FLATFILE= jan1294intrflat.fts   ; name of flatfield image

FLATREAD= 1	;  1 >>> above image is already made so read it
		;  0 >>> make new superflat to be named as above
		; -1 >>> already FLATFIELED and surface it now!
		;	( -1 assumes sky constant is already subtracted)
		; -2 >>> FLATFIELED BY OUTSIDERS and surface it now
		;	( -2 assumes sky constant is not subtracted)
		; -3 >>> NOT FLATFIELED, just surface raw image

FILTERTP= 5	; our database convention of fitertype
		;  7 >>> Z
		;  6 >>> I
		;  5 >>> R
		;  4 >>> V
		;  3 >>> B
		;  2 >>> U
		;  1 >>> Custom ?
		;  0 >>> unknown ?

mix_filt= 0	;  0 = False >>> False i.e, make sure that all of same
		;	filter type (Default)
		;  1 = True  >>> different filters are allowed

DOMEFLAT= 0	;  0 = False >>> surfix for cleaned images is "csg"
		;  1 = True  >>> surfix for cleaned images is "dbs	


X_RANGE = [50,2000]		;[xstart1,xend1]
or
X_RANGE = [50,1000, 1050,2000]	;[xstart1,xend1, xstart2,xend2]
	;X index range (inclusive) of real image region
	
Y_RANGE = "the same rule as X_RANGE above"
	; Actual cleaned images and flatfield are no longer trimed
	; at the edge by additional "rad" pixels.


maskfile= ssomask.fts	; name of mask image. This mask image must have values
			;1 for good region and 0 for junk region)
			; needed so far only for circurlar image like sso

BIASMD00= ****		; Only the first character counts
			;  o >>> overscan : use overscan portion of ccd
			;  u >>> uniform  : use a uniform constant value
			;  a >>> special case of bias already taken care of
;Depending on the above choise, appropriate lines are needed
OVRSCN00= [10,15,45,974]	; [xstart,xend,ystart,yend] of overscan region
;or
BIAS__00= 935.0		; bias level to be subtracted
RONOIS00= 4.5		; sigma of read-out noise 

;if there are multiple sections (see X_RANGE or Y_RANGE) then specify others
OVRSCN01= ****, OVRSCN11= ****, .....
;and
FACTOR  = [1.05, 1.0, 1.05]	;extra multiplicative factors to be used on
				;other regions 01, 10, 11 relative to region
				;00 (defualt is 1.0)


GAIN    = 2.4		; gain factor to get back to electrons
			; H (i.e., gain    = H) >>> use what's in the header
			; D >>> use the value in the database

WELLDEPT= 65000		; Saturation level on RAW images in ADU without
			; bias subtraction. This needs to be check by
			; hand to make sure all the images are same in
			; using BZERO (and BSCALE) of the FITS header.

SURFBOX = 100		; boxsize of surfacing interpolation
			; To be passed to EDGSURFACE.PRO keyword BOXSIZE
			; It needs some tuning so pay extra attention

SURFDIFF= 2         ; To be passed to EDGSURFACE.PRO keyword DIFFERENCE
SURFDILE= 2         ; To be passed to EDGSURFACE.PRO keyword DIALTE

FRINGE  = oct596whtRfringe.fts		; name of fringe pattern file to be
			;subtracted before surfacing. This pattern should be centered on 0
			;and normalized for images of sky value of 10000

ROTATION= 0		; input for IDL rotate funtion to make final image in
			; the same orientaion as INT (North down, East left)
			; [final = rotate(original,rotation)]

rawstr  = raw	; These three keys are to name output images from input images
csgstr  = csg	; Defaults are raw, csg(dbs), cln(dln)
clnstr  = uns	; depending on domeflat value

writ_csg= 1		; 1 = True >>> Do write out surfaced image
			; 0 = False >>> Do not write out surfaced image
writ_cln= 0		; Similar for unsurfaced image. (We usually do not want
			; cln images)

inputdir= /home/astro5/deepsearch/int/		; Directory for input images
			;if not specified, it assumes input images are in one of our
			;image dirrectorys (/home/astro??/deepsearch/) 

outdir  = /home/astro5/deepsearch/int/		; Directory for output images
			;if not specified, cleaned images are sent to the first available
			;image dirrectory (/home/astro??/deepsearch/)
			;If specified, all the outputs to this directory are overwriting
			;files of the same name.

overwrit= 1		; 1 = True >>> When ouput image is written out overwrite
			; 	existing file to avoid multiple files of the
			;	same name.
			; 0 = False >>> Do keep multiple files of the same name.
			;	(Not recommended)
			; this is mostly for when OUTDIR is not given.


		; Now some unlikely entries
skipsurf= 0		; 0 = False >>> Do perform surfacing (Default)
			; 1 = True >>> Skip surfacing

skyrecal= 0		; 0 = False >>> use nonzero database value for sky
			; 1 = True  >>> recalculate and overwrite database

rad     = 1		; Raduis in pixels for clipmean in making superflat
			; Here 0(missing) = 1
			; This affects the final image size in combination wtih
			; BOXFRAME above even if flatfield is already made.
clipsig = default	; use default clipmean sigma witdh of [3.5, 3.5] 
			; Recommandation: Use default)
iters    = 5		; iteration of clipmean (Recommandation: Use default 5)


This program assumes that flatfield are normalize to 10000.0 so if flatfield not
generated by this program is used, please make sure of normalization and image
size (BOXFRAME & RAD above)

Once FLATINPUT and CLEANLIST are set then boxflatprogram proceeds interactively
asking a few questions. Please pay attention to crutial parameters like GAIN,
SURFBOX and ROTATION.

During the final stage of cleaning it print to screen the ratio of expected sky
sigma vs. actual sigma of cleaned image. If everything went right, this ratio
should be around 1 (.9 ~ 1.3)


AFTER CLEANING : Keeping log for unusual or note worthy remarks
	Please make an plain text file named like jan2494int.cleanlog or append
	to it if exists. We are keeping these files in $DEEPHOME/logbooks/cleaning
	In these file one should put in any remarks that may be helpful later.
	(Don't forget data of processing, names of relevant images)
	For example:

	June 11, 1994  jan2494int101,105,110-115csg.fts
		SURFBOX was set to 50 instead of 75 since these were followup 
		images with a large object nearby. So it might cause depression
		of medium brightness objects
	or
	Jan. 12, 1995
		dec594sso110-130raw.fts	: BZERO = 0 causing valuses to go from
		-32768 to +32767 instead of 0 to 65535. So bias level is about
		-31800.
		

If there is any problem, let me know.  -Matthew Kim (Feb. 1995)