Changeset 18773


Ignore:
Timestamp:
02/20/17 21:22:32 (8 years ago)
Author:
Daniela Dorner
Message:
added decay to type 3, added logging, uncommented sending email
File:
1 edited

Legend:

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

    r18743 r18773  
    22#
    33
    4 # missing: install cron for current night
    5 # change logging to processlog
    6 # evaluate output of all nights
     4# missing:
    75# implement DB-entries for being called
     6# prepare directly template for email
     7# use current value for CU in triggers
     8#
     9# add more information:
     10#   mjd, obs-summary, weather info (clouds? dust?), CU, corrected excrates
     11#
     12# evaluate output of all nights (check also for crab to estimate fluctuations)
     13# error emails in case no DB content / no QLA
     14# calculate delay of QLA and send email if > 30 Min
     15
     16# run for more nights:
     17# for (( i=0; i < 70 ; i++)); do date=`date --date="-${i}days" +%Y%m%d`; /home/fact/SW.automatic.processing/DataCheck/QuickLook/FlareAlerts.sh $date; done > logfile
    818
    919source `dirname $0`/../Sourcefile.sh
     
    1121
    1222emailfrom=dorner@astro.uni-wuerzburg.de
    13 emailto=dorner@astro.uni-wuerzburg.de
     23emailto=fact-online@lists.phys.ethz.ch
     24
     25logfile=$runlogpath"/FlareAlerts-"$datetime".log"
     26date > $logfile
    1427
    1528# get date
     
    2841fi
    2942
    30 echo "Processing "$night
     43echo "Processing "$night >> $logfile
    3144
    3245
     
    171184      if [ "$bin" = "" ]   
    172185      then
    173          echo "  ontime: "${results[$num+8]}" h"
     186         echo "  ontime: "${results[$num+8]}" h" >> $logfile
    174187      fi
    175188
     
    209222      # missing: check on still available observation time
    210223
    211       echo "    "$i" "${results[$num+2]}"-"${results[$num+3]}"["${results[$num+8]}"] "$exc" "$sig
     224      echo "    "$i" "${results[$num+2]}"-"${results[$num+3]}"["${results[$num+8]}"] "$exc" "$sig >> $logfile
    212225     
    213226      case $triggertype in
     
    219232              ;;
    220233         3)   #echo "magic fast rise/decay"
    221               trigger=`echo " $slope >= $slopelimit && $slopeprev >= $slopelimit && $slope60 >= $slopelimit && $sig >= $siglimit " | bc -l`
     234              #trigger=`echo " $slope >= $slopelimit && $slopeprev >= $slopelimit && $slope60 >= $slopelimit && $sig >= $siglimit " | bc -l`
     235              trigger=`echo " ( ( $slope >= $slopelimit && $slopeprev >= $slopelimit && $slope60 >= $slopelimit ) || ( - $slope >= $slopelimit && - $slopeprev >= $slopelimit && - $slope60 >= $slopelimit  ) ) && $sig >= $siglimit " | bc -l`
    222236              ;;
    223          *)   echo $triggertype" not yet implemented"
     237         *)   echo $triggertype" not yet implemented" >> $logfile
    224238              ;;
    225239      esac
     
    253267               if [ $checkstatus -eq 0 ]
    254268               then
    255                   echo "  alert already done "$donetriggerfile
     269                  echo "  alert already done "$donetriggerfile >> $logfile
    256270                  i=`echo $i +1 | bc -l`
    257271                  continue
     
    264278         fi
    265279         #echo $night"_"$runid" "$sourcekey" -> "$triggerfile
    266          echo "  writing "$triggerfile
     280         echo "  writing "$triggerfile >> $logfile
    267281         touch $triggerfile
    268282         echo "Trigger found: " > $triggerfile
     
    333347
    334348         # send email only of $donetriggerfile doesn't exists
    335          ##cat $triggerfile | mail -s 'test flare alert ' -b $emailfrom -r $emailfrom $emailto
     349         if ! [ -e $donetriggerfile ]
     350         then
     351            cat $triggerfile | mail -s 'test flare alert ' -b $emailfrom -r $emailfrom $emailto
     352         fi
     353         
    336354         #cat $triggerfile | mail -s "test flare alert for $sourcename " $emailto
    337355         # that's also the cases for making a call
     
    343361   done
    344362   
    345    echo "  found "$i" data point(s)."
    346    echo ""
     363   echo "  found "$i" data point(s)." >> $logfile
     364   echo "" >> $logfile
    347365}
    348366
     
    351369   query="SELECT fSourceName FROM Source WHERE fSourceKey="$sourcekey
    352370   sourcename=`sendquery`
    353    
    354    if [ $sourcekey -ne 1 ]
     371
     372   # ignore Crab
     373   if [ $sourcekey -eq 5 ]
    355374   then
    356375      continue
    357376   fi
    358    echo "Evaluation for $sourcename ... "
     377   printprocesslog "INFO Evaluation for $sourcename ... "
     378   echo "Evaluation for $sourcename ... " >> $logfile
    359379   
    360380   # missing: get limits from DB (structure needs to be defined)
     
    364384   # limits
    365385   siglimit=3.0 # sigma
    366    if [ $sourcekey -eq 1 ] || [ $sourcekey -eq 2 ]
     386   #if [ $sourcekey -eq 1 ] || [ $sourcekey -eq 2 ]
     387   if [ $sourcekey -eq 1 ] || [ $sourcekey -eq 2 ] || [ $sourcekey -eq 5 ]
    367388   then
    368389      exclimit=3.0 # CU
     
    374395   higher=1
    375396   
    376    echo "[General gamma-ray MoU]"
    377    echo " nightly binning..."
     397   printprocesslog "INFO checking for [General gamma-ray MoU]" >> $logfile
     398   echo "[General gamma-ray MoU]" >> $logfile
     399   echo " nightly binning..." >> $logfile
    378400   # checking nightly binning
    379401   bin=
     
    384406   # 20 min binning
    385407   bin=20
    386    echo " "$bin" min binning..."
     408   echo " "$bin" min binning..." >> $logfile
    387409   get_query_minute_binning
    388410   results=( `sendquery` )
     
    396418      siglimit=3.0
    397419      exclimit=2.0 # cu
    398       echo "[Trigger to MAGIC 501 proposal]"
    399       echo " nightly binning..."
     420      printprocesslog "INFO checking for [Trigger to MAGIC 501 proposal]" >> $logfile
     421      echo "[Trigger to MAGIC 501 proposal]" >> $logfile
     422      echo " nightly binning..." >> $logfile
    400423      # checking nightly binning
    401424      bin=
     
    405428      # 20 min binning
    406429      bin=20
    407       echo " "$bin" min binning..."
     430      echo " "$bin" min binning..." >> $logfile
    408431      get_query_minute_binning
    409432      results=( `sendquery` )
     
    413436   # sources: Mrk 421, Mrk 501, 2344, 1959
    414437   triggertype=3
    415    if [ $sourcekey -eq 1 ] || [ $sourcekey -eq 2 ] || [ $sourcekey -eq 3 ] || [ $sourcekey -eq 7 ]
     438   #if [ $sourcekey -eq 1 ] || [ $sourcekey -eq 2 ] || [ $sourcekey -eq 3 ] || [ $sourcekey -eq 7 ]
     439   if [ $sourcekey -eq 1 ] || [ $sourcekey -eq 2 ] || [ $sourcekey -eq 3 ] || [ $sourcekey -eq 7 ] || [ $sourcekey -eq 5 ]
    416440   then
    417       echo "[Trigger to MAGIC - fast rise/decay]"
     441      printprocesslog "INFO checking for [Trigger to MAGIC - fast rise/decay]" >> $logfile
     442      echo "[Trigger to MAGIC - fast rise/decay]" >> $logfile
    418443      ## keep thresholds low (or do not use in evaluation)
    419444      #siglimit=2.0
     
    424449      # binning
    425450      bin=30
    426       echo " "$bin" min binning..."
     451      echo " "$bin" min binning..." >> $logfile
    427452      get_query_minute_binning
    428453      results=( `sendquery` )
     
    432457   # Triggers to AMON
    433458   triggertype=4
    434    echo "[Trigger to AMON]"
    435    echo " still to be defined"
     459   printprocesslog "INFO checking for [Trigger to AMON]" >> $logfile
     460   echo "[Trigger to AMON]" >> $logfile
     461   echo " still to be defined" >> $logfile
    436462   # missing: trigger limits and binning still to be defined
    437463   # also nightly?
     
    443469   bin=20
    444470   
    445    echo ""
    446    echo ""
     471   echo "" >> $logfile
     472   echo "" >> $logfile
    447473 done
    448474
    449475finish
    450 
    451 # missing information: mjd, obs-summary, weather info (clouds? dust?)
    452 # prepare directly template for email
    453 
    454 # missing: error emails in case no DB content / no QLA
    455 # calculate delay of QLA and send email if > 30 Min
    456476
    457477# for archival testing:
Note: See TracChangeset for help on using the changeset viewer.