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

Last change on this file since 19921 was 19733, checked in by Daniela Dorner, 5 years ago
added new options (cut on correction-factors, cut for rows with empty values)
File size: 20.6 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 later...</p>\n<p>\n<hr>\n<p>\n<p>\n";
28}
29
30
31$tables=array(
32 "AnalysisResultsRunLP" => "QLA",
33 "AnalysisResultsRunISDC" => "ISDC",
34 "AnalysisResultsRunCutsLC" => "CutsLC",
35 );
36
37$times=array(
38 "timestamp" => "timestamp [YYYY-MM-DD HH:MM:SS]",
39 "unix" => "unix-timestamp [seconds]",
40 "mjd" => "modified julian date [days]",
41 );
42
43$zdcuts=array(
44 "all" => "all data",
45 "75" => "zd<75",
46 "45" => "zd<45",
47 "35" => "zd<35",
48 "30" => "zd<30",
49 );
50
51$thcuts=array(
52 "all" => "all data",
53 "550" => "th<550",
54 "350" => "th<350",
55 );
56$lights=array(
57 "all" => "all data",
58 "nomoon" => "no moon",
59 "dark" => "only dark night",
60 );
61
62
63$dchs=array(
64 "no" => "all data",
65 "yes" => "apply data check (R750)",
66 );
67
68$rmemptyrows=array(
69 "no" => "all data",
70 "yes" => "remove rows with empty columns",
71 );
72
73$dusts=array(
74 "all" => "all data",
75 "20" => "dust<20",
76 "10" => "dust<10",
77 "1.0" => "dust<1",
78 );
79
80$factorcuts=array(
81 "all" => "all data",
82 "0.1" => "zdfactor * thfactor > 0.1",
83 "0.2" => "zdfactor * thfactor > 0.2",
84 "0.3" => "zdfactor * thfactor > 0.3",
85 "0.4" => "zdfactor * thfactor > 0.4",
86 "0.5" => "zdfactor * thfactor > 0.5",
87 "0.6" => "zdfactor * thfactor > 0.6",
88 "0.7" => "zdfactor * thfactor > 0.7",
89 "0.8" => "zdfactor * thfactor > 0.8",
90 "0.9" => "zdfactor * thfactor > 0.9",
91 );
92
93$timebins=array(
94 "5" => "5 minutes",
95 "10" => "10 minutes",
96 "20" => "20 minutes",
97 "30" => "30 minutes",
98 "40" => "40 minutes",
99 "60" => "1 hour",
100 "90" => "1.5 hours",
101 "120" => "2 hours",
102 "180" => "3 hours",
103 "240" => "4 hours",
104 "300" => "5 hours",
105 "360" => "6 hours",
106 "-1" => "1 night",
107 "-2" => "2 nights",
108 "-3" => "3 nights",
109 "-4" => "4 nights",
110 "-5" => "5 nights",
111 "-6" => "6 nights",
112 "-7" => "7 nights",
113 "-10" => "10 nights",
114 "00" => "period",
115 );
116
117$timebinsext=array(
118 "20" => "20 minutes",
119 "-1" => "1 night",
120 );
121
122// get/define initial values
123
124if (!empty($_POST["start"]))
125 $start=$_POST["start"];
126
127if (!empty($_POST["stop"]))
128 $stop=$_POST["stop"];
129
130if (!empty($_POST["dch"]))
131 $dch=$_POST["dch"];
132else
133 $dch="novalue";
134
135if (!empty($_POST["dust"]))
136 $dust=$_POST["dust"];
137else
138 $dust="novalue";
139
140if (!empty($_GET["expert"]))
141 $_POST["expert"]=$_GET["expert"];
142
143if (!empty($_POST["expert"]))
144 $expert=$_POST["expert"];
145else
146 $expert="no";
147
148if (!empty($_POST["email"]))
149 $email=$_POST["email"];
150else
151 $email="";
152
153if (!empty($_POST["light"]))
154 $light=$_POST["light"];
155else
156 $light="novalue";
157
158if (!empty($_POST["source"]))
159 $source=$_POST["source"];
160else
161 $source=-1;
162
163if (!empty($_POST["timebin"]))
164 $timebin=$_POST["timebin"];
165else
166 $timebin="novalue";
167
168if (!empty($_POST["time"]))
169 $time=$_POST["time"];
170else
171 $time="novalue";
172
173if (!empty($_POST["factorcut"]))
174 $factorcut=$_POST["factorcut"];
175else
176 $factorcut="novalue";
177
178if (!empty($_POST["table"]))
179 $table=$_POST["table"];
180else
181 $table="AnalysisResultsRunLP";
182
183if (!empty($_POST["rmemptyrow"]))
184 $rmemptyrow=$_POST["rmemptyrow"];
185else
186 $rmemptyrow="no";
187
188if (!empty($_POST["th"]))
189 $th=$_POST["th"];
190else
191 $th="novalue";
192
193if (!empty($_POST["zd"]))
194 $zd=$_POST["zd"];
195else
196 $zd="novalue";
197
198//variable for non-combinable date/source
199$warn="";
200
201
202include ("db.php");
203$db_id = mysql_connect($host, $user, $pw);
204mysql_select_db($db);
205
206ini_set("display_errors", "On");
207ini_set("mysql.trace_mode", "On");
208
209echo "<h1><u>FACT Quick Look Analysis - Download Area</u></h1>\n";
210//echo "<hr>\n";
211echo "<h2>Data Usage Policy</h2>\n";
212
213if ($expert=="yes")
214{
215 echo "As a member or associated member of the FACT Collaboration, you have access to internal information.<br>\n";
216 echo "Any publication using FACT internal information has to have the full FACT author list.<br><br>\n";
217}
218else
219{
220 echo "<b>Using data from the FACT Quick Look Analysis, you agree to cite the FACT design paper (H. Anderhub et al. JINST 8 P6008) ";
221// echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/8/06/P06008'>FACT design paper</a>\n ";
222 echo "and the quick look analysis (https://fact-project.org/monitoring).</b>\n";
223 echo "<br><br>\n \n ";
224 echo "<u>References:</u>\n";
225 echo "<ul>\n";
226 echo "<li>Website Quick Look Analysis: <a target='_blank' href='https://fact-project.org/monitoring'>https://fact-project.org/monitoring </a></li>\n";
227 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 ";
228 echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/8/06/P06008'>open access</a>\n</li>\n";
229 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 ";
230 echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/9/10/P10012/'>open access</a>\n</li>\n";
231 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 ";
232 echo "<a target='_blank' href='https://arxiv.org/pdf/1502.02582v1.pdf'>open access</a>\n</li>\n";
233 echo "</ul>\n";
234}
235
236
237echo "If you intend to use data or information from this website, please let us know for reference.<br>\n";
238
239
240//echo "<hr>\n";
241echo "<form name='formular' action='download.php' METHOD='POST'>\n";
242
243//$query="SELECT fSourceKey, fSourceName, (SELECT COUNT(*) FROM ".$_POST["table"]." LEFT JOIN RunInfo USING(fNight, fRunID) WHERE fRunTypeKey=1 AND RunInfo.fSourceKey=Source.fSourceKey) AS num FROM Source WHERE fSourceTypeKey=1";
244$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";
245//echo $query."<br>";
246
247$sources=array();
248$result=mysql_query($query);
249while ($row = mysql_fetch_row($result))
250 $sources[$row[0]]=$row[1];
251mysql_free_result($result);
252
253//$query="SELECT Min(fNight), Max(fNight) FROM ".$_POST["table"];
254$query="SELECT Min(fNight), Max(fNight) FROM RunInfo";
255//echo $query."<br>";
256
257$result=mysql_query($query);
258while ($row = mysql_fetch_row($result))
259{
260 if (empty($start))
261 $start=$row[0];
262 if (empty($stop))
263 $stop=$row[1];
264}
265mysql_free_result($result);
266
267if (strpos($email, "@")!= false && $source<0)
268 print_popup("Please select a source.");
269
270if (strpos($email, "@")!= false && $time=="novalue")
271 print_popup("Please select a time format.");
272
273if (strpos($email, "@")!= false && $timebin=="novalue")
274 print_popup("Please select a time binning.");
275
276if (empty($email) && $time!="novalue" && $timebin!="novalue" && $source>0)
277 print_popup("Please provide an email address.");
278
279
280if (strpos($email, "@")!= false && empty($_POST["emailcopy"]))
281 print_popup("Please agree that a copy of the email is stored.");
282
283
284if (strpos($email, "@")!= false && $source>0 && !empty($_POST["emailcopy"]))
285{
286 //echo "<h2>Sending data...</h2>\n";
287 //print_popup("Sent email to ".$email." containing the data of ".$sources[$source]." from ".$start." till ".$stop." for ".$timebins[$timebin]." binning.");
288 print_popup("Email with data sent to ".$email);
289 if ($maintenance)
290 echo $start." ".$stop." ".$source." ".$timebin." ".$email." ".$table." ".$time." ".$expert." ".$dch." ".$zd." ".$th." ".$light." ".$dust." ".$rmemptyrow." ".$factorcut."<br>\n";
291 $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." ".$rmemptyrow." ".$factorcut);
292 echo $sent;
293 if (!empty($_POST["newsletter"]))
294 {
295 $query_interested="SELECT * FROM memberlist.interested WHERE email='".$email."'";
296 $result_interested=mysql_query($query_interested);
297 //echo "num rows: ".mysql_num_rows($result_interested)."<br>\n";
298 //while ($row = mysql_fetch_row($result_interested))
299 // echo $row[0]." ".$row[1]." ".$row[2]." ".$row[3]."<br>\n";
300 if (mysql_num_rows($result_interested)>0)
301 $query_interested="UPDATE ";
302 else
303 $query_interested="INSERT ";
304 $query_interested.=" memberlist.interested SET date=NOW(), email='".$email."'";
305 if (mysql_num_rows($result_interested)>0)
306 $query_interested.=" WHERE email='".$email."'";
307 //echo $query_interested;
308 mysql_free_result($result_interested);
309 $result_interested=mysql_query($query_interested);
310 if ($maintenance)
311 echo "num affected rows: ".mysql_affected_rows()."<br>\n";
312 }
313}
314
315//#DFE6FA #CDD7F4
316echo "<br>\n<div style='background-color: #DFE6FA; padding-left: 20px; padding-right: 20px; padding-top: 1px; padding-bottom: 10px; border: 3px solid #394979; border-radius: 20px'>\n";
317echo "<h2>Select here the settings for your data sample:</h2>\n";
318
319// SOURCE
320echo "<select name='source' size='1'>\n";
321if ($source == -1)
322 printf("<option value='-1' selected>Select Source</option>\n");
323else
324 printf("<option value='-1'>Select Source</option>\n");
325foreach ($sources as $key => $sourcename)
326{
327 if ($source==$key)
328 printf("<option value='%s' selected>%s</option>\n", $key, $sourcename);
329 else
330 printf("<option value='%s'>%s</option>\n", $key, $sourcename);
331}
332echo "</select><sup>*</sup>\n";
333
334// Time Format
335echo "<select name='time' size='1'>\n";
336if ($time == "")
337 printf("<option value='novalue' selected>Select Time Format</option>\n");
338else
339 printf("<option value='novalue'>Select Time Format</option>\n");
340foreach ($times as $key => $name)
341{
342 if ($time == $key)
343 printf("<option value='%s' selected>%s</option>\n", $key, $name);
344 else
345 printf("<option value='%s'>%s</option>\n", $key, $name);
346}
347echo "</select><sup>*</sup>\n ";
348
349// Binning
350echo "<select name='timebin' size='1'>\n";
351if ($timebin == "novalue")
352 printf("<option value='novalue' selected>Select Binning</option>\n");
353else
354 printf("<option value='novalue'>Select Binning</option>\n");
355if ($expert != "yes")
356 $timebins=$timebinsext;
357foreach ($timebins as $key => $name)
358{
359 if ($timebin == $key)
360 printf("<option value='%s' selected>%s</option>\n", $key, $name);
361 else
362 printf("<option value='%s'>%s</option>\n", $key, $name);
363}
364echo "</select><sup>*</sup>\n";
365echo "<br>\n";
366
367printf("Time Range: from <input name='start' type='text' size='8' maxlength='8' value='%s'> \n", $start);
368printf("to <input name='stop' type='text' size='8' maxlength='8' value='%s'> \n ", $stop);
369//echo "<input class='Width' type='button' value='Reset' onClick='self.location.href=\"download.php\"'><br>\n";
370echo "<input class='Width' type='button' value='Reset' onClick='self.location.href=\"download.php";
371if ($expert == "yes")
372 echo "?expert=yes";
373echo "\"'><br>\n";
374
375if ($expert == "yes")
376{
377 echo "<h2>Further settings for internal use: </h2>\n";
378 echo "<input type='hidden' name='expert' value='yes'>\n";
379
380 echo "Select Analysis: <select name='table' size='1'>\n";
381 foreach ($tables as $key => $name)
382 {
383 if ($table == $key)
384 printf("<option value='%s' selected>%s</option>\n", $key, $name);
385 else
386 printf("<option value='%s'>%s</option>\n", $key, $name);
387 }
388 echo "</select><br>\n";
389
390 echo "Cuts: \n";
391 //DATACHECK
392 echo "<select name='dch' size='1'>\n";
393 if ($dch == "novalue")
394 printf("<option value='novalue' selected>Select DataCheck</option>\n");
395 else
396 printf("<option value='novalue'>Select DataCheck</option>\n");
397 foreach ($dchs as $key => $name)
398 {
399 if ($dch == $key)
400 printf("<option value='%s' selected>%s</option>\n", $key, $name);
401 else
402 printf("<option value='%s'>%s</option>\n", $key, $name);
403 }
404 echo "</select>\n ";
405
406 //DUST
407 echo "<select name='dust' size='1'>\n";
408 if ($dust == "novalue")
409 printf("<option value='novalue' selected>Select Calima-Cut</option>\n");
410 else
411 printf("<option value='novalue'>Select Calima-Cut</option>\n");
412 foreach ($dusts as $key => $name)
413 {
414 if ($dust == $key)
415 printf("<option value='%s' selected>%s</option>\n", $key, $name);
416 else
417 printf("<option value='%s'>%s</option>\n", $key, $name);
418 }
419 echo "</select>\n ";
420
421 //ZD
422 echo "<select name='zd' size='1'>\n";
423 if ($zd == "novalue")
424 printf("<option value='novalue' selected>Select Zd-Cut</option>\n");
425 else
426 printf("<option value='novalue'>Select Zd-Cut</option>\n");
427 foreach ($zdcuts as $key => $name)
428 {
429 if ($zd == $key)
430 printf("<option value='%s' selected>%s</option>\n", $key, $name);
431 else
432 printf("<option value='%s'>%s</option>\n", $key, $name);
433 }
434 echo "</select>\n ";
435
436 //TH
437 echo "<select name='th' size='1'>\n";
438 if ($th == "novalue")
439 printf("<option value='novalue' selected>Select Threshold-Cut</option>\n");
440 else
441 printf("<option value='novalue'>Select Threshold-Cut</option>\n");
442 foreach ($thcuts as $key => $name)
443 {
444 if ($th == $key)
445 printf("<option value='%s' selected>%s</option>\n", $key, $name);
446 else
447 printf("<option value='%s'>%s</option>\n", $key, $name);
448 }
449 echo "</select>\n ";
450
451 echo "<select name='light' size='1'>\n";
452 if ($light == "novalue")
453 printf("<option value='novalue' selected>Select Light-Condition-Cut</option>\n");
454 else
455 printf("<option value='novalue'>Select Light-Condition-Cut</option>\n");
456 foreach ($lights as $key => $name)
457 {
458 if ($light == $key)
459 printf("<option value='%s' selected>%s</option>\n", $key, $name);
460 else
461 printf("<option value='%s'>%s</option>\n", $key, $name);
462 }
463 echo "</select>\n";
464
465 echo "<select name='factorcut' size='1'>\n";
466 if ($factorcut == "novalue")
467 printf("<option value='novalue' selected>Select Factor-Cut</option>\n");
468 else
469 printf("<option value='novalue'>Select Factor-Cut</option>\n");
470 foreach ($factorcuts as $key => $name)
471 {
472 if ($factorcut == $key)
473 printf("<option value='%s' selected>%s</option>\n", $key, $name);
474 else
475 printf("<option value='%s'>%s</option>\n", $key, $name);
476 }
477 echo "</select>\n";
478
479 echo "<select name='rmemptyrows' size='1'>\n";
480 foreach ($rmemptyrows as $key => $name)
481 {
482 if ($rmemptyrow == $key)
483 printf("<option value='%s' selected>%s</option>\n", $key, $name);
484 else
485 printf("<option value='%s'>%s</option>\n", $key, $name);
486 }
487 echo "</select>\n <br>\n";
488}
489
490echo "<h2>Get data:</h2>\n";
491
492echo "Provide your email address to receive the data: \n";
493printf("<input name='email' type='text' size='20' maxlength='50' value='%s'><sup>*</sup>\n<br>\n", $email);
494
495if (empty($_POST["emailcopy"]))
496 echo "<input type='checkbox' name='emailcopy'><sup>*</sup> I agree that a copy of the email is stored for the statistical evaluation of data requests.<br>\n";
497else
498 echo "<input type='checkbox' name='emailcopy' checked><sup>*</sup> I agree that a copy of the email is stored for the statistical evaluation of data requests.<br>\n";
499if (empty($_POST["newsletter"]))
500 echo "<input type='checkbox' name='newsletter'> I would like to receive updates on the data and agree that my email address is stored for this purpose.<br><br>\n";
501else
502 echo "<input type='checkbox' name='newsletter' checked> I would like to receive updates on the data and agree that my email address is stored for this purpose.<br><br>\n";
503
504echo "Clicking on the button, you agree to the data usage policy: <br><br>\n";
505//echo "Clicking on the button, you agree to the data usage policy and that a copy of my email is stored: <br><br>\n";
506echo "<input type='button' style='width: 250px; height: 40px; font-size: 22px; ' value='Send data by Email' onClick='submit()'><br>\n";
507//border: 3px solid #394979; border-radius: 10px
508echo "<sup>*</sup> required<br>\n";
509
510
511echo "</form>\n";
512echo "</div>\n";
513//echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* required<br>\n";
514
515echo "<h2>Remarks:</h2> ";
516
517
518if ($expert=="yes")
519{
520 echo "<ul>\n";
521 echo "<li>The correction formula to correct the excess rate for the effects of zd and threshold is not yet final.</li>\n";
522 //echo "<li>The CU conversion is currently only valid for QLA and until summer 2016.</li>\n";
523 echo "<li>The data quality selection based on the artificial trigger rate R750 \n";
524 echo "<ul>\n";
525 echo "<li>might not work for all data (effect of lidar).</li>\n";
526 echo "<li>might not be available for the newest data (reference value needs to be determined).</li>\n";
527 echo "</ul></li>\n";
528 echo "<li>Not for all data dust measurements are available.</li>\n";
529 //echo "<li></li>\n";
530 echo "</ul>";
531}
532else
533{
534 echo "<ul>\n";
535 //echo "<li>The results shown on this page are <b><i>PRELIMINARY</i></b>.</li>";
536 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";
537 echo "<li>The quick look analysis includes all data, i.e. no data selection done.</li>\n";
538 //echo "<li><b>NO data check</b> is included in the analysis.</li>";
539 echo "<li>The shown curves are not fluxes but <b>excess rates</b> (number of excess events per effective ontime), \n";
540 echo "i.e. there is a dependence on trigger threshold and zenith distance of the observation (with the current \n";
541 echo "analysis for zenith distance > 40 degree and trigger threshold > 500 DAC counts).</li>\n";
542 //echo "i.e. a dependence on trigger threshold and zenith distance of the observation is expected ";
543 //echo "for zenith distance larger than 40 degree and very strong moon light.</li>";
544 //echo "<li><b>NO corrections</b> for the dependence on zenith distance and trigger threshold of the observation are applied so far.</li>";
545 //echo "<li>This webpage shows the <b>excess rates</b> (black), i.e. number of excess events ";
546 //echo "(signal minus background in the signal region) devided by the ontime of the observation, ";
547 //echo "and the <b>background rates</b> (blue), i.e. number of background events devided by ontime. </li>";
548 echo "<li>The curves are provided with 20 min binning and nightly binning.</li>\n";
549 echo "<li>In case, you need further details about the data or a different binning, please do not hesitate to contact us.</li>\n";
550 echo "<li>QLA results are available for the data since 12.12.2012. For older data, please contact us.</li>\n";
551 echo "<li>New software versions were introduced at the following dates: 24.5.2014</li>\n";
552 echo "</ul>\n";
553 echo "In case you are interested in more than the public data, please contact us.\n";
554}
555
556echo "<h2>Contact</h2>";
557echo "<i>qla&lt;at&gt;fact-project.org</i><br>";
558//echo "You acknowledge these regulations by clicking on the 'Show' button.</b></big> <br><br><br>";
559
560/*
561$ranges=array(
562// "5min" => " 5 min",
563// "10min" => "10 min",
564 "20min" => "20 min",
565 "30min" => "30 min",
566 "40min" => "40 min",
567 "60min" => "60 min",
568 "90min" => "90 min",
569 "120min" => "120 min",
570 "180min" => "180 min",
571 "240min" => "240 min",
572 "300min" => "300 min",
573 "360min" => "360 min",
574// "0001nights" => "1 night",
575// "0002nights" => "2 nights",
576// "0004nights" => "4 nights",
577// "0008nights" => "8 nights",
578// "0016nights" => "16 nights",
579 );
580
581echo "</body>";
582echo "</html>";
583*/
584//$dom = new DOMDocument();
585//$dom->loadHTML("download.php");
586//echo $dom->getElementById("logged");
587
588?>
589</body>
590</html>
Note: See TracBrowser for help on using the repository browser.