Changeset 41460
- Timestamp:
- Dec 18, 2020, 5:46:57 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/night_report.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/night_report.pl
r41459 r41460 514 514 # check the status of exposures: 515 515 if (1) { 516 if ($report) { print "Exposure overview:\n"; } 516 if ($report) { print "General exposure overview:\n"; } 517 if ($report) { print "Distribution is split between clean=0/1 (fullbundles vs catalog)\n"; } 517 518 518 519 my $query = "SELECT exp_type, obs_mode,(CASE WHEN position(' ' in comment)>1 THEN substr(comment, 1, position(' ' in comment)-1) WHEN position('.' in comment)>1 THEN substr(comment, 1, position('.' in comment)-1) ELSE comment END) as cmt, state, count(*)"; … … 525 526 my $result = &mysql_select ($query); 526 527 527 if ($report) { printf "%8s | %12s | %30s | %7s | %7s | %7s | %9s %9s | %9s %1 2s |\n", "exp_type", "obs_mode","comment", "N(raw)", "N(chip)", "N(cam)", "N(wrp)", "N(wrppub)", "N(wsdiff)", "N(wsdiffpub)"; }528 if ($report) { printf "%8s | %12s | %30s | %7s | %7s | %7s | %9s %9s | %9s %13s |\n", "exp_type", "obs_mode","comment", "N(raw)", "N(chip)", "N(cam)", "N(wrp)", "N(wrpdist)", "N(WSdiff)", "N(WSdiffdist)"; } 528 529 while (@row = $result->fetchrow_array()) { 529 530 #query chip stage … … 544 545 $query .= " FROM rawExp join chipRun using (exp_id)"; 545 546 $query .= " JOIN camRun using (chip_id)"; 547 $query .= " JOIN camProcessedExp USING (cam_id)"; 546 548 $query .= " WHERE dateobs LIKE '$date%'"; 547 549 $query .= " AND exp_id > $refExpID"; #REF … … 550 552 $query .= " AND comment LIKE BINARY '$row[2]%'"; 551 553 } 554 $query .= " AND (camProcessedExp.quality IS NULL OR camProcessedExp.quality = 0)"; 552 555 553 556 my $result3 = &mysql_select ($query); … … 555 558 556 559 #query warp stage 557 my $query = "SELECT exp_type, obs_mode, warpRun.state, count( *)";560 my $query = "SELECT exp_type, obs_mode, warpRun.state, count(DISTINCT warpRun.warp_id) AS Nwarp,count(if(distRun.state LIKE 'full' and distRun.stage LIKE 'warp' and distRun.clean = 0,1,NULL)) AS Ndist0,count(if(distRun.state LIKE 'full' and distRun.stage LIKE 'warp' and distRun.clean = 1,1,NULL)) AS Ndist1"; 558 561 $query .= " FROM rawExp"; 559 562 $query .= " JOIN chipRun using (exp_id)"; … … 562 565 $query .= " JOIN fakeRun using (cam_id)"; 563 566 $query .= " JOIN warpRun using (fake_id)"; 567 $query .= " LEFT JOIN distRun ON (warp_id = stage_id)"; 564 568 $query .= " WHERE dateobs LIKE '$date%'"; 565 569 $query .= " AND exp_id > $refExpID"; #REF … … 568 572 $query .= " AND comment LIKE '$row[2]%'"; 569 573 } 570 $query .= " AND (camProcessedExp.quality IS NULL OR camProcessedExp.quality = 0)";571 572 574 my $result4 = &mysql_select ($query); 573 575 @row4 = $result4->fetchrow_array(); 574 576 575 #query warp-stack diff stage and publishstatus577 #query warp-stack diff stage and distribution status 576 578 my $query = "SELECT diff_id,warp1,stack1,warp2,stack2"; 577 579 $query .= " FROM diffInputSkyfile"; 578 $query .= " JOIN warpRun ON (warp1=warp_id OR warp2=warp_id)";580 $query .= " JOIN warpRun ON warp1=warp_id"; 579 581 $query .= " JOIN fakeRun USING (fake_id)"; 580 582 $query .= " JOIN camRun USING (cam_id)"; … … 582 584 $query .= " JOIN chipRun USING (chip_id)"; 583 585 $query .= " JOIN rawExp USING (exp_id)"; 586 #$query .= " LEFT JOIN distRun ON (diffRun.diff_id = stage_id)"; 584 587 $query .= " WHERE rawExp.dateobs LIKE '$date%'"; 585 588 $query .= " AND exp_id > $refExpID"; #REF 589 $query .= " AND stack2 > 0"; 586 590 $query .= " AND obs_mode LIKE BINARY '$row[1]'"; 587 591 if ($row[2] ne "") { … … 590 594 $query .= " GROUP BY diff_id"; 591 595 my $result5 = &mysql_select ($query); 596 #@row5 = $result5->fetchrow_array(); 592 597 593 598 my $NWSdiffgood = 0; 594 599 my $NWSdiffbad = 0; 595 my $NWSdiffpub = 0; 596 my %wrpcnt = (); 600 my $NWSdiffdist0 = 0; 601 my $NWSdiffdist1 = 0; 602 my %dfcnt = (); 597 603 598 604 while (@row5 = $result5->fetchrow_array()) { 599 605 if ($row5[4] > 0) { 600 #find the total number of skycell and the number of skycell with a bad quality flag as well as the full publishstate601 my $query2 = " SELECT count(diffSkyfile.quality) AS Ndiff,count(if(diffSkyfile.quality > 0,1,NULL)) AS Ndiffbad,count(if(publishRun.state LIKE 'full',1,NULL)) AS NpubFROM ";602 $query2 .= " diffRun JOIN diffSkyfile USING (diff_id) LEFT JOIN publishRun ON (diffRun.diff_id = stage_id)";603 $query2 .= " WHERE diff_id='$row5[0]' GROUP BY diffRun.diff_id";606 #find the total number of skycell and the number of skycell with a bad quality flag as well as the full dist state 607 my $query2 = "SELECT count(DISTINCT diffSkyfile.skycell_id) AS Ndiff,count(if(diffSkyfile.quality > 0,1,NULL)) AS Ndiffbad,count(if(distRun.state LIKE 'full' and distRun.clean = 0,1,NULL)) AS Ndist0,count(if(distRun.state LIKE 'full' and distRun.clean = 1,1,NULL)) AS Ndist1 FROM "; 608 $query2 .= " diffRun JOIN diffSkyfile USING (diff_id) LEFT JOIN distRun ON (diffRun.diff_id = stage_id)"; 609 $query2 .= " WHERE diff_id='$row5[0]' AND distRun.stage LIKE 'diff' GROUP BY diffRun.diff_id"; 604 610 my $result6 = &mysql_select ($query2); 605 611 while (@row6 = $result6->fetchrow_array()) { … … 607 613 if ($row6[1]<$row6[0]) {$NWSdiffgood ++;} 608 614 if ($row6[1]==$row6[0]) {$NWSdiffbad ++;} 609 if ($row6[2]==$row6[0]) {$NWSdiffpub ++;} 615 if ($row6[2]==$row6[0]) {$NWSdiffdist0 ++;} 616 if ($row6[3]==$row6[0]) {$NWSdiffdist1 ++;} 610 617 611 618 #if this wsdiff is published, record its corresponding warp_ids to see how many unique ones there are 612 if ($row6[2]==$row6[0]) {$wrpcnt{$row5[1]}++;} # record the presence of warp1619 $dfcnt{$row5[0]}++; # record the presence of diff_id 613 620 } 614 621 } 615 622 } 616 623 #pull out the unique warp_ids 617 $N pubwarps = keys %wrpcnt;618 619 if ($report) { printf "%8s | %12s | %30s | %7d | %7d | %7d | %9d % 9d | %9d %12d |\n", $row[0], $row[1], $row[2], $row[4], $row2[3], $row3[3], $row4[3],$Npubwarps,$NWSdiffgood,$NWSdiffpub; }624 $Ndiffs = keys %dfcnt; 625 626 if ($report) { printf "%8s | %12s | %30s | %7d | %7d | %7d | %9d %4d%1s%4d | %9d %6d%1s%6d |\n", $row[0], $row[1], $row[2], $row[4], $row2[3], $row3[3], $row4[3],$row4[4],'/',$row4[5],$Ndiffs,$NWSdiffdist0,'/',$NWSdiffdist1 ; } 620 627 } 621 628 print "\n";
Note:
See TracChangeset
for help on using the changeset viewer.
