IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16728


Ignore:
Timestamp:
Feb 28, 2008, 2:59:18 PM (18 years ago)
Author:
Paul Price
Message:

Moving to a model where the outroot is provided to the script, rather
than a working directory. This means that the skycell has to be
generated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/warp_skycell.pl

    r16723 r16728  
    3333                       caturi
    3434                       );
    35 use PS::IPP::Operations qw( skycell_file );
    3635
    3736my $ipprc = PS::IPP::Config->new(); # IPP configuration
    3837
    39 my ($warp_id, $skycell_id, $tess_id, $camera, $dbname, $workdir, $verbose, $no_update, $no_op, $save_temps);
     38my ($warp_id, $skycell_id, $tess_id, $camera, $dbname, $outroot, $verbose, $no_update, $no_op, $save_temps);
    4039GetOptions(
    4140    'warp_id|i=s'       => \$warp_id, # Warp identifier
     
    4443    'camera|c=s'        => \$camera, # Camera name
    4544    'dbname|d=s'        => \$dbname, # Database name
    46     'workdir|w=s'       => \$workdir, # Working directory, for output files
     45    'outroot=s'         => \$outroot, # Output root name
    4746    'verbose'           => \$verbose,   # Print to stdout
    4847    'no-update'         => \$no_update, # Don't update the database?
     
    116115}
    117116
    118 my $skyFile = skycell_file($tess_id, $skycell_id, $workdir) or
    119     &my_die("Unable to get name of skycell file", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR);
    120 &my_die("Unable to find skycell file: $skyFile", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless
    121     $ipprc->file_exists( $skyFile );
    122 
    123 $workdir = caturi( $workdir, "tess_" . $tess_id, "sky_" . $skycell_id ) if defined $workdir;
    124 my $outputRoot = $ipprc->file_prepare( "$tess_id.$skycell_id.wrp$warp_id", $workdir, $$imfiles[0]->{uri} );
    125 my $outputImage = $ipprc->filename("PSWARP.OUTPUT", $outputRoot, $skycell_id );
    126 my $outputMask = $ipprc->filename("PSWARP.OUTPUT.MASK", $outputRoot, $skycell_id);
    127 my $outputWeight = $ipprc->filename("PSWARP.OUTPUT.WEIGHT", $outputRoot, $skycell_id);
    128 my $outputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $outputRoot, $skycell_id);
    129 my $outputPSF = $ipprc->filename("PSPHOT.PSF.SAVE", $outputRoot, $skycell_id);
    130 my $outputBin1 = $ipprc->filename("PSWARP.BIN1", $outputRoot, $skycell_id );
    131 my $outputBin2 = $ipprc->filename("PSWARP.BIN2", $outputRoot, $skycell_id );
    132 my $outputStats = $outputRoot . '.stats';
    133 
    134 my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".trace"; # Trace messages
    135 my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".log"; # Log messages
     117my $outputImage = $ipprc->filename("PSWARP.OUTPUT", $outroot, $skycell_id );
     118my $outputMask = $ipprc->filename("PSWARP.OUTPUT.MASK", $outroot, $skycell_id);
     119my $outputWeight = $ipprc->filename("PSWARP.OUTPUT.WEIGHT", $outroot, $skycell_id);
     120my $outputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $outroot, $skycell_id);
     121my $outputPSF = $ipprc->filename("PSPHOT.PSF.SAVE", $outroot, $skycell_id);
     122my $outputBin1 = $ipprc->filename("PSWARP.BIN1", $outroot, $skycell_id );
     123my $outputBin2 = $ipprc->filename("PSWARP.BIN2", $outroot, $skycell_id );
     124my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot, $skycell_id );
     125my $traceDest = $ipprc->filename("TRACE.EXP", $outroot, $skycell_id);
     126my $logDest = $ipprc->filename("TRACE.IMFILE", $outroot, $skycell_id);
     127
     128my $skyFile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id );
     129$ipprc->skycell_file( $tess_id, $skycell_id, $skyFile, $verbose ) or &my_die("Unable to generate template skycell", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR);
    136130
    137131# Get list of filenames
    138 my ($imageFile,  $imageName)  = tempfile( "$tess_id.$skycell_id.wrp$warp_id.image.list.XXXX",  UNLINK => !$save_temps);
    139 my ($maskFile,   $maskName)   = tempfile( "$tess_id.$skycell_id.wrp$warp_id.mask.list.XXXX",   UNLINK => !$save_temps);
    140 my ($weightFile, $weightName) = tempfile( "$tess_id.$skycell_id.wrp$warp_id.weight.list.XXXX", UNLINK => !$save_temps);
    141 my ($astromFile, $astromName) = tempfile( "$tess_id.$skycell_id.wrp$warp_id.astrom.list.XXXX", UNLINK => !$save_temps);
    142 
    143 # XXXX this is inconsistent: what is the goal of inputAstrom?
    144 my $inputAstrom = 0;
     132my ($imageFile,  $imageName)  = tempfile( caturi($outroot, "$tess_id.$skycell_id.wrp$warp_id.image.list.XXXX"),  UNLINK => !$save_temps);
     133my ($maskFile,   $maskName)   = tempfile( caturi($outroot, "$tess_id.$skycell_id.wrp$warp_id.mask.list.XXXX"),   UNLINK => !$save_temps);
     134my ($weightFile, $weightName) = tempfile( caturi($outroot, "$tess_id.$skycell_id.wrp$warp_id.weight.list.XXXX"), UNLINK => !$save_temps);
     135my ($astromFile, $astromName) = tempfile( caturi($outroot, "$tess_id.$skycell_id.wrp$warp_id.astrom.list.XXXX"), UNLINK => !$save_temps);
     136
    145137foreach my $imfile (@$imfiles) {
    146138    my $image = $imfile->{uri}; # Image name
     
    154146    if ($astromSource eq 'PSASTRO.OUTPUT.MEF') {
    155147        $astrom = $ipprc->filename($astromSource, $imfile->{cam_path_base});
    156         &my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($astrom);
    157         $inputAstrom = 1;
    158     }
    159     if ($astromSource eq 'PSASTRO.OUTPUT') {
     148    } elsif ($astromSource eq 'PSASTRO.OUTPUT') {
    160149        my $chipRoot = $imfile->{chip_path_base};
    161150        my $classID = $imfile->{class_id};
    162151        $astrom = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file
    163         $inputAstrom = 1;
    164     }
    165 
    166     if ($inputAstrom) {
    167         print $imageFile  "$image\n";
    168         print $maskFile   "$mask\n";
    169         print $weightFile "$weight\n";
    170         print $astromFile "$astrom\n";
    171     }
     152    }
     153
     154    &my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless defined $astrom and $ipprc->file_exists($astrom);
     155   
     156    print $imageFile  "$image\n";
     157    print $maskFile   "$mask\n";
     158    print $weightFile "$weight\n";
     159    print $astromFile "$astrom\n";
    172160}
    173161close $imageFile;
     
    175163close $weightFile;
    176164close $astromFile;
     165
    177166
    178167# Run pswarp
     
    183172    $command .= " -masklist $maskName";
    184173    $command .= " -weightlist $weightName";
    185     $command .= " -astromlist $astromName" if $inputAstrom;
    186     $command .= " $outputRoot $skyFile";
     174    $command .= " -astromlist $astromName";
     175    $command .= " $outroot $skyFile";
    187176    $command .= " -stats $outputStats";
    188177    $command .= " -recipe PPSTATS WARPSTATS";
     
    225214    my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id";
    226215    $command .= " -ignore" if not $accept; # Completed succesfully, but can't produce product
    227     $command .= " -uri $outputImage -path_base $outputRoot" if $accept;
     216    $command .= " -uri $outputImage -path_base $outroot" if $accept;
    228217    $command .= $stats->cmdflags() if $accept;
    229218    $command .= " -dbname $dbname" if defined $dbname;
Note: See TracChangeset for help on using the changeset viewer.