IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 7, 2009, 4:08:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging trunk (r25026) to get up-to-date on old branch.

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/ippScripts/scripts/magic_process.pl

    r23908 r25027  
    136136        }
    137137
    138         $command .= " --detect --image $image --mask $mask --weight $weight";
    139 
    140         # set threshold to 4 sigma
    141         $command .= ' -t 4';
    142 
    143         # add -S
     138        my $template = resolve_template($innode);
     139        &my_die("failed to resolve template", $magic_id, $node, $PS_EXIT_DATA_ERROR)
     140            unless defined $template;
     141
     142        $command .= " --detect --image $image --mask $mask --weight $weight -k $template";
     143
     144        # XXX: get all of these parameters from a recipe
     145
     146        # set threshold to 2.3 sigma (Default specified by Paul Sydney)
     147        $command .= ' -t 2.3';
     148
     149        # set threshold to 2.75 sigma (Test by EAM : uncorrelated noise is typically ~20% higher than expected)
     150        # XXX we have fixed the output variance to address this
     151        # $command .= ' -t 2.75';
     152
     153        # set threshold to 4 sigma (for testing)
     154        # $command .= ' -t 4';
     155
     156        # set Minimum percent visible required between pixels clusters in a valid streak [0.0 - 1.0]
     157        # default is 0.2
     158        $command .= ' -P 0.2';
     159
     160        #$command .= ' -t 4' . ' -P 0.25';
     161
     162        # add -S "Number of pixels to shift for determining maximum differences in mean images default:8"
    144163        $command .= ' -S';
     164
     165        # add 3 x 3 binning
     166        $command .= ' -b 3';
    145167
    146168        # create the list of inputs used at this stage. At higher levels the
     
    183205            foreach my $innode (@$inputs) {
    184206                # root for inputs from previous stage
    185                 my $in_uri = $innode->{uri};
    186                 print $sfh "$in_uri\n";
    187 
    188                 cat_list_to_list($in_fh, $in_uri, "input.list");
     207                my $in_path_base = $innode->{magic_path_base};
     208                print $sfh "$in_path_base\n";
     209
     210                cat_list_to_list($in_fh, $in_path_base, "input.list");
    189211                # build input lists by combining the lists from
    190212                # previous stages
    191                 cat_list_to_list($ifh, $in_uri, "image.list");
    192                 cat_list_to_list($mfh, $in_uri, "mask.list");
    193                 cat_list_to_list($wfh, $in_uri, "weight.list");
     213                cat_list_to_list($ifh, $in_path_base, "image.list");
     214                cat_list_to_list($mfh, $in_path_base, "mask.list");
     215                cat_list_to_list($wfh, $in_path_base, "weight.list");
    194216            }
    195217            close $in_fh;
     
    202224            $command .= " --images $image_list --masks $mask_list --weights $weight_list" ;
    203225            $command .= " --inputstreaks $streaks_list";
     226            # new option to "merge duplicate streaks into unique streaks"
     227            $command .= " --duplicates";
    204228        };
    205229        if ($@) {
     
    235259    $command   .= " -magic_id $magic_id";
    236260    $command   .= " -node $node";
    237     $command   .= " -uri $outroot";
     261    $command   .= " -path_base $outroot";
    238262    $command   .= " -dbname $dbname" if defined $dbname;
    239263
     
    254278    my $resolved = $ipprc->file_resolve($streaks_file);
    255279
    256     my $fh;
    257     open $fh, "<$resolved" or
    258         &my_die("failed to open streaks file $streaks_file", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR);
    259     # the first line in the streaks file contains the number of streaks found
    260     my $num_streaks = <$fh>;
    261     chomp $num_streaks;
    262     close $fh;
    263     print "$num_streaks streaks found on magicRun $magic_id\n" if $verbose;
     280    my $num_streaks = -1;
     281    unless ($no_op) {
     282        my $fh;
     283        open $fh, "<$resolved" or
     284            &my_die("failed to open streaks file $streaks_file", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR);
     285        # the first line in the streaks file contains the number of streaks found
     286        $num_streaks = <$fh>;
     287        chomp $num_streaks;
     288        close $fh;
     289        print "$num_streaks streaks found on magicRun $magic_id\n" if $verbose;
     290    }
    264291
    265292    my $command = "$magictool -addmask";
     
    301328sub cat_list_to_list   {
    302329    my $out = shift;        # output file handle
    303     my $uri = shift;        # uri to append ...
     330    my $path_base = shift;  # path_base to append ...
    304331    my $extension = shift;  # ... the extension to
    305332
    306     my $filename = "$uri.$extension";
     333    my $filename = "$path_base.$extension";
    307334
    308335    my $in;
     
    313340}
    314341
    315 sub resolve_inputs {
    316 
     342sub resolve_inputs
     343{
    317344    my $node = shift;
    318     my $input_base = $node->{path_base};
    319 
    320     my $image = $ipprc->file_resolve($ipprc->filename("PPSUB.OUTPUT", $input_base));
    321     my $mask = $ipprc->file_resolve($ipprc->filename("PPSUB.OUTPUT.MASK", $input_base));
    322     my $weight= $ipprc->file_resolve($ipprc->filename("PPSUB.OUTPUT.VARIANCE", $input_base));
    323 
    324     return ($image, $mask, $weight);
     345    my $input_base = $node->{diff_path_base};
     346
     347    my ($image, $mask, $variance); # Names to return
     348    if ($node->{inverse}) {
     349        $image = "PPSUB.INVERSE";
     350        $mask = "PPSUB.INVERSE.MASK";
     351        $variance = "PPSUB.INVERSE.VARIANCE";
     352    } else {
     353        $image = "PPSUB.OUTPUT";
     354        $mask = "PPSUB.OUTPUT.MASK";
     355        $variance = "PPSUB.OUTPUT.VARIANCE";
     356    }
     357
     358    $image = $ipprc->file_resolve($ipprc->filename($image, $input_base));
     359    $mask = $ipprc->file_resolve($ipprc->filename($mask, $input_base));
     360    $variance= $ipprc->file_resolve($ipprc->filename($variance, $input_base));
     361
     362    return ($image, $mask, $variance);
     363}
     364
     365sub resolve_template
     366{
     367    my $node = shift;
     368
     369    my $path_base = $node->{diff_path_base}; # Base name for name
     370    my $image = $node->{inverse} ? "PPSUB.INPUT.CONV" : "PPSUB.REF.CONV"; # File rule of interest
     371
     372    $image = $ipprc->file_resolve($ipprc->filename($image, $path_base));
     373
     374    return $image
    325375}
    326376
Note: See TracChangeset for help on using the changeset viewer.