Changeset 42736
- Timestamp:
- Nov 25, 2024, 3:50:12 PM (18 months ago)
- Location:
- trunk/ippMonitor
- Files:
-
- 3 added
- 8 edited
-
Makefile.in (modified) (1 diff)
-
def/addRunRun.d (modified) (3 diffs)
-
def/minidvodbRun.d (modified) (1 diff)
-
def/minidvodbRun_num.d (modified) (2 diffs)
-
raw/czartool_labels.php (modified) (40 diffs)
-
raw/ipp.php (modified) (1 diff)
-
raw/ipp.plots.dat (modified) (1 diff)
-
raw/scatterPlotAirmassMcal.php (added)
-
raw/scatterPlotDataQuality.php (added)
-
raw/scatterPlotPointing.php (added)
-
raw/storage.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/Makefile.in
r42384 r42736 89 89 $(DESTWWW)/skycoverage.php \ 90 90 $(DESTWWW)/ganglia.php \ 91 $(DESTWWW)/scatterPlotPointing.php \ 92 $(DESTWWW)/scatterPlotAirmassMcal.php \ 93 $(DESTWWW)/scatterPlotDataQuality.php \ 91 94 $(DESTWWW)/loader.js 92 95 -
trunk/ippMonitor/def/addRunRun.d
r41253 r42736 13 13 FIELD addRun.stage_id, 5, %d, stageID 14 14 FIELD addRun.stage_extra1, 5, %d, stageExtra1 15 #FIELD addRun.add_id, 5, %d, addID16 15 FIELD addRun.state, 5, %s, state 17 16 FIELD addRun.workdir, 5, %s, workdir … … 20 19 FIELD addRun.data_group, 5, %s, data_group 21 20 FIELD addRun.dvodb, 5, %s, dvodb 22 FIELD addRun.note, 5, %s, note23 21 FIELD addRun.image_only, 5, %d, image_only 24 22 FIELD addRun.minidvodb, 5, %d, minidvodb … … 26 24 FIELD addRun.minidvodb_name, 5, %s, minidvodb_name 27 25 FIELD addRun.minidvodb_host, 5, %s, minidvodb_host 26 FIELD addRun.note, 5, %s, note -
trunk/ippMonitor/def/minidvodbRun.d
r41253 r42736 1 1 TABLE minidvodbRun 2 #TABLE minidvodbRun LEFT JOIN (SELECT count(*) AS addnum, minidvodb_name FROM addRun GROUP BY minidvodb_name) AS sub ON sub.minidvodb_name = minidvodbRun.minidvodb_name3 2 TITLE minidvodb Runs 4 3 FILE minidvodbRun.php -
trunk/ippMonitor/def/minidvodbRun_num.d
r41254 r42736 1 #TABLE minidvodbRun2 1 TABLE minidvodbRun LEFT JOIN (SELECT count(*) AS addnum, minidvodb_name FROM addRun GROUP BY minidvodb_name) AS sub ON sub.minidvodb_name = minidvodbRun.minidvodb_name 3 2 TITLE minidvodb Runs … … 17 16 #FIELD minidvodbRun.mergedvodb_path, 25, %s, mergedvodb_path 18 17 FIELD state, 5, %s, State 18 FIELD creation_date, 5, %T, epoch 19 19 FIELD addnum, 5, %d, addnum 20 FIELD creation_date, 5, %T, epoch21 20 -
trunk/ippMonitor/raw/czartool_labels.php
r42276 r42736 89 89 "pstamp", 90 90 "registration", 91 "stack",91 // "stack", 92 92 "stdscience", 93 93 "summitcopy"); … … 134 134 } 135 135 136 137 136 $debug = 0; 138 137 $table = "<table bgcolor=\"#FFFFFF\" width=\"100%\" align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n"; … … 183 182 echo "<table border=\"0\">"; 184 183 // timer begin for main page 185 $time = microtime(); 186 $time = explode(' ', $time); 187 $time = $time[1] + $time[0]; 188 $mainstart = $time; 184 $mainstart = microtime(true); 189 185 190 186 # headers … … 210 206 $hsttime1 = date("Y-m-d H:i:s", strtotime("$lastUpdateTime")); 211 207 $utctime1 = gmdate("Y-m-d H:i:s", strtotime("$lastUpdateTime")); 208 $mjdday = getMJD(); 212 209 213 210 echo "<br>"; … … 249 246 <td>".getNightlyScienceStatus($czardb, $proj)."</td></tr>"; 250 247 echo "<tr><td>Czardb last update time</td> 251 <td> $hsttime1 (HST), $utctime1 (UTC) </td></tr>";248 <td> $hsttime1 (HST), $utctime1 (UTC), $mjdday (MJD)</td></tr>"; 252 249 echo "</table><br>"; 253 250 … … 258 255 # XXX EAM : 2017.09.17 : debugging slowness 259 256 # CCL : 2019.11.09 : debugging slowness 260 //createSummitDataTable($projectdb); // this is slow because of the join between summitExp and rawExp, but not the major one 261 createSummitDataTable2($projectdb, $pass, $proj); // this is slow because of the join between summitExp and rawExp, but not the major one 262 263 createChunkDataTable($projectdb); // this is another part for slowness during nightly processing 264 265 createDatesTable($czardb, $proj); 257 createSummitDataTable2($projectdb, $pass, $proj, $debug); // this is slow because of the join between summitExp and rawExp, but not the major one 258 259 createChunkDataTable($projectdb, $debug); // this is another part for slowness during nightly processing 260 261 // createDatesTable($czardb, $proj); what is this for? 266 262 267 263 // Database status 268 // timer begin for Database status269 $time = microtime();270 $time = explode(' ', $time);271 $time = $time[1] + $time[0];272 $start = $time;273 274 264 echo $table; 275 echo "<tr>"; 276 createTableTitle("Database status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\"><font color=\"blue\">here</a>)", 2); 277 278 echo "<tr>"; 279 createTableColumnHeader("Database"); 280 createTableColumnHeader("Status (sec behind master)"); 281 // gpc dbs 282 showDatabaseStatus($HOST_GPC1, $USER_GPC1, $PASSWORD_GPC1, $LABEL_GPC1); 283 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_LABEL_GPC1); 284 showReplicationsStatus($REPL_HOST_GPC1_SECONDARY, $REPL_USER_GPC1_SECONDARY, $REPL_PASSWORD_GPC1_SECONDARY, $REPL_LABEL_GPC1_SECONDARY); 285 showReplicationsStatus($REPL_HOST_GPC1_TERTIARY, $REPL_USER_GPC1_TERTIARY, $REPL_PASSWORD_GPC1_TERTIARY, $REPL_LABEL_GPC1_TERTIARY); 286 // nebulous dbs 287 showDatabaseStatus($HOST_NEBULOUS, $USER_NEBULOUS, $PASSWORD_NEBULOUS, $LABEL_NEBULOUS); 288 //showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_LABEL_NEBULOUS); 289 showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_LABEL_NEBULOUS_SECONDARY); 290 showReplicationsStatus($REPL_HOST_NEBULOUS_TERTIARY, $REPL_USER_NEBULOUS_TERTIARY, $REPL_PASSWORD_NEBULOUS_TERTIARY, $REPL_LABEL_NEBULOUS_TERTIARY); 291 showReplicationsStatus($REPL_HOST_NEBULOUS_QUATERNARY, $REPL_USER_NEBULOUS_QUATERNARY, $REPL_PASSWORD_NEBULOUS_QUATERNARY, $REPL_LABEL_NEBULOUS_QUATERNARY); 292 // other dbs 293 showDatabaseStatus($HOST_PSTAMP, $USER_PSTAMP, $PASSWORD_PSTAMP, $LABEL_PSTAMP); 294 showReplicationsStatus($REPL_HOST_DATASTORE, $REPL_USER_DATASTORE, $REPL_PASSWORD_DATASTORE, $REPL_LABEL_DATASTORE); 295 296 // timer finished 297 echo "<tr><th colspan=2>"; 298 $time = microtime(); 299 $time = explode(' ', $time); 300 $time = $time[1] + $time[0]; 301 $finish = $time; 302 $total_time = round(($finish - $start), 3); 303 echo "loading in $total_time seconds."; 304 echo "</th></tr>"; 265 // timer begin 266 $start = microtime(true); 267 echo "<tr>"; 268 createTableTitle("Database status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\"><font color=\"blue\">here</a>)", 2); 269 270 echo "<tr>"; 271 createTableColumnHeader("Database"); 272 createTableColumnHeader("Status (sec behind master)"); 273 // gpc dbs 274 showDatabaseStatus($HOST_GPC1, $USER_GPC1, $PASSWORD_GPC1, $LABEL_GPC1); 275 showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_LABEL_GPC1); 276 showReplicationsStatus($REPL_HOST_GPC1_SECONDARY, $REPL_USER_GPC1_SECONDARY, $REPL_PASSWORD_GPC1_SECONDARY, $REPL_LABEL_GPC1_SECONDARY); 277 showReplicationsStatus($REPL_HOST_GPC1_TERTIARY, $REPL_USER_GPC1_TERTIARY, $REPL_PASSWORD_GPC1_TERTIARY, $REPL_LABEL_GPC1_TERTIARY); 278 // nebulous dbs 279 showDatabaseStatus($HOST_NEBULOUS, $USER_NEBULOUS, $PASSWORD_NEBULOUS, $LABEL_NEBULOUS); 280 //showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_LABEL_NEBULOUS); 281 showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_LABEL_NEBULOUS_SECONDARY); 282 showReplicationsStatus($REPL_HOST_NEBULOUS_TERTIARY, $REPL_USER_NEBULOUS_TERTIARY, $REPL_PASSWORD_NEBULOUS_TERTIARY, $REPL_LABEL_NEBULOUS_TERTIARY); 283 showReplicationsStatus($REPL_HOST_NEBULOUS_QUATERNARY, $REPL_USER_NEBULOUS_QUATERNARY, $REPL_PASSWORD_NEBULOUS_QUATERNARY, $REPL_LABEL_NEBULOUS_QUATERNARY); 284 // other dbs 285 showDatabaseStatus($HOST_PSTAMP, $USER_PSTAMP, $PASSWORD_PSTAMP, $LABEL_PSTAMP); 286 showReplicationsStatus($REPL_HOST_DATASTORE, $REPL_USER_DATASTORE, $REPL_PASSWORD_DATASTORE, $REPL_LABEL_DATASTORE); 287 288 // end time 289 echo "<tr><th colspan=2>"; 290 $total_time = round((microtime(true) - $start), 3); 291 echo "loading in $total_time seconds."; 292 echo "</th></tr>"; 305 293 echo "</table><br>"; 306 294 307 295 308 296 // critical machines status 309 // timer begin for critical machines310 $time = microtime();311 $time = explode(' ', $time);312 $time = $time[1] + $time[0];313 $start = $time;314 315 $PingStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">DOWN</font>";316 297 echo $table; 317 echo "<tr>"; 318 createTableTitle("Critical machine status", 3); 319 320 echo "<tr>"; 321 createTableColumnHeader("Hostname"); 322 createTableColumnHeader("Status"); 323 createTableColumnHeader("Loading time"); 324 showPingStatus($HOST_GATEWAY, $LABEL_GATEWAY); 325 showPingStatus($HOST_GATEWAY_SECONDARY, $LABEL_GATEWAY_SECONDARY); 326 showPingStatus($HOST_PROXY, $LABEL_PROXY); 327 showPingStatus($HOST_APACHE1, $LABEL_APACHE1); 328 showPingStatus($HOST_APACHE2, $LABEL_APACHE2); 329 showPingStatus($HOST_APACHE3, $LABEL_APACHE3); 330 showPingStatus($HOST_APACHE4, $LABEL_APACHE4); 331 showPingStatus($HOST_APACHE5, $LABEL_APACHE5); 332 showPingStatus($HOST_APACHE6, $LABEL_APACHE6); 333 showPingStatus($HOST_APACHE_BACKUP1, $LABEL_APACHE_BACKUP1); 334 showPingStatus($HOST_APACHE_BACKUP2, $LABEL_APACHE_BACKUP2); 335 showPingStatus($HOST_HOME, $LABEL_HOME); 336 showPingStatus($HOST_HOME_BACKUP, $LABEL_HOME_BACKUP); 337 showPingStatus($HOST_NAGIOS, $LABEL_NAGIOS); 338 showPingStatus($HOST_SVN, $LABEL_SVN); 339 showPingStatus($HOST_CONFLUENCE, $LABEL_CONFLUENCE); 340 showPingStatus($HOST_MAILMAN, $LABEL_MAILMAN); 341 // echo "<td>ippc70 (apache node) <td> $PingStatus <td> 0 seconds "; // comment out if ippc70 is back 342 // timer finished 343 echo "<tr><th colspan=3>"; 344 $time = microtime(); 345 $time = explode(' ', $time); 346 $time = $time[1] + $time[0]; 347 $finish = $time; 348 $total_time = round(($finish - $start), 3); 349 echo "loading in $total_time seconds."; 350 echo "</th></tr>"; 298 // start time 299 $start = microtime(true); 300 301 $PingStatus = "<font style=\"BACKGROUND-COLOR: yellow\" color=\"red\">DOWN</font>"; 302 303 echo "<tr>"; 304 createTableTitle("Critical machine status", 3); 305 306 echo "<tr>"; 307 createTableColumnHeader("Hostname"); 308 createTableColumnHeader("Status"); 309 createTableColumnHeader("Loading time"); 310 showPingStatus($HOST_GATEWAY, $LABEL_GATEWAY); 311 showPingStatus($HOST_GATEWAY_SECONDARY, $LABEL_GATEWAY_SECONDARY); 312 showPingStatus($HOST_PROXY, $LABEL_PROXY); 313 showPingStatus($HOST_APACHE1, $LABEL_APACHE1); 314 showPingStatus($HOST_APACHE2, $LABEL_APACHE2); 315 showPingStatus($HOST_APACHE3, $LABEL_APACHE3); 316 showPingStatus($HOST_APACHE4, $LABEL_APACHE4); 317 showPingStatus($HOST_APACHE5, $LABEL_APACHE5); 318 showPingStatus($HOST_APACHE6, $LABEL_APACHE6); 319 showPingStatus($HOST_APACHE_BACKUP1, $LABEL_APACHE_BACKUP1); 320 showPingStatus($HOST_APACHE_BACKUP2, $LABEL_APACHE_BACKUP2); 321 showPingStatus($HOST_HOME, $LABEL_HOME); 322 showPingStatus($HOST_HOME_BACKUP, $LABEL_HOME_BACKUP); 323 showPingStatus($HOST_NAGIOS, $LABEL_NAGIOS); 324 showPingStatus($HOST_SVN, $LABEL_SVN); 325 showPingStatus($HOST_CONFLUENCE, $LABEL_CONFLUENCE); 326 showPingStatus($HOST_MAILMAN, $LABEL_MAILMAN); 327 328 // end time 329 echo "<tr><th colspan=3>"; 330 $total_time = round((microtime(true) - $start), 3); 331 echo "loading in $total_time seconds."; 332 echo "</th></tr>"; 351 333 echo "</table><br>"; 352 334 353 createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); // this was the major slowness part due to large table in czardb 354 355 # pantasks server status, if requested 356 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer, $proj); 357 358 #2nd table column for space 335 createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); 336 # pantasks server status, if requested 337 if ($selectedServer && !$serverCmd) showServerStatus($selectedServer, $proj); 338 339 #2nd table column empty contnets 359 340 echo "<td style=height:200px;width: 10px;text-align:top;\"><br>"; 360 341 … … 362 343 echo "<td style=height:200px;width:600px;text-align:top;\"><br>"; 363 344 # plots 364 if ($selectedStage == "all_stages" & $selectedLabel == "all") { 365 # with all stages and all labels, the rate query is too slow so I use the old method until it get improved. CCL 20210117 366 # gnuplots 367 # time series plot 368 echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br><br>"; 369 echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=log\"><br><br>"; 370 # rate series plot 371 echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br><br>"; 372 #for dev version 373 # google chart 374 # time series plot 375 #echo Gettimeseries($czardb, $selectedMode, $selectedLabel, $proj, $selectedStage); 376 # rate series plot 377 #echo Getrate($czardb, $selectedMode, $selectedLabel, $proj, $selectedStage); 345 if ($selectedStage == "all_stages" && $selectedLabel == "all") { 346 // Use old method with gnuplots as the rate query is slow with all stages and labels 347 displayImage("t", $selectedMode, $selectedLabel, $proj, $selectedStage, "linear"); 348 displayImage("t", $selectedMode, $selectedLabel, $proj, $selectedStage, "log"); 349 displayImage("rt", $selectedMode, $selectedLabel, $proj, $selectedStage, "linear"); 350 351 // Uncomment for dev version with Google Charts 352 // echo Gettimeseries($czardb, $selectedMode, $selectedLabel, $proj, $selectedStage); 353 //echo Getrate($czardb, $selectedMode, $selectedLabel, $proj, $selectedStage); 378 354 } else { 379 # google chart 380 # time series plot 381 echo Gettimeseries($czardb, $selectedMode, $selectedLabel, $proj, $selectedStage); 382 # rate series plot 383 echo Getrate($czardb, $selectedMode, $selectedLabel, $proj, $selectedStage); 355 // Use Google Charts for specific stage and label 356 echo Gettimeseries($czardb, $selectedMode, $selectedLabel, $proj, $selectedStage); 357 echo Getrate($czardb, $selectedMode, $selectedLabel, $proj, $selectedStage); 358 } 359 360 // Helper function to generate image tags for plots 361 function displayImage($type, $mode, $label, $proj, $stage, $plottype) { 362 $src = "czartool_getplot.php?mode=" . urlencode($mode) . 363 "&type=" . urlencode($type) . 364 "&label=" . urlencode($label) . 365 "&proj=" . urlencode($proj) . 366 "&stage=" . urlencode($stage) . 367 "&plottype=" . urlencode($plottype); 368 echo "<img src=\"$src\"><br><br>"; 384 369 } 385 370 386 371 # data quality timeseries 387 echo getDataQuality($projectdb); 372 echo getDataQuality2($projectdb); // new version of data quality plots 373 388 374 # storage timeseries 389 375 echo getSpaces($czardb); 390 376 # storage plot 391 echo getHosts($czardb);377 echo getHosts($czardb); 392 378 393 379 # timer for main page end 394 380 echo "<tr><th colspan=3>"; 395 $time = microtime(); 396 $time = explode(' ', $time); 397 $time = $time[1] + $time[0]; 398 $finish = $time; 399 $total_time = round(($finish - $mainstart), 3); 400 echo "overall loading in $total_time seconds."; 381 echo "overall loading in " . round((microtime(true) - $mainstart), 3) . " seconds."; 401 382 echo "</th></tr>"; 402 383 echo "</table>"; … … 457 438 # 458 439 ########################################################################### 459 function createChunkDataTable($projectdb ) {440 function createChunkDataTable($projectdb, $debug) { 460 441 461 442 // timer start 462 $time = microtime(); 463 $time = explode(' ', $time); 464 $time = $time[1] + $time[0]; 465 $start = $time; 443 $start = microtime(true); 466 444 467 445 // function begin 468 446 #First find the reference exposure ID to speed up the subsequent queries 447 $mjdDay = getMJD(); 448 $expname = "o{$mjdDay}%"; 449 469 450 $date = gmdate("Y-m-d"); 470 $sql = "SELECT MAX(exp_id) FROM rawExp WHERE dateobs >= date_sub('$date', interval 20 day) AND dateobs <= date_sub('$date', interval 10 day)"; 451 $sql = "SELECT MIN(exp_id) FROM rawExp WHERE exp_name like '$expname' "; 452 if ($debug) {echo "$sql<br>";} 471 453 $qry = $projectdb->query($sql); 454 472 455 if (dberror($qry)) { 473 print "*** WARNING: no data in period 10-20 days before requested date (query will be slower) **\n"; 474 $refExpID = 0; 475 } 476 $qry->fetchInto($refExpID); 477 if ($refExpID[0] = 'NULL') { 478 $refExpID[0] = 0; 479 } 456 echo "*** WARNING: No data for tonight **\n"; 457 $refExpID = 0; 458 } else { 459 $qry->fetchInto($refExpID); 460 $refExpID = isset($refExpID[0]) ? $refExpID[0] : 0; 461 } 462 // Print the result of the query 463 if ($debug) {echo "The first exp_id of tonight is: $refExpID<br>";} 480 464 481 465 #do a query of raw/chip/cam/warp counts for this night, split by chunk. … … 485 469 $query .= " count(if(rawExp.comment LIKE '%visit 2%',1,NULL)) AS Nvis2,count(if(rawExp.comment LIKE '%visit 3%',1,NULL)) AS Nvis3,"; 486 470 $query .= " count(if(rawExp.comment LIKE '%visit 4%',1,NULL)) AS Nvis4, count(if(camProcessedExp.sigma_ra <= 5 AND camProcessedExp.sigma_dec <= 5 AND camProcessedExp.quality = 0,1,NULL)) AS Ncamgood,"; 487 $query .= " count(if(camProcessedExp. sigma_ra > 5 OR camProcessedExp.sigma_dec > 5 OR camProcessedExp.quality > 0,1,NULL)) AS Ncambad";471 $query .= " count(if(camProcessedExp.fwhm_major > 12 OR camProcessedExp.sigma_ra > 5 OR camProcessedExp.sigma_dec > 5 OR camProcessedExp.quality > 0,1,NULL)) AS Ncambad"; 488 472 $query .= " FROM rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) JOIN camProcessedExp USING (cam_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id)"; 489 $query .= " WHERE dateobs like '$date%' AND exp_id > $refExpID[0]AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%'";473 $query .= " WHERE exp_name like '$expname' AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%'"; 490 474 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 491 475 $query .= " GROUP BY chunk ORDER BY dateobs) as suba "; … … 495 479 $query .= " (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count(warpSkyfile.quality) AS Nwarpskycell,count(if(warpSkyfile.quality > 0,1,NULL)) AS Nwarpskycellbad"; 496 480 $query .= " FROM rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id) JOIN warpSkyfile USING (warp_id)"; 497 $query .= " WHERE dateobs like '$date%' AND exp_id > $refExpID[0]AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%'";481 $query .= " WHERE exp_name like '$expname' AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%'"; 498 482 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 499 483 $query .= " GROUP BY exp_name) as subc"; 500 484 $query .= " GROUP BY chunk) AS subb "; 501 485 $query .= "ON suba.chunk=subb.chunk"; 502 486 487 if ($debug) {echo "$query<br>";} 503 488 $qry = $projectdb->query($query); 489 504 490 if (dberror($qry)) { 505 491 echo "<b>error querying SQL table</b><br>\n"; … … 512 498 echo $table; 513 499 echo "<tr>"; 514 createTableTitle("Status of last night's chunks", 10); 500 $mjdday = getMJD(); 501 createTableTitle("Status of night $mjdday chunks", 10); 515 502 echo "<tr>"; 516 503 createTableColumnHeader("Chunk"); … … 556 543 $query1 = "SELECT suba.chunk, SUM(IF(suba.Nvisits = 2,1,NULL)) as totvis2, SUM(IF(suba.Nvisits = 3 OR suba.Nvisits = 4,2,NULL)) as totvis34 FROM"; 557 544 $query1 .= " (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count(distinct(comment)) AS Nvisits FROM"; 558 $query1 .= " rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) WHERE dateobs like '$date%'"; 559 $query1 .= " AND exp_id > $refExpID[0] AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 545 $query1 .= " rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) "; 546 $query1 .= " WHERE exp_name like '$expname'"; 547 $query1 .= " AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 560 548 $query1 .= " AND substr(comment, 1, position(' ' in comment)) LIKE '$chunkname%' group by object) as suba group by chunk;"; 549 561 550 $qry1 = $projectdb->query($query1); 562 551 while ($qry1->fetchInto($row)) {$NexpWWdiff = $row[1] + $row[2];} … … 565 554 $query2 = " SELECT diff_id,warp1,stack1,warp2,stack2 FROM "; 566 555 $query2 .= " diffInputSkyfile JOIN warpRun ON (warp1=warp_id OR warp2=warp_id) JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)"; 567 $query2 .= " WHERE rawExp.dateobs LIKE '$date%' AND exp_id > $refExpID[0] AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 556 $query2 .= " WHERE exp_name like '$expname'"; 557 $query2 .= " AND exp_type = 'OBJECT' AND rawExp.comment like '%visit%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 568 558 $query2 .= " AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL' AND substr(comment, 1, position(' ' in comment)) LIKE '$chunkname%' GROUP By diff_id"; 569 559 $qry2 = $projectdb->query($query2); … … 670 660 $query .= " JOIN camRun USING (chip_id)"; 671 661 $query .= " JOIN camProcessedExp USING (cam_id)"; 672 $query .= " WHERE dateobs LIKE '$date%'";673 $query .= " AND exp_id > $refExpID[0]";662 //$query .= " WHERE dateobs LIKE '$date%' AND exp_id > $refExpID"; 663 $query .= " WHERE exp_name like '$expname'"; 674 664 $query .= " AND exp_type = 'OBJECT'"; 675 665 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 676 $query .= " AND (camProcessedExp. quality > 0 OR camProcessedExp.sigma_ra > 5 OR camProcessedExp.sigma_dec > 5)";666 $query .= " AND (camProcessedExp.fwhm_major > 12 OR camProcessedExp.quality > 0 OR camProcessedExp.sigma_ra > 5 OR camProcessedExp.sigma_dec > 5)"; 677 667 $query .= " ORDER BY comment"; 678 668 … … 710 700 $query = "SELECT exp_name,warp_id,count(warpSkyfile.quality) AS Nwarpskycell,count(if(warpSkyfile.quality > 0,1,NULL)) AS Nwarpskycellbad, comment"; 711 701 $query .= " FROM rawExp LEFT JOIN chipRun USING (exp_id) LEFT JOIN camRun USING (chip_id) LEFT JOIN fakeRun USING (cam_id) LEFT JOIN warpRun USING (fake_id) JOIN warpSkyfile USING (warp_id)"; 712 $query .= " WHERE dateobs like '$date%' AND exp_id > $refExpID[0]";702 $query .= " WHERE exp_name like '$expname'"; 713 703 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 714 704 $query .= " GROUP BY exp_name ORDER BY comment"; … … 747 737 $query = " SELECT diff_id,warp1,stack1,warp2,stack2,exp_name,comment FROM "; 748 738 $query .= " diffInputSkyfile JOIN warpRun ON (warp1=warp_id OR warp2=warp_id) JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)"; 749 $query .= " WHERE rawExp.dateobs LIKE '$date%' AND exp_id > $refExpID[0] AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 739 $query .= " WHERE exp_name like '$expname'"; 740 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; 750 741 $query .= " GROUP By diff_id"; 742 if ($debug) {echo "$query<br>";} 743 751 744 $qry1 = $projectdb->query($query); 752 753 745 while ($qry1->fetchInto($row)) { 754 746 #distinguish between WW and WS diffs based on stack2 … … 811 803 $query .= " JOIN chipRun USING (exp_id)"; 812 804 $query .= " JOIN camRun USING (chip_id)"; 813 $query .= " WHERE dateobs LIKE '$date%'"; 814 $query .= " AND exp_id > $refExpID[0]"; 805 $query .= " WHERE exp_name like '$expname'"; 815 806 $query .= " AND exp_type = 'OBJECT'"; 816 807 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; … … 826 817 $query .= " JOIN chipRun USING (exp_id)"; 827 818 $query .= " JOIN camRun USING (chip_id)"; 828 $query .= " WHERE dateobs LIKE '$date%' AND comment LIKE '$row[1]'";829 $query .= " AND exp_id > $refExpID[0]";819 $query .= " WHERE exp_name like '$expname'"; 820 $query .= " AND comment LIKE '$row[1]'"; 830 821 $query .= " AND exp_type = 'OBJECT'"; 831 822 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND obs_mode NOT LIKE 'MANUAL'"; … … 863 854 864 855 865 // timer finished856 // End timer 866 857 echo "<tr><th colspan=10>"; 867 $time = microtime(); 868 $time = explode(' ', $time); 869 $time = $time[1] + $time[0]; 870 $finish = $time; 871 $total_time = round(($finish - $start), 3); 872 echo "loading in $total_time seconds."; 873 $start= $finish; 858 $total_time = round(microtime(true) - $start, 3); 859 echo "<center>loading in $total_time seconds<br></center>"; 860 874 861 echo "</th></tr>"; 875 862 echo "</table></br>"; … … 914 901 $selectedState, $selectedLabel, $selectedStage, $plotType) { 915 902 916 // timer start 917 $time = microtime(); 918 $time = explode(' ', $time); 919 $time = $time[1] + $time[0]; 920 $start = $time; 903 // Start timer 904 $start = microtime(true); 905 921 906 922 907 // function begin … … 1010 995 } 1011 996 } 1012 // echo "getStateAndFaults $db, $thisLabel, $proj, $selectedState, $stage, $str, $anyFaults<br>";1013 997 getStateAndFaults($db, $thisLabel, $proj, $selectedState, $stage, $str, $anyFaults); 998 //echo "getStateAndFaults $db, $thisLabel, $proj, $selectedState, $stage, $str, $anyFaults<br>"; 1014 999 1015 1000 $cellcolor = 0; … … 1045 1030 echo "</tr>\n"; 1046 1031 1047 // timer finished1032 // End timer 1048 1033 echo "<tr><th colspan=11>"; 1049 $time = microtime(); 1050 $time = explode(' ', $time); 1051 $time = $time[1] + $time[0]; 1052 $finish = $time; 1053 $total_time = round(($finish - $start), 3); 1054 echo "loading in $total_time seconds."; 1055 $start= $finish; 1034 $total_time = round(microtime(true) - $start, 3); 1035 echo "<center>loading plot in $total_time seconds<br></center>"; 1036 1056 1037 echo "</th></tr>"; 1057 1038 echo "</table><br>"; … … 1204 1185 1205 1186 // timer start 1206 $time = microtime(); 1207 $time = explode(' ', $time); 1208 $time = $time[1] + $time[0]; 1209 $start = $time; 1187 $start = microtime(true); 1210 1188 1211 1189 // function begin … … 1223 1201 1224 1202 // timer finished 1225 # echo "<tr><th colspan=11>"; 1226 $time = microtime(); 1227 $time = explode(' ', $time); 1228 $time = $time[1] + $time[0]; 1229 $finish = $time; 1230 $total_time = round(($finish - $start), 3); 1231 # echo "loading in $total_time seconds."; 1232 $start= $finish; 1233 # echo "</th></tr>"; 1203 echo "<tr><th colspan=11>"; 1204 $total_time = round((microtime(true) - $start), 3); 1205 echo "loading in $total_time seconds."; 1206 echo "</th></tr>"; 1234 1207 echo "</table><br>"; 1235 1208 … … 1272 1245 ########################################################################### 1273 1246 function createServersTable($pass, $proj, $selectedMode, $db, $servers, $selectedLabel, $selectedStage, $plotType) { 1274 1275 // timer start 1276 $time = microtime(); 1277 $time = explode(' ', $time); 1278 $time = $time[1] + $time[0]; 1279 $start = $time; 1280 1281 // function begin 1282 // set up table columns 1247 // Start the timer 1248 $start = microtime(true); 1249 1250 // Display table header 1283 1251 global $table; 1284 1252 echo $table; … … 1286 1254 createTableTitle("Pantasks server status", 3); 1287 1255 echo "<tr>"; 1288 createTableColumnHeader("Server"); 1289 createTableColumnHeader("Alive?"); 1290 createTableColumnHeader("Running?"); 1256 1257 // Define column headers in an array for flexibility 1258 $columnHeaders = array("Server", "Alive?", "Running?"); 1259 foreach ($columnHeaders as $header) { 1260 createTableColumnHeader($header); 1261 } 1291 1262 echo "</tr>\n"; 1292 1263 1293 1264 foreach ($servers as &$server) { 1294 1295 1265 getServerStatus($db,$proj, $server, $alive, $running); 1296 1266 1297 1267 echo "<tr>\n"; 1268 1269 // Generate the link once and pass it to the cell function 1298 1270 $link = "czartool_labels.php?pass=".$pass 1299 1271 ."&proj=".$proj … … 1304 1276 ."&plottype=".$plotType; 1305 1277 1278 // Display server row cells 1306 1279 createFormattedTableCell(1, $link, $server, 0, 0); 1307 1280 createFormattedTableCell(0, "", $alive ? "yes" : "NO", !$alive, 0); 1308 1281 createFormattedTableCell(0, "", $running ? "yes" : "NO", !$running, 0); 1282 1309 1283 echo "</tr>\n"; 1310 1284 } 1311 1285 1312 // timer finished1286 // Display loading time 1313 1287 echo "<tr><th colspan=5>"; 1314 $time = microtime(); 1315 $time = explode(' ', $time); 1316 $time = $time[1] + $time[0]; 1317 $finish = $time; 1318 $total_time = round(($finish - $start), 3); 1319 echo "loading in $total_time seconds."; 1320 $start= $finish; 1288 echo "loading in " . round((microtime(true) - $start), 3) . " seconds."; 1321 1289 echo "</th></tr>"; 1322 1290 echo "</table><br>\n"; … … 1515 1483 # 1516 1484 ########################################################################### 1517 function createSummitDataTable2($projectdb, $pass, $proj ) {1485 function createSummitDataTable2($projectdb, $pass, $proj, $debug) { 1518 1486 1519 1487 // timer start 1520 $time = microtime(); 1521 $time = explode(' ', $time); 1522 $time = $time[1] + $time[0]; 1523 $start = $time; 1524 1525 // function begin 1526 $date = gmdate("Y-m-d"); 1527 $datem1 = gmdate("Y-m-d",strtotime ( "-1 day") ); 1528 $datetime = gmdate("H:i:s"); 1488 $start = microtime(true); 1489 1490 // Define constants 1491 $mjdDay = getMJD(); 1492 $expname = "%{$mjdDay}%"; 1493 1494 $mjdDaym1 = $mjdDay - 1; 1495 $expnamem1 = "%{$mjdDaym1}%"; 1496 1497 $mjdDaym5 = $mjdDay - 5; 1498 $expnamem5 = "o{$mjdDaym5}%"; 1499 1500 $currentDate = gmdate("Y-m-d H:i:s"); 1501 $previousDate = gmdate("Y-m-d", strtotime("-1 day")); 1529 1502 1530 1503 // set up the table … … 1533 1506 echo $table; 1534 1507 echo "<tr>"; 1535 createTableTitle("Data status tonight $date <br> current time $datetime (UTC)", 4);1508 createTableTitle("Data status for night $mjdDay <br> current time UT: $currentDate", 4); 1536 1509 echo "<tr>"; 1537 1538 createTableColumnHeader("Exposure type"); 1539 createTableColumnHeader("<a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=summitExp\"><font color=\"blue\">summitExp status</font></a>"); 1540 createTableColumnHeader("<a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=downloadExp\"><font color=\"blue\">downloadExp status</font></a>"); 1541 createTableColumnHeader("<a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=rawExp\"><font color=\"blue\">rawExp </a>/ 1542 <a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=newExp\"><font color=\"blue\"> newExp</font></a>"); 1543 $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp 1544 LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name 1545 WHERE summitExp.dateobs like '$date%' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state"; 1510 createTableColumnHeader("Exposure type"); 1511 createTableColumnHeader("<a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=summitExp\"><font color=\"blue\">summitExp status</font></a>"); 1512 createTableColumnHeader("<a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=downloadExp\"><font color=\"blue\">downloadExp status</font></a>"); 1513 createTableColumnHeader("<a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=rawExp\"><font color=\"blue\">rawExp </a>/ 1514 <a href=\"czartool_labels.php?pass=".$pass."&proj=".$proj."&label=all&stage=newExp\"><font color=\"blue\"> newExp</font></a>"); 1515 1516 $sql = " 1517 SELECT sum_type, pzstate, rawstate, count(*), sum_exp, pz_exp, raw_exp 1518 FROM 1519 (SELECT summitExp.exp_type as sum_type, pzDownloadExp.state as pzstate, rawExp.state as rawstate, summitExp.exp_name as sum_exp, pzDownloadExp.exp_name as pz_exp, rawExp.exp_name as raw_exp 1520 FROM summitExp 1521 LEFT JOIN pzDownloadExp USING (summit_id) 1522 LEFT JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 1523 WHERE summitExp.summit_id >= ( 1524 SELECT COALESCE(MIN(summit_id), 0) 1525 FROM summitExp 1526 WHERE exp_name LIKE '$expnamem5' 1527 ) 1528 AND summitExp.exp_name LIKE '$expname' ORDER BY summitExp.dateobs desc) as sub 1529 GROUP BY sum_type, pzstate, rawstate"; 1530 if ($debug) {echo "$sql<br>";} 1531 1546 1532 $qry = $projectdb->query($sql); 1547 1533 while ($qry->fetchInto($tmp)) { 1548 if ($tmp[1] == NULL) { 1549 echo "<tr><td>$tmp[0]<td> null <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$tmp[3]"; 1534 list($expType, $downloadState, $rawState, $count, $summit_exp, $pz_exp, $raw_exp) = $tmp; 1535 if ($downloadState == NULL) { 1536 echo "<tr><td> $expType ($summit_exp) <td> loading imfiles <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$count"; 1550 1537 } else { 1551 if ($ tmp[1]== 'run') {1552 echo "<tr><td> $tmp[0]<td> loading <td> null <td bgcolor=$columnHeaderColor> <font color=\"red\">$tmp[3]";1538 if ($downloadState == 'run') { 1539 echo "<tr><td> $expType ($summit_exp) <td> summit_copy ($pz_exp) <td> saving ($pz_exp) <td bgcolor=$columnHeaderColor> <font color=\"red\">$count"; 1553 1540 } else { 1554 if ($ tmp[2]== NULL) {1555 echo "<tr><td> $tmp[0] <td> $tmp[1] <td> loading <td bgcolor=$columnHeaderColor> <font color=\"blue\">$tmp[3]";1541 if ($rawState == NULL) { 1542 echo "<tr><td> $expType ($summit_exp) <td> $downloadState ($pz_exp) <td> registering ($pz_exp) <td bgcolor=$columnHeaderColor> <font color=\"blue\">$count"; 1556 1543 } else { 1557 echo "<tr><td> $tmp[0]<td> $tmp[1] <td> downloaded <td> $tmp[3]";1544 echo "<tr><td> $expType ($summit_exp) <td> $downloadState ($pz_exp) <td> $rawState ($raw_exp) <td> $count"; 1558 1545 } 1559 1546 } … … 1561 1548 } 1562 1549 1563 echo "<tr><th colspan=4>Last night $datem1 (UTC)"; 1564 $sql = "SELECT summitExp.exp_type,pzDownloadExp.state,rawExp.state,COUNT(*) FROM summitExp 1565 LEFT JOIN pzDownloadExp USING (summit_id) LEFT JOIN rawExp on summitExp.exp_name = rawExp.exp_name 1566 WHERE summitExp.dateobs like '$datem1%' group by summitExp.exp_type,pzDownloadExp.state,rawExp.state"; 1550 echo "<tr><th colspan=4>Last night $previousDate (UTC), $mjdDaym1 (MJD)"; 1551 $sql = " 1552 SELECT sum_type, pzstate, rawstate, count(*), sum_exp, pz_exp, raw_exp 1553 FROM 1554 (SELECT summitExp.exp_type as sum_type, pzDownloadExp.state as pzstate, rawExp.state as rawstate, summitExp.exp_name as sum_exp, pzDownloadExp.exp_name as pz_exp, rawExp.exp_name as raw_exp 1555 FROM summitExp 1556 LEFT JOIN pzDownloadExp USING (summit_id) 1557 LEFT JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 1558 WHERE summitExp.summit_id >= ( 1559 SELECT COALESCE(MIN(summit_id), 0) 1560 FROM summitExp 1561 WHERE exp_name LIKE '$expnamem5' 1562 ) 1563 AND summitExp.exp_name LIKE '$expnamem1' ORDER BY summitExp.dateobs desc) as sub 1564 GROUP BY sum_type, pzstate, rawstate"; 1565 // $sql = " 1566 // SELECT summitExp.exp_type, pzDownloadExp.state, rawExp.state, COUNT(*) 1567 // FROM summitExp 1568 // LEFT JOIN pzDownloadExp USING (summit_id) 1569 // LEFT JOIN rawExp ON summitExp.exp_name = rawExp.exp_name 1570 // WHERE summitExp.summit_id >= ( 1571 // SELECT COALESCE(MIN(summit_id), 0) 1572 // FROM summitExp 1573 // WHERE exp_name LIKE '$expnamem5' 1574 // ) 1575 // AND summitExp.exp_name LIKE '$expnamem1' 1576 // GROUP BY summitExp.exp_type, pzDownloadExp.state, rawExp.state"; 1577 if ($debug) {echo "$sql<br>";} 1578 1567 1579 $qry = $projectdb->query($sql); 1568 1580 while ($qry->fetchInto($tmp)) { 1569 if ($tmp[1] == NULL) { 1570 echo "<tr><td>$tmp[0]<td> null <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$tmp[3]"; 1581 list($expType, $downloadState, $rawState, $count, $summit_exp, $pz_exp, $raw_exp) = $tmp; 1582 if ($downloadState == NULL) { 1583 echo "<tr><td> $expType ($summit_exp) <td> loading imfiles <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$count"; 1571 1584 } else { 1572 if ($ tmp[1]== 'run') {1573 echo "<tr><td> $tmp[0]<td> loading <td> null <td bgcolor=$columnHeaderColor> <font color=\"red\">$tmp[3]";1585 if ($downloadState == 'run') { 1586 echo "<tr><td> $expType ($summit_exp) <td> summit_copy ($pz_exp) <td> saving ($pz_exp) <td bgcolor=$columnHeaderColor> <font color=\"red\">$count"; 1574 1587 } else { 1575 if ($ tmp[2]== NULL) {1576 echo "<tr><td> $tmp[0] <td> $tmp[1] <td> loading <td bgcolor=$columnHeaderColor> <font color=\"blue\">$tmp[3]";1588 if ($rawState == NULL) { 1589 echo "<tr><td> $expType ($summit_exp) <td> $downloadState ($pz_exp) <td> registering <td bgcolor=$columnHeaderColor> <font color=\"blue\">$count"; 1577 1590 } else { 1578 echo "<tr><td> $tmp[0]<td> $tmp[1] <td> downloaded <td> $tmp[3]";1591 echo "<tr><td> $expType ($summit_exp) <td> $downloadState ($pz_exp) <td> $rawState ($raw_exp) <td> $count"; 1579 1592 } 1580 1593 } 1581 1594 } 1582 1595 } 1583 // timer finished 1596 //while ($qry->fetchInto($tmp)) { 1597 // list($expType, $downloadState, $rawState, $count) = $tmp; 1598 // if ($downloadState == NULL) { 1599 // echo "<tr><td> $expType <td> null <td> null <td bgcolor=\"yellow\"> <font color=\"red\">$count"; 1600 // } else { 1601 // if ($downloadState == 'run') { 1602 // echo "<tr><td> $expType <td> loading <td> null <td bgcolor=$columnHeaderColor> <font color=\"red\">$count"; 1603 // } else { 1604 // if ($rawState == NULL) { 1605 // echo "<tr><td> $expType <td> $downloadState <td> loading <td bgcolor=$columnHeaderColor> <font color=\"blue\">$count"; 1606 // } else { 1607 // echo "<tr><td> $expType <td> $downloadState <td> download ($rawState) <td> $count"; 1608 // } 1609 // } 1610 // } 1611 //} 1612 1584 1613 echo "<tr><th colspan=4>"; 1585 $time = microtime(); 1586 $time = explode(' ', $time); 1587 $time = $time[1] + $time[0]; 1588 $finish = $time; 1589 $total_time = round(($finish - $start), 3); 1590 echo "loading in $total_time seconds."; 1591 $start= $finish; 1614 // End timer 1615 $total_time = round(microtime(true) - $start, 3); 1616 echo "<center>loading in $total_time seconds<br></center>"; 1617 1592 1618 echo "</th></tr>"; 1593 1619 echo "</table><br>"; 1620 } 1621 1622 function formatState($state) { 1623 // Formats display of the state for better readability 1624 if (is_null($state)) { 1625 return "<span style='color: red;'>null</span>"; 1626 } elseif ($state == 'run') { 1627 return "<span style='color: red;'>loading</span>"; 1628 } else { 1629 return $state; 1630 } 1594 1631 } 1595 1632 ########################################################################### … … 1608 1645 echo "<script type=\"text/javascript\" src=\"loader.js\"></script>"; 1609 1646 echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 640px\">"; 1610 echo " <div id=\"disk_div\" style=\"width:640px; height: 1200px\"></div>";1647 echo " <div id=\"disk_div\" style=\"width:640px; height:4000px\"></div>"; 1611 1648 echo " <div class=\"overlay\" style=\"position: absolute; width: 100px; top: 35px; right: 20px;\">"; 1612 1649 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #00ff00\"><center>Free</div>"; … … 1686 1723 echo " },"; 1687 1724 echo " bar: { groupWidth: '95%' },"; 1688 echo " chartArea: {left:70, top:30, right:20, bottom:40},"; 1689 echo " fontSize: 12,"; 1690 echo " isStacked: true"; 1725 echo " chartArea: {left:100, top:30, right:20, bottom:40},"; 1726 echo " fontSize: 15,"; 1727 echo " isStacked: true,"; 1728 echo " colors: ['#76A7FA', '#FF5733', '#C70039', '#900C3F', '#581845']"; 1691 1729 echo " };"; 1692 1730 echo " var chart = new google.visualization.BarChart(document.getElementById('disk_div'));"; … … 1821 1859 1822 1860 $date = gmdate("Y-m-d"); 1823 $sql = "SELECT MAX(exp_id) FROM rawExp WHERE dateobs >= date_sub('$date', interval 20 day) AND dateobs <= date_sub('$date', interval 10 day)"; 1861 $sql = "SELECT MAX(exp_id) FROM rawExp WHERE dateobs BETWEEN DATE_SUB('$date', INTERVAL 20 DAY) AND DATE_SUB('$date', INTERVAL 10 DAY)"; 1862 if ($debug) {echo "$sql<br>";} 1824 1863 $qry = $db->query($sql); 1864 1825 1865 if (dberror($qry)) { 1826 print "*** WARNING: no data inperiod 10-20 days before requested date (query will be slower) **\n";1866 echo "*** WARNING: No data in the period 10-20 days before requested date (query will be slower) **\n"; 1827 1867 $refExpID = 0; 1828 } 1829 $qry->fetchInto($refExpID); 1830 if ($refExpID[0] = 'NULL') { 1831 $refExpID[0] = 0; 1832 } 1868 } else { 1869 $qry->fetchInto($refExpID); 1870 $refExpID = isset($refExpID[0]) ? $refExpID[0] : 0; 1871 } 1872 // Print the result of the query 1873 if ($debug) {echo "The result of MAX(exp_id) is: $refExpID<br>";} 1874 {echo "The result of MAX(exp_id) is: $refExpID<br>";} 1833 1875 1834 1876 #Query for the needed data … … 1838 1880 # $sql.= " WHERE (rawExp.dateobs > utc_date() - INTERVAL 14 hour) and (rawExp.dateobs < utc_date() + INTERVAL 10 hour)"; 1839 1881 $sql.= " WHERE (rawExp.dateobs > utc_date())"; 1882 # $sql.= " WHERE (rawExp.dateobs > '2024-10-24')"; 1883 # $sql.= " AND (rawExp.dateobs < '2024-10-25')"; 1840 1884 $sql.= " AND exp_id > $refExpID[0]"; 1841 1885 $sql.= " AND exp_type = 'OBJECT' AND camRun.state like 'full' ORDER BY dateobs asc;"; … … 1843 1887 $qry = $db->query($sql); 1844 1888 if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";} 1889 # echo "<b>error with $sql </b><br>\n"; 1845 1890 while ($qry->fetchInto($row)) { 1846 1891 $DQarray[] = $row; … … 2044 2089 2045 2090 #define new zeropoints 2046 if(substr($row[5],0,1) == 'g') {$col_string = ' blue'; $zpt_off = $zp - 25.013;}2047 if(substr($row[5],0,1) == 'r') {$col_string = ' red'; $zpt_off = $zp - 24.840;}2048 if(substr($row[5],0,1) == 'i') {$col_string = '# 6a3d9a'; $zpt_off = $zp - 24.711;}2049 if(substr($row[5],0,1) == 'z') {$col_string = ' green'; $zpt_off = $zp - 24.30;}2050 if(substr($row[5],0,1) == 'y') {$col_string = ' cyan'; $zpt_off = $zp - 23.57;}2051 if(substr($row[5],0,1) == 'w') {$col_string = ' grey'; $zpt_off = $zp - 26.000;}2091 if(substr($row[5],0,1) == 'g') {$col_string = '#00f000'; $zpt_off = $zp - 25.013;} 2092 if(substr($row[5],0,1) == 'r') {$col_string = '#f00000'; $zpt_off = $zp - 24.840;} 2093 if(substr($row[5],0,1) == 'i') {$col_string = '#f05000'; $zpt_off = $zp - 24.711;} 2094 if(substr($row[5],0,1) == 'z') {$col_string = '#0050a0'; $zpt_off = $zp - 24.300;} 2095 if(substr($row[5],0,1) == 'y') {$col_string = '#ffe000'; $zpt_off = $zp - 23.570;} 2096 if(substr($row[5],0,1) == 'w') {$col_string = '#808080'; $zpt_off = $zp - 26.060;} 2052 2097 2053 2098 $tt_string1 = sprintf('time: %s\n zeropoint: %s\n filter: %s\n exp_time: %s\n comment: %s', $timestamp, $zp,$row[5],$row[6],$row[7]); … … 2101 2146 } 2102 2147 2148 2149 2150 2103 2151 ########################################################################### 2104 2152 # … … 2108 2156 function Gettimeseries($db, $selectedMode, $selectedLabel, $proj, $selectedStage) { 2109 2157 // timer start 2110 $time = microtime(); 2111 $time = explode(' ', $time); 2112 $time = $time[1] + $time[0]; 2113 $start = $time; 2158 $start = microtime(true); 2114 2159 2115 2160 // google chart javascript source code … … 2512 2557 2513 2558 // timer end 2514 $time = microtime(); 2515 $time = explode(' ', $time); 2516 $time = $time[1] + $time[0]; 2517 $finish = $time; 2518 $total_time = round(($finish - $start), 3); 2519 $start= $finish; 2520 echo "<center>loading in $total_time seconds</center>"; 2559 echo "<center> loading in " . round((microtime(true) - $start), 3) . " seconds. </center>"; 2521 2560 } 2522 2561 … … 2994 3033 } 2995 3034 3035 3036 ########################################################################### 3037 # 3038 # Get data quality 3039 # 3040 ########################################################################### 3041 function getDataQuality2($db) { 3042 // Start timer 3043 $start = microtime(true); 3044 3045 $mjdDay = getMJD(); 3046 $expname = "o".$mjdDay."%"; 3047 3048 $sql = "SELECT SUBTIME(dateobs, '10:00:00') AS time, 3049 round(( 367*YEAR(dateobs)- FLOOR((7 * (YEAR(dateobs) + FLOOR((MONTH(dateobs) + 9) / 12))) / 4) + FLOOR(275 * MONTH(dateobs) / 9) 3050 + DAY(dateobs) + 1721013.5 + (HOUR(dateobs) / 24.0) + (MINUTE(dateobs) / 1440.0) + (SECOND(dateobs) / 86400.0) - 2400000.5), 5) AS MJD, 3051 filter, comment, ra*180/pi() as RA, decl*180/pi() as DECL, exp_name, alt, az, fwhm_major, fwhm_minor, zpt_obs, zpt_stdev, rawExp.exp_id 3052 FROM rawExp JOIN chipRun using (exp_id) JOIN camRun using (chip_id) JOIN camProcessedExp using (cam_id) 3053 WHERE rawExp.exp_name like '$expname' 3054 AND exp_type = 'OBJECT' 3055 AND camRun.state like 'full' 3056 AND camProcessedExp.fault = 0 3057 AND camProcessedExp.zpt_obs != 0; "; 3058 3059 $DQarray = array(); 3060 $qry = $db->query($sql); 3061 if (dberror($qry)) { 3062 echo "<b>Error with $sql</b><br>\n"; 3063 return; 3064 } 3065 3066 while ($qry->fetchInto($row)) { 3067 $DQarray[] = $row; 3068 } 3069 3070 // Ensure $DQarray is not empty 3071 if (empty($DQarray)) { 3072 echo "<center><b> No data for MJD: $mjdDay </b></center>"; 3073 return; // Stop execution if no data to encode 3074 } 3075 3076 // Convert data array to JSON for easier handling in JavaScript 3077 $dataJson = json_encode($DQarray); 3078 3079 if ($dataJson === false) { 3080 echo "<b>Error encoding JSON:</b> " . json_last_error_msg(); // Display any JSON encoding errors 3081 return; // Stop execution if JSON encoding fails 3082 } 3083 3084 echo "<script>console.log(" . json_encode($dataJson) . ");</script>"; // Log JSON output to console for debugging 3085 3086 echo <<<HTML 3087 <script type="text/javascript" src="loader.js"></script> 3088 3089 <script type="text/javascript"> 3090 google.charts.load('current', {packages: ['corechart']}); 3091 3092 // Use the encoded JSON directly in JavaScript 3093 const dataArray = JSON.parse('{$dataJson}'); // Directly parse the PHP JSON string 3094 3095 // draw FWHM vs MJD 3096 function drawFWHMChart() { 3097 var data = new google.visualization.DataTable(); 3098 data.addColumn('number', 'MJD'); 3099 data.addColumn('number', 'FWHM_major'); 3100 data.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}}); 3101 data.addColumn('number', 'FWHM_minor'); 3102 data.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}}); 3103 data.addColumn('number', 'seeing ~ 1"'); 3104 data.addColumn('number', 'seeing ~ 3"'); 3105 3106 const rows = dataArray.map(row => { 3107 const [timestamp, mjd, filter, comment, ra, dec, exp_name, alt, az, iq_fwhm_maj, iq_fwhm_min, zpt_obs, zpt_stdev, exp_id] = row; 3108 3109 return [ 3110 parseFloat(mjd), // Position Angle 3111 parseFloat(iq_fwhm_maj), // RA_offset (AST_R0) 3112 "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, 3113 parseFloat(iq_fwhm_min), // Dec_offset (AST_D0) 3114 "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, 3115 4, 3116 12 3117 ]; 3118 }); 3119 3120 data.addRows(rows); 3121 3122 const options = { 3123 title: 'FWHM (MJD)', 3124 titleTextStyle: {color: 'black', fontSize: 15}, 3125 width: '100%', 3126 height: 480, 3127 legend: { position: 'top', alignment: 'center' }, 3128 series: { 3129 0: { color: '#0000ff', pointSize: 3, lineWidth: 1 }, 3130 1: { color: '#33a532', pointSize: 3, lineWidth: 1 }, 3131 2: { color: 'red', lineWidth: 2, pointSize: 0 }, 3132 3: { color: 'red', lineWidth: 2, lineDashStyle: [8, 4], pointSize: 0 } 3133 }, 3134 intervals: { color: 'red', lineWidth: 2, style: 'sticks' }, 3135 hAxis: { 3136 title: 'MJD', 3137 gridlines: {count: -1} 3138 }, 3139 vAxis: { 3140 title: 'FWHM (pixels)', 3141 }, 3142 tooltip: { isHtml: true }, // Render tooltips as HTML 3143 chartArea: {left: '8%', top: 60, right: '5%', bottom: 50}, // Adjust left and right 3144 fontSize: 12, 3145 }; 3146 3147 const chart = new google.visualization.LineChart(document.getElementById('dq_div_fwhm')); 3148 chart.draw(data, options); 3149 } 3150 3151 // draw zoomed zerpoint vs mjd 3152 function drawZOOMZPTChart() { 3153 var data = new google.visualization.DataTable(); 3154 data.addColumn('number', 'MJD'); 3155 3156 // Add columns for each filter type to handle separate colors 3157 data.addColumn('number', 'g (24.563, 25.013)'); 3158 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3159 data.addColumn({type: 'number', role: 'interval'}); 3160 data.addColumn({type: 'number', role: 'interval'}); 3161 data.addColumn('number', 'r (24.750, 24.840)'); 3162 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3163 data.addColumn({type: 'number', role: 'interval'}); 3164 data.addColumn({type: 'number', role: 'interval'}); 3165 data.addColumn('number', 'i (24.611, 24.711)'); 3166 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3167 data.addColumn({type: 'number', role: 'interval'}); 3168 data.addColumn({type: 'number', role: 'interval'}); 3169 data.addColumn('number', 'z (24.240, 24.300)'); 3170 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3171 data.addColumn({type: 'number', role: 'interval'}); 3172 data.addColumn({type: 'number', role: 'interval'}); 3173 data.addColumn('number', 'y (23.320, 23.570)'); 3174 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3175 data.addColumn({type: 'number', role: 'interval'}); 3176 data.addColumn({type: 'number', role: 'interval'}); 3177 data.addColumn('number', 'w (26.000, 26.300)'); 3178 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3179 data.addColumn({type: 'number', role: 'interval'}); 3180 data.addColumn({type: 'number', role: 'interval'}); 3181 3182 const rows = dataArray.map(row => { 3183 const [timestamp, mjd, filter, comment, ra, dec, exp_name, alt, az, iq_fwhm_maj, iq_fwhm_min, zpt_obs, zpt_stdev, exp_id] = row; 3184 3185 // Initialize all filter values as null 3186 let zp_g = null, zp_r = null, zp_i = null, zp_z = null, zp_y = null, zp_w = null; 3187 3188 // Set the zeropoint offset based on filter and assign it to the correct series 3189 switch (filter[0]) { 3190 case 'g': 3191 zp_g = zpt_obs - 24.563; 3192 break; 3193 case 'r': 3194 zp_r = zpt_obs - 24.750; 3195 break; 3196 case 'i': 3197 zp_i = zpt_obs - 24.611; 3198 break; 3199 case 'z': 3200 zp_z = zpt_obs - 24.240; 3201 break; 3202 case 'y': 3203 zp_y = zpt_obs - 23.320; 3204 break; 3205 case 'w': 3206 zp_w = zpt_obs - 26.000; 3207 break; 3208 } 3209 3210 return [ 3211 parseFloat(mjd), // MJD value 3212 zp_g, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_g - zpt_stdev), parseFloat(zp_g - zpt_stdev*-1), 3213 zp_r, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_r - zpt_stdev), parseFloat(zp_r - zpt_stdev*-1), 3214 zp_i, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_i - zpt_stdev), parseFloat(zp_i - zpt_stdev*-1), 3215 zp_z, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_z - zpt_stdev), parseFloat(zp_z - zpt_stdev*-1), 3216 zp_y, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_y - zpt_stdev), parseFloat(zp_y - zpt_stdev*-1), 3217 zp_w, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_w - zpt_stdev), parseFloat(zp_w - zpt_stdev*-1) 3218 ]; 3219 }); 3220 3221 data.addRows(rows); 3222 3223 const options = { 3224 title: 'Zeropoint zoom-in (MJD)', 3225 titleTextStyle: { color: 'black', fontSize: 15 }, 3226 width: '100%', 3227 height: 480, 3228 legend: { position: 'top', alignment: 'start', maxLines: 3 }, 3229 series: { 3230 0: { color: '#00f000', pointSize: 10, pointShape: 'circle', linewidth: 1}, // 'g' filter 3231 1: { color: '#f00000', pointSize: 10, pointShape: 'triangle', linewidth: 1}, // 'r' filter 3232 2: { color: '#f05000', pointSize: 10, pointShape: 'square', linewidth: 1}, // 'i' filter 3233 3: { color: '#0050a0', pointSize: 10, pointShape: 'diamond', linewidth: 1}, // 'z' filter 3234 4: { color: '#ffe000', pointSize: 10, pointShape: 'star', linewidth: 1}, // 'y' filter 3235 5: { color: '#808080', pointSize: 10, pointShape: 'polygon', linewidth: 1}, // 'w' filter 3236 }, 3237 intervals: { color: 'red', lineWidth: 1, style: 'sticks' }, 3238 hAxis: { 3239 title: 'MJD', 3240 gridlines: { count: -1 } 3241 }, 3242 vAxis: { 3243 title: 'Zeropoint (mag)', 3244 viewWindow: { min: -1.00, max: .5 }, 3245 }, 3246 tooltip: { isHtml: true }, 3247 chartArea: { left: '9%', top: 60, right: '5%', bottom: 50 }, 3248 fontSize: 12, 3249 }; 3250 3251 const chart = new google.visualization.LineChart(document.getElementById('dq_div_zoomzpt')); 3252 chart.draw(data, options); 3253 } 3254 3255 // draw zeropoint vs mjd 3256 function drawZPTChart() { 3257 var data = new google.visualization.DataTable(); 3258 data.addColumn('number', 'MJD'); 3259 3260 // Add columns for each filter type to handle separate colors 3261 data.addColumn('number', 'g' ); 3262 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3263 data.addColumn({type: 'number', role: 'interval'}); 3264 data.addColumn({type: 'number', role: 'interval'}); 3265 data.addColumn('number', 'r' ); 3266 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3267 data.addColumn({type: 'number', role: 'interval'}); 3268 data.addColumn({type: 'number', role: 'interval'}); 3269 data.addColumn('number', 'i' ); 3270 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3271 data.addColumn({type: 'number', role: 'interval'}); 3272 data.addColumn({type: 'number', role: 'interval'}); 3273 data.addColumn('number', 'z' ); 3274 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3275 data.addColumn({type: 'number', role: 'interval'}); 3276 data.addColumn({type: 'number', role: 'interval'}); 3277 data.addColumn('number', 'y' ); 3278 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3279 data.addColumn({type: 'number', role: 'interval'}); 3280 data.addColumn({type: 'number', role: 'interval'}); 3281 data.addColumn('number', 'w' ); 3282 data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}}); 3283 data.addColumn({type: 'number', role: 'interval'}); 3284 data.addColumn({type: 'number', role: 'interval'}); 3285 3286 // Count occurrences of each filter 3287 const filterCounts = { g: 0, r: 0, i: 0, z: 0, y: 0, w: 0 }; 3288 const rows = dataArray.map(row => { 3289 const [timestamp, mjd, filter, comment, ra, dec, exp_name, alt, az, iq_fwhm_maj, iq_fwhm_min, zpt_obs, zpt_stdev, exp_id] = row; 3290 3291 // Initialize all filter values as null 3292 let zp_g = null, zp_r = null, zp_i = null, zp_z = null, zp_y = null, zp_w = null; 3293 3294 // Increment the count for the filter 3295 if (filterCounts.hasOwnProperty(filter[0])) { 3296 filterCounts[filter[0]] += 1; 3297 } 3298 3299 // Set the zeropoint offset based on filter and assign it to the correct series 3300 switch (filter[0]) { 3301 case 'g': 3302 zp_g = zpt_obs - 0.0; 3303 break; 3304 case 'r': 3305 zp_r = zpt_obs - 0.0; 3306 break; 3307 case 'i': 3308 zp_i = zpt_obs - 0.0; 3309 break; 3310 case 'z': 3311 zp_z = zpt_obs - 0.0; 3312 break; 3313 case 'y': 3314 zp_y = zpt_obs - 0.0; 3315 break; 3316 case 'w': 3317 zp_w = zpt_obs - 0.0; 3318 break; 3319 } 3320 3321 return [ 3322 parseFloat(mjd), // MJD value 3323 zp_g, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_g - zpt_stdev), parseFloat(zp_g - zpt_stdev*-1), 3324 zp_r, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_r - zpt_stdev), parseFloat(zp_r - zpt_stdev*-1), 3325 zp_i, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_i - zpt_stdev), parseFloat(zp_i - zpt_stdev*-1), 3326 zp_z, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_z - zpt_stdev), parseFloat(zp_z - zpt_stdev*-1), 3327 zp_y, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_y - zpt_stdev), parseFloat(zp_y - zpt_stdev*-1), 3328 zp_w, "expname: "+exp_name+"<br>exp_id: "+exp_id+"<br>HST: "+timestamp+"<br>RA: "+ra+"<br>DEC: "+dec+"<br>filter: "+filter+"<br>comment: "+comment, parseFloat(zp_w - zpt_stdev), parseFloat(zp_w - zpt_stdev*-1), 3329 3330 ]; 3331 }); 3332 data.addRows(rows); 3333 3334 // Include counts in the title using string concatenation 3335 const countsTitle = 'Zeropoint (MJD) g: ' + filterCounts.g + ', r: ' + filterCounts.r + ', i: ' + filterCounts.i + ', z: ' + filterCounts.z + ', y: ' + filterCounts.y + ', w: ' + filterCounts.w; 3336 3337 3338 console.log(countsTitle); 3339 3340 const options = { 3341 title: countsTitle, 3342 titleTextStyle: { color: 'black', fontSize: 15 }, 3343 width: '100%', 3344 height: 480, 3345 legend: { position: 'top', alignment: 'center' }, 3346 series: { 3347 0: { color: '#00f000', pointSize: 10, pointShape: 'circle', linewidth: 1}, // 'g' filter 3348 1: { color: '#f00000', pointSize: 10, pointShape: 'triangle', linewidth: 1}, // 'r' filter 3349 2: { color: '#f05000', pointSize: 10, pointShape: 'square', linewidth: 1}, // 'i' filter 3350 3: { color: '#0050a0', pointSize: 10, pointShape: 'diamond', linewidth: 1}, // 'z' filter 3351 4: { color: '#ffe000', pointSize: 10, pointShape: 'star', linewidth: 1}, // 'y' filter 3352 5: { color: '#808080', pointSize: 10, pointShape: 'polygon', linewidth: 1}, // 'w' filter 3353 }, 3354 intervals: { color: 'red', lineWidth: 1, style: 'sticks' }, 3355 hAxis: { 3356 title: 'MJD', 3357 gridlines: { count: -1 } 3358 }, 3359 vAxis: { 3360 title: 'Zeropoint (mag)' 3361 }, 3362 tooltip: { isHtml: true }, 3363 chartArea: { left: '9%', top: 60, right: '5%', bottom: 50 }, 3364 fontSize: 12, 3365 }; 3366 3367 const chart = new google.visualization.LineChart(document.getElementById('dq_div_zpt')); 3368 chart.draw(data, options); 3369 } 3370 3371 google.charts.setOnLoadCallback(drawFWHMChart); 3372 google.charts.setOnLoadCallback(drawZPTChart); 3373 google.charts.setOnLoadCallback(drawZOOMZPTChart); 3374 3375 </script> 3376 3377 <div class="chartWithOverlay" style="position: relative; width: 640px; height:500px;"> 3378 <div id="dq_div_fwhm" style="width:640px;"></div> 3379 <div class="overlay" style="position: absolute; width: 400px; bottom: 60px; left: 85px;"></div> 3380 </div> 3381 3382 <div class="chartWithOverlay" style="position: relative; width: 640px; height:500px;"> 3383 <div id="dq_div_zpt" style="width:640px;"></div> 3384 <div class="overlay" style="position: absolute; width: 400px; bottom: 60px; left: 85px;"></div> 3385 </div> 3386 3387 <div class="chartWithOverlay" style="position: relative; width: 640px; height:500px;"> 3388 <div id="dq_div_zoomzpt" style="width:640px;"></div> 3389 <div class="overlay" style="position: absolute; width: 400px; bottom: 60px; left: 85px;"></div> 3390 </div> 3391 3392 HTML; 3393 // End timer 3394 $total_time = round(microtime(true) - $start, 3); 3395 echo "<center>loading plot in $total_time seconds<br></center>"; 3396 3397 } 3398 3399 3400 2996 3401 function getprocrate ($proc1, $proc0, $trange) { 2997 3402 if($proc1 > $proc0) { -
trunk/ippMonitor/raw/ipp.php
r42384 r42736 958 958 } 959 959 960 function getMJD() { 961 // Get the current date and time in UTC as a Unix timestamp 962 $currentTimestamp = time(); 963 964 // Convert the Unix timestamp to Julian Date (JD) 965 $jd = 2440587.5 + ($currentTimestamp / 86400); 966 967 // Calculate the Modified Julian Date (MJD) 968 $mjd = $jd - 2400000.5; 969 $mjdDay = floor($mjd); // Get only the day part of MJD 970 971 // Concatenate the desired string for expname 972 //$expname = "o" . $mjdDay . "%"; 973 974 // Format the current date in 'YYYY-MM-DD-HH:mm:ss' for display 975 //$currentUTC = gmdate('Y-m-d-H:i:s', $currentTimestamp); 976 977 // Display the result 978 //echo "Current UTC: $currentUTC, MJD: $mjdDay, expname: $expname<br>"; 979 980 // Return MJD day as an integer 981 return $mjdDay; 982 } 983 984 985 960 986 ?> -
trunk/ippMonitor/raw/ipp.plots.dat
r42272 r42736 22 22 menulink | menuselect | link | Plot Background (chipProcessedImfile) vs Moon Phase (rawExp) | scatterCpiBgReMpImage.php 23 23 menulink | menuselect | link | Plot Background (chipProcessedImfile) vs Sun Angle (rawExp) | scatterCpiBgReSaImage.php 24 25 menutop | menutop | plain | | 26 menulink | menuselect | link | pointing status | scatterPlotPointing.php 27 menulink | menuselect | link | data quality status | scatterPlotDataQuality.php 28 menulink | menuselect | link | airmass status | scatterPlotAirmassMcal.php -
trunk/ippMonitor/raw/storage.php
r42276 r42736 23 23 echo "<table border=\"0\">"; 24 24 echo "<tr>"; 25 echo " <td style=width:1 000px>";25 echo " <td style=width:1200px>"; 26 26 echo " <h1 align=\"middle\">Storage status</h1>"; 27 27 # storage timeseries … … 42 42 ///////////////////////////////////////////////////////////////////////////// 43 43 44 45 44 ########################################################################### 46 45 # … … 49 48 ########################################################################### 50 49 function getHosts($db) { 51 // timer start 52 $time = microtime(); 53 $time = explode(' ', $time); 54 $time = $time[1] + $time[0]; 55 $start = $time; 56 57 #echo "<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>"; 50 $start = microtime(true); 51 58 52 echo "<script type=\"text/javascript\" src=\"loader.js\"></script>"; 59 echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 640px\">";60 echo " <div id=\"disk_div\" style=\"width:100 0px; height:1600px\"></div>";53 echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 100%\">"; 54 echo " <div id=\"disk_div\" style=\"width:100%; height:4000px\"></div>"; 61 55 echo " <div class=\"overlay\" style=\"position: absolute; width: 100px; top: 50px; right: 20px;\">"; 62 56 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #00ff00\"><center>Free</div>"; … … 68 62 echo "</div>"; 69 63 70 echo "<script type=\"text/javascript\">"; 71 echo "google.charts.load('current', {packages: ['corechart', 'bar']});"; 72 echo "google.charts.setOnLoadCallback(drawBarColors);"; 73 echo "function drawBarColors() {"; 74 echo " var data = google.visualization.arrayToDataTable(["; 75 echo " ['Host', "; 76 echo " 'used', {type: 'string', role: 'style'}, {type: 'string', role: 'tooltip', 'p': {'html': true}}, "; 77 echo " 'free', {type: 'string', role: 'style'}, {type: 'string', role: 'tooltip', 'p': {'html': true}}],"; 78 79 $sql = "SELECT host, format(total,1), format(available,2), format(used,2), writable, readable, format(used/total*100,2) FROM hosts order by host"; 80 if ($debug) {echo "$sql<br>";} 64 // Set environment variables 65 putenv("PATH=/usr/local/bin:/usr/bin:/bin:/data/ippc65.0/ipp/src/psconfig//ipp-20210708-gentoo.lin64/bin"); 66 putenv("PERL5LIB=/data/ippc65.0/ipp/src/psconfig//ipp-20210708-gentoo.lin64/lib"); 67 68 $hostnoteall = array(); 69 exec("neb-host |cut -b 17-30,86-", $hostnoteall); 70 71 $sql = "SELECT host, format(total, 2), format(available, 2), format(used, 2), writable, readable, format(used/total*100,3) as ratio 72 FROM hosts 73 ORDER BY host"; 81 74 $qry = $db->query($sql); 82 if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";} 83 # not sure why neb-host doesn't work on ipp113 CCL.20210216 84 exec("neb-host |cut -b 17-30,86-", $hostnoteall); 75 76 if ($qry === false) { 77 echo "<b>Error with SQL query</b><br>"; 78 return; 79 } 80 81 $dataRows = array(); 85 82 while ($qry->fetchInto($row)) { 86 list($host, $total, $available, $used, $writable, $readable, $ratio) = $row; 87 $hostnotes = preg_grep("/$host/", $hostnoteall); 88 $hostnote = array_values($hostnotes); 89 if ($writable == 1 && $readable == 1) { 90 if ($ratio >= 97) { 91 # space used over limits, up mode (read/write ok). 92 echo "[ \"$host\", "; 93 echo " $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ff0000;\", \"<i><b>$host: $ratio% of $total TB used</b></i><br>$hostnote[0]\", "; 94 echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #00ff00;\", \"<i><b>$host: $available TB free</b></i>\"],"; 95 } 96 else { 97 # enough space, up mode (read/write ok). 98 echo "[ \"$host\", "; 99 echo " $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ffff00;\", \"<i><b>$host: $ratio% of $total TB used</b></i><br>$hostnote[0]\", "; 100 echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #00ff00;\", \"<i><b>$host: $available TB free</b></i>\"],"; 101 } 102 } 103 else if ($writable == 0 && $readable == 1) { 104 if ($ratio >= 97) { 105 # space used over limits, repair mode (read only). 106 echo "[ \"$host\", "; 107 echo " $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ff0000;\", \"<i><b>$host: $ratio% of $total TB used<br><font color=red>$hostnote[0]\", "; 108 echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $available TB free</b></i>\"],"; 109 } 110 else { 111 # enough space, but hosts are unstable, repair mode (read only). 112 echo "[ \"$host\", "; 113 echo " $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ffff00;\", \"<i><b>$host: $ratio% of $total TB used<br>$hostnote[0]\", "; 114 echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $available TB free</b></i>\"],"; 115 } 116 } 117 else { 118 # down mode (can't read or write). 119 echo "[ \"$host\", "; 120 echo " $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $ratio% used<br>$hostnote[0]\", "; 121 echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $available TB free</b></i>\"],"; 122 } 83 // Access data using numeric indices 84 $host = $row[0]; // ipp071.0 85 $total = $row[1]; // 80.0352 86 $available = $row[2]; // 10.8096 87 $used = $row[3]; // 69.2256 88 $writable = $row[4]; // 0 89 $readable = $row[5]; // 1 90 $ratio = $row[6]; // 86.493950215116 91 92 $hostnotes = preg_grep("/$host/", $hostnoteall); 93 $hostnote = reset($hostnotes); 94 95 $styles = "stroke-width: 0.5; stroke-color: black;"; 96 if ($writable == 1 && $readable == 1) { 97 $usedColor = $ratio >= 97 ? "#ff0000" : "#ffff00"; 98 $freeColor = "#00ff00"; 99 } elseif ($writable == 0 && $readable == 1) { 100 $usedColor = $ratio >= 97 ? "#ff0000" : "#ffff00"; 101 $freeColor = "#bbbbbb"; 102 } else { 103 $usedColor = $freeColor = "#bbbbbb"; 104 } 105 106 $dataRows[] = "[ \"$host\", $used, \"$styles color: $usedColor;\", \"$host: $ratio% of $total TB used<br>$hostnote\", 107 $available, \"$styles color: $freeColor;\", \"$host: $available TB free\"]"; 123 108 } 124 echo " ]);"; 125 echo " var options = {"; 126 echo " title: 'Nebulous Disk Use across IPP Clusters',"; 127 echo " titleTextStyle: {color: 'black', fontSize: 15},"; 128 echo " width: '100%',"; 129 echo " height: '100%',"; 130 echo " tooltip: {isHtml: true},"; 131 echo " legend: { position: 'none',"; 132 echo " alignment: 'end',"; 133 echo " maxLines: 3},"; 134 echo " hAxis: { title: 'Space (TB)',"; 135 echo " gridlines: {count: 10}"; 136 echo " },"; 137 echo " bar: { groupWidth: '95%' },"; 138 echo " chartArea: {left:70, top:30, right:20, bottom:40},"; 139 echo " fontSize: 12,"; 140 echo " isStacked: true"; 141 echo " };"; 142 echo " var chart = new google.visualization.BarChart(document.getElementById('disk_div'));"; 143 echo " chart.draw(data, options);"; 144 echo " }"; 145 echo "</script>"; 146 $time = microtime(); 147 $time = explode(' ', $time); 148 $time = $time[1] + $time[0]; 149 $finish = $time; 150 $total_time = round(($finish - $start), 3); 151 $start= $finish; 109 110 echo "<script type=\"text/javascript\"> 111 google.charts.load('current', {packages: ['corechart', 'bar']}); 112 google.charts.setOnLoadCallback(drawBarColors); 113 114 function drawBarColors() { 115 var data = google.visualization.arrayToDataTable([ 116 ['Host', 'Used', {type: 'string', role: 'style'}, {type: 'string', role: 'tooltip', 'p': {'html': true}}, 117 'Free', {type: 'string', role: 'style'}, {type: 'string', role: 'tooltip', 'p': {'html': true}}], 118 " . implode(",\n", $dataRows) . " 119 ]); 120 121 var options = { 122 title: 'Nebulous Disk Use across IPP Clusters', 123 titleTextStyle: {color: 'black', fontSize: 15}, 124 width: '100%', 125 height: '100%', 126 tooltip: {isHtml: true}, 127 legend: { position: 'none', alignment: 'end', maxLines: 3 }, 128 hAxis: { title: 'Space (TB)', gridlines: {count: 10} }, 129 bar: { groupWidth: '95%' }, 130 chartArea: {left:100, top:50, right:20, bottom:40}, 131 fontSize: 15, 132 isStacked: true 133 }; 134 135 var chart = new google.visualization.BarChart(document.getElementById('disk_div')); 136 chart.draw(data, options); 137 } 138 </script>"; 139 140 $total_time = round(microtime(true) - $start, 3); 152 141 echo "<center>loading in $total_time seconds<br></center>"; 153 142 } 143 154 144 155 145 ########################################################################### … … 186 176 #echo "<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>"; 187 177 echo "<script type=\"text/javascript\" src=\"loader.js\"></script>"; 188 echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 640; height:400\">";189 echo " <div id=\"space_div\" style=\"width:100 0; \"></div>";178 echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 100%; height:400\">"; 179 echo " <div id=\"space_div\" style=\"width:100%; \"></div>"; 190 180 echo " <div class=\"overlay\" style=\"position: absolute; width: 400px; bottom: 60px; left: 85px;\">"; 191 181 echo " <div style=\"font-size: 16px; color:#0000ff; background-color:#ffffff\"><b>ipp + ippb nodes: $ippusable + $ippbusable TB (latest usable)</b></div>";
Note:
See TracChangeset
for help on using the changeset viewer.
