source: trunk/www/dch/download.php@ 19058

Last change on this file since 19058 was 19058, checked in by Daniela Dorner, 7 years ago
fixed small bugs, included sanity checks
File size: 16.0 KB
Line 
1<!DOCTYPE HTML>
2<html>
3<head>
4 <meta name="Author" content="The FACT Group" />
5 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6 <title>FACT Project</title>
7
8 <link rel="StyleSheet" type="text/css" href="../../style.css" />
9 <link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
10 <script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
11</head>
12<body>
13<?php
14
15function print_popup($text)
16{
17 echo "<script type=\"text/javascript\" language=\"Javascript\">\n";
18 echo "alert(\"".$text."\")\n";
19 echo "</script>\n";
20}
21$maintenance=0;
22//$maintenance=1;
23
24if ($maintenance)
25{
26 echo "<hr>\n <p style='font-size:xx-large'> MAINTENANCE ONGOING </p>\n";
27 echo "<p>check again in a few hours...</p>\n<p>\n<hr>\n<p>\n<p>\n";
28}
29
30
31$tables=array(
32 "AnalysisResultsRunLP" => "QLA",
33 "AnalysisResultsRunISDC" => "ISDC",
34 );
35
36$times=array(
37 "timestamp" => "timestamp",
38 "unix" => "unixtime",
39 "mjd" => "MJD",
40 );
41
42$zdcuts=array(
43 "all" => "all data",
44 "75" => "zd<75",
45 "45" => "zd<45",
46 "35" => "zd<35",
47 "30" => "zd<30",
48 );
49
50$thcuts=array(
51 "all" => "all data",
52 "550" => "th<550",
53 "350" => "th<350",
54 );
55$lights=array(
56 "all" => "all data",
57 "nomoon" => "no moon",
58 "dark" => "only dark night",
59 );
60
61
62$dchs=array(
63 "no" => "all data",
64 "yes" => "apply data check (R750)",
65 );
66
67$dusts=array(
68 "all" => "all data",
69 "20" => "dust<20",
70 "10" => "dust<10",
71 "1.0" => "dust<1",
72 );
73
74$timebins=array(
75 "5" => "5 minutes",
76 "10" => "10 minutes",
77 "20" => "20 minutes",
78 "30" => "30 minutes",
79 "40" => "40 minutes",
80 "60" => "1 hour",
81 "90" => "1.5 hours",
82 "120" => "2 hours",
83 "180" => "3 hours",
84 "240" => "4 hours",
85 "300" => "5 hours",
86 "360" => "6 hours",
87 "-1" => "1 night",
88 "-2" => "2 nights",
89 "-3" => "3 nights",
90 "-4" => "4 nights",
91 "-5" => "5 nights",
92 "-6" => "6 nights",
93 "-7" => "7 nights",
94 "-10" => "10 nights",
95 "00" => "period",
96 );
97
98$timebinsext=array(
99 "20" => "20 minutes",
100 "-1" => "1 night",
101 );
102
103// get/define initial values
104
105if (!empty($_GET["dch"]))
106 $dch=$_GET["dch"];
107else
108 $dch="novalue";
109
110if (!empty($_GET["dust"]))
111 $dust=$_GET["dust"];
112else
113 $dust="novalue";
114
115if (!empty($_GET["expert"]))
116 $expert=$_GET["expert"];
117else
118 $expert="no";
119
120if (!empty($_GET["email"]))
121 $email=$_GET["email"];
122else
123 $email="";
124
125if (!empty($_GET["light"]))
126 $light=$_GET["light"];
127else
128 $light="novalue";
129
130if (!empty($_GET["source"]))
131 $source=$_GET["source"];
132else
133 $source=-1;
134
135if (!empty($_GET["timebin"]))
136 $timebin=$_GET["timebin"];
137else
138 $timebin="novalue";
139
140if (!empty($_GET["time"]))
141 $time=$_GET["time"];
142else
143 $time="novalue";
144
145if (!empty($_GET["table"]))
146 $table=$_GET["table"];
147else
148 $table="AnalysisResultsRunLP";
149
150if (!empty($_GET["th"]))
151 $th=$_GET["th"];
152else
153 $th="novalue";
154
155if (!empty($_GET["zd"]))
156 $zd=$_GET["zd"];
157else
158 $zd="novalue";
159
160//variable for non-combinable date/source
161$warn="";
162
163
164include ("db.php");
165$db_id = mysql_connect($host, $user, $pw);
166mysql_select_db($db);
167
168ini_set("display_errors", "On");
169ini_set("mysql.trace_mode", "On");
170
171echo "<h1><u>FACT Quick Look Analysis - Download Area</u></h1>\n";
172//echo "<hr>\n";
173echo "<h2>Data Usage Policy</h2>\n";
174
175if ($expert=="yes")
176{
177 echo "As a member or associated member of the FACT Collaboration, you have access to internal information.<br>\n";
178 echo "Any publication using FACT internal information has to have the full FACT author list.<br><br>\n";
179}
180else
181{
182 echo "<b>Using data from the FACT Quick Look Analysis, you agree to cite the ";
183 echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/8/06/P06008'>FACT design paper</a>\n ";
184 echo "and the <a target='_blank' href='https://fact-project.org/monitoring'>quick look analysis</a>.</b>\n";
185 echo "<br><br>\n \n ";
186 echo "<u>References:</u>\n";
187 echo "<ul>\n";
188 echo "<li>Website Quick Look Analysis: <a target='_blank' href='https://fact-project.org/monitoring'>https://fact-project.org/monitoring </a></li>\n";
189 echo "<li>FACT Design Paper: H. Anderhub et al. JINST 8 P6008 <a target='_blank' href='http://adsabs.harvard.edu/abs/2013JInst...8P6008A'>ADS</a>\n ";
190 echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/8/06/P06008'>open access</a>\n</li>\n";
191 echo "<li>FACT Performance Paper: A. Biland et al. JINST 9 P10012 <a target='_blank' href='http://adsabs.harvard.edu/abs/2014JInst...9P0012B'>ADS</a>\n ";
192 echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/9/10/P10012/'>open access</a>\n</li>\n";
193 echo "<li>Information on the Quick Look Analysis: D. Dorner et al. Proceedings Fermi Symposium 2014 <a target='_blank' href='http://adsabs.harvard.edu/abs/2015arXiv150202582D'>ADS</a>\n ";
194 echo "<a target='_blank' href='https://arxiv.org/pdf/1502.02582v1.pdf'>open access</a>\n</li>\n";
195 echo "</ul>\n";
196}
197
198
199echo "If you intend to use data or information from this website, please let us know for reference.<br>\n";
200
201
202//echo "<hr>\n";
203echo "<form name='formular' action='download.php' METHOD='GET'>\n";
204
205//$query="SELECT fSourceKey, fSourceName, (SELECT COUNT(*) FROM ".$_GET["table"]." LEFT JOIN RunInfo USING(fNight, fRunID) WHERE fRunTypeKey=1 AND RunInfo.fSourceKey=Source.fSourceKey) AS num FROM Source WHERE fSourceTypeKey=1";
206$query="SELECT fSourceKey, fSourceName, COUNT(*) AS num FROM RunInfo LEFT JOIN Source USING(fSourceKey) WHERE fSourceTypeKey=1 AND fRunTypeKey=1 GROUP BY fSourceKey ORDER BY num DESC";
207//echo $query."<br>";
208
209$sources=array();
210$result=mysql_query($query);
211while ($row = mysql_fetch_row($result))
212 $sources[$row[0]]=$row[1];
213mysql_free_result($result);
214
215//$query="SELECT Min(fNight), Max(fNight) FROM ".$_GET["table"];
216$query="SELECT Min(fNight), Max(fNight) FROM RunInfo";
217//echo $query."<br>";
218
219$result=mysql_query($query);
220while ($row = mysql_fetch_row($result))
221{
222 if (empty($start))
223 $start=$row[0];
224 if (empty($stop))
225 $stop=$row[1];
226}
227mysql_free_result($result);
228
229if (strpos($email, "@")!= false && $source<0)
230 print_popup("Please select a source.");
231
232if (strpos($email, "@")!= false && $time=="novalue")
233 print_popup("Please select a time format.");
234
235if (strpos($email, "@")!= false && $timebin=="novalue")
236 print_popup("Please select a time binning.");
237
238if (empty($email) && $time!="novalue" && $timebin!="novalue" && $source>0)
239 print_popup("Please provide an email address.");
240
241
242if (strpos($email, "@")!= false && $source>0)
243{
244 echo "<h2>Sending data...</h2>\n";
245 //print_popup("Sent email to ".$email." containing the data of ".$sources[$source]." from ".$start." till ".$stop." for ".$timebins[$timebin]." binning.");
246 print_popup("Email with data sent to ".$email);
247 if ($maintenance)
248 echo $start." ".$stop." ".$source." ".$timebin." ".$email." ".$table." ".$time." ".$expert." ".$dch." ".$zd." ".$th." ".$light." ".$dust."<br>\n";
249 $sent=shell_exec("/users/fact/SW.automatic.processing/DataCheck/Tools/get_data.sh ".$start." ".$stop." ".$source." ".$timebin." ".$email." ".$table." ".$time." ".$expert." ".$dch." ".$zd." ".$th." ".$light." ".$dust);
250 echo $sent;
251 // use other return information
252}
253
254echo "<h2>Select here the settings for your data sample:</h2>\n";
255
256// SOURCE
257echo "<select name='source' size='1'>\n";
258if ($source == -1)
259 printf("<option value='-1' selected>Select Source</option>\n");
260else
261 printf("<option value='-1'>Select Source</option>\n");
262foreach ($sources as $key => $sourcename)
263{
264 if ($source==$key)
265 printf("<option value='%s' selected>%s</option>\n", $key, $sourcename);
266 else
267 printf("<option value='%s'>%s</option>\n", $key, $sourcename);
268}
269echo "</select>\n";
270
271// Time Format
272echo "<select name='time' size='1'>\n";
273if ($time == "")
274 printf("<option value='novalue' selected>Select Time Format</option>\n");
275else
276 printf("<option value='novalue'>Select Time Format</option>\n");
277foreach ($times as $key => $name)
278{
279 if ($time == $key)
280 printf("<option value='%s' selected>%s</option>\n", $key, $name);
281 else
282 printf("<option value='%s'>%s</option>\n", $key, $name);
283}
284echo "</select>\n ";
285
286// Binning
287echo "<select name='timebin' size='1'>\n";
288if ($timebin == "novalue")
289 printf("<option value='novalue' selected>Select Binning</option>\n");
290else
291 printf("<option value='novalue'>Select Binning</option>\n");
292if ($expert != "yes")
293 $timebins=$timebinsext;
294foreach ($timebins as $key => $name)
295{
296 if ($timebin == $key)
297 printf("<option value='%s' selected>%s</option>\n", $key, $name);
298 else
299 printf("<option value='%s'>%s</option>\n", $key, $name);
300}
301echo "</select>\n";
302echo "<br>\n";
303
304printf("Time Range: from <input name='start' type='text' size='8' maxlength='8' value='%s'> \n", $start);
305printf("to <input name='stop' type='text' size='8' maxlength='8' value='%s'> \n ", $stop);
306//echo "<input class='Width' type='button' value='Reset' onClick='self.location.href=\"download.php\"'><br>\n";
307echo "<input class='Width' type='button' value='Reset' onClick='self.location.href=\"download.php";
308if ($expert == "yes")
309 echo "?expert=yes";
310echo "\"'><br>\n";
311
312if ($expert == "yes")
313{
314 echo "<h2>Further settings for internal use: </h2>\n";
315 echo "<input type='hidden' name='expert' value='yes'>\n";
316
317 echo "Select Analysis: <select name='table' size='1'>\n";
318 foreach ($tables as $key => $name)
319 {
320 if ($table == $key)
321 printf("<option value='%s' selected>%s</option>\n", $key, $name);
322 else
323 printf("<option value='%s'>%s</option>\n", $key, $name);
324 }
325 echo "</select><br>\n";
326
327 echo "Cuts: \n";
328 //DATACHECK
329 echo "<select name='dch' size='1'>\n";
330 if ($dch == "novalue")
331 printf("<option value='novalue' selected>Select DataCheck</option>\n");
332 else
333 printf("<option value='novalue'>Select DataCheck</option>\n");
334 foreach ($dchs as $key => $name)
335 {
336 if ($dch == $key)
337 printf("<option value='%s' selected>%s</option>\n", $key, $name);
338 else
339 printf("<option value='%s'>%s</option>\n", $key, $name);
340 }
341 echo "</select>\n ";
342
343 //DUST
344 echo "<select name='dust' size='1'>\n";
345 if ($dust == "novalue")
346 printf("<option value='novalue' selected>Select Calima-Cut</option>\n");
347 else
348 printf("<option value='novalue'>Select Calima-Cut</option>\n");
349 foreach ($dusts as $key => $name)
350 {
351 if ($dust == $key)
352 printf("<option value='%s' selected>%s</option>\n", $key, $name);
353 else
354 printf("<option value='%s'>%s</option>\n", $key, $name);
355 }
356 echo "</select>\n ";
357
358 //ZD
359 echo "<select name='zd' size='1'>\n";
360 if ($zd == "novalue")
361 printf("<option value='novalue' selected>Select Zd-Cut</option>\n");
362 else
363 printf("<option value='novalue'>Select Zd-Cut</option>\n");
364 foreach ($zdcuts as $key => $name)
365 {
366 if ($zd == $key)
367 printf("<option value='%s' selected>%s</option>\n", $key, $name);
368 else
369 printf("<option value='%s'>%s</option>\n", $key, $name);
370 }
371 echo "</select>\n ";
372
373 //TH
374 echo "<select name='th' size='1'>\n";
375 if ($th == "novalue")
376 printf("<option value='novalue' selected>Select Threshold-Cut</option>\n");
377 else
378 printf("<option value='novalue'>Select Threshold-Cut</option>\n");
379 foreach ($thcuts as $key => $name)
380 {
381 if ($th == $key)
382 printf("<option value='%s' selected>%s</option>\n", $key, $name);
383 else
384 printf("<option value='%s'>%s</option>\n", $key, $name);
385 }
386 echo "</select>\n ";
387
388 echo "<select name='light' size='1'>\n";
389 if ($light == "novalue")
390 printf("<option value='novalue' selected>Select Light-Condition-Cut</option>\n");
391 else
392 printf("<option value='novalue'>Select Light-Condition-Cut</option>\n");
393 foreach ($lights as $key => $name)
394 {
395 if ($light == $key)
396 printf("<option value='%s' selected>%s</option>\n", $key, $name);
397 else
398 printf("<option value='%s'>%s</option>\n", $key, $name);
399 }
400 echo "</select>\n <br>\n";
401}
402
403echo "<h2>Get data:</h2>\n";
404
405echo "Provide your email address to receive the data: \n";
406printf("<input name='email' type='text' size='20' maxlength='50' value='%s'>\n<br>\n", $email);
407
408echo "Clicking on the button, you agree to the data usage policy: \n";
409echo "<input class='Width' type='button' value='Send data by Email' onClick='submit()'><br>\n";
410
411
412
413echo "</form>\n";
414
415echo "<h2>Remarks:</h2> ";
416
417
418if ($expert=="yes")
419{
420 echo "<ul>\n";
421 echo "<li>The correction formula to correct the excess rate for the effects of zd and threshold are not yet final.</li>\n";
422 echo "<li>The CU conversion is currently only valid for QLA and until summer 2016.</li>\n";
423 echo "<li>The data quality selection based on the artificial trigger rate R750 might not work for all data (effect of lidar).</li>\n";
424 //echo "<li></li>\n";
425 echo "</ul>";
426}
427else
428{
429 echo "<ul>\n";
430 //echo "<li>The results shown on this page are <b><i>PRELIMINARY</i></b>.</li>";
431 echo "<li>These are the results of a <b>fast quick look analysis</b> on site, i.e. they are <b>preliminary</b>.</li>\n";
432 echo "<li>The quick look analysis includes all data, i.e. no data selection done.</li>\n";
433 //echo "<li><b>NO data check</b> is included in the analysis.</li>";
434 echo "<li>The shown curves are not fluxes but <b>excess rates</b> (number of excess events per effective ontime), \n";
435 echo "i.e. there is a dependence on trigger threshold and zenith distance of the observation (with the current \n";
436 echo "analysis for zenith distance > 40 degree and trigger threshold > 500 DAC counts).</li>\n";
437 //echo "i.e. a dependence on trigger threshold and zenith distance of the observation is expected ";
438 //echo "for zenith distance larger than 40 degree and very strong moon light.</li>";
439 //echo "<li><b>NO corrections</b> for the dependence on zenith distance and trigger threshold of the observation are applied so far.</li>";
440 //echo "<li>This webpage shows the <b>excess rates</b> (black), i.e. number of excess events ";
441 //echo "(signal minus background in the signal region) devided by the ontime of the observation, ";
442 //echo "and the <b>background rates</b> (blue), i.e. number of background events devided by ontime. </li>";
443 echo "<li>The curves are provided with 20 min binning and nightly binning.</li>\n";
444 echo "<li>In case, you need further details about the data or a different binning, please do not hesitate to contact us.</li>\n";
445 echo "<li>QLA results are available for the data since 12.12.2012. For older data, please contact us.</li>\n";
446 echo "<li>New software versions were introduced at the following dates: 24.5.2014</li>\n";
447 echo "</ul>\n";
448 echo "In case you are interested in more than the public data, please contact us.\n";
449}
450
451echo "<h2>Contact</h2>";
452echo "Daniela Dorner <i>dorner&lt;at&gt;astro.uni-wuerzburg.de</i><br>";
453//echo "You acknowledge these regulations by clicking on the 'Show' button.</b></big> <br><br><br>";
454
455/*
456$ranges=array(
457// "5min" => " 5 min",
458// "10min" => "10 min",
459 "20min" => "20 min",
460 "30min" => "30 min",
461 "40min" => "40 min",
462 "60min" => "60 min",
463 "90min" => "90 min",
464 "120min" => "120 min",
465 "180min" => "180 min",
466 "240min" => "240 min",
467 "300min" => "300 min",
468 "360min" => "360 min",
469// "0001nights" => "1 night",
470// "0002nights" => "2 nights",
471// "0004nights" => "4 nights",
472// "0008nights" => "8 nights",
473// "0016nights" => "16 nights",
474 );
475
476echo "</body>";
477echo "</html>";
478*/
479//$dom = new DOMDocument();
480//$dom->loadHTML("download.php");
481//echo $dom->getElementById("logged");
482
483?>
484</body>
485</html>
Note: See TracBrowser for help on using the repository browser.