IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 12, 2009, 4:07:48 PM (17 years ago)
Author:
Paul Price
Message:

Reworking magic (and some diff) to be ready for performing magic on warp-warp diffs. Several database changes to diff and magic tables because we can no longer assume that a diff is associated with a single exposure. Ready for testing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_magic/ippScripts/scripts/magic_process.pl

    r23966 r24149  
    3737
    3838# Parse the command-line arguments
    39 my ($magic_id, $node, $camera, $dbname, $outroot, $template_uri, $save_temps, $verbose, $no_update, $no_op, $logfile);
     39my ($magic_id, $node, $camera, $dbname, $outroot, $save_temps, $verbose, $no_update, $no_op, $logfile);
    4040
    4141GetOptions(
     
    4545           'dbname=s'        => \$dbname,     # Database name
    4646           'outroot=s'       => \$outroot,    # Output root name
    47            'template_uri=s'  => \$template_uri,# uri of diff template
    4847           'save-temps'      => \$save_temps, # Save temporary files?
    4948           'verbose'         => \$verbose,    # Print stuff?
     
    5958    defined $node and
    6059    defined $camera and
    61     defined $outroot and
    62     defined $template_uri;
     60    defined $outroot;
    6361
    6462my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $node, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     
    138136        }
    139137
    140         my $template = $ipprc->file_resolve($template_uri);
    141         &my_die("failed to resolve template_uri: $template_uri", $magic_id, $node, $PS_EXIT_DATA_ERROR)
    142             if !($template);
     138        my $template = resolve_template($innode);
     139        &my_die("failed to resolve template", $magic_id, $node, $PS_EXIT_DATA_ERROR)
     140            unless defined $template;
    143141
    144142        $command .= " --detect --image $image --mask $mask --weight $weight -k $template";
     
    189187            foreach my $innode (@$inputs) {
    190188                # root for inputs from previous stage
    191                 my $in_uri = $innode->{uri};
    192                 print $sfh "$in_uri\n";
    193 
    194                 cat_list_to_list($in_fh, $in_uri, "input.list");
     189                my $in_path_base = $innode->{magic_path_base};
     190                print $sfh "$in_path_base\n";
     191
     192                cat_list_to_list($in_fh, $in_path_base, "input.list");
    195193                # build input lists by combining the lists from
    196194                # previous stages
    197                 cat_list_to_list($ifh, $in_uri, "image.list");
    198                 cat_list_to_list($mfh, $in_uri, "mask.list");
    199                 cat_list_to_list($wfh, $in_uri, "weight.list");
     195                cat_list_to_list($ifh, $in_path_base, "image.list");
     196                cat_list_to_list($mfh, $in_path_base, "mask.list");
     197                cat_list_to_list($wfh, $in_path_base, "weight.list");
    200198            }
    201199            close $in_fh;
     
    241239    $command   .= " -magic_id $magic_id";
    242240    $command   .= " -node $node";
    243     $command   .= " -uri $outroot";
     241    $command   .= " -path_base $outroot";
    244242    $command   .= " -dbname $dbname" if defined $dbname;
    245243
     
    307305sub cat_list_to_list   {
    308306    my $out = shift;        # output file handle
    309     my $uri = shift;        # uri to append ...
     307    my $path_base = shift;  # path_base to append ...
    310308    my $extension = shift;  # ... the extension to
    311309
    312     my $filename = "$uri.$extension";
     310    my $filename = "$path_base.$extension";
    313311
    314312    my $in;
     
    319317}
    320318
    321 sub resolve_inputs {
    322 
     319sub resolve_inputs
     320{
    323321    my $node = shift;
    324     my $input_base = $node->{path_base};
    325 
    326     my $image = $ipprc->file_resolve($ipprc->filename("PPSUB.OUTPUT", $input_base));
    327     my $mask = $ipprc->file_resolve($ipprc->filename("PPSUB.OUTPUT.MASK", $input_base));
    328     my $weight= $ipprc->file_resolve($ipprc->filename("PPSUB.OUTPUT.VARIANCE", $input_base));
    329 
    330     return ($image, $mask, $weight);
     322    my $input_base = $node->{diff_path_base};
     323
     324    my ($image, $mask, $variance); # Names to return
     325    if ($node->{inverse}) {
     326        $image = "PPSUB.INVERSE";
     327        $mask = "PPSUB.INVERSE.MASK";
     328        $variance = "PPSUB.INVERSE.VARIANCE";
     329    } else {
     330        $image = "PPSUB.OUTPUT";
     331        $mask = "PPSUB.OUTPUT.MASK";
     332        $variance = "PPSUB.OUTPUT.VARIANCE";
     333    }
     334
     335    $image = $ipprc->file_resolve($ipprc->filename($image, $input_base));
     336    $mask = $ipprc->file_resolve($ipprc->filename($mask, $input_base));
     337    $variance= $ipprc->file_resolve($ipprc->filename($variance, $input_base));
     338
     339    return ($image, $mask, $variance);
     340}
     341
     342sub resolve_template
     343{
     344    my $node = shift;
     345
     346    my $image;                  # Name of template to return
     347    my $path_base;              # Base name for name
     348    if (defined $node->{warp_path_base} and $node->{warp_path_base} ne "NULL") {
     349        $path_base = $node->{warp_path_base};
     350        $image = "PSWARP.OUTPUT";
     351    } elsif (defined $node->{stack_path_base} and $node->{stack_path_base} ne "NULL") {
     352        $path_base = $node->{stack_path_base};
     353        $image = "PPSTACK.OUTPUT";
     354    } else {
     355        return undef;
     356    }
     357
     358    $image = $ipprc->file_resolve($ipprc->filename($image, $path_base));
     359
     360    return $image
    331361}
    332362
Note: See TracChangeset for help on using the changeset viewer.