Changeset 40766 for tags/ipp-ps2-20190404
- Timestamp:
- May 30, 2019, 8:48:56 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-ps2-20190404/ippScripts/scripts/night_report.pl
r40762 r40766 68 68 } 69 69 70 ################## 3370 ################## 71 71 ### testing the diff grouping -- this does not work for the Euclid data taken 2018.07.29 because the OBJECT 72 72 ### field is missing … … 382 382 $query .= " AND exp_type = 'OBJECT'"; 383 383 $query .= " AND obs_mode NOT LIKE 'ENGINEERING'"; 384 $query .= " AND obs_mode like '%SS%'";384 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 385 385 $query .= " AND rawExp.comment like '%visit%'"; 386 386 $query .= " AND (camProcessedExp.quality IS NULL or camProcessedExp.quality = 0)"; … … 438 438 $query .= " AND exp_type = 'OBJECT'"; 439 439 $query .= " AND obs_mode NOT LIKE 'ENGINEERING'"; 440 $query .= " AND obs_mode like '%SS%'";440 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 441 441 $query .= " AND rawExp.comment like '%visit%'"; 442 442 $query .= " AND (camProcessedExp.quality IS NULL or camProcessedExp.quality = 0)"; … … 474 474 $query .= " AND exp_type = 'OBJECT'"; 475 475 $query .= " AND obs_mode NOT LIKE 'ENGINEERING'"; 476 $query .= " AND obs_mode like '%SS%'";476 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 477 477 $query .= " AND rawExp.comment like '%visit%'"; 478 478 $query .= " AND (camProcessedExp.quality IS NULL or camProcessedExp.quality = 0)"; … … 660 660 $query .= " AND exp_type = 'OBJECT'"; 661 661 $query .= " AND obs_mode NOT LIKE 'ENGINEERING'"; 662 $query .= " AND obs_mode NOT like '%SS%'";662 $query .= " AND (obs_mode NOT LIKE '%SS%' AND obs_mode NOT LIKE '%BRIGHT%')"; 663 663 $query .= " AND rawExp.comment like '%visit%'"; 664 664 $query .= " AND (camProcessedExp.quality IS NULL or camProcessedExp.quality = 0)"; … … 694 694 $query .= " WHERE dateobs like '$date%'"; 695 695 $query .= " AND exp_id > $refExpID"; #REF 696 $query .= " AND obs_mode like '%SS%'";696 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 697 697 $query .= " AND (camProcessedExp.quality = 0)"; 698 $query .= " AND (comment NOT LIKE '%twilight%')"; 698 699 $query .= " ) AS expall"; 699 700 $query .= " LEFT JOIN"; … … 709 710 $query .= " JOIN chipRun using (chip_id)"; 710 711 $query .= " JOIN rawExp using (exp_id)"; 711 $query .= " WHERE diffRun.reduction like 'SWEETSPOT'";712 $query .= " WHERE stack2 IS NULL"; 712 713 ## $query .= " AND exp_id > $refExpID"; -- adding this restriction here slows the query way down1 713 714 $query .= " AND stack2 IS NULL"; … … 724 725 while (@row = $result->fetchrow_array()) { 725 726 if ($doHeader) { 726 print "Unpublished Solar System Exposures ( obs_mode like %SS%) with good camera quality :\n";727 print "Unpublished Solar System Exposures WW diffs (obs_mode like %SS% or obs_mode like %BRIGHT%) with good camera quality :\n"; 727 728 printf "%12s %12s %12s | %-19s | %-16s\n", "exp_name", "warp_id", "diff_id", "dateobs", "comment"; 728 729 $doHeader = 0; … … 751 752 $query .= " AND exp_type = 'OBJECT'"; 752 753 $query .= " AND obs_mode NOT LIKE 'ENGINEERING'"; 753 $query .= " AND obs_mode like '%SS%'";754 $query .= " AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 754 755 $query .= " AND rawExp.comment like '%visit%'"; 755 756 $query .= " AND (camProcessedExp.quality IS NULL or camProcessedExp.quality = 0)"; … … 770 771 print "Current status of SS and Euclid chunks:\n"; 771 772 772 # This is a long query, but it efficiently gathers all the necessary information773 my $query = "SELECT groupchunk.chunk,groupchunk.Nquad_firstvisit,group4.Nquad_fourvisits ,groupdiff.NdiffsFROM";773 #First find the number of chunks and their names 774 my $query = "SELECT groupchunk.chunk,groupchunk.Nquad_firstvisit,group4.Nquad_fourvisits FROM"; 774 775 $query .= " ("; 775 $query .= " SELECT dateobs,comment,substr(comment, 1, position(' ' in comment)) AS chunk,count( *) AS Nquad_firstvisit";776 $query .= " SELECT dateobs,comment,substr(comment, 1, position(' ' in comment)) AS chunk,count(distinct(comment)) AS Nquad_firstvisit"; 776 777 $query .= " FROM rawExp"; 777 778 $query .= " WHERE dateobs LIKE '$date%'"; … … 783 784 $query .= " ("; 784 785 $query .= " SELECT groupobj.chunk,count(*) AS Nquad_fourvisits FROM "; 785 $query .= " (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count( *) AS Nvisits";786 $query .= " (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count(distinct(comment)) AS Nvisits"; 786 787 $query .= " FROM rawExp"; 787 788 $query .= " WHERE dateobs LIKE '$date%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; … … 793 794 $query .= " ) AS group4"; 794 795 $query .= " on groupchunk.chunk=group4.chunk"; 795 $query .= " LEFT JOIN"; 796 $query .= " ("; 797 $query .= " SELECT substr(expall.comment, 1, position(' ' in expall.comment)) AS chunk,count(*) AS Ndiffs FROM "; 798 $query .= " (SELECT exp_name,comment,dateobs"; 799 $query .= " FROM rawExp "; 800 $query .= " WHERE dateobs LIKE '$date%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING'"; 801 $query .= " ) AS expall "; 802 $query .= " LEFT JOIN"; 803 $query .= " (SELECT * FROM "; 804 $query .= " ("; 805 $query .= " (SELECT exp_name FROM "; 806 $query .= " diffRun JOIN diffInputSkyfile USING (diff_id) JOIN publishRun ON (diff_id = stage_id) JOIN warpRun ON (warp1=warp_id)"; 807 $query .= " 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)"; 808 $query .= " WHERE rawExp.dateobs LIKE '$date%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 809 $query .= " AND stack2 IS NULL AND diffRun.diff_id=stage_id"; 810 $query .= " ) "; 811 $query .= " UNION "; 812 $query .= " (SELECT exp_name FROM"; 813 $query .= " diffRun JOIN diffInputSkyfile USING (diff_id) JOIN publishRun ON (diff_id = stage_id) JOIN warpRun ON (warp2=warp_id)"; 814 $query .= " 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)"; 815 $query .= " WHERE rawExp.dateobs LIKE '$date%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 816 $query .= " AND stack2 IS NULL AND diffRun.diff_id=stage_id"; 817 $query .= " )"; 818 $query .= " ) AS diffgather "; 819 $query .= " GROUP BY diffgather.exp_name"; 820 $query .= " ) AS exppub"; 821 $query .= " ON expall.exp_name=exppub.exp_name"; 822 $query .= " WHERE exppub.exp_name=expall.exp_name"; 823 $query .= " GROUP BY chunk "; 824 $query .= " ) AS groupdiff"; 825 $query .= " ON groupchunk.chunk=groupdiff.chunk"; 826 796 827 797 my $result = &mysql_select ($query); 828 798 829 799 printf "%18s | %18s | %18s | %18s |\n", "chunk", "Nquad_firstvisit", "Nquad_fourvisits", "Ndiffs done"; 830 800 while (@row = $result->fetchrow_array()) { 831 if ($row[1] ne $row[2]) { 832 if ($row[3] ne ($row[1]*4)) {printf "%18s | %18s | %18s | %14s%4s | %18s\n", $row[0], $row[1], $row[2], $row[3], "/? ", "chunk not finished";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 833 if ($row[3] eq ($row[1]*4)) {printf "%18s | %18s | %18s | %14s%4s | %18s\n", $row[0], $row[1], $row[2], $row[3], "/? ", "chunk done";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 801 my $chunkname = $row[0]; 802 my $Nfirstvisits = $row[1]; 803 my $Nfourvisits = $row[2]; 804 805 my $query2 .= " SELECT warp_id FROM "; 806 $query2 .= " warpRun 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)"; 807 $query2 .= " WHERE rawExp.dateobs LIKE '$date%' AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')"; 808 $query2 .= " AND substr(comment, 1, position(' ' in comment)) LIKE '$chunkname%'"; 809 my $result2 = &mysql_select ($query2); 810 811 my $Ndiffs = 0; 812 while (@row2 = $result2->fetchrow_array()) { 813 my $query3 .= " SELECT diff_id FROM "; 814 $query3 .= " diffRun JOIN diffInputSkyfile USING (diff_id) JOIN publishRun ON (diff_id = stage_id) JOIN warpRun ON (warp1=warp_id)"; 815 $query3 .= " WHERE stack2 IS NULL AND warp_id='$row2[0]' GROUP BY diff_id"; 816 my $result3 = &mysql_select ($query3); 817 while (@row3 = $result3->fetchrow_array()) {if ($row3[0] !=0) {$Ndiffs ++;}} 818 819 my $query3 .= " SELECT diff_id FROM "; 820 $query3 .= " diffRun JOIN diffInputSkyfile USING (diff_id) JOIN publishRun ON (diff_id = stage_id) JOIN warpRun ON (warp2=warp_id)"; 821 $query3 .= " WHERE stack2 IS NULL AND warp_id='$row2[0]' GROUP BY diff_id"; 822 my $result3 = &mysql_select ($query3); 823 while (@row3 = $result3->fetchrow_array()) {if ($row3[0] !=0) {$Ndiffs ++;}} 834 824 } 835 if ($row[1] eq $row[2]) { 836 if ($row[3] ne ($row[1]*4)) {printf "%18s | %18s | %18s | %14s%1s%3s | %18s\n", $row[0], $row[1], $row[2], $row[3],"/",$row[1]*4, "chunk not finished";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 837 if ($row[3] eq ($row[1]*4)) {printf "%18s | %18s | %18s | %14s%1s%3s | %18s\n", $row[0], $row[1], $row[2], $row[3],"/",$row[1]*4, "chunk done";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 825 826 if ($Nfirstvisits ne $Nfourvisits) { 827 if ($Ndiffs ne ($Nfirstvisits*4)) {printf "%18s | %18s | %18s | %14s%4s | %18s\n", $chunkname, $Nfirstvisits, $Nfourvisits, $Ndiffs, "/? ", "chunk not finished";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 828 if ($Ndiffs eq ($Nfirstvisits*4)) {printf "%18s | %18s | %18s | %14s%4s | %18s\n", $chunkname, $Nfirstvisits, $Nfourvisits, $Ndiffs, "/? ", "chunk done";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 829 } 830 if ($Nfirstvisits eq $Nfourvisits) { 831 if ($Ndiffs ne ($Nfirstvisits*4)) {printf "%18s | %18s | %18s | %14s%1s%3s | %18s\n", $chunkname, $Nfirstvisits, $Nfourvisits, $Ndiffs,"/",$Nfirstvisits*4, "chunk not finished";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 832 if ($Ndiffs eq ($Nfirstvisits*4)) {printf "%18s | %18s | %18s | %14s%1s%3s | %18s\n", $chunkname, $Nfirstvisits, $Nfourvisits, $Ndiffs,"/",$Nfirstvisits*4, "chunk done";} # chunk Nquad_firstvisit Nquad_fourvisits Ndiffs 838 833 } 839 834 }
Note:
See TracChangeset
for help on using the changeset viewer.
