| 1 |
! @(#)ccdflat.prg 19.1 (ESO-DMD) 02/25/03 14:15:59 |
| 2 |
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 3 |
!.COPYRIGHT (C) 1992 European Southern Observatory |
| 4 |
!.IDENT ccdflat.prg |
| 5 |
!.AUTHOR Rein H. Warmels, ESO-Garching |
| 6 |
!.KEYWORDS Direct imaging, CCD package |
| 7 |
!.PURPOSE Do the correction for flat field |
| 8 |
!.VERSION 920731 RHW Creation |
| 9 |
!.NOTE The procedure checks if the operation was already done |
| 10 |
!. by checking the descriptor CCDSTAT(6) |
| 11 |
!. Other CCDSTAT descriptor values |
| 12 |
!. CCDSTAT(1) for overscan correction |
| 13 |
!. CCDSTAT(2) for trimming the frame |
| 14 |
!. CCDSTAT(3) for bad pixel correction |
| 15 |
!. CCDSTAT(4) for bias subtraction |
| 16 |
!. CCDSTAT(5) for dark current subtraction |
| 17 |
!. CCDSTAT(6) for flat fielding |
| 18 |
!. CCDSTAT(7) for illumination correction |
| 19 |
!. CCDSTAT(8) for fringing correction |
| 20 |
!------------------------------------------------------- |
| 21 |
DEFINE/PARAM P1 ? IMA "Enter input frame: " |
| 22 |
DEFINE/PARAM P2 ? IMA "Enter output frame: " |
| 23 |
DEFINE/PARAM P3 {SC_FFFRM} IMA "Enter flat frame: " |
| 24 |
! |
| 25 |
! *** check if frame has already be flatfielded |
| 26 |
IF M$EXISTD(P1,"CCDSTAT") .EQ. 0 THEN |
| 27 |
WRITE/OUT "{P1}: *** WARNING: No check on CCD reduction status possible" |
| 28 |
WRITE/DESCR {P1} CCDSTAT/I/1/10 0 ALL |
| 29 |
ELSE |
| 30 |
IF {{P1},CCDSTAT(6)} .EQ. 1 THEN |
| 31 |
WRITE/OUT "{P1}: *** WARNING: Flat field was applied; nothing done ..." |
| 32 |
RETURN |
| 33 |
ENDIF |
| 34 |
ENDIF |
| 35 |
! |
| 36 |
! *** check existence of flat field and descriptors; return on errors |
| 37 |
IF M$EXIST("{P3}.bdf"} .EQ. 0 THEN |
| 38 |
WRITE/OUT "{P1}: *** ERROR: Flat field {P3}.bdf doesn't exist ..." |
| 39 |
RETURN |
| 40 |
ENDIF |
| 41 |
IF FF_TYP .NE. "*" .AND. FF_TYP .NE. "?" THEN |
| 42 |
IF M$EXISTD(P3,EXP_DESC) .EQ. 1 .AND. - |
| 43 |
"{{P3},{EXP_DESC}}" .NE. "{FF_TYP}" THEN |
| 44 |
WRITE/OUT - |
| 45 |
"{P3}: *** ERROR: Exposure descriptor {EXP_DESC} has wrong type" |
| 46 |
RETURN |
| 47 |
ENDIF |
| 48 |
ENDIF |
| 49 |
! |
| 50 |
DEFINE/LOCAL CCDFLAT/R/1/1 0 |
| 51 |
IF M$EXISTD(P3,"CCDMEAN") .EQ. 0 THEN |
| 52 |
STATISTIC/IMAGE {P3} {IM_SEC} ? ? SN ! get the mean |
| 53 |
COPY/KD OUTPUTR/R/3/1 {P3} CCDMEAN/R/1/1 ! store in descriptor |
| 54 |
ENDIF |
| 55 |
CCDFLAT = {{P3},CCDMEAN} |
| 56 |
IF CCDFLAT .LE. 0 THEN |
| 57 |
CCDFLAT = 1.0 |
| 58 |
ENDIF |
| 59 |
! |
| 60 |
! *** do the work |
| 61 |
COMPUTE/IMAGE {P2} = {P1}*{CCDFLAT}/{P3} |
| 62 |
WRITE/DESCR {P2} CCDSTAT/I/6/1 1 ! correction done |
| 63 |
WRITE/DESCR {P2} HISTORY/C/-1/80 "FLAT/CCD {P1} {P2} {P3} |
| 64 |
IF VERBOSE(1:1) .EQ. "Y" THEN |
| 65 |
STATISTIC/IMAGE {P2} {IM_SEC} ? ? FF ! full statistics |
| 66 |
ELSE |
| 67 |
STATISTIC/IMAGE {P2} {IM_SEC} ? ? FX ! short statistics |
| 68 |
ENDIF |
| 69 |
! |
| 70 |
RETURN |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|