pro example_calibration ; This is a little example program to demonstrate the standalone use ; of routines from the AMIE calibration pipeline to calibrate an AMIE ; image with the master flat and darks created from in-flight data. ; ; 2008-03-27, Bj"orn Grieger (ESA/SCI-OS) ; ; Minor updates in comments, ; 2010-04-05, Bj"orn Grieger (ESA/SCI-OS) ;*****************************************************************************; ;- Table of contents ;#TOC ;*****************************************************************************; ;- 1 Requirements ;- 1.1 Routines ;- 1.2 Master frames ;- 2 Read master frames ;- 2.1 Master dark bias frame ;- 2.2 Master dark current (slope) frame ;- 2.3 Master flat frame ;- 3 Read image to calibrate ;- 4 Calibrate image ;- 5 Rotate to REAL_WORLD orientation ;- 6 Display the result ;- 6.1 Create a window ;- 6.2 Display the image ;*****************************************************************************; ;- 1 ;# Requirements ;*****************************************************************************; ;=============================================================================; ;- 1.1 ;## Routines ;=============================================================================; ; Running this program requires the following routines: ; read_amie.pro ; calibrate_amie.pro ; create_log_entry.pro ; amie_getfilter.pro ; dark_frame.pro ; amie_gettemperaturfactor ; Additionally, the readpds routines from SBN are required. ; All these routines are provided in the DOCUMENT/IDL/ directory of each ; AMIE data set. ;=============================================================================; ;- 1.2 ;## Master frames ;=============================================================================; ; Three files are needed: ; - a master dark bias file, usually nammed like ; AMI_CMA_??????_?????_00000.IMG ; - a master dark current (slope) file, usually named like ; AMI_CMA_??????_?????_00001.IMG ; - a master flat file, usually named like ; AMI_CMA_??????_?????_XXXXX.IMG ; These files are provided in the CALIB/ directory of each AMIE data set. ;*****************************************************************************; ;- 2 ;# Read master frames ;*****************************************************************************; ;=============================================================================; ;- 2.1 ;## Master dark bias frame ;=============================================================================; master_bias = read_amie( '/home/bgrieger/MOON/SMART-1/AMIE/FLATS/tmp/' + $ 'AMI_CMA_071101_00001_00000.IMG', $ bias_label, orientation = 'CCD_FRAME' ) ;=============================================================================; ;- 2.2 ;## Master dark current (slope) frame ;=============================================================================; master_slope = read_amie( '/home/bgrieger/MOON/SMART-1/AMIE/FLATS/tmp/' + $ 'AMI_CMA_071101_00002_00001.IMG', $ slope_label, orientation = 'CCD_FRAME' ) ;=============================================================================; ;- 2.3 ;## Master flat frame ;=============================================================================; master_flat = read_amie( '/home/bgrieger/MOON/SMART-1/AMIE/FLATS/tmp/' + $ 'AMI_CMA_080319_00001_XXXXX.IMG', $ flat_label, orientation = 'CCD_FRAME' ) ;*****************************************************************************; ;- 3 ;# Read image to calibrate ;*****************************************************************************; raw_file = '/home/bgrieger/MOON/SMART-1/AMIE/distribution/' + $ 'S1-L-X-AMIE-2-EDR-RAW-V0.3.1/ORBIT_002821/' + $ 'AMI_LE1_R02821_00039_00021.IMG' ;raw_image = read_amie( '/home/bgrieger/MOON/SMART-1/AMIE/distribution/' + $ ; 'SELECTION/SUB/AMI_LE3_R00590_00024_00011.IMG', $ raw_image = read_amie( raw_file, $ raw_label, orientation = 'CCD_FRAME' ) ; The raw image should be version 0.3.0 or higher, earlier versions do ; have less accurate or even missing temperatue values in the labels ; (this refers to the internal versioning before publication; all ; versions published by the PSA should be fine). ;*****************************************************************************; ;- 4 ;# Calibrate image ;*****************************************************************************; logname = initialize_log('AMIE_pipeline_') calibrated_image = calibrate_amie( raw_label, raw_image, $ logname=logname, $ master_bias = master_bias, $ master_slope = master_slope, $ master_flat = master_flat ) ; While the master frames and the raw_image are structures containing also ; the browse image, the calibrated_image is an array containing only ; the real image ;*****************************************************************************; ;- 5 ;# Rotate to REAL_WORLD orientation ;*****************************************************************************; ; We have operated in CCD_FRAME orientation. To obtain REAL_WORLD ; orientation, we apply a respective rotation. calibrated_image = rotate( rotate( calibrated_image, 1 ), 4 ) ;*****************************************************************************; ;- 6 ;# Display the result ;*****************************************************************************; ;=============================================================================; ;- 6.1 ;## Create a window ;=============================================================================; window, 0, retain=2, xsize=512, ysize=512 ;=============================================================================; ;- 6.2 ;## Display the image ;=============================================================================; tvscl, calibrated_image end