Changeset 18792
- Timestamp:
- 03/25/17 06:21:01 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/QuickLook/FlareAlerts.sh
r18791 r18792 72 72 # missing: time-dependent CU 73 73 74 75 # missing: excerr is NOT rate 74 76 function get_query_nightly_binning() 75 77 { … … 506 508 } 507 509 510 get_average_flux() 511 { 512 # query average flux from DB 513 query="SELECT ROUND(SUM(fNumExcEvts)/SUM("$ontime")*3600,1) as excrate, " 514 query=$query"ROUND(ExcErr(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM("$ontime")*3600, 1) AS excerr, " 515 query=$query"ROUND(SUM("$ontime")/3600.,1) AS ontime " 516 query=$query"FROM AnalysisResultsRunLP " 517 query=$query"LEFT JOIN RunInfo USING (fNight, fRunID) " 518 if [ "$1" = "" ] 519 then 520 query=$query"WHERE fSourceKey="$sourcekey" AND NOT ISNULL(fNumExcEvts) " 521 else 522 query=$query"WHERE fSourceKey="$sourcekey" AND fNight BETWEEN "$1" AND "$2" AND NOT ISNULL(fNumExcEvts) " 523 fi 524 query=$query"GROUP BY fSourceKey " 525 sendquery 526 # missing - get in CU to correct for fluctuations of CU 527 } 528 529 508 530 509 531 # main part of the script … … 519 541 sourcename=`sendquery` #do not combine this with other source info as sourcename can have spaces 520 542 543 # todo: what about data check ? 544 # should avg include current night? 545 total=( `get_average_flux` ) 546 month=( `get_average_flux \`date -d $night' - 1 MONTH' +%Y%m%d\` $night` ) 547 year=( `get_average_flux \`date -d $night' - 1 YEAR' +%Y%m%d\` $night` ) 548 avgflux=${total[0]} 549 avgfluxmonth=${month[0]} 550 avgfluxyear=${year[0]} 551 error=${total[1]} 552 errormonth=${month[1]} 553 erroryear=${year[1]} 554 521 555 # getting some information on the source 522 556 query="SELECT fDeclination, fRightAscension, fRightAscension/24.*15 FROM Source WHERE fSourceKey="$sourcekey … … 530 564 printprocesslog "INFO Evaluation for $sourcename ... " 531 565 echo "Evaluation for $sourcename ... " >> $logfile 566 echo " average fluxes: "$avgfluxmonth"+-"$errormonth" "$avgfluxyear"+-"$erroryear" "$avgflux"+-"$error 532 567 533 568 # missing: get limits from DB (structure needs to be defined) … … 573 608 printprocesslog "INFO checking for [Trigger to MAGIC 501 proposal]" >> $logfile 574 609 echo "[Trigger to MAGIC 501 proposal]" >> $logfile 575 echo " nightly binning..." >> $logfile576 610 # checking nightly binning 577 611 bin= 612 echo " nightly binning..." >> $logfile 578 613 get_query_nightly_binning 579 614 results=( `sendquery` ) … … 589 624 # sources: Mrk 421, Mrk 501, 2344, 1959 590 625 triggertype=3 591 #if [ $sourcekey -eq 1 ] || [ $sourcekey -eq 2 ] || [ $sourcekey -eq 3 ] || [ $sourcekey -eq 7 ] 592 if [ $sourcekey -eq 1 ] || [ $sourcekey -eq 2 ] || [ $sourcekey -eq 3 ] || [ $sourcekey -eq 7 ] || [ $sourcekey -eq 5 ]626 #if [ $sourcekey -eq 1 ] || [ $sourcekey -eq 2 ] || [ $sourcekey -eq 3 ] || [ $sourcekey -eq 7 ] || [ $sourcekey -eq 5 ] # for testing 627 if [ $sourcekey -eq 1 ] || [ $sourcekey -eq 2 ] || [ $sourcekey -eq 3 ] || [ $sourcekey -eq 7 ] 593 628 then 594 629 printprocesslog "INFO checking for [Trigger to MAGIC - fast rise/decay]" >> $logfile … … 608 643 fi 609 644 610 # Triggers to AMON645 # AMON - automatic triggers using VOEvent files 611 646 triggertype=4 612 647 printprocesslog "INFO checking for [Trigger to AMON]" >> $logfile 613 648 echo "[Trigger to AMON]" >> $logfile 614 echo " still to be defined" >> $logfile649 echo " details still to be defined" >> $logfile 615 650 # missing: trigger limits and binning still to be defined 616 # also nightly? 617 # sub-threshold-triggers? 618 # FP-rate? 619 siglimit=2.0 651 # x times above average + significance limit ? 652 # sub-threshold? 653 # FP-rate to be calculated 654 # use for the moment 0.5 CU and 3 sigma 655 siglimit=3.0 620 656 exclimit=0.5 621 657 onlyifhigher="no" 622 658 bin=20 623 #echo "AMON" 659 # checking nightly binning 660 bin= 661 echo " nightly binning..." >> $logfile 662 get_query_nightly_binning 663 results=( `sendquery` ) 664 evaluate_result 624 665 echo " "$bin" min binning..." >> $logfile 625 666 get_query_minute_binning
Note:
See TracChangeset
for help on using the changeset viewer.