Exemple #1
0
    Qpairs.append(Qangles[i*2:(i+1)*2])
    Upairs.append(Uangles[i*2:(i+1)*2])

WLOG('info',log_opt,'Starting to classify the given files: %s'%str(arg_file_names))

insmodes=[]
ret25=[]
ret50=[]

firstfile=arg_file_names[0]

for filename in arg_file_names:
    fitsfilename=os.path.join(dir_data_raw,arg_night_name,filename)
    if DEBUG: print "fitsfilename: %s"%fitsfilename
    
    insmodes.append(s.strip(hadmrFITS.read_key(fitsfilename,kw_insmode)))
    r25=hadmrFITS.read_key(fitsfilename,kw_pol_ret25)
    if isinstance(r25,float): ret25.append(r25)

    r50=hadmrFITS.read_key(fitsfilename,kw_pol_ret50)
    if isinstance(r50,float): 
        if r50!=360.0:
            ret50.append(r50)
        else:
            ret50.append(0.0)
    

# check if all files are polarisation files
if insmodes.count(kw_insmode_pol) != len(arg_file_names):
    WLOG('error',log_opt,'Not all given files are polarization measurements.')
    exit(1)

if os.path.exists(working_dir)==0:
   WLOG('error',log_opt,'Redirected outpout directory: '+working_dir+' does not exist')
   exit(1)
else:
   WLOG('info',log_opt,'Using redirected output directory: '+working_dir)


O_e2ds_fitsfilename=os.path.join(working_dir,arg_file_names[0])


WLOG('info',log_opt,'Now processing new CCF on '+I_e2ds_fitsfilename)

if os.path.exists(I_e2ds_fitsfilename):
   insmode=string.strip(hadmrFITS.read_key(I_e2ds_fitsfilename,kw_insmode))
   WLOG('info',log_opt,'INSTRUMENT MODE: '+insmode)
   WLOG('',log_opt,'Reading existing E2DS file '+os.path.split(I_e2ds_fitsfilename)[1])
else:
   WLOG('error',log_opt,'Files  '+I_e2ds_fitsfilename+' missing')
   exit(0)
fiber=''
if (string.find(I_e2ds_fitsfilename,'A.fits') > -1): fiber='A'
if (string.find(I_e2ds_fitsfilename,'B.fits') > -1): fiber='B'
if (fiber==''): 
   WLOG('error',log_opt,'Fiber cannot be identified from filename')
   exit(1)

wave={}
e2dsff={}
blaze={}
Exemple #3
0
from numpy.oldnumeric import *
from newbervmain import *
from e2dstos1d import *
from hadmrMATH import *

execfile(os.getenv('PYTHONSTARTUP'))
execfile(os.getenv('PYTHONSTARTUP2'))

s=string
VISU=hadgtVISU
tmp_file="%s"%int(time.time())


fitsfilename=os.path.join(dir_data_raw,arg_night_name,arg_file_names[0])
dirfits=os.path.join(dir_data_reduc,arg_night_name)
insmode=string.strip(hadmrFITS.read_key(fitsfilename,kw_insmode))
WLOG('info',log_opt,'INSTRUMENT MODE: '+insmode)

if (string.find(insmode,ic_insmode)<0):
   WLOG('error',log_opt,'Wrong Image keyword INS MODE: '+insmode+ ' (should be : '+ic_insmode+ ')')
   WLOG('info',log_opt,'Recipe '+process_running+' is terminated')
   exit(1)


if os.path.exists(os.path.join(dir_data_reduc,arg_night_name))==0:
   WLOG('error',log_opt,'Directory :'+dir_data_reduc+arg_night_name+' does not exist')
   exit(1)
 
e2ds_fitsfilename={\
     'A': os.path.join(dir_data_reduc,arg_night_name,string.replace(arg_file_names[0],'.fits','_e2ds_A.fits')),\
     'B': os.path.join(dir_data_reduc,arg_night_name,string.replace(arg_file_names[0],'.fits','_e2ds_B.fits'))}