Changeset 18099 for trunk


Ignore:
Timestamp:
02/01/15 14:05:36 (10 years ago)
Author:
Daniela Dorner
Message:
adapted to changes of RunGanymed.sh from 4 weeks ago
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/QuickLook/Step2a.sh

    r18071 r18099  
    3535   
    3636   numganymeds=0
    37    
    3837   # getting all image files for this night
    3938   printprocesslog "INFO get file list for night "$date
     
    4443      continue
    4544   fi
    46    # write data set file
    47    #dspath=$anapath/$source/datasets`printf %03d $min`min/$date
    48    #dspath=$anapath/$source/datasets_run/$date
    49    dspath=$anapath/datasets_run/$date
    50    makedir $dspath >/dev/null
    5145
    52    for (( i=1 ; i<=${#files[@]} ; i++ ))
     46   for file in ${files[@]}
    5347   do
    54       night=`basename ${files[$i-1]} | cut -d_ -f1`
    55       run=`basename ${files[$i-1]} | cut -d_ -f2`
    56       printprocesslog "DEBUG night: "$night" run: "$run
    57       dsfile=$dspath"/dataset"$night"_"$run".txt"
    58       #echo $dsfile
    59       printprocesslog "INFO writing dataset file "$dsfile
    60       # write dataset only if merpp-log is available to make sure that star-file is complete
     48      night=`basename $file | cut -d_ -f1`
     49      run=`basename $file | cut -d_ -f2`
     50      printprocesslog "INFO processing run "$run
     51      # process only if merpp-log is available to make sure that star-file is complete
     52      # at ISDC seq# != run# -> get seq#
    6153      if echo $resulttable1 | grep ISDC >/dev/null 2>&1
    6254      then
    6355         query="SELECT LPAD(fSequenceID, 3, 0) FROM RunInfo WHERE fNight="$night" AND fRunID="$run
    6456         seq=`sendquery`
    65          merpplog=`dirname ${files[$i-1]}`"/"$night"_"$seq"-merpp.log"
     57         merpplog=`dirname $file`"/"$night"_"$seq"-merpp.log"
    6658      else
    67          merpplog=`echo ${files[$i-1]} | sed -e 's/_I.root/-merpp.log/'`
     59         merpplog=`echo $file | sed -e 's/_I.root/-merpp.log/'`
    6860      fi
     61      # check if merpp is finished
    6962      stillrunning=`find $merpplog -mmin -1 2>/dev/null`
    70       if [ -e $merpplog ] && [ "$stillrunning" == "" ]
     63      if ! [ -e $merpplog ] || [ "$stillrunning" != "" ]
    7164      then
    72          echo `dirname ${files[$i-1]}`" "`basename ${files[$i-1]}` > $dsfile
    73       else
    74          printprocesslog "INFO merpp still running - wait with file "${files[$i-1]}
     65         printprocesslog "INFO merpp still running - wait with file "$file
    7566         continue
    7667      fi
    7768      # process only if ganymedlogfiles is not yet there
    78       logfile=`echo $dsfile | sed -e 's/datasets/ganymed/' -e 's/dataset//' -e 's/[.]txt/-ganymed[.]log/'`
     69      logfile=`echo $file | sed -e 's/star/ganymed_run/' -e 's/_I[.]root/-ganymed[.]log/'`
    7970      if ! ls $logfile >/dev/null 2>&1
    8071      then
    81          # fixme: why is this double?
    82          night=`basename ${files[$i-1]} | cut -d_ -f1`
    83          runid=`basename ${files[$i-1]} | cut -d_ -f2 | cut -d. -f1`
    84          drivefile=$auxdata"/"$date"/"`basename ${files[$i-1]} | cut -d_ -f1`".DRIVE_CONTROL_SOURCE_POSITION.fits"
    85          rawfilepath=$rawdata"/"$date"/"
    86          rawfilename=`basename ${files[$i-1]} | sed -e 's/_I.root/.fits/'`
    87          rawfile=`find $rawfilepath -name $rawfilename* 2>/dev/null`
    88          if ! [ "$rawfile" == "" ]
    89          then
    90             printprocesslog "INFO processing "$rawfile
    91             tstopi=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
    92             tstopf=`$factpath/fitsdump -h $rawfile  2>/dev/null | grep TSTOPF | grep -E -o '[.][0-9]+'`
    93             tstop=${tstopi}${tstopf}
    94          fi
    95          #echo "tstop: "$tstop
    96          if  ls $drivefile >/dev/null 2>&1  && ! [ "$tstop" == "" ]
    97          then
    98             printprocesslog "INFO getting coordinates from "$drivefile
    99             coordinates=( `${factpath}/fitsdump ${drivefile} -c Ra_src Dec_src -r --filter='Time<'${tstop}  2>/dev/null | tail -1 2>&1` )
    100             if [ "${coordinates[0]}" == "" ] || [ "${coordinates[1]}" == "" ]
    101             then
    102                printprocesslog "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
    103                #echo "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
    104                continue
    105             fi
    106             if [ "${coordinates[0]}" == "0" ] || [ "${coordinates[1]}" == "0" ]
    107             then
    108                printprocesslog "WARN coordinates "${coordinates[@]}
    109                #echo "WARN coordinates "${coordinates[@]}
    110                continue
    111             fi
    112          else
    113             printprocesslog "INFO getting coordinates from DB."
    114             query="SELECT fSourceKEY FROM RunInfo WHERE fNight="$night" AND fRunID="$runid
    115             sourcekey=`sendquery`
    116             if [ "$sourcekey" == "" ]
    117             then
    118                printprocesslog "WARN sourcekey empty - coordinates"${coordinates[@]}
    119                #echo "WARN sourcekey empty - coordinates"${coordinates[@]}" for "$rawfile
    120                continue
    121             fi
    122             query="SELECT Round(fRightAscension,6), Round(fDeclination,6) from Source WHERE fSourceKey="$sourcekey
    123             coordinates=( `sendquery` )
    124             if [ "${coordinates[0]}" == "" ] || [ "${coordinates[1]}" == "" ]
    125             then
    126                printprocesslog "WARN couldn't get coordinates ("${coordinates[@]}") from DB."
    127                #echo "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
    128                continue
    129             fi
    130             if [ "${coordinates[0]}" == "0" ] || [ "${coordinates[1]}" == "0" ]
    131             then
    132                printprocesslog "WARN coordinates "${coordinates[@]}
    133                #echo "WARN coordinates "${coordinates[@]}
    134                continue
    135             fi
    136          fi
    137 
    138          printprocesslog "DEBUG "$logfile" "${files[$i-1]}" -"${coordinates[0]}"-"${coordinates[1]}
    139          printprocesslog "DEBUG `dirname $0`/RunGanymed.sh $dsfile "${coordinates[0]}" "${coordinates[1]}
     72         printprocesslog "DEBUG `dirname $0`/RunGanymed.sh "$file
    14073         if [ "$qlasge" = "yes" ]
    14174         then
    142             printprocesslog "$sgepath/qsub -b y -q fact_short -v AUTOMATIONSETUP=$AUTOMATIONSETUP -v dsfile=$dsfile -v ra=${coordinates[0]} -v dec=${coordinates[1]} -e bla.txt -o bla.txt `dirname $0`/RunGanymed.sh"
    143             $sgepath/qsub -b y -q fact_short -v AUTOMATIONSETUP=$AUTOMATIONSETUP -v dsfile=$dsfile -v ra=${coordinates[0]} -v dec=${coordinates[1]} -e bla.txt -o bla.txt `dirname $0`/RunGanymed.sh
     75            printprocesslog "$sgepath/qsub -b y -q fact_short -v AUTOMATIONSETUP=$AUTOMATIONSETUP -v starfile=$file -e bla.txt -o bla.txt `dirname $0`/RunGanymed.sh"
     76            $sgepath/qsub -b y -q fact_short -v AUTOMATIONSETUP=$AUTOMATIONSETUP -v star=$file -e bla.txt -o bla.txt `dirname $0`/RunGanymed.sh
    14477         else
    145             `dirname $0`/RunGanymed.sh $dsfile ${coordinates[0]} ${coordinates[1]}
    146             #echo "ganymed for "$dsfile" "${coordinates[0]}" "${coordinates[1]}
     78            printprocesslog " INFO `dirname $0`/RunGanymed.sh $file"
     79            `dirname $0`/RunGanymed.sh $file
     80            echo "ganymed for "$file
    14781         fi
    14882         numganymeds=`echo " $numganymeds + 1 " | bc -l`
Note: See TracChangeset for help on using the changeset viewer.