Changeset 18783 for trunk/DataCheck/QuickLook/FlareAlerts.sh
- Timestamp:
- 03/15/17 22:41:43 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/QuickLook/FlareAlerts.sh
r18779 r18783 48 48 query="SELECT fSourceKey FROM RunInfo WHERE fNight="$night" AND fRunTypeKey=1 AND NOT ISNULL(fSourceKey) GROUP BY fSourceKey" 49 49 sourcekeys=( `sendquery` ) 50 if [ ${#sourcekeys[@]} -eq 0 ] 51 then 52 echo "no sources found for "$night 53 finish 54 fi 55 56 printprocesslog "INFO Checking the "${#sourcekeys[@]}" sourcekeys: "${sourcekeys[@]} 50 57 51 58 # some stuff for queries: … … 149 156 } 150 157 158 function print_voevent_file() 159 { 160 # put here voevent file 161 # make sure that it is written to amon-folder 162 echo '<?xml version="1.0" ?>' 163 echo '<voe:VOEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' 164 echo 'xmlns:voe="http://www.ivoa.net/xml/VOEvent/v2.0"' 165 echo 'xsi:schemaLocation="http://www.ivoa.net/xml/VOEvent/v2.0 http://www.ivoa.net/xml/VOEvent/VOEvent-v2.0.xsd"' 166 echo ' version="2.0" role="test" ivorn="ivo://amon/fact_#5_3772_0">' 167 echo ' <Who>' 168 echo ' <AuthorIVORN>ivo://FACT</AuthorIVORN>' 169 echo ' <Date>'`date +%F\ %H:%M:%S`'</Date>' 170 echo ' </Who>' 171 # FACT = 5 in AMON 172 echo ' <What>' 173 echo ' <Param name="stream" dataType="float" value="5" ucd="meta.number" unit=" ">' 174 echo ' <Description>Stream number</Description>' 175 echo ' </Param>' 176 # event identifier 177 # nightly binning: night+sourcekey 178 # 20 min binning: night+source+? 179 echo ' <Param name="id" dataType="float" value="3772" ucd="meta.number" unit=" ">' 180 echo ' <Description>Id number</Description>' 181 echo ' </Param>' 182 # keep 0 for the beginning 183 # how to handle updates? e.g. in case of full disk and random processing 184 echo ' <Param name="rev" dataType="float" value="0" ucd="meta.number" unit=" ">' 185 echo ' <Description>Revision number</Description>' 186 echo ' </Param>' 187 # what to do with this? in IC it's number of neutrinos, but does number of gammas make sense? 188 # (excevts? depends on time range...) 189 echo ' <Param name="nevents" dataType="float" value="1" ucd="meta.number" unit=" ">' 190 echo ' <Description>Number of events</Description>' 191 echo ' </Param>' 192 # get time window (stop of last - start of first run) 193 # maybe: don't send alert if time window > xxx 194 echo ' <Param name="deltaT" dataType="float" value="0.0" ucd="time.duration" unit="s">' 195 echo ' <Description>Time window of the burst</Description>' 196 echo ' </Param>' 197 # probably 0 198 echo ' <Param name="sigmaT" dataType="float" value="0.0" ucd="time" unit="s">' 199 echo ' <Description>Uncertainty of the time window</Description>' 200 echo ' </Param>' 201 # FPR - to be calculated 202 echo ' <Param name="false_pos" dataType="float" value="-1" ucd="stat.probability" unit="s-1.sr-1 ">' 203 echo ' <Description>False positive rate</Description>' 204 echo ' </Param>' 205 # some significane value - how significant is the alert? 206 # to be discussed and calculated 207 echo ' <Param name="pvalue" dataType="float" value="1.0" ucd="stat.probability" unit=" ">' 208 echo ' <Description>Pvalue</Description>' 209 echo ' </Param>' 210 # use source RA/Dec? but then naming doesn't fit 211 # -> leave empty for the moment 212 echo ' <Param name="point_RA" dataType="float" value="-1.0" ucd="os.eq.ra" unit="deg">' 213 echo ' <Description>Pointing RA</Description>' 214 echo ' </Param>' 215 echo ' <Param name="point_dec" dataType="float" value="-1.0" ucd="os.eq.dec" unit="deg">' 216 echo ' <Description>Pointing Dec</Description>' 217 echo ' </Param>' 218 # shape of psf - to be determined - fit thetaplot? for crab or mc 219 echo ' <Param name="psf_type" dataType="string" value="fisher" ucd="meta.code.multip" unit=" ">' 220 echo ' <Description>Type of psf (skymap, fisher, kent, king)</Description>' 221 echo ' </Param>' 222 echo ' <Group name="aux_params">' 223 # which other information to add? 224 echo ' <Param name="zenith" dataType="float" value="0.0" ucd="os.lc.ze" unit="deg"/>' 225 echo ' <Param name="xyz" dataType="float" value="0.0" ucd="os.lc.ze" unit="xyz"/>' 226 echo ' </Group>' 227 echo ' </What>' 228 echo ' <WhereWhen>' 229 echo ' <ObsDataLocation>' 230 echo ' <ObservatoryLocation>' 231 echo ' <AstroCoordSystem id="UTC-GEOD-TOPO"/>' 232 echo ' <AstroCoords coord_system_id="UTC-GEOD-TOPO">' 233 echo ' <Position3D unit="deg-deg-m">' 234 echo ' <Name1>longitude</Name1>' 235 echo ' <Name2>latitude</Name2>' 236 echo ' <Name3>elevation</Name3>' 237 echo ' <Value3>' 238 echo ' <C1>-17.88</C1>' 239 echo ' <C2>28.76</C2>' 240 echo ' <C3>2200</C3>' 241 echo ' </Value3>' 242 echo ' </Position3D>' 243 echo ' </AstroCoords>' 244 echo ' </ObservatoryLocation>' 245 echo ' <ObservationLocation>' 246 echo ' <AstroCoordSystem id="UTC-ICRS-TOPO"/>' 247 echo ' <AstroCoords coord_system_id="UTC-ICRS-TOPO">' 248 echo ' <Time unit="s">' 249 echo ' <TimeInstant>' 250 # python needs the .0 in the time-format - as I don't have the time more accurately here, I put .0 251 echo ' <ISOTime>'${results[$num+4]}' '${results[$num+5]}'.0</ISOTime>' 252 echo ' </TimeInstant>' 253 echo ' </Time>' 254 echo ' <Position2D unit="deg-deg">' 255 echo ' <Name1>RA</Name1>' 256 echo ' <Name2>Dec</Name2>' 257 echo ' <Value2>' 258 echo ' <C1>'${sourceinfo[2]}'</C1>' # RA in deg 259 echo ' <C2>'${sourceinfo[0]}'</C2>' # decl in deg 260 echo ' </Value2>' 261 echo ' <Error2Radius>0.1</Error2Radius>' # PSF of FACT 262 echo ' </Position2D>' 263 echo ' </AstroCoords>' 264 echo ' </ObservationLocation>' 265 echo ' </ObsDataLocation>' 266 echo ' </WhereWhen>' 267 echo ' <Description>FACT flare event information</Description>' 268 echo '</voe:VOEvent>' 269 270 } 271 151 272 function evaluate_result() 152 273 { … … 236 357 trigger=`echo " ( ( $slope >= $slopelimit && $slopeprev >= $slopelimit && $slope60 >= $slopelimit ) || ( - $slope >= $slopelimit && - $slopeprev >= $slopelimit && - $slope60 >= $slopelimit ) ) && $sig >= $siglimit " | bc -l` 237 358 ;; 359 4) #echo "std trigger: criteria ( $exc >= $exclimit && $sig >= $siglimit && $higher )" 360 trigger=`echo " $exc >= $exclimit && $sig >= $siglimit && $higher " | bc -l` 361 ;; 238 362 *) echo $triggertype" not yet implemented" >> $logfile 239 363 ;; … … 255 379 # or check value if it's increasing? 256 380 # missing: get information from previous trigger + interpret 257 triggerfile= "/home/fact/flare.alerts/"$night"-"$exclimit"_"$siglimit"-source"$sourcekey".trigger"$triggertype381 triggerfile=$flarealertspath"/"$night"-"$exclimit"_"$siglimit"-source"$sourcekey".trigger"$triggertype 258 382 else 259 383 # smaller binning: check if trigger is identical 260 triggerfile= "/home/fact/flare.alerts/"$night"_"`printf %03d $runid`"-"$exclimit"_"$siglimit"-source"$sourcekey".trigger"$triggertype384 triggerfile=$flarealertspath"/"$night"_"`printf %03d $runid`"-"$exclimit"_"$siglimit"-source"$sourcekey".trigger"$triggertype 261 385 donetriggerfile=$triggerfile".done" 262 386 #ls $donetriggerfile … … 346 470 347 471 # missing AMON cases - create VOEvent-File 472 if [ $triggertype -eq 4 ] 473 then 474 echo "amon" 475 voeventfile="/home/dorner/amon/test/"$night"_"`printf %03d $runid`"-"$exclimit"_"$siglimit"-source"$sourcekey".trigger"$triggertype".xml" 476 echo $voeventfile 477 echo ${sourceinfo[@]} 478 #print_voevent_file 479 print_voevent_file > $voeventfile 480 fi 348 481 349 482 # send email only of $donetriggerfile doesn't exists … … 366 499 } 367 500 501 502 # main part of the script 503 504 # missing: check if twistd client is running 505 # + check if there are remaining files in the to-send-folder of amon 506 # -> send email if amon connection has problem 507 508 368 509 for sourcekey in ${sourcekeys[@]} 369 510 do 370 511 query="SELECT fSourceName FROM Source WHERE fSourceKey="$sourcekey 371 sourcename=`sendquery` 512 sourcename=`sendquery` #do not combine this with other source info as sourcename can have spaces 513 514 # getting some information on the source 515 query="SELECT fDeclination, fRightAscension, fRightAscension/24.*15 FROM Source WHERE fSourceKey="$sourcekey 516 sourceinfo=( `sendquery` ) 372 517 373 518 # ignore Crab … … 469 614 onlyifhigher="no" 470 615 bin=20 616 echo "AMON" 617 echo " "$bin" min binning..." >> $logfile 618 get_query_minute_binning 619 results=( `sendquery` ) 620 evaluate_result 471 621 472 622 echo "" >> $logfile 473 623 echo "" >> $logfile 474 624 done 475 625 476 626 finish
Note:
See TracChangeset
for help on using the changeset viewer.