!------------------------------------------------------------------------ ! E.S.O. - VLT project ! ! "@(#) $Id: help_emmi.prg,v 2.3+ 2003/11/15 01:29:20 vltsccm Exp $" ! ! EMMI quick look context, module nttplemmi ! ! usage: ! EMMI/SPECTRO ! or ! @@ emmi_quickred ! syntax: @@ quickred inframe outframe mode(BLUE/RED) [masterflat] [masterwave] [extmode] [snr] ! ! if a masterflat is not given, it will be taken from the archive (if ! exists) ! if a masterwavelength calibration is not given, it will be ! taken from the archive (if exists) ! extmode: interactive or hard-coded spectrum extraction ! snr: calculate S/N or nor; default is no ! ! author: E. Pompei ! ! Purpose: does a quick and dirty ! spectra reduction, provided ! that a wavelength solution and ! master calibration frames ! exist. ! ! ! Requires: ! inemmi.prg ! ! who when what ! --------- -------- ---------------------------------------------- ! ohainaut 2004-08-19 changed outimage name to variable ! ohainaut 2004-08-04 renamed emmi_quickred.prg; fixed logical structure ! epompei 2004-07 Third revision ! epompei 2004-02 Second revision ! epompei 2004-03 Major revision: single line command ! epompei 2003-09 First creation !----------------------------------------------------------------------------- write/out "***********************************" write/out "* MIDAS PROCEDURE QUICKRED *" write/out "***********************************" write/out write/out "A bias frame and a guess session" write/out "for wavelength calibration should be" write/out "available in the specified directory" write/out "The input frames must be in .bdf format" write/out write/out "These are the master flats available" $ ls /data/NTTOPS/pipeline_database/EMMI/master_flats/README_flats write/out "These are the master arcs available" $ ls /data/NTTOPS/pipeline_database/EMMI/master_arcs/README_arcs define/local x/r/1/1 1.0 define/local x1/r/1/1 1.0 define/local x2/r/1/1 1.0 define/local readmode/c/1/4 xxxx define/local speedmode/c/1/3 100 define/local modo/c/1/4 xxxx define/local o1/i/1/1 1 define/local o2/i/1/1 1 define/local skl1/i/1/1 1 define/local skl2/i/1/1 1 define/local sku1/i/1/1 1 define/local sku2/i/1/1 1 define/local window/i/1/1 1 define/local wchar/c/1/72 xxxx define/local wint/i/1/1 2. define/local grism/i/1/1 1 define/local bin/i/1/1 2 $ ls *.fits defi/par p1 ? ? "Please type the name of the 2D spectra (no extension)" defi/par p2 ? ? "Please type the name of the output spectra (no extension)" defi/par p3 ? ? "Please type the mode you are using" defi/par p4 masterflat1 ? ! masterflat: if not given, from DB defi/par p5 grism2_new ? ! masterwave: if not given, from DB defi/par p6 0 ? "Extragalactic mode?(Yes=1; No=0)" defi/par p7 0 ? "S/N estimate? (Yes=1; No=0)" defi/loc outima/c/1/72 xxx if p3 .EQ. "BLUE" then !============================================================================== ! ! ! BLUE ! ! !============================================================================== !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! Begin of spectra reduction: BLMD, REMD, RILD !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! Blue arm: needs master flat and wavelength !! calibration in the afternoon. !! The name of the calibration session goes in !! parameter p5 !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BLUE: indisk/fits {p1} {p2} outima = "{p2}" ! bias database for the Blu Arm ! name=bias ! 1=1x1; 2=2x2 ! values from EMMI CCD page 2003-11-25 ! Ampl. B for Red; chip 1x1 blue define/local biasBLUEslow/r/1/1 572. define/local biasBLUEnorm/r/1/1 564. copy/dk {outima} ESO.DET.READ.MODE readmode define/local bias/r/1/1 0. bias = biasBLUE{readmode} comp/ima {outima}_bb = {outima}-{bias} ! read the grating from the descriptor write/out "This is the grating you are using:" read/descr {outima} ESO.INS.GRAT2.NAME ! trimming: extr/ima {outima}_extr = {outima}_bb[@50,@275:@1075,@827] ! flat-fielding comp/ima {outima}_ff = {outima}_extr/{p4} ! set-up the long context set/con long init/long {p5} set/long skymod=1 set/long extmtd=linear **************************************************** ! Extragalactic or interactive extraction **************************************************** if {p6} .EQ. Y then load/ima {outima}_ff sc=fu cuts=f,i write/out "Click on the bottom and top of the object" write/out "Exit with middle mouse button" get/curs ogg ? ? 2,1 o1 = {ogg.tbl,:Y_coordpix,@1} o2 = {ogg.tbl,:Y_coordpix,@2} set/long object={o1},{o2} write/out "Click on the bottom and top of skyregion below the object" write/out "Exit with middle mouse button" get/curs skyl ? ? 2,1 skl1 = {skyl.tbl,:Y_coordpix,@1} skl2 = {skyl.tbl,:Y_coordpix,@2} set/long lowsky={skl1},{skl2} write/out "Click on the bottom and top of skyregion above the object" write/out "Exit with middle mouse button" get/curs skyu ? ? 2,1 sku1 = {skyu.tbl,:Y_coordpix,@1} sku2 = {skyu.tbl,:Y_coordpix,@2} set/long uppsky={sku1},{sku2} skyfit/long {outima}_ff sky comp/ima {outima}_ss = {outima}_ff-sky goto extraction endif **************************************************** ! Hard coded extraction (ok for stellar objects) **************************************************** load/ima {outima}_ff sc=fu cuts=f,i write/out "Click on the bottom and top of skyregion below the object" get/curs skyl ? ? 2,1 skl1 = {skyl.tbl,:Y_coordpix,@1} skl2 = {skyl.tbl,:Y_coordpix,@2} set/long lowsky={skl1},{skl2} write/out "Click on the bottom and top of skyregion above the object" get/curs skyu ? ? 2,1 sku1 = {skyu.tbl,:Y_coordpix,@1} sku2 = {skyu.tbl,:Y_coordpix,@2} set/long uppsky={sku1},{sku2} skyfit/long {outima}_ff} sky comp/ima {outima}_ss = {outima}_ff-sky ! object extraction ave/colu {outima}_profile = {outima}_ss set/gra pmode=1 set/gra color=1 set/gra ltype=1 plot {outima}_profile write/out "Center the star" center/gauss gcurs comp/key window = 3*{OUTPUTR(5)}/2 comp/key o1 = {OUTPUTR(3)}-{window} comp/key o2 = {OUTPUTR(3)}+{window} extraction: ave/row {outima}_1D = {outima}_ss {o1},{o2} SUM rebin/long {outima}_1D {outima}_reb !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! end of BLMD !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! else !============================================================================== ! ! ! RED ! ! !============================================================================== RED: @@ inemmi {p1} {p2} outima = outputc @@ check_file {outima} .bdf check naked outima = outputc ! bias database for the Red Arm ! name=bias ! 1=1x1; 2=2x2 ! values from EMMI CCD page 2003-11-25 ! Ampl. B for Red; chip 1x1 blue define/local biasRed100/r/1/1 288. define/local biasRed225/r/1/1 340. ! get the binning copy/dk {outima} ESO.DET.WIN1.BINY bin if {bin} .EQ. 1 then write/out "No calibration frames with binning=1!" write/out "Use fcombEMMI.prg to build a masterframe" write/out "and long context to get a wavelength solution!!" write/out "Once this is done, reduce with @@ quickred_bin1" goto end endif copy/dk {outima} ESO.DET.READ.SPEED speedmode define/local bias/r/1/1 0. bias = biasRed{speedmode} comp/ima {outima}_bb = {outima}-{bias} modo = "{{outima},ESO.INS.MODE}" write/out {modo} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! REMD: needs master flat and wavelength !! calibration in afternoon. !! The name of the calibration session goes !! in parameter p5 !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if modo .EQ. "REMD" then ! give the spectrum the right orientation and steps rot/clock {outima}_bb {outima}_rot write/descr {outima}_rot START 1.0,1.0 write/descr {outima}_rot STEP 2.0,2.0 ! read the grating from the descriptor write/out "This is the grating you are using:" read/descr {outima} ESO.INS.GRAT1.NAME ! trimming extr/ima {outima}_extr = {outima}_rot [@1,@520:@2049,@1036] ! flat-fielding comp/ima {outima}_ff = {outima}_extr/{p4} ! start context long and set it up properly set/con long init/long {p5} set/long skymod=1 set/long extmtd=linear if {p6} .EQ. 1 then !**************************************************** ! Extragalactic or interactive extraction !**************************************************** load/ima {outima}_ff sc=fu cuts=f,i write/out "Click on the bottom and top of the object" get/curs ogg ? ? 2,1 o1 = {ogg.tbl,:Y_coordpix,@1} o2 = {ogg.tbl,:Y_coordpix,@2} set/long object={o1},{o2} write/out "Click on the bottom and top of skyregion below the object" get/curs skyl ? ? 2,1 skl1 = {skyl.tbl,:Y_coordpix,@1} skl2 = {skyl.tbl,:Y_coordpix,@2} set/long lowsky={skl1},{skl2} write/out "Click on the bottom and top of skyregion above the object" write/out "Exit with middle mouse button" get/curs skyu ? ? 2,1 sku1 = {skyu.tbl,:Y_coordpix,@1} sku2 = {skyu.tbl,:Y_coordpix,@2} set/long uppsky={sku1},{sku2} skyfit/long {outima}_ff sky comp/ima {outima}_ss = {outima}_ff-sky else !**************************************************** ! Hard coded extraction (ok for stellar objects) !**************************************************** load/ima {outima}_ff sc=fu cuts=f,i write/out "Click on the bottom and top of skyregion below the object" !write/out "Exit with middle mouse button" get/curs skyl ? ? 2,1 skl1 = {skyl.tbl,:Y_coordpix,@1} skl2 = {skyl.tbl,:Y_coordpix,@2} set/long lowsky={skl1},{skl2} write/out "Click on the bottom and top of skyregion above the object" !write/out "Exit with middle mouse button" get/curs skyu ? ? 2,1 sku1 = {skyu.tbl,:Y_coordpix,@1} sku2 = {skyu.tbl,:Y_coordpix,@2} set/long uppsky={sku1},{sku2} skyfit/long {outima}_ff sky comp/ima {outima}_ss = {outima}_ff-sky ! object extraction ave/colu {outima}_profile = {outima}_ss set/gra pmode=1 set/gra color=1 set/gra ltype=1 plot {outima}_profile write/out "Center the star" center/gauss gcurs comp/key window = 3*{OUTPUTR(5)}/2 comp/key o1 = {OUTPUTR(3)}-{window} comp/key o2 = {OUTPUTR(3)}+{window} endif extraction: ave/row {outima}_1D = {outima}_ss {o1},{o2} SUM rebin/long {outima}_1D {outima}_reb endif !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! End of REMD !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! RILD.Takes the wavelength solution !! from calibration database. Just !! need to type the grism number !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if modo .EQ. "RILD" then ! set-up the correct orientation and start, steps rot/clock {outima}_bb {outima}_rot write/descr {outima}_rot START 1.0,1.0 write/descr {outima}_rot STEP 2.0,2.0 ! gets the grism name from image descriptor wchar = "{{outima},ESO.INS.GRIS1.NAME}" write/out "This is the grism you are using" {wchar} wint = {wchar(4:)} set/form i1 grism = {wint} write/out {grism} ! trimming extr/ima {outima}_extr = {outima}_rot [@1,@520:@2049,@1036] !on wg5off $cp /data/NTTOPS/pipeline_database//EMMI/master_flats/masterflat_grism{grism}.bdf . $cp /data/NTTOPS/pipeline_database/EMMI/master_arcs/grism_{grism}*tbl . ! on Mac: !get it from the disk ! flat-fielding comp/ima {outima}_ff = {outima}_extr/masterflat_grism{grism}.bdf ! start context long and set it up properly set/con long init/long grism_{grism} set/long skymod=1 set/long extmtd=linear if {p6} .EQ. 1 then !**************************************************** ! Extragalactic or interactive extraction !**************************************************** load/ima {outima}_ff sc=fu cuts=f,i write/out "Click on the bottom and top of the object" !write/out "Exit with middle mouse button" get/curs ogg ? ? 2,1 o1 = {ogg.tbl,:Y_coordpix,@1} o2 = {ogg.tbl,:Y_coordpix,@2} set/long object={o1},{o2} write/out "Click on the bottom and top of skyregion below the object" !write/out "Exit with middle mouse button" get/curs skyl ? ? 2,1 skl1 = {skyl.tbl,:Y_coordpix,@1} skl2 = {skyl.tbl,:Y_coordpix,@2} set/long lowsky={skl1},{skl2} write/out "Click on the bottom and top of skyregion above the object" write/out "Exit with middle mouse button" get/curs skyu ? ? 2,1 sku1 = {skyu.tbl,:Y_coordpix,@1} sku2 = {skyu.tbl,:Y_coordpix,@2} set/long uppsky={sku1},{sku2} skyfit/long {outima}_ff sky comp/ima {outima}_ss = {outima}_ff-sky else !********************************************************** ! Hard coded extraction parameters (ok for stellar objects) !********************************************************** load/ima {outima}_ff sc=fu cuts=f,i write/out "Click on the bottom and top of skyregion below the object" !write/out "Exit with middle mouse button" get/curs skyl ? ? 2,1 skl1 = {skyl.tbl,:Y_coordpix,@1} skl2 = {skyl.tbl,:Y_coordpix,@2} set/long lowsky={skl1},{skl2} write/out "Click on the bottom and top of skyregion above the object" !write/out "Exit with middle mouse button" get/curs skyu ? ? 2,1 sku1 = {skyu.tbl,:Y_coordpix,@1} sku2 = {skyu.tbl,:Y_coordpix,@2} set/long uppsky={sku1},{sku2} skyfit/long {outima}_ff sky comp/ima {outima}_ss = {outima}_ff-sky ! object extraction ave/colu {outima}_profile = {outima}_ss set/gra pmode=1 set/gra color=1 set/gra ltype=1 plot {outima}_profile write/out "Center the star" center/gauss gcurs comp/key window = 3*{OUTPUTR(5)}/2 comp/key o1 = {OUTPUTR(3)}-{window} comp/key o2 = {OUTPUTR(3)}+{window} endif ave/row {outima}_1D = {outima}_ss {o1},{o2} SUM rebin/long {outima}_1D {outima}_reb endif !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! end of RILD !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! endif ! if BLUE/RED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! Correction for extinction !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $cp /scisoft/midas/calib/data/spec/exti/atmoexan.tbl atmoexan.tbl copy/dk {outima}_reb ESO.TEL.AIRM.START x1 copy/dk {outima}_reb ESO.TEL.AIRM.END x2 x = (x1+x2)/2 write/out {x} extinct/long {outima}_reb {outima}_ext {x} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! Plot of the spectra and estimate of the S/N !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! crea/gra 1 600,400,400,400 set/gra pmode=1 set/gra xaxis=auto set/gra yaxis=auto plot {outima}_ext write/out "This is the reduced spectra!" write/out ! Signal-to-noise calculation (p7=1), skipped by default if {p7} .EQ. 1 then @@ emmi_snr.prg {outima}_ext copy/it endif write/out ".....that's it!" end: