IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 28, 2010, 8:26:37 AM (16 years ago)
Author:
eugene
Message:

staticsky tools, tasks, and script all working at the basic level

File:
1 edited

Legend:

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

    r28096 r28154  
    3838}
    3939
    40 my ($sky_id, $camera, $dbname, $threads, $outroot, $reduction, $inverse, $run_state, $verbose, $no_update, $no_op, $redirect, $save_temps);
     40# XXX test:
     41print "run staticsky.pl @ARGV\n";
     42# exit 0;
     43
     44my ($sky_id, $camera, $dbname, $threads, $outroot, $reduction, $verbose, $no_update, $no_op, $redirect, $save_temps);
    4145GetOptions(
    4246    'sky_id=s'          => \$sky_id, # Diff identifier
     
    4448    'dbname|d=s'        => \$dbname, # Database name
    4549    'threads=s'         => \$threads,   # Number of threads to use
    46     'run-state=s'       => \$run_state,   # state for run: 'new' or 'update'
    4750    'outroot=s'         => \$outroot, # Output root name
    4851    'reduction=s'       => \$reduction, # Reduction class
     
    5659pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    5760pod2usage(
    58     -msg => "Required options: --sky_id --outroot --camera (--run_state)",
     61    -msg => "Required options: --sky_id --outroot --camera",
    5962    -exitval => 3,
    6063          ) unless
     
    6265    defined $outroot and
    6366    defined $camera;
    64 #   and defined $run_state;
    6567
    6668my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $sky_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    6769
    6870my $logDest = $ipprc->filename("LOG.EXP", $outroot);
    69 # $logDest .= ".update" if $run_state eq "update";
    7071$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $sky_id, $PS_EXIT_SYS_ERROR ) if $redirect;
    7172
     
    8586    unless ($success) {
    8687        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    87         &my_die("Unable to perform difftool -inputskyfile: $error_code", $sky_id, $error_code);
     88        &my_die("Unable to perform staticskytool -inputs: $error_code", $sky_id, $error_code);
    8889    }
    8990
     
    152153print "recipe_psphot: $recipe_psphot\n";
    153154
    154 my $cmdflags;
    155 
    156 # Perform subtraction
     155# my $cmdflags;
     156
     157# Perform stack photometry analysis
    157158{
    158159    my $command = "$psphotStack $outroot";
     
    167168
    168169    unless ($no_op) {
    169         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    170             run(command => $command, verbose => $verbose);
    171         unless ($success) {
    172             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    173             &my_die("Unable to perform ppSub: $error_code", $sky_id, $error_code);
    174         }
     170        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
     171        unless ($success) {
     172            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     173            &my_die("Unable to perform psphotStack: $error_code", $sky_id, $error_code);
     174        }
    175175
    176176        # my $outputStatsReal = $ipprc->file_resolve($outputStats);
     
    190190        # chomp $cmdflags;
    191191
    192         my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
    193 
     192        # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
     193
     194        my $quality = 0;
    194195        if (!$quality) {
    195196
     
    197198            # we have one set of output files per input file set
    198199            for (my $i = 0; $i < @$files; $i++) {
    199                 my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot);
    200                 my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot);
    201                 my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot);
    202                 my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot);
     200                my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i);
     201                my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i);
     202                my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i);
     203                my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i);
    203204
    204205                &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
     
    211212            #my $outputStats    = $ipprc->filename("SKYCELL.STATS", $outroot);
    212213            #my $traceDest      = $ipprc->filename("TRACE.EXP", $outroot);
    213 
    214             # if ($run_state eq 'update') {
    215             #   $traceDest .= '.update';
    216             #   $outputStats .= '.update';
    217             # }
    218214
    219215            my $chisqName     = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot);
     
    235231    {
    236232        my $command = "$staticskytool -sky_id $sky_id";
    237         # if ($run_state eq 'new') {
    238233        $command .= " -addresult -path_base $outroot";
    239234        $command .= " -num_inputs $nInputs";
    240         $command .= " $cmdflags";
     235        # $command .= " $cmdflags";
    241236        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    242237        $command .= " -hostname $host" if defined $host;
    243         # } else {
    244         #     $command .= " -tofullskyfile";
    245         # }
    246238        $command .= " -dbname $dbname" if defined $dbname;
    247239
     
    250242        unless ($success) {
    251243            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    252             my $err_message = $run_state eq "update" ?
    253                 "Unable to perform difftool -adddiffskyfile" :
    254                 "Unable to perform difftool -tofullskyfile";
    255             &my_die("$err_message: $error_code", $sky_id, $error_code);
     244            my $err_message = "Unable to perform staticskytool -addresult";
     245            warn($err_message);
     246            exit $error_code;
    256247        }
    257248    }
     
    270261    if (defined $sky_id and not $no_update) {
    271262        my $command = "$staticskytool -sky_id $sky_id -fault $exit_code";
    272         if ($run_state eq 'new') {
    273             $command .= " -adddiffskyfile";
    274             $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    275             $command .= " -hostname $host" if defined $host;
    276             $command .= " -path_base $outroot" if defined $outroot;
    277             $command .= " -dbname $dbname" if defined $dbname;
    278         } else {
    279             $command .= " -updatediffskyfile";
    280         }
     263        $command .= " -addresult";
     264        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
     265        $command .= " -hostname $host" if defined $host;
     266        $command .= " -path_base $outroot" if defined $outroot;
     267        $command .= " -dbname $dbname" if defined $dbname;
    281268        run(command => $command, verbose => $verbose);
    282269    }
Note: See TracChangeset for help on using the changeset viewer.