| 1 |
! @(#)ccdillum.prg 19.1 (ESO-DMD) 02/25/03 14:16:00 |
| 2 |
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 3 |
!.COPYRIGHT (C) 1992 European Southern Observatory |
| 4 |
!.IDENT ccdillum.prg |
| 5 |
!.AUTHOR Rein H. Warmels, ESO-Garching |
| 6 |
!.KEYWORDS Direct imaging, CCD package |
| 7 |
!.PURPOSE Do the illumination 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(7) |
| 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_ILFRM} IMA "Enter illumination 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(7)} .EQ. 1 THEN |
| 31 |
WRITE/OUT - |
| 32 |
"{P1}: *** WARNING: Illum. correction was applied; nothing done ..." |
| 33 |
RETURN |
| 34 |
ENDIF |
| 35 |
ENDIF |
| 36 |
! |
| 37 |
! *** check illumination frame for its descriptors; return on errors |
| 38 |
IF M$EXIST("{P3}.bdf"} .EQ. 0 THEN |
| 39 |
WRITE/OUT "{P1}: *** ERROR: Illum. correction {P3} doesn't exist ..." |
| 40 |
RETURN |
| 41 |
ENDIF |
| 42 |
IF IL_TYP .NE. "*" .AND. IL_TYP .NE. "?" THEN |
| 43 |
IF M$EXISTD(P3,EXP_DESC) .EQ. 1 .AND. - |
| 44 |
"{{P3},{EXP_DESC}}" .NE. "{IL_TYP}" THEN |
| 45 |
WRITE/OUT - |
| 46 |
"{P3}: *** ERROR: Exposure descriptor {EXP_DESC} has wrong type" |
| 47 |
RETURN |
| 48 |
ENDIF |
| 49 |
ENDIF |
| 50 |
! |
| 51 |
IF M$EXISTD(P3,"MKILLUM") .EQ. 0 THEN |
| 52 |
WRITE/OUT "{P3}: MKILLUM Illumination flag missing in descriptor" |
| 53 |
RETURN |
| 54 |
ENDIF |
| 55 |
IF M$EXISTD(P3,"ILLUMSCALE") .EQ. 1 THEN |
| 56 |
CCDILLUM = {{P3},{ILLUMSCALE}} |
| 57 |
ELSE |
| 58 |
@s ccdmean {P3} |
| 59 |
IF M$EXISTD(P3,"CCDMEAN") .EQ. 1 THEN |
| 60 |
CCDILLUM = {{P3},CCDMEAN} |
| 61 |
ELSE |
| 62 |
CCDILLUM = 1.0 |
| 63 |
ENDIF |
| 64 |
ENDIF |
| 65 |
! |
| 66 |
! *** do the actual work |
| 67 |
COMPUTE/IMAGE {P2} = {P1}*{CCDILLUM}/{P3} |
| 68 |
WRITE/DESCR {P2} CCDSTAT/I/7/1 1 ! illum. correction done |
| 69 |
WRITE/DESCR {P2} HISTORY/C/-1/80 "ILLUM/CCD {P1} {P2} {P3} |
| 70 |
IF VERBOSE(1:1) .EQ. "Y" THEN |
| 71 |
STATISTIC/IMAGE {P2} {IM_SEC} ? ? FF ! full statistics |
| 72 |
ELSE |
| 73 |
STATISTIC/IMAGE {P2} {IM_SEC} ? ? FX ! short statistics |
| 74 |
ENDIF |
| 75 |
! |
| 76 |
RETURN |
| 77 |
|
| 78 |
|
| 79 |
|