IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31512


Ignore:
Timestamp:
May 10, 2011, 1:52:17 PM (15 years ago)
Author:
watersc1
Message:

Update laptool_definerun to not attempt to define two rows for the same exp_id. Speed up laptool_exposures, as well as add better quality handling for lap_science.pl

Location:
tags/ipp-20110505
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20110505/ippScripts/scripts/lap_science.pl

    r31499 r31512  
    474474            $exposure = remake_this_exposure($exposure);
    475475        }
    476         if ($exposure->{cam_quality}) {
    477             $needs_qstack = 1;
    478             $needs_something_private = 1;
    479             if ($companion) {
    480                 $companion->{private} = 1;
    481                 $companion->{pairwise} = 0;
    482                 &update_this_exposure($companion);
     476        # Do quality checks here
     477        if ((($exposure->{chipRun_state} eq 'full')&&($exposure->{chip_bad_quality} / $exposure->{chip_component_count} > 0.05)) ||
     478            (($exposure->{camRun_state} eq 'full')&&($exposure->{cam_bad_quality} / $exposure->{cam_component_count} > 0)) ||
     479            (($exposure->{warpRun_state} eq 'full')&&($exposure->{warp_bad_quality} / $exposure->{warp_component_count} > 0.2)) ||
     480            (($exposure->{diffRun_state} eq 'full')&&($exposure->{diff_bad_quality} / $exposure->{diff_component_count} > 0.5)))  {
     481            printf( "QUALITY: $exposure->{exp_id} has bad quality fractions: chip: %d/%d cam: %d/%d warp: %d/%d diff: %d/%d\n",
     482                    $exposure->{chip_bad_quality} , $exposure->{chip_component_count},
     483                    $exposure->{cam_bad_quality} , $exposure->{cam_component_count},
     484                    $exposure->{warp_bad_quality} , $exposure->{warp_component_count},
     485                    $exposure->{diff_bad_quality} , $exposure->{diff_component_count});
     486
     487            unless ($exposure->{diffRun_state} eq 'full') {
     488                $needs_qstack = 1;
     489                $needs_something_private = 1;
     490                if ($companion) {
     491                    $companion->{private} = 1;
     492                    $companion->{pairwise} = 0;
     493                    &update_this_exposure($companion);
     494                }
     495                $exposure->{private} = 1;
     496                $exposure->{pairwise} = 0;
    483497            }
    484             $exposure->{private} = 1;
    485             $exposure->{pairwise} = 0;
    486498            $exposure->{data_state} = 'drop';
    487499            &update_this_exposure($exposure);
    488500
    489501        }
    490 #       if ($companion) { # Validate that there are no problems with the companion exposure
    491 #           if ($companion->{cam_quality}) { # Maybe other things here?
    492 #               $exposure->{private} = 1;
    493 #               $exposure->{data_state} = 'drop';
    494 #               &update_this_exposure($exposure);
    495 #               $needs_qstack = 1;
    496 #           }
    497 #       }
     502
    498503        if  ($exposure->{data_state} eq 'drop') { # This exposure is impossible, so fudge the counts so we get through.
    499504            $can_qstack ++;
  • tags/ipp-20110505/ippTools/share/laptool_definerun.sql

    r31474 r31512  
    88  ) AS want
    99  LEFT JOIN
    10   (SELECT *
     10  (SELECT exp_id,MAX(chip_id) AS chip_id
    1111     FROM lapExp
    1212     where private IS FALSE
  • tags/ipp-20110505/ippTools/share/laptool_exposures.sql

    r31435 r31512  
    1 SELECT DISTINCT
    2     D.*,diffRun.state,
    3     coalesce(CONVERT(sum(others.private),SIGNED),0) AS needs_remade
    4 --      0 AS needs_remade
    5     FROM (
    6   SELECT DISTINCT
    7       W.*,CONVERT(IFNULL(diff1.diff_id,diff2.diff_id),SIGNED) AS diff_id FROM (
    8     SELECT DISTINCT
    9         lap_id,lapRun.tess_id,projection_cell,filter,lapRun.state as lapRun_state, lapRun.registered, lapRun.fault, lapRun.label, lapRun.dist_group,
    10         lapExp.exp_id,lapExp.chip_id,lapExp.pair_id,private,pairwise,active,lapExp.data_state,
    11         chipRun.state as chipRun_state,
    12         coalesce(CONVERT(sum(chipProcessedImfile.fault),SIGNED),0) as chip_faults,
    13         coalesce(CONVERT(sum(chipProcessedImfile.quality),SIGNED),0) as chip_quality,
    14         camRun.cam_id, camRun.state as camRun_state,   
    15         coalesce(CONVERT(sum(camProcessedExp.fault),SIGNED),0) AS cam_faults,
    16         coalesce(CONVERT(sum(camProcessedExp.quality),SIGNED),0) AS cam_quality,
    17         fakeRun.fake_id, fakeRun.state as fakeRun_state,
    18         coalesce(CONVERT(sum(fakeProcessedImfile.fault),SIGNED),0) as fake_faults,
    19         warpRun.warp_id, warpRun.state as warpRun_state,
    20         coalesce(CONVERT(sum(warpSkyfile.fault),SIGNED),0) as warp_faults,
    21         coalesce(CONVERT(sum(warpSkyfile.quality),SIGNED),0) as warp_quality,
    22         warpRun.magicked
    23     FROM lapRun JOIN lapExp USING(lap_id)
    24     LEFT JOIN chipRun USING(chip_id)
    25     LEFT JOIN chipProcessedImfile USING(chip_id)
    26     LEFT JOIN camRun USING(chip_id) LEFT JOIN camProcessedExp USING(cam_id)
    27     LEFT JOIN fakeRun USING(cam_id) LEFT JOIN fakeProcessedImfile USING(fake_id)
    28     LEFT JOIN warpRun USING(fake_id) LEFT JOIN warpSkyfile USING(warp_id)
    29     WHERE    @WHERE@
    30     AND (warpSkyfile.quality IS NULL OR
    31          (warpSkyfile.quality != 8007      -- known cases where quality != 0, but everything's fine.
    32           AND warpSkyfile.quality != 3006  -- known cases where quality != 0, but everything's fine.
    33           ))
    34     GROUP BY lap_id,exp_id
    35     ) AS W
    36 -- This was unreasonably slow in testing, so that's why I'm using a subquery here.
    37   LEFT JOIN diffInputSkyfile AS diff1 ON (W.warp_id = diff1.warp1)
    38   LEFT JOIN diffInputSkyfile AS diff2 ON (W.warp_id = diff2.warp2)
    39 ) AS D
     1select DISTINCT V3.*,
     2       diffRun.diff_id,diffRun.state as diffRun_state,
     3       coalesce(CONVERT(sum(diffSkyfile.quality != 0),SIGNED),0) AS diff_bad_quality,
     4       coalesce(CONVERT(count(diffSkyfile.diff_id),SIGNED),0) AS diff_component_count
     5       FROM
     6( select V2.*,
     7       warpRun.warp_id,warpRun.state as warpRun_state,
     8       coalesce(CONVERT(sum(warpSkyfile.quality != 0),SIGNED),0) AS warp_bad_quality,
     9       coalesce(CONVERT(count(warpSkyfile.warp_id),SIGNED),0) AS warp_component_count,
     10       warpRun.magicked
     11       FROM
     12( select V1.*,
     13       camRun.cam_id,camRun.state as camRun_state,
     14       coalesce(CONVERT(sum(camProcessedExp.quality != 0),SIGNED),0) AS cam_bad_quality,
     15       coalesce(CONVERT(count(camProcessedExp.cam_id),SIGNED),0) AS cam_component_count,
     16       fakeRun.fake_id,fakeRun.state as fakeRun_state FROM
     17( SELECT DISTINCT
     18       lap_id,lapRun.tess_id,projection_cell,filter,lapRun.state as lapRun_state, lapRun.registered, lapRun.fault, lapRun.label, lapRun.dist_group,
     19       lapExp.exp_id,lapExp.chip_id,lapExp.pair_id,private,pairwise,active,lapExp.data_state,
     20       chipRun.state as chipRun_state,
     21       coalesce(CONVERT(sum(chipProcessedImfile.quality != 0),SIGNED),0) AS chip_bad_quality,
     22       coalesce(CONVERT(count(chipProcessedImfile.chip_id),SIGNED),0) AS chip_component_count
     23       FROM lapRun JOIN lapExp USING(lap_id)
     24       LEFT JOIN chipRun USING(chip_id) LEFT JOIN chipProcessedImfile USING(chip_id)
     25WHERE @WHERE@
     26       GROUP BY lap_id,exp_id
     27       ) AS V1
     28       LEFT JOIN camRun USING(chip_id) LEFT JOIN camProcessedExp USING(cam_id)
     29       LEFT JOIN fakeRun USING(cam_id)
     30       GROUP BY lap_id,exp_id
     31  ) AS V2
     32  LEFT JOIN warpRun USING(fake_id) LEFT JOIN warpSkyfile USING(warp_id)
     33  GROUP BY lap_id,exp_id
     34) AS V3
     35LEFT JOIN
     36  (SELECT DISTINCT diff_id,warp1,warp2 FROM diffInputSkyfile) AS DI ON
     37  (DI.warp1 = warp_id OR DI.warp2 = warp_id)
    4038LEFT JOIN diffRun USING(diff_id)
    41 LEFT JOIN lapExp AS others ON (D.chip_id = others.chip_id AND D.lap_id != others.lap_id)
     39LEFT JOIN diffSkyfile USING(diff_id)
    4240GROUP BY lap_id,exp_id
    4341
Note: See TracChangeset for help on using the changeset viewer.