source: trunk/www/flare_alerts/index.php@ 19662

Last change on this file since 19662 was 19634, checked in by Daniela Dorner, 5 years ago
addapted tables to new information, fixed bug in QLA links
File size: 17.9 KB
Line 
1<!DOCTYPE HTML>
2<html>
3<head>
4 <link rel="stylesheet" type="text/css" href="checkstyle.css" />
5 <style>
6 .error {color: #FF0000;}
7 </style>
8
9 <script language="JavaScript" type="text/javascript">
10 if (document.getElementById) {
11 document.writeln('<style type="text/css"><!--')
12 document.writeln('.texter {display:none} @media print {.texter {display:block;}}')
13 document.writeln('//--></style>') }
14 function openClose(theID) {
15 if (document.getElementById(theID).style.display == "block") {
16 document.getElementById(theID).style.display = "none"
17 } else {
18 document.getElementById(theID).style.display = "block" }
19 }
20 </script>
21</head>
22<body>
23
24<?php
25
26 echo "<hr size='2px' style='border-width:5px'>\n";
27 echo "<h1>Flare Alerts</h1>\n";
28 echo "<hr>\n";
29 echo "<h2>Acknowledge Alerts</h2>\n";
30
31 if (!empty($_GET["date"]))
32 {
33 $today=$_GET["date"];
34 }
35 else
36 {
37 if (date("H")>18)
38 $today=date("Ymd", mktime(0,0,0,date("m"), date("d"), date("Y")));
39 else
40 $today=date("Ymd",strtotime(date("Y-m-d", mktime(0,0,0,date("m"), date("d"), date("Y")))." -1 day"));
41 }
42 if (!empty($_GET["date2"]))
43 {
44 $today2=$_GET["date2"];
45 }
46 else
47 {
48 $today2=date("Ymd", mktime(0,0,0,date("m"), date("d"), date("Y")));
49 }
50 if (!empty($_GET["trigger"]))
51 $trigger=$_GET["trigger"];
52 else
53 $trigger="New";
54 if (!empty($_GET["type"]))
55 $type=$_GET["type"];
56 else
57 $type=0;
58 $year=substr($today,0,4);
59 $month=substr($today,4,2);
60 $day=substr($today,6,2);
61
62 echo "<form method=\"post\" action=\"acknowledge_alerts.php\" enctype=\"multipart/form-data\" >\n";
63 //echo "<form method=\"get\" action=\"acknowledge_alerts.php\" enctype=\"multipart/form-data\" >\n";
64 echo "<p>\n";
65 echo "User Name: <input type='text' name='Uname' maxlength='50' /> <br>\n";
66 echo "Password: <input type='password' name='Passwd' maxlength='50' /> <br>\n";
67 echo "</p>\n";
68 //echo "<input type='text' name='link' value='test'\>\n";
69 echo "<input type='submit' name='submit' value='Acknowledge Alerts' />\n";
70 echo "<input type='hidden' name='link' value='".$_SERVER[REQUEST_URI]."'\>\n";
71 //echo "---".$_SERVER[REQUEST_URI]."---";
72 echo "</form>\n";
73 echo "<hr>\n";
74
75 echo "<h2>Display Alerts</h2>\n";
76 echo "<form method=\"get\" action=\"index.php\" enctype=\"multipart/form-data\" >\n";
77 echo "<p>\n";
78 echo "Date/Start: <input type='text' name='date' size='8' maxlength='8' value='".$today."'/>\n";
79 echo "Stop: <input type='text' name='date2' size='8' maxlength='8' value='".$today2."'/> <br>\n";
80 echo "Trigger:\n";
81 if ($trigger=="All")
82 {
83 echo "<input type='radio' name='trigger' id='All' value='All' checked='checked'/> <label for='All'>all</label>\n";
84 echo "<input type='radio' name='trigger' id='New' value='New' /> <label for='New'>new</label>\n";
85 }
86 else
87 {
88 echo "<input type='radio' name='trigger' id='All' value='All' /> <label for='All'>all</label>\n";
89 echo "<input type='radio' name='trigger' id='New' value='New' checked='checked'/> <label for='New'>new</label>\n";
90 }
91 echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type: <input type='text' name='type' size='2' maxlength='2' value='".$type."'/> <br>\n";
92 echo "</p>\n";
93 echo "<input type='submit' name='submit' value='Show Alerts' />\n";
94 echo "<input class='Width' type='button' value='Reset' onClick='self.location.href=\"index.php\"'>";
95 echo "</form>\n";
96 echo "<hr>\n";
97
98
99 echo "<h2>".$trigger." alert(s) from ".$today." to ".$today2.": </h2>";
100 if($_SERVER["HTTPS"] != "on")
101 {
102 header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
103 exit();
104 }
105 include('/home/fact/php_credentials/factweb.php');
106
107 $db = new PDO(
108 'mysql:host='.$host.';dbname=FlareAlerts;charset=utf8mb4',
109 $user,
110 $pass);
111
112 // table with alert from table FlareAlerts.FlareTriggers
113 echo "<table border='1' style='border-collapse:collapse'>\n";
114 $first_row = 0;
115 $colnames = "";
116
117 $query="SELECT CONCAT(fTriggerKey, '[', fTriggerType, ']') AS 'Trigger[Type]', if (isnull(fName), fSourceName, fName) AS 'Source', ";
118 $query.="fPacketTypeKey AS 'Packet', CONCAT(Round(fRa,1), '/', Round(fDec,1), '/', Round(fErr,1)) AS 'Ra/Dec/Err', ";
119 $query.="CONCAT(fNight, '_', fRunID) AS 'Run', ";
120 $query.="if (fBinning=-1, 'nightly', CONCAT(fBinning, ' min')) AS 'Binning', ";
121 $query.="fTriggerInserted AS 'Inserted', fTriggerAcknowledged AS 'Acknowledged', ";
122 //$query.="CONCAT('<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=".substr($today,0,4)."&m=".substr($today,4,2)."&d=".substr($today,6,2)."&source=', fSourceKey, '&timebin=3&plot=night\">20Min</a> ', ";
123 //$query.="'<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=".substr($today,0,4)."&m=".substr($today,4,2)."&d=".substr($today,6,2)."&source=', fSourceKey, '&timebin=12&plot=night\">Nightly</a>') as 'QLA', ";
124 $query.="CONCAT('<a target=\"_blank\" href=\"http://www.fact-project.org/run_db/db/fact_runinfo.php?fSourceKEY=', fSourceKey, '&fStartDate=', "
125 .$today.", '&fStopDate=', ".$today
126 .", '&fSourceName=On&fRunTypeName=On&fRunStart=On&fRunStop=On&fZenithDistanceMean=On&fAzimuthMean=On&fTriggerRateMedian=On&fThresholdMedian=On&fSourceName=On\">RunInfo</a>') as 'RunInfo', ";
127 $query.="CONCAT('<a target=\"_blank\" href=\"http://www.fact-project.org/run_db/db/fact_runinfo.php?fSourceKEY=', fSourceKey, '&fStartDate=', "
128 .$today.", '&fStopDate=', ".$today.", '&fSourceName=On&fRunTypeKEY=-1\">Summary</a>') AS 'Summary', ";
129 $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/', DATE_FORMAT(fNight, '%Y/%m/%d'), '/lightcurve', fSourceKey, '_20min_', fNight, '.root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
130 ."<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=', YEAR(fNight), '&m=', MONTH(fNight), '&d=', DAY(fNight), '&source=', fSourceKey, '&timebin=3&plot=night\">more details</a>\n') AS 'QLA 20min', ";
131 $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/', DATE_FORMAT(fNight, '%Y/%m/%d'), '/lightcurve', fSourceKey, '_1night_', fNight, '.root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
132 ."<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=', YEAR(fNight), '&m=', MONTH(fNight), '&d=', DAY(fNight), '&source=', fSourceKey, '&timebin=12&plot=night\">more details</a>\n') AS 'QLA 1night', ";
133 $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/', DATE_FORMAT(fNight, '%Y/%m/%d'), '/lightcurve', fSourceKey, '_1night_week.root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
134 ."<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=', YEAR(fNight), '&m=', MONTH(fNight), '&d=', DAY(fNight), '&source=', fSourceKey, '&timebin=12&plot=week\">more details</a>\n') AS 'QLA nightly last week' ";
135 $query.="FROM FlareTriggers LEFT JOIN factdata.Source USING (fSourceKey) WHERE fNight BETWEEN ".$today." AND ".$today2;
136 if ($trigger=="New")
137 $query.=" AND ISNULL(fTriggerAcknowledged) ";
138 if ($type)
139 $query.=" AND fTriggerType=".$type;
140 //echo $query;
141
142 $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);
143 foreach($result as $row)
144 {
145 if ($first_row == 0)
146 {
147 $first_row = 1;
148 echo "<tr>\n";
149 $colnames = array_keys($row);
150 foreach($colnames as $colname){
151 echo "<th>".$colname."</th>\n";
152 }
153 echo "</tr>\n";
154 }
155 echo "<tr>\n";
156 foreach ($colnames as $key) {
157
158 echo "<td>".$row[$key]."</td>\n";
159 }
160 echo "</tr>\n";
161 }
162 echo "</table>\n";
163 echo "<hr size='2px' style='border-width:5px'>\n";
164 echo "<h1>Additional Information</h1>\n";
165
166 //obs_summary.php
167 echo "<h2> From Observation-Summary: </h2>\n";
168 echo "<iframe width='100%' height='315' src='https://fact-project.org/dch/obs_summary.php?d=".$year."-".$month."-".$day."&nolegend=yes' frameborder='0' allowfullscreen></iframe>\n";
169
170 /*
171 $query="SELECT fSourceKey AS 'Source', fStart AS 'Start of Observation', fData AS 'Settings' FROM factdata.Schedule WHERE ";
172 $query.="fSTART BETWEEN DATE_ADD(DATE_FORMAT(".$today.", '%Y-%m-%d'), INTERVAL +18 HOUR) ";
173 $query.="AND DATE_ADD(DATE_FORMAT(".$today2.", '%Y-%m-%d'), INTERVAL +35 HOUR) ";
174 //$query.="AND fData='nodrs:true,grb:true'";
175 $query.="AND NOT ISNULL(fData)";
176 echo "<h2> ToO observations in schedule from ".$today." to ".$today2.": </h2>";
177 echo "<table border='1' style='border-collapse:collapse'>\n";
178 $first_row = 0;
179 $colnames = "";
180 $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);
181 foreach($result as $row)
182 {
183 if ($first_row == 0)
184 {
185 $first_row = 1;
186 echo "<tr>\n";
187 $colnames = array_keys($row);
188 foreach($colnames as $colname){
189 echo "<th>".$colname."</th>\n";
190 }
191 echo "</tr>\n";
192 }
193 echo "<tr>\n";
194 foreach ($colnames as $key) {
195
196 echo "<td>".$row[$key]."</td>\n";
197 }
198 echo "</tr>\n";
199 }
200 echo "</table>\n";
201 */
202
203 $query="SELECT fSourceName AS 'Source', fStart AS 'Start of Observation', fData AS 'Settings', fUser AS 'User' ";
204 $query.="FROM factdata.Schedule LEFT JOIN factdata.Source USING (fSourceKey) WHERE ";
205 $query.="fSTART BETWEEN DATE_ADD(DATE_FORMAT(".$today.", '%Y-%m-%d'), INTERVAL +18 HOUR) ";
206 $query.="AND DATE_ADD(DATE_FORMAT(".$today2.", '%Y-%m-%d'), INTERVAL +35 HOUR) ";
207 //$query.="AND fData='nodrs:true,grb:true'";
208 $query.="AND fMeasurementTypeKey=4";
209 echo "<h2> Physics observations in schedule from ".$today." to ".$today2.": </h2>";
210 echo "<table border='1' style='border-collapse:collapse'>\n";
211 $first_row = 0;
212 $colnames = "";
213 $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);
214 foreach($result as $row)
215 {
216 if ($first_row == 0)
217 {
218 $first_row = 1;
219 echo "<tr>\n";
220 $colnames = array_keys($row);
221 foreach($colnames as $colname){
222 echo "<th>".$colname."</th>\n";
223 }
224 echo "</tr>\n";
225 }
226 echo "<tr>\n";
227 foreach ($colnames as $key) {
228
229 echo "<td>".$row[$key]."</td>\n";
230 }
231 echo "</tr>\n";
232 }
233 echo "</table>\n";
234
235 // table with ToOs
236 $query="SELECT fSourceName AS 'Source', CONCAT(ToOs.fRightAscension, '/', Source.fRightAscension) AS 'RA (Satellite/FACT)', ";
237 $query.="CONCAT(ToOs.fDeclination, '/', Source.fDeclination) AS 'Dec (Satellite/FACT)', ";
238 $query.="fLastUpdate AS 'ToO time', fTypeID AS 'PaketType' FROM factdata.ToOs LEFT JOIN factdata.Source USING (fSourceKey) ";
239 $query.="WHERE fLastUpdate BETWEEN DATE_ADD(DATE_FORMAT(".$today.", '%Y-%m-%d'), INTERVAL +18 HOUR) ";
240 $query.="AND DATE_ADD(DATE_FORMAT(".$today2.", '%Y-%m-%d'), INTERVAL +35 HOUR) ";
241 echo "<h2> ToO observations in ToO-table from ".$today." to ".$today2.": </h2>";
242 echo "<table border='1' style='border-collapse:collapse'>\n";
243 $first_row = 0;
244 $colnames = "";
245 $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);
246 foreach($result as $row)
247 {
248 if ($first_row == 0)
249 {
250 $first_row = 1;
251 echo "<tr>\n";
252 $colnames = array_keys($row);
253 foreach($colnames as $colname){
254 echo "<th>".$colname."</th>\n";
255 }
256 echo "</tr>\n";
257 }
258 echo "<tr>\n";
259 foreach ($colnames as $key) {
260
261 echo "<td>".$row[$key]."</td>\n";
262 }
263 echo "</tr>\n";
264 }
265 echo "</table>\n\n";
266
267 //weather:
268 echo "<h2>Weather Info:</h2>\n";
269 echo "<image src='http://www.gtc.iac.es/multimedia/netcam/camaraAllSky.jpg' frameborder='0' allowfullscreen></image>\n";
270
271 //visibility
272 echo "<h2>Visibility:</h2>\n";
273 echo "<image src='https://www.fact-project.org/scheduling/".$year."/".$month."/".$day."/".$today."-ZenithDistance.png' frameborder='0' allowfullscreen></image>\n";
274
275
276 echo "<hr>\n";
277 echo "<h2>Important Links for Flare Experts</h2>";
278 echo "<li><a href='https://trac.fact-project.org/wiki/Protected/FlareAlertInfo'>All information on flare alerts in FACT</a></li>\n";
279 echo "<ul>\n";
280
281 echo "<li> Sending ToOs: <ul>\n";
282 echo "<li><a href='https://trac.fact-project.org/wiki/Protected/FlareAlertInfo#Type1MoUpartners'>Alert to MoU partners</a></li>\n";
283 echo "<li><a href='https://www.swift.psu.edu/toop/too.php'>Swift-ToO</a></li>\n";
284 echo "<li>List of Previous Flare Alerts: <a href='https://trac.fact-project.org/wiki/FlareAlertsSent'>[old]</a> \n";
285 echo "<a href='https://fact-project.org/run_db/db/printtable.php?fTable=FlareAlerts.Sent'>[new, view-only]</a> (add alert to list)</li>\n";
286 echo "</li></ul>\n";
287
288 echo "<li> Data Quality and Weather: <ul>\n";
289 echo "<li><a href='https://www.fact-project.org/logbook/calendar.php?action=dayview&calendar=1&year=".$year."&month=".$month."&day=".$day."'>logbook ".$year."-".$month."-".$day."</a></li>\n";
290 echo "<li><a href='https://fact-project.org/overview_video/".$year."/".$month."/".$day."/images'>Overview Images</a></li>\n";
291 echo "<li>Weather info: <a href='http://www.magic.iac.es/site/weather/index.html'>MAGIC</a>, \n";
292 echo "<a href='http://tngweb.tng.iac.es/weather/current'>TNG</a>,\n";
293 echo "<a href='http://atmosportal.gtc.iac.es/'>GTC</a></li>\n";
294 echo "<li><a href='http://www.gtc.iac.es/multimedia/webcamPopup.php?webcam=skycam'>GTC allsky cam current image</a></li>\n";
295 echo "</li></ul>\n";
296
297 echo "<li> Visibility and Scheduling: <ul>\n";
298 echo "<li><a href='https://fact-project.org/showlog/?log=scheduler#bottom'>scheduler log</a>, ";
299 echo "<a href='https://fact-project.org/showlog/?log=gcn#bottom'>gcn log</a></li>\n";
300 echo "<li>FACT: <a href='https://www.fact-project.org/schedule'>Schedule</a>\n";
301 echo "<a href='https://www.fact-project.org/dch/scheduling.php'>Visibility</a> </li>\n";
302 echo "<li>Swift-XRT Schedule: \n";
303 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".($day-1)."&a=0'>".$year."-".$month."-".($day-1)."</a>, \n";
304 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".$day."&a=0'>".$year."-".$month."-".$day."</a>, \n";
305 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".($day+1)."&a=0'>".$year."-".$month."-".($day+1)."</a> \n";
306 echo "(planned) \n";
307 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".($day-1)."&a=1'>".$year."-".$month."-".($day-1)."</a>, \n";
308 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".$day."&a=1'>".$year."-".$month."-".$day."</a>, \n";
309 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".($day+1)."&a=1'>".$year."-".$month."-".($day+1)."</a> \n";
310 echo "(achieved)</li>\n";
311 echo "</li></ul>\n";
312 //XMM, NuStar, Integral
313
314 echo "<li> Other Information: <ul>\n";
315 echo "<li><a href='https://trac.fact-project.org/browser/trunk/FACT%2B%2B/src/HeadersGCN.h'> Explanation Paket Types in FACT++</a></li>\n";
316 echo "</li></ul>\n";
317
318 echo "<li> GRBs: <ul>\n";
319 echo "<li><a href='https://gcn.gsfc.nasa.gov/fermi_grbs.html'>Fermi-GBM GRBs</a> \n";
320 echo "(<a href='https://gcn.gsfc.nasa.gov/fermi.html'>Fermi</a>)</li>\n";
321 echo "<li><a href='https://gcn.gsfc.nasa.gov/swift_grbs.html'>Swift-BAT GRBs</a> \n";
322 echo "(<a href='https://gcn.gsfc.nasa.gov/swift.html'>Swift</a>)</li>\n";
323 echo "<li><a href='https://gcn.gsfc.nasa.gov/integral_grbs.html'>INTEGRAL GRBs</a>\n";
324 echo "(<a href='https://gcn.gsfc.nasa.gov/integral.html'>INTEGRAL</a>)</li>\n";
325 echo "<li><a href='https://gcn.gsfc.nasa.gov/agile_grbs.html'>AGILE GRBs</a>\n";
326 echo "(<a href='https://gcn.gsfc.nasa.gov/agile.html'>AGILE</a>)</li>\n";
327 echo "<li><a href='https://gcn.gsfc.nasa.gov/amon_hawc_events.html'>AMON HAWC Bursts</a>\n";
328 echo "(<a href='https://gcn.gsfc.nasa.gov/amon.html'>AMON</a>)</li>\n";
329 echo "</li></ul>\n";
330
331 echo "<li> Transients: <ul>\n";
332 echo "<li><a href='https://gcn.gsfc.nasa.gov/fermi_lat_mon_trans.html'>Fermi-LAT monitored and transient</a>\n";
333 echo "(<a href='https://gcn.gsfc.nasa.gov/fermi.html'>Fermi</a>)</li>\n";
334 echo "</li></ul>\n";
335
336 echo "<li> Neutrinos: <ul>\n";
337 echo "<li><a href='https://gcn.gsfc.nasa.gov/amon_ehe_events.html'>AMON EHE/HESE Events</a>\n";
338 echo "(<a href='https://gcn.gsfc.nasa.gov/amon.html'>AMON</a>)</li>\n";
339 echo "<li><a href='https://gcn.gsfc.nasa.gov/amon_icecube_gold_bronze_events.html'>AMON IceCube BRONZE/GOLD Events</a>\n";
340 echo "(<a href='https://gcn.gsfc.nasa.gov/amon.html'>AMON</a>)</li>\n";
341 echo "<li><a href='https://gcn.gsfc.nasa.gov/gcn3_archive.html'>GCN circulars</a></li>\n";
342 echo "</li></ul>\n";
343
344 echo "<li> GW: <ul>\n";
345 echo "<li><a href='https://gcn.gsfc.nasa.gov/lvc.html'>LVC</a></li>\n";
346 echo "<li><a href='https://gracedb.ligo.org/latest/'>latest GW-alerts</a></li>\n";
347 echo "<li><a href='https://gcn.gsfc.nasa.gov/gcn3_archive.html'>GCN circulars</a></li>\n";
348 echo "</li></ul>\n";
349 echo "</ul>\n";
350 // to be added
351 // email template
352 // flare summary (copy flare-alert files to gate)
353 // internal qla links: 10 min, 5 min, significance (20 min, nightly)
354 // make links dependent on flare type and if sourcekey is available
355 // link to visibility plot (+ create them)
356 // future dreams
357 // interface to send email directly to both too-lists
358 echo "<hr size='2px' style='border-width:5px'>\n";
359
360?>
361</body>
362</html>
Note: See TracBrowser for help on using the repository browser.