Changeset 18773
- Timestamp:
- 02/20/17 21:22:32 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/QuickLook/FlareAlerts.sh
r18743 r18773 2 2 # 3 3 4 # missing: install cron for current night 5 # change logging to processlog 6 # evaluate output of all nights 4 # missing: 7 5 # 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 8 18 9 19 source `dirname $0`/../Sourcefile.sh … … 11 21 12 22 emailfrom=dorner@astro.uni-wuerzburg.de 13 emailto=dorner@astro.uni-wuerzburg.de 23 emailto=fact-online@lists.phys.ethz.ch 24 25 logfile=$runlogpath"/FlareAlerts-"$datetime".log" 26 date > $logfile 14 27 15 28 # get date … … 28 41 fi 29 42 30 echo "Processing "$night 43 echo "Processing "$night >> $logfile 31 44 32 45 … … 171 184 if [ "$bin" = "" ] 172 185 then 173 echo " ontime: "${results[$num+8]}" h" 186 echo " ontime: "${results[$num+8]}" h" >> $logfile 174 187 fi 175 188 … … 209 222 # missing: check on still available observation time 210 223 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 212 225 213 226 case $triggertype in … … 219 232 ;; 220 233 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` 222 236 ;; 223 *) echo $triggertype" not yet implemented" 237 *) echo $triggertype" not yet implemented" >> $logfile 224 238 ;; 225 239 esac … … 253 267 if [ $checkstatus -eq 0 ] 254 268 then 255 echo " alert already done "$donetriggerfile 269 echo " alert already done "$donetriggerfile >> $logfile 256 270 i=`echo $i +1 | bc -l` 257 271 continue … … 264 278 fi 265 279 #echo $night"_"$runid" "$sourcekey" -> "$triggerfile 266 echo " writing "$triggerfile 280 echo " writing "$triggerfile >> $logfile 267 281 touch $triggerfile 268 282 echo "Trigger found: " > $triggerfile … … 333 347 334 348 # 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 336 354 #cat $triggerfile | mail -s "test flare alert for $sourcename " $emailto 337 355 # that's also the cases for making a call … … 343 361 done 344 362 345 echo " found "$i" data point(s)." 346 echo "" 363 echo " found "$i" data point(s)." >> $logfile 364 echo "" >> $logfile 347 365 } 348 366 … … 351 369 query="SELECT fSourceName FROM Source WHERE fSourceKey="$sourcekey 352 370 sourcename=`sendquery` 353 354 if [ $sourcekey -ne 1 ] 371 372 # ignore Crab 373 if [ $sourcekey -eq 5 ] 355 374 then 356 375 continue 357 376 fi 358 echo "Evaluation for $sourcename ... " 377 printprocesslog "INFO Evaluation for $sourcename ... " 378 echo "Evaluation for $sourcename ... " >> $logfile 359 379 360 380 # missing: get limits from DB (structure needs to be defined) … … 364 384 # limits 365 385 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 ] 367 388 then 368 389 exclimit=3.0 # CU … … 374 395 higher=1 375 396 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 378 400 # checking nightly binning 379 401 bin= … … 384 406 # 20 min binning 385 407 bin=20 386 echo " "$bin" min binning..." 408 echo " "$bin" min binning..." >> $logfile 387 409 get_query_minute_binning 388 410 results=( `sendquery` ) … … 396 418 siglimit=3.0 397 419 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 400 423 # checking nightly binning 401 424 bin= … … 405 428 # 20 min binning 406 429 bin=20 407 echo " "$bin" min binning..." 430 echo " "$bin" min binning..." >> $logfile 408 431 get_query_minute_binning 409 432 results=( `sendquery` ) … … 413 436 # sources: Mrk 421, Mrk 501, 2344, 1959 414 437 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 ] 416 440 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 418 443 ## keep thresholds low (or do not use in evaluation) 419 444 #siglimit=2.0 … … 424 449 # binning 425 450 bin=30 426 echo " "$bin" min binning..." 451 echo " "$bin" min binning..." >> $logfile 427 452 get_query_minute_binning 428 453 results=( `sendquery` ) … … 432 457 # Triggers to AMON 433 458 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 436 462 # missing: trigger limits and binning still to be defined 437 463 # also nightly? … … 443 469 bin=20 444 470 445 echo "" 446 echo "" 471 echo "" >> $logfile 472 echo "" >> $logfile 447 473 done 448 474 449 475 finish 450 451 # missing information: mjd, obs-summary, weather info (clouds? dust?)452 # prepare directly template for email453 454 # missing: error emails in case no DB content / no QLA455 # calculate delay of QLA and send email if > 30 Min456 476 457 477 # for archival testing:
Note:
See TracChangeset
for help on using the changeset viewer.