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

Last change on this file since 19598 was 19580, checked in by Daniela Dorner, 5 years ago
added files
File size: 17.7 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 fSourceName AS 'Source', fTriggerKey AS 'Trigger', fTriggerType as 'Type', fRunID as 'Run', fBinning as 'Binning', ";
118 $query.="fTriggerInserted as 'Inserted', fTriggerAcknowledged as 'Acknowledged', ";
119 //$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> ', ";
120 //$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', ";
121 $query.="CONCAT('<a target=\"_blank\" href=\"http://www.fact-project.org/run_db/db/fact_runinfo.php?fSourceKEY=', fSourceKey, '&fStartDate=', "
122 .$today.", '&fStopDate=', ".$today
123 .", '&fSourceName=On&fRunTypeName=On&fRunStart=On&fRunStop=On&fZenithDistanceMean=On&fAzimuthMean=On&fTriggerRateMedian=On&fThresholdMedian=On&fSourceName=On\">RunInfo</a>') as 'RunInfo', ";
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.", '&fSourceName=On&fRunTypeKEY=-1\">Summary</a>') AS 'Summary', ";
126 $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/".$year."/".$month."/".$day."/lightcurve', fSourceKey, '_20min_".$today.".root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
127 ."<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\">more details</a>\n') AS 'QLA 20min', ";
128 $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/".$year."/".$month."/".$day."/lightcurve', fSourceKey, '_1night_".$today.".root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
129 ."<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\">more details</a>\n') AS 'QLA 1night', ";
130 $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/".$year."/".$month."/".$day."/lightcurve', fSourceKey, '_1night_week.root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
131 ."<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=week\">more details</a>\n') AS 'QLA nightly last week' ";
132 $query.="FROM FlareTriggers LEFT JOIN factdata.Source USING (fSourceKey) WHERE fNight BETWEEN ".$today." AND ".$today2;
133 if ($trigger=="New")
134 $query.=" AND ISNULL(fTriggerAcknowledged) ";
135 if ($type)
136 $query.=" AND fTriggerType=".$type;
137 //echo $query;
138
139 $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);
140 foreach($result as $row)
141 {
142 if ($first_row == 0)
143 {
144 $first_row = 1;
145 echo "<tr>\n";
146 $colnames = array_keys($row);
147 foreach($colnames as $colname){
148 echo "<th>".$colname."</th>\n";
149 }
150 echo "</tr>\n";
151 }
152 echo "<tr>\n";
153 foreach ($colnames as $key) {
154
155 echo "<td>".$row[$key]."</td>\n";
156 }
157 echo "</tr>\n";
158 }
159 echo "</table>\n";
160 echo "<hr size='2px' style='border-width:5px'>\n";
161 echo "<h1>Additional Information</h1>\n";
162
163 //obs_summary.php
164 echo "<h2> From Observation-Summary: </h2>\n";
165 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";
166
167 /*
168 $query="SELECT fSourceKey AS 'Source', fStart AS 'Start of Observation', fData AS 'Settings' FROM factdata.Schedule WHERE ";
169 $query.="fSTART BETWEEN DATE_ADD(DATE_FORMAT(".$today.", '%Y-%m-%d'), INTERVAL +18 HOUR) ";
170 $query.="AND DATE_ADD(DATE_FORMAT(".$today2.", '%Y-%m-%d'), INTERVAL +35 HOUR) ";
171 //$query.="AND fData='nodrs:true,grb:true'";
172 $query.="AND NOT ISNULL(fData)";
173 echo "<h2> ToO observations in schedule from ".$today." to ".$today2.": </h2>";
174 echo "<table border='1' style='border-collapse:collapse'>\n";
175 $first_row = 0;
176 $colnames = "";
177 $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);
178 foreach($result as $row)
179 {
180 if ($first_row == 0)
181 {
182 $first_row = 1;
183 echo "<tr>\n";
184 $colnames = array_keys($row);
185 foreach($colnames as $colname){
186 echo "<th>".$colname."</th>\n";
187 }
188 echo "</tr>\n";
189 }
190 echo "<tr>\n";
191 foreach ($colnames as $key) {
192
193 echo "<td>".$row[$key]."</td>\n";
194 }
195 echo "</tr>\n";
196 }
197 echo "</table>\n";
198 */
199
200 $query="SELECT fSourceName AS 'Source', fStart AS 'Start of Observation', fData AS 'Settings', fUser AS 'User' ";
201 $query.="FROM factdata.Schedule LEFT JOIN factdata.Source USING (fSourceKey) WHERE ";
202 $query.="fSTART BETWEEN DATE_ADD(DATE_FORMAT(".$today.", '%Y-%m-%d'), INTERVAL +18 HOUR) ";
203 $query.="AND DATE_ADD(DATE_FORMAT(".$today2.", '%Y-%m-%d'), INTERVAL +35 HOUR) ";
204 //$query.="AND fData='nodrs:true,grb:true'";
205 $query.="AND fMeasurementTypeKey=4";
206 echo "<h2> Physics observations in schedule from ".$today." to ".$today2.": </h2>";
207 echo "<table border='1' style='border-collapse:collapse'>\n";
208 $first_row = 0;
209 $colnames = "";
210 $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);
211 foreach($result as $row)
212 {
213 if ($first_row == 0)
214 {
215 $first_row = 1;
216 echo "<tr>\n";
217 $colnames = array_keys($row);
218 foreach($colnames as $colname){
219 echo "<th>".$colname."</th>\n";
220 }
221 echo "</tr>\n";
222 }
223 echo "<tr>\n";
224 foreach ($colnames as $key) {
225
226 echo "<td>".$row[$key]."</td>\n";
227 }
228 echo "</tr>\n";
229 }
230 echo "</table>\n";
231
232 // table with ToOs
233 $query="SELECT fSourceName AS 'Source', CONCAT(ToOs.fRightAscension, '/', Source.fRightAscension) AS 'RA (Satellite/FACT)', ";
234 $query.="CONCAT(ToOs.fDeclination, '/', Source.fDeclination) AS 'Dec (Satellite/FACT)', ";
235 $query.="fLastUpdate AS 'ToO time', fTypeID AS 'PaketType' FROM factdata.ToOs LEFT JOIN factdata.Source USING (fSourceKey) ";
236 $query.="WHERE fLastUpdate BETWEEN DATE_ADD(DATE_FORMAT(".$today.", '%Y-%m-%d'), INTERVAL +18 HOUR) ";
237 $query.="AND DATE_ADD(DATE_FORMAT(".$today2.", '%Y-%m-%d'), INTERVAL +35 HOUR) ";
238 echo "<h2> ToO observations in ToO-table from ".$today." to ".$today2.": </h2>";
239 echo "<table border='1' style='border-collapse:collapse'>\n";
240 $first_row = 0;
241 $colnames = "";
242 $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);
243 foreach($result as $row)
244 {
245 if ($first_row == 0)
246 {
247 $first_row = 1;
248 echo "<tr>\n";
249 $colnames = array_keys($row);
250 foreach($colnames as $colname){
251 echo "<th>".$colname."</th>\n";
252 }
253 echo "</tr>\n";
254 }
255 echo "<tr>\n";
256 foreach ($colnames as $key) {
257
258 echo "<td>".$row[$key]."</td>\n";
259 }
260 echo "</tr>\n";
261 }
262 echo "</table>\n\n";
263
264 //weather:
265 echo "<h2>Weather Info:</h2>\n";
266 echo "<image src='http://www.gtc.iac.es/multimedia/netcam/camaraAllSky.jpg' frameborder='0' allowfullscreen></image>\n";
267
268 //visibility
269 echo "<h2>Visibility:</h2>\n";
270 echo "<image src='https://www.fact-project.org/scheduling/".$year."/".$month."/".$day."/".$today."-ZenithDistance.png' frameborder='0' allowfullscreen></image>\n";
271
272
273 echo "<hr>\n";
274 echo "<h2>Important Links for Flare Experts</h2>";
275 echo "<li><a href='https://trac.fact-project.org/wiki/Protected/FlareAlertInfo'>All information on flare alerts in FACT</a></li>\n";
276 echo "<ul>\n";
277
278 echo "<li> Sending ToOs: <ul>\n";
279 echo "<li><a href='https://trac.fact-project.org/wiki/Protected/FlareAlertInfo#Type1MoUpartners'>Alert to MoU partners</a></li>\n";
280 echo "<li><a href='https://www.swift.psu.edu/toop/too.php'>Swift-ToO</a></li>\n";
281 echo "<li>List of Previous Flare Alerts: <a href='https://trac.fact-project.org/wiki/FlareAlertsSent'>[old]</a> \n";
282 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";
283 echo "</li></ul>\n";
284
285 echo "<li> Data Quality and Weather: <ul>\n";
286 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";
287 echo "<li><a href='https://fact-project.org/overview_video/".$year."/".$month."/".$day."/images'>Overview Images</a></li>\n";
288 echo "<li>Weather info: <a href='http://www.magic.iac.es/site/weather/index.html'>MAGIC</a>, \n";
289 echo "<a href='http://tngweb.tng.iac.es/weather/current'>TNG</a>,\n";
290 echo "<a href='http://atmosportal.gtc.iac.es/'>GTC</a></li>\n";
291 echo "<li><a href='http://www.gtc.iac.es/multimedia/webcamPopup.php?webcam=skycam'>GTC allsky cam current image</a></li>\n";
292 echo "</li></ul>\n";
293
294 echo "<li> Visibility and Scheduling: <ul>\n";
295 echo "<li><a href='https://fact-project.org/showlog/?log=scheduler#bottom'>scheduler log</a>, ";
296 echo "<a href='https://fact-project.org/showlog/?log=gcn#bottom'>gcn log</a></li>\n";
297 echo "<li>FACT: <a href='https://www.fact-project.org/schedule'>Schedule</a>\n";
298 echo "<a href='https://www.fact-project.org/dch/scheduling.php'>Visibility</a> </li>\n";
299 echo "<li>Swift-XRT Schedule: \n";
300 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".($day-1)."&a=0'>".$year."-".$month."-".($day-1)."</a>, \n";
301 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".$day."&a=0'>".$year."-".$month."-".$day."</a>, \n";
302 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".($day+1)."&a=0'>".$year."-".$month."-".($day+1)."</a> \n";
303 echo "(planned) \n";
304 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".($day-1)."&a=1'>".$year."-".$month."-".($day-1)."</a>, \n";
305 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".$day."&a=1'>".$year."-".$month."-".$day."</a>, \n";
306 echo "<a href='https://www.swift.psu.edu/operations/obsSchedule.php?d=".$year."-".$month."-".($day+1)."&a=1'>".$year."-".$month."-".($day+1)."</a> \n";
307 echo "(achieved)</li>\n";
308 echo "</li></ul>\n";
309 //XMM, NuStar, Integral
310
311 echo "<li> Other Information: <ul>\n";
312 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";
313 echo "</li></ul>\n";
314
315 echo "<li> GRBs: <ul>\n";
316 echo "<li><a href='https://gcn.gsfc.nasa.gov/fermi_grbs.html'>Fermi-GBM GRBs</a> \n";
317 echo "(<a href='https://gcn.gsfc.nasa.gov/fermi.html'>Fermi</a>)</li>\n";
318 echo "<li><a href='https://gcn.gsfc.nasa.gov/swift_grbs.html'>Swift-BAT GRBs</a> \n";
319 echo "(<a href='https://gcn.gsfc.nasa.gov/swift.html'>Swift</a>)</li>\n";
320 echo "<li><a href='https://gcn.gsfc.nasa.gov/integral_grbs.html'>INTEGRAL GRBs</a>\n";
321 echo "(<a href='https://gcn.gsfc.nasa.gov/integral.html'>INTEGRAL</a>)</li>\n";
322 echo "<li><a href='https://gcn.gsfc.nasa.gov/agile_grbs.html'>AGILE GRBs</a>\n";
323 echo "(<a href='https://gcn.gsfc.nasa.gov/agile.html'>AGILE</a>)</li>\n";
324 echo "<li><a href='https://gcn.gsfc.nasa.gov/amon_hawc_events.html'>AMON HAWC Bursts</a>\n";
325 echo "(<a href='https://gcn.gsfc.nasa.gov/amon.html'>AMON</a>)</li>\n";
326 echo "</li></ul>\n";
327
328 echo "<li> Transients: <ul>\n";
329 echo "<li><a href='https://gcn.gsfc.nasa.gov/fermi_lat_mon_trans.html'>Fermi-LAT monitored and transient</a>\n";
330 echo "(<a href='https://gcn.gsfc.nasa.gov/fermi.html'>Fermi</a>)</li>\n";
331 echo "</li></ul>\n";
332
333 echo "<li> Neutrinos: <ul>\n";
334 echo "<li><a href='https://gcn.gsfc.nasa.gov/amon_ehe_events.html'>AMON EHE/HESE Events</a>\n";
335 echo "(<a href='https://gcn.gsfc.nasa.gov/amon.html'>AMON</a>)</li>\n";
336 echo "<li><a href='https://gcn.gsfc.nasa.gov/amon_icecube_gold_bronze_events.html'>AMON IceCube BRONZE/GOLD Events</a>\n";
337 echo "(<a href='https://gcn.gsfc.nasa.gov/amon.html'>AMON</a>)</li>\n";
338 echo "<li><a href='https://gcn.gsfc.nasa.gov/gcn3_archive.html'>GCN circulars</a></li>\n";
339 echo "</li></ul>\n";
340
341 echo "<li> GW: <ul>\n";
342 echo "<li><a href='https://gcn.gsfc.nasa.gov/lvc.html'>LVC</a></li>\n";
343 echo "<li><a href='https://gracedb.ligo.org/latest/'>latest GW-alerts</a></li>\n";
344 echo "<li><a href='https://gcn.gsfc.nasa.gov/gcn3_archive.html'>GCN circulars</a></li>\n";
345 echo "</li></ul>\n";
346 echo "</ul>\n";
347 // to be added
348 // email template
349 // flare summary (copy flare-alert files to gate)
350 // internal qla links: 10 min, 5 min, significance (20 min, nightly)
351 // make links dependent on flare type and if sourcekey is available
352 // link to visibility plot (+ create them)
353 // future dreams
354 // interface to send email directly to both too-lists
355 echo "<hr size='2px' style='border-width:5px'>\n";
356
357?>
358</body>
359</html>
Note: See TracBrowser for help on using the repository browser.