source: trunk/MagicSoft/Mars/datacenter/db/builddatasets.php@ 8331

Last change on this file since 8331 was 8273, checked in by Daniela Dorner, 18 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 45.6 KB
Line 
1<?php
2{
3 function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs)
4 {
5 $fromtable="Sequences";
6
7 $groups = 0;
8 foreach ($checkgroup as $element)
9 if ($element==-1)
10 $groups++;
11
12 $statusgroups = 0;
13 foreach ($checkstatusgroup as $element)
14 if ($element==-1)
15 $statusgroups++;
16
17 $query0 = "SELECT ";
18
19 if ($groups>0)
20 {
21 foreach ($checkgroup as $key => $element)
22 if ($element==-1)
23 $query0 .= $key . " as '" . $alias[$key] . "' " . ", ";
24 //--------------------------------------------------
25 $query0 .= "SUM(fRunTime)/3600 as '" . $alias["SUM(fRunTime)/3600"] . "', ";
26 //--------------------------------------------------
27 $query0 .= " SUM(fNumEvents) as '" . $alias["SUM(fNumEvents)"] . "', ";
28 $query0 .= " Min(fZenithDistanceMin) as '" . $alias["Min(fZenithDistanceMin)"] . "', ";
29 $query0 .= " Max(fZenithDistanceMax) as '" . $alias["Max(fZenithDistanceMax)"] . "', ";
30 $query0 .= " COUNT(*) as '# Sequ' ";
31 }
32 else
33 {
34 if ($statusgroups>0)
35 {
36 foreach ($checkstatusgroup as $key => $element)
37 if ($element==-1)
38 $query0 .= " (if(IsNull(" . $key . "), if(isnull(fStartTime), 'not done', if(isnull(fFailedTime),if(isnull(" . $needs[$key] . "),'not done',if(date_sub(Now(),interval 12 hour) < fStartTime,'running','crashed')),if(isnull(" . $needs[$key] . "),'not done','failed'))) ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
39// $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
40
41 $query0 .= " COUNT(*) as '# Sequ'";
42
43 }
44 else
45 {
46 $query0 .= " " . $fromtable . ".fSequenceFirst as '" . $alias["fSequenceFirst"] . "' ";
47 if (!empty($_GET["fLinks"]))
48 {
49 $query0 .= ", CONCAT('<A&ws;HREF=\"runinfo-aio.php?', 'fRunStart=On', '&amp;fZenithDistance=On', '&amp;fRunMin=', Sequences.fSequenceFirst, '&amp;fMeanTriggerRate=On', '&amp;fTest=On', '&amp;fRunTypeName=On', '&amp;fRunMax=', fSequenceLast, '&amp;fNumEvents=On', '&amp;fSourceName=On&amp;', 'fExcludedFDAKEY=1', '&amp;fSequenceFirst=On', '&amp;fRawFileAvail=On', '&amp;fCCFileAvail=On', '&amp;fCaCoFileAvail=On', '&amp;fNumResults=500\">r</A>' ";
50 // $query0 .= " as " . $alias["fSequenceFirst"];
51 $query0 .= ", '&nbsp;<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), 'callisto', LPAD(CONCAT(Sequences.fSequenceFirst , '.html'), 13,'0') , '\">cl</A>'";
52 $query0 .= ", '&nbsp;<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), '\">c</A>'";
53 $query0 .= ", '&nbsp;<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/star/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), 'star', LPAD(CONCAT(Sequences.fSequenceFirst , '.html'), 13,'0') , '\">sl</A>'";
54 $query0 .= ", '&nbsp;<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/star/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), '\">s</A>'";
55 $query0 .= ", '&nbsp;<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/sequences/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/sequence', LPAD(CONCAT(Sequences.fSequenceFirst , '.txt'), 12,'0') , '\">', 'f </A>' ";
56 $query0 .= ", '&nbsp;<A&ws;HREF=\"sequence.php?fSequenceNo=', Sequences.fSequenceFirst , '&amp;fAll=On\">i</A>') ";
57 $query0 .= " as 'Links'";
58 }
59
60 foreach ($_GET as $key => $element)
61 if ($_GET[$key]=="On")
62 if ($key!="fLinks" && $key!="fOff" && $key!="fOnlyOff")
63 if (empty($checkwhere[$key]) || $checkwhere[$key]==0)
64 $query0 .= ", " . $key . " as '" . $alias[$key] . "' ";
65 }
66 }
67
68 $query0 .= " FROM " . $fromtable;
69
70 $query0 .= " LEFT JOIN SequenceProcessStatus ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
71 $query0 .= " LEFT JOIN Calibration ON Sequences.fSequenceFirst=Calibration.fSequenceFirst ";
72 $query0 .= " LEFT JOIN Star ON Sequences.fSequenceFirst=Star.fSequenceFirst ";
73
74 foreach ($_GET as $key => $element)
75 if (($_GET[$key]=="On" || $groups>0))// && !empty(GetJoin($fromtable,$key)))
76 $query0 .= GetJoin($fromtable,$key);
77
78 if ($_GET["fTest"]!="On")
79 {
80 if ($_GET["fSourceName"]!="On")
81 $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY ";
82 $query0 .= " WHERE fTest='no'";
83 }
84
85 if ($_GET["fOff"]=="Off")
86 {
87 if (strpos($query0, " WHERE ")==FALSE)
88 $query0 .= " WHERE ";
89 else
90 $query0 .= " AND ";
91
92 $query0 .= " NOT (fSourceName like '%Off%')";
93 }
94
95 if ($_GET["fOnlyOff"]=="On")
96 {
97 if (strpos($query0, " WHERE ")==FALSE)
98 $query0 .= " WHERE ";
99 else
100 $query0 .= " AND ";
101
102 $query0 .= " fSourceName like '%Off%'";
103 }
104
105 foreach ($checkwhere as $key => $element)
106 {
107 if (empty($element) || $element<=0)
108 continue;
109
110 if (strpos($query0, " WHERE ")==FALSE)
111 $query0 .= " WHERE ";
112 else
113 if ($element!=-1)
114 if (strrpos($query0, " AND ")!=strlen($query0)-5)
115 $query0 .= " AND ";
116
117 if ($element!=-1)
118 $query0 .= GetCheck($fromtable, $key) . "=" . $element;
119 }
120
121 if (strpos($query0, " WHERE ")==FALSE)
122 $query0 .= " WHERE ";
123 else
124 $query0 .= " AND ";
125
126 $query0 .= StatusQuery("fSequenceFileWritten", $needs);
127 $query0 .= StatusQuery("fAllFilesAvail", $needs);
128 $query0 .= StatusQuery("fCallisto", $needs);
129 $query0 .= StatusQuery("fFillCallisto", $needs);
130 $query0 .= StatusQuery("fStar", $needs);
131 $query0 .= StatusQuery("fFillStar", $needs);
132
133 if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
134 $query0 .= "Sequences.fSequenceFirst BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " ";
135 else
136 $query0 = substr($query0, 0, -4);
137
138 if (!empty($_GET["fZDMin"]) && !empty($_GET["fZDMax"]))
139 $query0 .= "AND (fZenithDistanceMin > " . $_GET["fZDMin"] . " AND fZenithDistanceMax < " . $_GET["fZDMax"] . ") ";
140
141 if (!empty($_GET["fSourceN"]))
142 $query0 .= " AND fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" ";
143
144 if (!empty($_GET["fStartDate"]))
145 {
146 if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
147 $query0 .= " AND ";
148
149 $startdate=substr($_GET["fStartDate"], 0, 10);
150 if ($startdate=="0000-00-00")
151 $query0 .=" fRunStart >= '" . $startdate . " 00:00:00' ";
152 else
153 $query0 .= " fRunStart >= ADDDATE('" . $startdate . " 13:00:00', INTERVAL -1 DAY) ";
154 }
155
156 if (!empty($_GET["fStopDate"]))
157 {
158 if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
159 $query0 .= " AND ";
160
161 $stopdate=substr($_GET["fStopDate"], 0, 10);
162 $query0 .= " fRunStart < '" . $stopdate . " 13:00:00' ";
163 }
164
165 if (!empty($_GET["fStarStart"]))
166 {
167 if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
168 $query0 .= " AND ";
169
170 $starstart=substr($_GET["fStarStart"], 0, 10);
171 $query0 .=" fStar >= '" . $starstart . " 00:00:00' ";
172 }
173
174 if (!empty($_GET["fStarStop"]))
175 {
176 if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
177 $query0 .= " AND ";
178
179 $starstop=substr($_GET["fStarStop"], 0, 10);
180 $query0 .= " fStar < '" . $starstop . " 23:59:59' ";
181 }
182
183 if ($groups>0)
184 {
185 $query0 .= " GROUP BY ";
186 $num = $groups;
187 foreach ($checkgroup as $key => $element)
188 if ($element==-1)
189 {
190 $query0 .= GetCheck($fromtable,$key);
191 if ($num-->1)
192 $query0 .= ", ";
193 }
194 }
195
196 if ($statusgroups>0)
197 {
198 $query0 .= " GROUP BY ";
199 $num = $statusgroups;
200 foreach ($checkstatusgroup as $key => $element)
201 if ($element==-1)
202 {
203 $query0 .= $alias[$key];
204 if ($num-->1)
205 $query0 .= ", ";
206 }
207 }
208
209 if (!empty($_GET["fSortBy"]))
210 {
211 $val=substr($_GET["fSortBy"], 0, -1);
212 $query0 .= " ORDER BY " . GetTable($fromtable,$val) . " ";
213 if (substr($_GET["fSortBy"], -1)=="-")
214 $query0 .= "DESC";
215 }
216
217 if (empty($_GET["fSortBy"]) && $groups==0 && $statusgroups==0)
218 $query0 .= "ORDER BY Sequences.fSequenceFirst DESC ";
219
220 if (empty($_GET["fNumStart"]))
221 $_GET["fNumStart"]=0;
222
223 if (empty($_GET["fSendTxt"]))
224 $query0 .= " LIMIT " . $_GET["fNumStart"] . ", " . $_GET["fNumResults"];
225
226 return $query0;
227 }
228
229 function InitGet($_GET)
230 {
231 // Find out whether it is the first call to the php script
232 $first = empty($_GET["fRunMin"]) && empty($_GET["fRunMax"]);
233
234 if (empty($_GET["fNumResults"]))
235 $_GET["fNumResults"]="100";
236
237 if (empty($_GET["fRunStart"]))
238 $_GET["fRunStart"]=$first?"On":"";
239
240 if (empty($_GET["fRunTime/60"]))
241 $_GET["fRunTime/60"]=$first?"On":"";
242
243 if (empty($_GET["fZenithDistanceMin"]))
244 $_GET["fZenithDistanceMin"]=$first?"On":"";
245
246 if (empty($_GET["fZenithDistanceMax"]))
247 $_GET["fZenithDistanceMax"]=$first?"On":"";
248
249 if (empty($_GET["fSourceName"]))
250 $_GET["fSourceName"]=$first?"On":"";
251
252 if (empty($_GET["fObservationModeName"]))
253 $_GET["fObservationModeName"]=$first?"On":"";
254
255 if (empty($_GET["fUnsuitableInner"]))
256 $_GET["fUnsuitableInner"]=$first?"On":"";
257
258 if (empty($_GET["fUnsInLimit1"]))
259 $_GET["fUnsInLimit1"]=$first?"12":"";
260
261 if (empty($_GET["fUnsInLimit2"]))
262 $_GET["fUnsInLimit2"]=$first?"20":"";
263
264// if (empty($_GET["fRunTimeLimit1"]))
265// $_GET["fRunTimeLimit1"]=$first?"5":"";
266
267// if (empty($_GET["fRunTimeLimit2"]))
268// $_GET["fRunTimeLimit2"]=$first?"2":"";
269
270 if (empty($_GET["fPSFLimitRms"]))
271 $_GET["fPSFLimitRms"]=$first?"1.0":"";
272
273 if (empty($_GET["fPedRmsInLimitRms"]))
274 $_GET["fPedRmsInLimitRms"]=$first?"0.08":"";
275
276 if (empty($_GET["fNumIslLimitMean"]))
277 $_GET["fNumIslLimitMean"]=$first?"1.230":"";
278
279 if (empty($_GET["fNumIslLimitRms"]))
280 $_GET["fNumIslLimitRms"]=$first?"0.013":"";
281
282 if (empty($_GET["fMuonCalLimitMean"]))
283 $_GET["fMuonCalLimitMean"]=$first?"100.0":"";
284
285 if (empty($_GET["fMuonCalLimitRms"]))
286 $_GET["fMuonCalLimitRms"]=$first?"1.6":"";
287
288 if (empty($_GET["fRelTimeMaxLimit1"]))
289 $_GET["fRelTimeMaxLimit1"]=$first?"1.0":"";
290
291 if (empty($_GET["fRelTimeMaxLimit2"]))
292 $_GET["fRelTimeMaxLimit2"]=$first?"1.02":"";
293
294 if (empty($_GET["fRelTimeMinLimit1"]))
295 $_GET["fRelTimeMinLimit1"]=$first?"0.97":"";
296
297 if (empty($_GET["fRelTimeMinLimit2"]))
298 $_GET["fRelTimeMinLimit2"]=$first?"0.93":"";
299
300 if (empty($_GET["fIMCLimit1"]))
301 $_GET["fIMCLimit1"]=$first?"00":"";
302
303 if (empty($_GET["fIMCLimit2"]))
304 $_GET["fIMCLimit2"]=$first?"00":"";
305
306 if (empty($_GET["fIsoInLimit1"]))
307 $_GET["fIsoInLimit1"]=$first?"00":"";
308
309 if (empty($_GET["fIsoInLimit2"]))
310 $_GET["fIsoInLimit2"]=$first?"00":"";
311
312 if (empty($_GET["fInhomLimitMean"]))
313 $_GET["fInhomLimitMean"]=$first?"10":"";
314
315 if (empty($_GET["fInhomLimitRms"]))
316 $_GET["fInhomLimitRms"]=$first?"3":"";
317
318 if (empty($_GET["fImgRateLimitMean"]))
319 $_GET["fImgRateLimitMean"]=$first?"180":"";
320
321 if (empty($_GET["fImgRateLimitRms"]))
322 $_GET["fImgRateLimitRms"]=$first?"30":"";
323
324 if (empty($_GET["fMuonRateLimitMean"]))
325 $_GET["fMuonRateLimitMean"]=$first?"1":"";
326
327 if (empty($_GET["fMuonRateLimitRms"]))
328 $_GET["fMuonRateLimitRms"]=$first?"0.1":"";
329
330 if (empty($_GET["fMuonNumLimit1"]))
331 $_GET["fMuonNumLimit1"]=$first?"180":"";
332
333 if (empty($_GET["fMuonNumLimit2"]))
334 $_GET["fMuonNumLimit2"]=$first?"120":"";
335
336 if (empty($_GET["fPulsePosLimit1"]))
337 $_GET["fPulsePosLimit1"]=$first?"3.5":"";
338
339 if (empty($_GET["fPulsePosLimit2"]))
340 $_GET["fPulsePosLimit2"]=$first?"2.5":"";
341
342 if (empty($_GET["fNumStarsLimit1"]))
343 $_GET["fNumStarsLimit1"]=$first?"30":"";
344
345 if (empty($_GET["fNumStarsLimit2"]))
346 $_GET["fNumStarsLimit2"]=$first?"20":"";
347
348 if (empty($_GET["fNumStarsCorLimit1"]))
349 $_GET["fNumStarsCorLimit1"]=$first?"10":"";
350
351 if (empty($_GET["fNumStarsCorLimit2"]))
352 $_GET["fNumStarsCorLimit2"]=$first?"5":"";
353
354 if (empty($_GET["fUnreliableInner"]))
355 $_GET["fUnreliableInner"]=$first?"On":"";
356
357 if (empty($_GET["fIsolatedInner"]))
358 $_GET["fIsolatedInner"]=$first?"On":"";
359
360 if (empty($_GET["fIsolatedMaxCluster"]))
361 $_GET["fIsolatedMaxCluster"]=$first?"On":"";
362
363// if (empty($_GET["fArrTimeMeanInner"]))
364// $_GET["fArrTimeMeanInner"]=$first?"On":"";
365
366 if (empty($_GET["fArrTimeRmsInner"]))
367 $_GET["fArrTimeRmsInner"]=$first?"On":"";
368
369 if (empty($_GET["fMeanPedRmsInner"]))
370 $_GET["fMeanPedRmsInner"]=$first?"On":"";
371
372 if (empty($_GET["fPulsePosMean"]))
373 $_GET["fPulsePosMean"]=$first?"On":"";
374
375 if (empty($_GET["fConvFactorInner"]))
376 $_GET["fConvFactorInner"]=$first?"On":"";
377
378 if (empty($_GET["fInhomogeneity"]))
379 $_GET["fInhomogeneity"]=$first?"On":"";
380
381 if (empty($_GET["fPSF"]))
382 $_GET["fPSF"]=$first?"On":"";
383
384 if (empty($_GET["fMuonNumber"]))
385 $_GET["fMuonNumber"]=$first?"On":"";
386
387 if (empty($_GET["fEffOnTime/fRunTime"]))
388 $_GET["fEffOnTime/fRunTime"]=$first?"On":"";
389
390 if (empty($_GET["fMuonRate"]))
391 $_GET["fMuonRate"]=$first?"On":"";
392
393 if (empty($_GET["fDataRate"]))
394 $_GET["fDataRate"]=$first?"On":"";
395
396// if (empty($_GET["fMaxHumidity"]))
397// $_GET["fMaxHumidity"]=$first?"On":"";
398
399 if (empty($_GET["fBrightnessMed"]))
400 $_GET["fBrightnessMed"]=$first?"On":"";
401
402 if (empty($_GET["fNumStarsMed"]))
403 $_GET["fNumStarsMed"]=$first?"On":"";
404
405 if (empty($_GET["fNumStarsCorMed"]))
406 $_GET["fNumStarsCorMed"]=$first?"On":"";
407
408 if (empty($_GET["fOff"]))
409 $_GET["fOff"]=$first?"On":"";
410
411 if (empty($_GET["fLinks"]))
412 $_GET["fLinks"]=$first?"On":"";
413
414 if (empty($_GET["fOnlyOff"]))
415 $_GET["fOnlyOff"]=$first?"Off":"";
416
417 InitFindOffData($_GET, $first);
418 }
419
420 function PrintForm($_GET, $host, $user, $pw, $db, $limitsmean, $limitsmin, $limitsmax, $alias)
421 {
422 printf("<center>\n");
423 printf("<form action='builddatasets.php' METHOD='GET'>\n");
424 printf("<input id='sh' type='hidden' name='fShowHide' value='");
425 if (!empty($_GET["fShowHide"]))
426 printf("%s", $_GET["fShowHide"]);
427 else
428 printf("1000000000");
429 printf("'>\n");
430 printf("<img id='allbutton' src='../minus.png' alt='-' onclick='showhide(\"all\")'> <b>Menu</b>&nbsp;&nbsp;&nbsp;&nbsp;\n");
431 printf("&nbsp;&nbsp;<img id='infobutton' src='../plus.png' alt='+' onClick='showhide(\"info\");showhide(\"info2\")'> SequInfo \n");
432 printf("&nbsp;&nbsp;<img id='statbutton' src='../plus.png' alt='+' onClick='showhide(\"stat\");showhide(\"fail\")'> StatusInfo \n");
433 printf("&nbsp;&nbsp;<img id='calbutton' src='../plus.png' alt='+' onClick='showhide(\"cal\")'> CalInfo \n");
434 printf("&nbsp;&nbsp;<img id='starbutton' src='../plus.png' alt='+' onClick='showhide(\"star\")'> StarInfo \n");
435 printf("&nbsp;&nbsp;<img id='limitsbutton' src='../plus.png' alt='+' onClick='showhide(\"limits\")'> Limits \n");
436 printf("&nbsp;&nbsp;<img id='rangesbutton' src='../plus.png' alt='+' onClick='showhide(\"ranges\")'> Ranges \n");
437
438 printf(" <div id='all' style='display:block'>");
439
440 PrintSequInfo2Menu($host,$user,$pw,$db);
441 PrintSequInfoMenu();
442 PrintSequStatMenu();
443 PrintFailMenu();
444 PrintCalMenu();
445 PrintStarMenu();
446 PrintLimitsMenu($limitsmean, $limitsmin, $limitsmax, $alias, "");
447
448 printf(" <div id='ranges' style='display:none'>");
449 PrintZdRangeMenu($host,$user,$pw,$db);
450 PrintSequRangeMenu($host,$user,$pw,$db);
451 printf("<p>");
452 PrintSourceMenu($host,$user,$pw,$db);
453 PrintNightRangeMenu($host,$user,$pw,$db);
454 PrintStarRangeMenu($host,$user,$pw,$db);
455 printf("<p>");
456 printf("</div>");
457
458 printf("</div>");
459 printf(" <P>\n");
460
461 PrintNumResPullDown();
462
463 ini_set("mysql.trace_mode", "Off");
464 ini_set("display_errors", "Off");
465
466 PrintButtons("builddatasets.php");
467
468 $sequon=" ";
469 $sequoff=" ";
470 foreach($_POST as $key => $val)
471 if ($val=="On")
472 {
473 if (ereg("ON$", $key))
474 $sequon.=str_replace("ON", " ", $key);
475 if (ereg("Off$", $key))
476 $sequoff.=str_replace("Off", " ", $key);
477 }
478 printf("<input name='Set' type='hidden' value='%s'>\n", $sequon);
479 printf("<input name='Set2' type='hidden' value='%s'>\n", $sequoff);
480 printf("<input name='name' type='hidden' value='%s'>\n", $_POST["name"]);
481 printf("<input name='comment' type='hidden' value='%s'>\n", $_POST["comment"]);
482 printf("<input name='obsmode' type='hidden' value='%s'>\n", $_POST["fObservationModeKEY"]);
483 printf("<input name='username' type='hidden' value='%s'>\n", $_POST["fUserKEY"]);
484 printf("</form>\n");
485 printf("</center>\n");
486 printf("</td>\n");
487 printf("</tr>\n");
488 printf("<tr class='Block'>\n");
489 printf("<td>\n");
490 }
491
492 function PrintPage($html, $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs)
493 {
494 $db_id = mysql_pconnect($host, $user, $pw);
495 if ($db_id==FALSE)
496 {
497 printf("mysql_connect returned the following error: %s\n", mysql_error());
498 die("");
499 }
500 mysql_select_db($db);
501
502 $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
503
504 $result0 = mysql_query($query0, $db_id);
505
506 if ($result0)
507 {
508 if ($html=="1" || $html=="2")
509 {
510 PrintMagicTable($result0, $alias, $rightalign, $limitsmean, $limitsmin, $limitsmax, "yes", $_GET);
511 foreach($_POST as $key => $val)
512 if ($val=="On")
513 {
514 if (ereg("ON$", $key))
515 $sequon.=str_replace("ON", " ", $key);
516 if (ereg("Off$", $key))
517 $sequoff.=str_replace("Off", " ", $key);
518 }
519
520 printf("<input type='submit' value='Get Dataset'><br><br>\n");
521 printf("<input name='submit' type='hidden' value='post'>\n");
522
523 $on=str_replace(" ", ",", trim($sequon));
524 $off=str_replace(" ", ",", trim($sequoff));
525
526 $values=array("Sum(fRunTime)/60" => $runtime,
527 "Min(fRunTime)/60" => $runtimemin,
528 "Max(fUnsuitableInner)" => $unsuitablemax,
529 "Max(fUnreliableInner)" => $unreliablemax,
530 "Max(fIsolatedInner)" => $isolatedmax,
531 "Max(fIsolatedMaxCluster)" => $imcmax,
532 "Max(fArrTimeMeanInner)" => $arrtimemax,
533 "Min(fArrTimeMeanInner)" => $arrtimemin,
534 "Max(fArrTimeRmsInner)" => $arrtimermsmax,
535 "Avg(fMeanPedRmsInner)" => $pedrmsmean,
536 "Std(fMeanPedRmsInner)" => $pedrmsrms,
537 "Min(fMeanPedRmsInner)" => $pedrmsmin,
538 "Max(fMeanPedRmsInner)" => $pedrmsmax,
539 "Min(fPulsePosMean)" => $pulseposmin,
540 "Max(fPulsePosMean)" => $pulseposmax,
541 "Max(fPulsePosRms)" => $pulseposrmsmax,
542 "Max(fMaxHumidity)" => $hummax,
543 "Max(fInhomogeneity)" => $inhommax,
544 "Avg(fInhomogeneity)" => $inhommean,
545 "Std(fInhomogeneity)" => $inhomrms,
546 "Min(fMeanNumberIslands)" => $numislmin,
547 "Max(fMeanNumberIslands)" => $numislmax,
548 "Min(fDataRate)" => $clratemin,
549 "Max(fDataRate)" => $clratemax,
550 "Min(fMuonRate)" => $muonratemin,
551 "Max(fMuonRate)" => $muonratemax,
552 "Min(fMuonNumber)" => $muonnumbermin,
553 "Avg(fPSF)" => $psfmean,
554 "Std(fPSF)" => $psfrms,
555 "Min(fPSF)" => $psfmin,
556 "Max(fPSF)" => $psfmax,
557 "Min(fEffOnTime/fRunTime)" => $relontimemin,
558 "Max(fEffOnTime/fRunTime)" => $relontimemax,
559 "Min(fBrightnessMed)" => $brightmin,
560 "Max(fBrightnessMed)" => $brightmax,
561 "Min(fNumStarsMed)" => $idstarsmin,
562 "Max(fNumStarsMed)" => $idstarsmax,
563 "Min(fNumStarsCorMed)" => $corstarsmin,
564 "Max(fNumStarsCorMed)" => $corstarsmax,
565 "Min(fZenithDistanceMin)" => $zdmin,
566 "Max(fZenithDistanceMax)" => $zdmax,
567 "Min(fRunStart)" => $starttime,
568 "Max(fRunStop)" => $stoptime,
569 );
570 //get runtimes of dataset
571 function GetSequenceValues($db_id, $sequences, $txt, &$values)
572 {
573 $query="SELECT COUNT(*) ";
574 foreach($values as $name => $varname)
575 $query.=", " . $name;
576 $query.=" FROM Sequences ";
577 $query.=" LEFT JOIN Calibration ON Calibration.fSequenceFirst=Sequences.fSequenceFirst ";
578 $query.=" LEFT JOIN Star ON Star.fSequenceFirst=Sequences.fSequenceFirst ";
579 $query.=" WHERE Sequences.fSequenceFirst IN (" . $sequences . ")";
580 $result = mysql_query($query, $db_id);
581 $row = mysql_fetch_assoc($result);
582 foreach($values as $name => $varname)
583 $values[$name][$txt]=$row[$name];
584 mysql_free_result($result);
585 }
586
587 //get next dataset#
588 $query="SELECT fDataSetNumber+1 FROM DataSets ORDER BY fDataSetNumber DESC LIMIT 0,1";
589 $result = mysql_query($query, $db_id);
590 $row = mysql_fetch_assoc($result);
591 $dataset=$row["fDataSetNumber+1"];
592 if (empty($dataset))
593 $dataset=1;
594 mysql_free_result($result);
595
596 //get sourcenames
597 function GetSources($db_id, $sequences)
598 {
599 $query="SELECT fSourceName FROM Source LEFT JOIN Sequences ON Sequences.fSourceKEY=Source.fSourceKEY ";
600 $query.="WHERE fSequenceFirst IN (" . $sequences . ") GROUP BY fSourceName";
601 $result = mysql_query($query, $db_id);
602 while ($row = mysql_fetch_assoc($result))
603 $sources.=" " . $row["fSourceName"];
604 mysql_free_result($result);
605 return $sources;
606 }
607 $sourceson=GetSources($db_id, $on);
608 $sourcesoff=GetSources($db_id, $off);
609
610 //get sourcename for dataset
611 $son=str_replace(" ", "','", trim($sourceson));
612 $query="SELECT fRealSourceKEY, Count(*) FROM Source where fSourcename IN ('" . $son . "') GROUP BY fRealSourceKEY";
613// printf("q: %s <br>", $query);
614 $result = mysql_query($query, $db_id);
615 $row = mysql_fetch_assoc($result);
616 $numsources=$row["Count(*)"];
617 $numrealkeys=mysql_num_rows($result);
618 $realsourcekey=$row["fRealSourceKEY"];
619 mysql_free_result($result);
620// printf("found %s sources with real sourcekey %s", $numsources, $realsourcekey);
621// printf("found %s keys", $numrealkeys);
622
623 //check observationmode for on-sequences
624 $query="SELECT fObservationModeKEY FROM Sequences where fSequenceFirst IN (" . $on . ") GROUP BY fObservationModeKEY";
625 $result = mysql_query($query, $db_id);
626 $numobskeys=mysql_num_rows($result);
627 mysql_free_result($result);
628
629
630 $runtimelimit=5;
631 $unsuitablemaxlimit=15;
632 $isolatedlimit=0;
633 $imclimit=0;
634 $pedrmsrms=0.09;
635 $scalelimit=1.3;
636 $inhomlimit=13;
637 $numstarslimit=20;
638 $numstarscorlimit=10;
639
640
641 $numerr=0;
642 if (!empty($on))
643 {
644 $color=array("INFO" => "#000000",
645 "WARN" => "#FF9900",
646 "ERROR" => "#FF0000");
647 printf("<div align='left'><font><ul>\n");
648 $vals=array("on", "off");
649 foreach($vals as $num => $val)
650 {
651 if (empty(${$val}))
652 continue;
653 GetSequenceValues($db_id, ${$val}, $val, $values);
654
655 if ($values["Min(fNumStarsCorMed)"][$val]<$numstarscorlimit)
656 printf("<li style='color:%s'>%s: one of your %s-sequences has less than %s identified stars (%s)</li>",
657 $color["WARN"], "WARN", $val, $numstarscorlimit, $values["Min(fNumStarsCorMed)"][$val]);
658 if ($values["Min(fNumStarsMed)"][$val]<$numstarslimit)
659 printf("<li style='color:%s'>%s: one of your %s-sequences has less than %s identified stars (%s)</li>",
660 $color["WARN"], "WARN", $val, $numstarslimit, $values["Min(fNumStarsMed)"][$val]);
661 if ($values["Min(fRunTime)/60"][$val]<$runtimelimit)
662 printf("<li style='color:%s'>%s: one of your %s-sequences is shorter than %s min (%s min)</li>",
663 $color["INFO"], "INFO", $val, $runtimelimit, $values["Min(fRunTime)/60"][$val]);
664 if ($values["Max(fInhomogeneity)"][$val]>$inhomlimit)
665 printf("<li style='color:%s'>%s: one of your %s-sequences has an inhomogeneity larger than %s (%s)</li>",
666 $color["WARN"], "WARN", $val, $inhomlimit, $values["Max(fInhomogeneity)"][$val]);
667 if ($values["Max(fUnsuitableInner)"][$val]>$unsuitablemaxlimit)
668 printf("<li style='color:%s'>%s: one of your %s-sequences has more than %s unsuitable inner pixel (%s)</li>",
669 $color["WARN"], "WARN", $val, $unsuitablemaxlimit, $values["Max(fUnsuitableInner)"][$val]);
670 if ($values["Max(fIsolatedInner)"][$val]>$isolatedlimit)
671 printf("<li style='color:%s'>%s: one of your %s-sequences has more than %s isolated inner pixel (%s)</li>",
672 $color["WARN"], "WARN", $val, $isolatedlimit, $values["Max(fIsolatedInner)"][$val]);
673 if ($values["Max(fIsolatedMaxCluster)"][$val]>$imclimit)
674 printf("<li style='color:%s'>%s: one of your %s-sequences has more than %s isolated max cluster (%s)</li>",
675 $color["WARN"], "WARN", $val, $imclimit, $values["Max(fIsolatedMaxCluster)"][$val]);
676 }
677 if (!empty($on) && $values["Max(fMeanPedRmsInner)"]["on"]>$values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms)
678 printf("<li style='color:%s'>%s: one of your on-sequences has a PedRms larger than %s (%s)</li>",
679 $color["WARN"], "WARN", $values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms, $values["Max(fMeanPedRmsInner)"]["on"]);
680 if (!empty($off) && $values["Max(fMeanPedRmsInner)"]["off"]>$values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms)
681 printf("<li style='color:%s'>%s: one of your off-sequences has a PedRms larger than %s (%s)</li>",
682 $color["WARN"], "WARN", $values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms, $values["Max(fMeanPedRmsInner)"]["off"]);
683 if (!empty($off) && $values["Min(fMeanPedRmsInner)"]["off"]<$values["Avg(fMeanPedRmsInner)"]["on"]-$pedrmsrms)
684 printf("<li style='color:%s'>%s: one of your off-sequences has a PedRms smaller than %s (%s)</li>",
685 $color["WARN"], "WARN", $values["Avg(fMeanPedRmsInner)"]["on"]-$pedrmsrms, $values["Min(fMeanPedRmsInner)"]["off"]);
686 $scale=$values["Sum(fRunTime)/60"]["on"]/$values["Sum(fRunTime)/60"]["off"];
687 if ($scale > $scalelimit)
688 printf("<li style='color:%s'>%s: Your scale factor is larger than %s (%0.2f). Try to find more offdata!",
689 $color["WARN"], "WARN", $scalelimit, $scale);
690 /*
691 if (str_word_count($sourceson) > 1)
692 printf("<li style='color:%s'>%s: You have selected more than one (%s) on source",
693 $color["WARN"], "WARN", str_word_count($sourceson));
694 */
695 $doubleseq=0;
696// printf("finding: %s<br>", $sequon);
697 foreach(explode(" ", $sequon) as $n => $s)
698 {
699// printf("finding %s in %s <br>", $s, $sequoff);
700 if (ereg($s, $sequoff))
701 $doubleseq++;
702 }
703 if ($doubleseq>0)
704 {
705 printf("<li style='color:%s'>%s: You have selected sequences (%s) as On AND Off",
706 $color["ERROR"], "ERROR", $doubleseq);
707 $numerr=$numerr+1;
708 }
709 if ($numrealkeys>1)
710 {
711 printf("<li style='color:%s'>%s: You have selected more than one (%s) on source",
712 $color["ERROR"], "ERROR", $numrealkeys);
713 $numerr=$numerr+1;
714 }
715 if ($numobskeys>1)
716 {
717 printf("<li style='color:%s'>%s: You have selected more than one (%s) different observation modes for your on sequences",
718 $color["ERROR"], "WARN", $numobskeys);
719// $numerr=$numerr+1;
720 }
721 if (empty($_POST["fObservationModeKEY"]) && !empty($_GET["obsmode"]))
722 $_POST["fObservationModeKEY"]=$_GET["obsmode"];
723 if ($_POST["fObservationModeKEY"]==3 && empty($off))
724 {
725 printf("<li style='color:%s'>%s: You have selected on/off mode, but you haven't chosen any off sequences.",
726 $color["ERROR"], "WARN");
727// $numerr=$numerr+1;
728 }
729 if (empty($realsourcekey))
730 {
731 printf("<li style='color:%s'>%s: The source you selected doesn't have a real sourcekey yet. Please insert fRealSourceKEY in the DB for %s",
732 $color["ERROR"], "ERROR", $sourceson);
733 $numerr=$numerr+1;
734 }
735 if (empty($_POST["fObservationModeKEY"]))
736 {
737 printf("<li style='color:%s'>%s: You have to choose an observation mode.",
738 $color["ERROR"], "ERROR");
739 $numerr=$numerr+1;
740 }
741 if (empty($_POST["fUserKEY"]))
742 {
743 printf("<li style='color:%s'>%s: You have to choose your username.",
744 $color["ERROR"], "ERROR");
745 $numerr=$numerr+1;
746 }
747 if (empty($_POST["name"]))
748 {
749 printf("<li style='color:%s'>%s: You have to choose a name.",
750 $color["ERROR"], "ERROR");
751 $numerr=$numerr+1;
752 }
753 if (empty($_POST["comment"]))
754 {
755 printf("<li style='color:%s'>%s: You have to comment your dataset.",
756 $color["ERROR"], "ERROR");
757 $numerr=$numerr+1;
758 }
759 // printf("<li></li>");
760 printf("</ul></font>\n");
761
762 printf("<div align='left'>");
763 printf("SequencesOn: %s<br>", $sequon);
764 printf("SequencesOff: %s<br>", $sequoff);
765 $insquery[0]="INSERT DataSets SET fDataSetNumber=" . $dataset . ", fUserKEY=" . $_POST["fUserKEY"];
766 $insquery[0].=", fComment='" . $_POST["comment"] . "', fObservationModeKEY=" . $_POST["fObservationModeKEY"];
767 $insquery[0].=", fDataSetName='" . $_POST["name"] . "', fSourceKEY= " . $realsourcekey;
768 $insquery[0].=", fRunStart='" . $values["Min(fRunStart)"]["on"];
769 $insquery[0].="', fRunStop='" . $values["Max(fRunStop)"]["on"];
770 $insquery[0].="', fZenithDistanceMin=" . $values["Min(fZenithDistanceMin)"]["on"];
771 $insquery[0].=", fZenithDistanceMax=" . $values["Max(fZenithDistanceMax)"]["on"];
772 $insquery[0].=", fRunTime=" . $values["Sum(fRunTime)/60"]["on"];
773 $insquery[1]="INSERT DataSetProcessStatus SET fDataSetNumber=" . $dataset . ", fDataSetInserted=Now()";
774 $i=2;
775 foreach(explode(" ", trim($sequon)) as $key => $sequ)
776 {
777 $insquery[$i]="INSERT DataSetSequenceMapping SET fDataSetNumber=" . $dataset;
778 $insquery[$i].=", fSequenceFirst=" . $sequ . ", fOnOff=1";
779 $i=$i+1;
780 }
781 if (!empty($off))
782 {
783 foreach(explode(" ", trim($sequoff)) as $key => $sequ)
784 {
785 $insquery[$i]="INSERT DataSetSequenceMapping SET fDataSetNumber=" . $dataset;
786 $insquery[$i].=", fSequenceFirst=" . $sequ . ", fOnOff=2";
787 $i=$i+1;
788 }
789 }
790 foreach($insquery as $num => $q)
791 {
792 if (!empty($_POST["insert"]) && $numerr==0)
793 {
794 printf("Inserted Query #%s: %s<br>", $num, $q);
795 $insresult=mysql_query($q);
796 if (mysql_errno()>0)
797 printf("&nbsp; Errorno: %s <br>", mysql_errno());
798 if (mysql_error()!="")
799 printf("&nbsp; Errormsg: %s <br>", mysql_error());
800 if (mysql_info()!="")
801 printf("&nbsp; Info: %s <br>", mysql_info());
802 printf("&nbsp; Affected Rows: %s <br>", mysql_affected_rows());
803 mysql_free_result($insresult);
804 if (mysql_errno()>0)
805 {
806 printf("ERROR => stop inserting");
807 break;
808 }
809 }
810 }
811 printf("</div>");
812 if (empty($_POST["name"]) && !empty($_GET["name"]))
813 $_POST["name"]=$_GET["name"];
814 if (empty($_POST["comment"]) && !empty($_GET["comment"]))
815 $_POST["comment"]=$_GET["comment"];
816 if (empty($_POST["fUserKEY"]) && !empty($_GET["username"]))
817 $_POST["fUserKEY"]=$_GET["username"];
818 printf("Name: &nbsp;<input name='name' type='text' size='20' maxlength='20' value='%s'><br>\n", $_POST["name"]);
819 printf("Comment: &nbsp;<input name='comment' type='text' size='50' maxlength='255' value='%s'><br>\n", $_POST["comment"]);
820
821 $query = "SELECT fObservationModeKEY, fObservationModeName FROM ObservationMode ORDER BY fObservationModeName";
822 $result = mysql_query($query);
823 if (!$result)
824 printf("-N/A-");
825
826 $numrows = mysql_num_rows($result);
827
828 printf("ObservationMode&nbsp;<select name='fObservationModeKEY' size='1' class='Width'>\n");
829 while ($row = mysql_fetch_row($result))
830 {
831 if (!empty($_POST["fObservationModeKEY"]) && $_POST["fObservationModeKEY"]==$row[0])
832 printf("<option value='%s' selected>%s</option>\n", $row[0], $row[1]);
833 else
834 printf("<option value='%s'>%s</option>\n", $row[0], $row[1]);
835 }
836 printf("</select><br>\n");
837 mysql_free_result($result);
838
839 $query = "SELECT fUserKEY, fUserName FROM User ORDER BY fUserKEY";
840 $result = mysql_query($query);
841 if (!$result)
842 printf("-N/A-");
843
844 $numrows = mysql_num_rows($result);
845
846 printf("UserName&nbsp;<select name='fUserKEY' size='1' class='Width'>\n");
847 while ($row = mysql_fetch_row($result))
848 {
849 if (!empty($_POST["fUserKEY"]) && $_POST["fUserKEY"]==$row[0])
850 printf("<option value='%s' selected>%s</option>\n", $row[0], $row[1]);
851 else
852 printf("<option value='%s'>%s</option>\n", $row[0], $row[1]);
853 }
854 printf("</select><br>\n");
855 mysql_free_result($result);
856
857 printf("Remark: only datasets without errors can be inserted.<br>");
858 if ($numerr!=0)
859 printf("Your dataset has %s error(s).<br>", $numerr);
860 printf("<input type='checkbox' name='insert' value='On'>insert\n");
861
862 printf("<table><tr><td colspan='2' align='center'>Dataset</td></tr>");
863 printf("<tr><td>proposed DataSet#: </td><td>%s</td></tr>", $dataset);
864 printf("<tr><td valign='top'>SequencesOn:</td><td> %s</td></tr>", $sequon);
865 if (!empty($sequoff))
866 printf("<tr><td valign='top'>SequencesOff:</td><td> %s</td></tr>", $sequoff);
867 printf("<tr><td>Scale: </td><td>%0.2f</td></tr>", $scale);
868 printf("<tr><td>SourcenamesOn[%s]: </td><td>%s</td></tr>", str_word_count($sourceson), $sourceson);
869 printf("<tr><td>SourcenamesOff[%s]: </td><td>%s</td></tr>", str_word_count($sourcesoff), $sourcesoff);
870 printf("</table>\n");
871
872 printf("<table border='1'>\n");
873 printf("<tr><td>Value</td><td>On</td>");
874 if (!empty($off))
875 printf("<td>Off</td></tr>\n");
876 foreach($values as $name => $varname)
877 {
878 printf("<tr><td>%s</td>\n", $name);
879 foreach($vals as $num => $val)
880 if (!empty(${$val}))
881 printf("<td>%s</td>\n", $varname[$val]);
882 printf("</tr>\n");
883 }
884 printf("</table>\n");
885 }
886
887 printf("</div>\n");
888 /*
889 printf("<table border='1'><tr>\n");
890 printf("<td>--</td>\n");
891 foreach($values as $name => $varname)
892 printf("<td>%s</td>\n", $name);
893 $vals=array("on", "off");
894 foreach($vals as $num => $val)
895 {
896 GetSequenceValues($db_id, ${$val}, $val, $values);
897 printf("</tr><tr>\n");
898 printf("<td>On</td>\n");
899 foreach($values as $name => $varname)
900 printf("<td>%s</td>\n", $varname[$val]);
901 }
902 printf("</tr></table>\n");
903 */
904
905 printf("</center>\n");
906 printf("</td>\n");
907 printf("</tr>\n");
908
909 printf("</form>\n");
910 }
911 else
912 PrintText($result0);
913
914 mysql_free_result($result0);
915 }
916 mysql_close($db_id);
917
918 PrintSubmittedQuery($query0, $html, $db, "");
919 }
920
921 include ("include.php");
922 include ("menu.php");
923 include ("db.php");
924 include ("magicdefs.php");
925
926 ini_set("display_errors", "On");
927 ini_set("mysql.trace_mode", "On");
928
929 $sitepw="\$1\$ml/Gld67\$zOvhC4vFrLCkbAzQs2swo1";
930 $siteuser="dcdb";
931
932 if (!isset($_SERVER['PHP_AUTH_USER']) || crypt($_SERVER['PHP_AUTH_PW'], $sitepw)!=$sitepw || $_SERVER['PHP_AUTH_USER']!=$siteuser)
933 {
934 header('WWW-Authenticate: Basic realm="Build Datasets"');
935 header('HTTP/1.0 401 Unauthorized');
936 echo 'Cancelled.';
937 return;
938 }
939 else
940 {
941// echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
942// echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
943// printf("pw: %s", crypt($_SERVER['PHP_AUTH_PW']));
944
945 if (crypt($_SERVER['PHP_AUTH_PW'], $sitepw)!=$sitepw || $_SERVER['PHP_AUTH_USER']!=$siteuser)
946 {
947 printf("<br>pw or user incorrect<br>");
948 return;
949 }
950 }
951
952 if (!empty($_GET["fSendTxt"]))
953 {
954 header("Content-type: application/octet");
955 header("Content-Disposition: attachment; filename=query-result.txt");
956
957 PrintPage("0", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs);
958 }
959 else
960 {
961 echo (file_get_contents("index-header.html"));
962
963 $environment = sizeof($_GET);
964
965 InitGet($_GET);
966 if (empty($_GET["fPrintTable"]))
967 PrintForm($_GET, $host, $user, $pw, $db, $limitsmean, $limitsmin, $limitsmax, $alias);
968
969 if ($environment==0)
970 printf("No query submitted yet.<BR>");
971 else
972 {
973 if (empty($_GET["fPrintTable"]))
974 PrintPage("1", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs);
975 else
976 PrintPage("2", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs);
977 }
978
979 echo (file_get_contents("index-footer.html"));
980 }
981
982 ini_set("display_errors", "Off");
983 ini_set("mysql.trace_mode", "Off");
984}
985?>
Note: See TracBrowser for help on using the repository browser.