IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 25, 2009, 2:00:56 PM (17 years ago)
Author:
eugene
Message:

merging changes from head

Location:
branches/eam_branches/20090522
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090522

  • branches/eam_branches/20090522/ippScripts/scripts/ipp_serial_mops.pl

    r24193 r24557  
    1919# Look for programs we need
    2020my $missing_tools;
    21 my $mops = can_run('ipp_mops_translate.pl') or (warn "Can't find ipp_mops_translate.pl" and $missing_tools = 1);
     21my $ppmops = can_run('ppMops') or (warn "Can't find ppMops" and $missing_tools = 1);
    2222my $dsreg = can_run('dsreg') or (warn "Can't find dsreg" and $missing_tools = 1);
    2323die "Can't find required tools.\n" if $missing_tools;
     
    7272    die "Unable to connect to database: $DBI::errstr";
    7373
    74 my $where_label = defined $label ? "AND label = '$label'" : ""; # WHERE for label
     74my $where_label = defined $label ? "AND diffRun.label = '$label'" : ""; # WHERE for label
    7575
    7676my $sql = "
    7777-- Get a list of exposures on which magic may be performed
    7878SELECT
    79     exp_id,
     79    rawExp.exp_id,
    8080    MAX(diffWarps.diff_id) AS diff_id,
    81     -- The following trick pulls out the 'inverse' value for the maximum diff_id
     81    -- The following trick pulls out the appropriate values for the maximum diff_id
     82    SUBSTRING_INDEX(GROUP_CONCAT(camProcessedTemplate.zpt_obs ORDER BY diffWarps.diff_id), ',', 1) AS zpt_obs,
     83    SUBSTRING_INDEX(GROUP_CONCAT(rawTemplate.exp_time ORDER BY diffWarps.diff_id), ',', 1) AS exp_time,
    8284    CONVERT(SUBSTRING_INDEX(GROUP_CONCAT(diffWarps.inverse ORDER BY diffWarps.diff_id), ',', 1), UNSIGNED) AS inverse
    8385FROM (
     
    8688        diffRun.diff_id,
    8789        warp1 AS warp_id,
     90        warp1 AS template_warp,
    8891        0 AS inverse
    8992    FROM diffRun
     
    98101        diffRun.diff_id,
    99102        warp2 AS warp_id,
     103        warp1 AS template_warp,
    100104        1 AS inverse
    101105    FROM diffRun
     
    112116JOIN chipRun USING(chip_id)
    113117JOIN rawExp USING(exp_id)
     118JOIN warpRun AS warpTemplate ON warpTemplate.warp_id = diffWarps.template_warp
     119JOIN fakeRun AS fakeTemplate ON fakeTemplate.fake_id = warpTemplate.fake_id
     120JOIN camRun AS camTemplate ON camTemplate.cam_id = fakeTemplate.cam_id
     121JOIN camProcessedExp AS camProcessedTemplate ON camProcessedTemplate.cam_id = camTemplate.cam_id
     122JOIN chipRun AS chipTemplate ON chipTemplate.chip_id = camTemplate.chip_id
     123JOIN rawExp AS rawTemplate ON rawTemplate.exp_id = chipTemplate.exp_id
    114124WHERE rawExp.camera = '$camera'
    115125GROUP BY exp_id;";
     
    125135foreach my $diff ( @$diffs ) {
    126136    my $exp_id = $diff->{exp_id};
     137    my $zp = $diff->{zpt_obs};
     138    my $exp_time = $diff->{exp_time};
    127139    my $diff_id = $diff->{diff_id};
    128140    my $inverse = $diff->{inverse};
     141
     142    (carp "Bad ZP or EXPTIME for $exp_id" and next) if not defined $zp or not defined $exp_time;
     143    $zp += 2.5 * log($exp_time) / log(10);
    129144
    130145    my $sql = "SELECT * FROM diffSkyfile WHERE diff_id = $diff_id AND fault = 0 AND quality = 0;";
     
    146161        unless ($no_op) {
    147162            $ipprc->file_prepare($output);
    148             my $command = "$mops --input $input --extname SkyChip.psf --output $output";
     163            my $command = "$ppmops $input $zp $output";
    149164            my $success = run( command => $command, verbose => $verbose );
    150165            (carp "Couldn't translate $input\n" and next) unless $success;
Note: See TracChangeset for help on using the changeset viewer.