%------------------------------------------------------------------------------
% $Id: cookbook.txt,v 1.3 2001/01/04 12:02:59 amodigli Exp $
% $Name:  $
% $Revision: 1.3 $
% $Log: cookbook.txt,v $
% Revision 1.3  2001/01/04 12:02:59  amodigli
% Added Id, Name, Revision, Log conf. control info
%
%------------------------------------------------------------------------------
========================================================================
 COOKBOOK PIPELINE UVES				  AKA,PBA,SWO 1999-12-20
========================================================================

Pipeline Machine:
----------------------------------------------------------
logon:

pipeline@wu2pl
passwd: USR.df

Pipeline Environment:
----------------------------------------------------------
Environment:
pipeline@wu2pl: env | grep DFS


DO:
----------------------------------------------------------
start DO
pipeline@wu2pl: cd
pipeline@wu2pl: startDO uves

stop DO 
<DO window> : Ctrl-C


RBS:
-----------------------------------------------------------
set to deliver all products:
pipeline@wu2pl: setenv DFS_PIPE_ALLPRODUCTS YES

clean reduction blocks directory
pipeline@wu2pl: cd $DFS_REDBLOCK/
pipeline@wu2pl: rm *

start:
pipeline@wu2pl: cd
pipeline@wu2pl: startRBS

start uves pipeline DRS
RBS: startDRS
RBS: drs @d pipeline.control display,,80 [overwrite]
RBS: drs ...
RBS: set auto=yes

other RBS commands:

start a reduction block manually
RBS:  exec $DFS_REDBLOCK/<rbname>.rb
enable hardcopies
RBS: drs hardcopy/plot on
do hardcopy
RBS: drs hardcopy/plot N,G <psname>.ps

stop RBS fro auto mode
pipeline@wu2pl: $DFS_HOME/RBS_X_autono.rb ~pipeline/dfs_redblock
or
pipeline@wu2pl: $DFS_HOME/RBS_X_autono.rb $DFS_REDBLOCK
or
pipeline@wu2pl: noautoRBS

end RBS
RBS: quit


Reduction blocks:
----------------------------------------------------------------

in $DFS_REDBLOCK:
.rb	before execution (prepared by DO, will be seen by RBS)
.rX	successfully executed
.rY,.rZ	failed RBs

to resubmit in automatic mode, 
mv <rbfilename>.rZ <rbfilename>.rb
otherwise 
RBS: exec $DFS_REDBLOCK/<rbname>.rZ


Raw Frames:
-----------------------------------------------------------------

DO polls for raw frames in $DFS_DO_RAW

submit to DO:
pipeline@wu2pl: cd $DFS_DO_RAW
pipeline@wu2pl: ln -s /data/raw/<date>/UVES_<name>.fits UVES_<name>.fits.link


Gasgano sessions:
-------------------------------------------------------------------
preferences are set in gasgano.prefs, for UVES use gasgano.prefs.UVES

pipeline@wu2pl: cd; gasgano

Shell Scripts:
/midas/99NOV/pipeline/uves/scripts/

Submit files to DO (raw but also e.g. new calibration solutions)

gasgano:  select files	
gasgano:  run uves_dosubmit.sh

Other shell script can be also started from gasgano uvesp@wu2pl


Standalone MIDAS  session:
---------------------------------------------------------------------
should run from uvesp account

uvesp@wu2pl
passwd: pipeline4ut2

uvesp@wu2pl: cd <workdir>
uvesp@wu2pl: inmidas -P
Midas:	@d pipeline.start
Midas:  @d pipeline.control display,,80 [overwrite]
Midas:  set/context uves /midas/99NOV/pipeline/context
Midas:  config/disp p3=0.8
Midas:	...


Pipeline working directories:
--------------------------------------------------------------------
pipeline@wu2pl: ~/tmp_00_pipe
directory is cleaned with every new RB


Calibration Database directory:
--------------------------------------------------------------------
Certified (should not be touched)
quality@wu2pl: /cal/ut2/uves/ech/cal/  

Check area (normally empty)
quality@wu2pl: /tcal/ut2/uves/ech/cal

To submit a file from check area to certified area:

quality@wu2pl: cd /tcal/ut2/uves/ech/cal
quality@wu2pl: cp <files> ./
quality@wu2pl: updateCalibDb *.*
quality@wu2pl: rm *

To remove files from calibDB:
quality@wu2pl: cd /cal/ut2/uves/ech/cal 
quality@wu2pl: rmFromCalibDb <filename>


Naming conventions for CalibDb:
--------------------------------------------------------------------
<detectors>	be	Blue EEV
		re	Red EEV
		rm	Red MIT
<binning>	1x1	(low gain)	VM
		2x2	(high gain)	VM
		1x2	(low gain)	SM
		2x3	(high gain)	SM
<dichroic>	d0	No Dic.
		d1	Dic1
		d2	Dic2
<wavelength>	NNN	Central Wavelength F3.0 [nm]
<slit>		sNN	Slit Length F2.0 [arcsec]


master bias:	mbs<detector><binning>.fits
DRS table:	drs<wavelength><dichroic><detector><binning>.tfits
Guess table:	gue<wavelength><dichroic><detector><binning>.tfits
Order table:	ord<wavelength><dichroic><detector><binning>.tfits
Background tab:	bkg<wavelength><dichroic><detector><binning>.tfits
Linetables 1:	lin<wavelength><dichroic><detector><binning>low.tfits
	   2:	lin<wavelength><dichroic><detector><binning>med.tfits
	   3:	lin<wavelength><dichroic><detector><binning>upp.tfits
master Flat:	mff<wavelength><dichroic><detector><binning><slit>.fits


Directories to clean:
---------------------------------------------------------------------
$DFS_REDBLOCK
/data/raw/
/data/reduced/



Preparation of Calibration Solutions
--------------------------------------------------------------------

Run as pipeline@wu2pl:

gasgano: select following set of files for one setup:

					  OBs to run on UVES
	orderdef			|
	formatcheck			| <mode>_tec.obd	

	flatfields			|
	wavelength calibration		| <mode>_cal.obd
	biases				|

	line table  thar_good2.tfits

gasgano: run uves_popul.sh

Product files are in ~/midwork/tmpwrk/data/

	bkg<>
	drs<>
	gue<>
	lin<>med
	lin<>low
	lin<>upp
	mff<>
	ord<>

Save results to a working directory
uvesp@wu2pl: cd noStandard
uvesp@wu2pl: cp ~/pipeline/midwork/tmpwrk/data/*.*fits ./


Usage for Non-Standard Settings in DO
--------------------------------------------------------------------

gasgano: select above <files>  and run	uves_dosubmit.sh
	 to submit to DO

	 select science frame in non-standard configuration
	 and run			uves_dosubmit.sh


Usage for Standard Settings in CalibDB
--------------------------------------------------------------------

quality@wu2pl: cd /tcal/ut2/uves/ech/cal
quality@wu2pl: cp ~uvesp/noStandard/<files> ./
quality@wu2pl: updateCalibDb *.*
quality@wu2pl: rm *

Restart DO to include new setting.
pipeline@wupl: <DO window> : Ctrl-C
pipeline@wupl: startDO uves


All Gasgano Scripts
--------------------------------------------------------------------
Resolution plots:		uves_resol.sh

		files:		wavelength calibration (ThAr)
				order table
				line reference list		
					
CCD characterization:		uves_ccdtest.sh
			
		files:		>8 screenflat pairs       | red/blue_ccdtest.ob
				>5 biases                 | 
				
Instrument efficiency:		uves_effic.sh

		files:		standardstar raw frame
				drs table
				background table
				ordertable
				linetable (med)
				atmospheric extinction table (atmoexan.tfits)
				flux table (flxstd.tfits)
	
Echelle spectra plotting:	uves_plot.sh
				
		files:		all products of science reduction

Science Reduction 
 with optimal extraction:	uves_reducOPT.sh	

				science raw frame 
				drs table
				background table
				ordertable
				linetable (low,med,upp)
				master flat
				[master bias] 
	
Submission to DO:		uves_dosubmit.sh

		files:		files to be submitted to DO
				

----------------------------------------------------------------
