IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38565 for trunk


Ignore:
Timestamp:
Jul 2, 2015, 9:42:32 AM (11 years ago)
Author:
bills
Message:

Add update mode for skycal stage. The only difference is to
not output the cff file.

File:
1 edited

Legend:

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

    r38115 r38565  
    6262
    6363my ($skycal_id, $stack_id, $camera, $dbname, $threads, $outroot, $path_base, $filter, $singlefilter, $reduction, $verbose, $no_update, $no_op, $redirect, $save_temps);
     64my $run_state = 'new';
    6465GetOptions(
    6566    'skycal_id=s'       => \$skycal_id, # sky calibration run id
     
    6970    'threads=s'         => \$threads,   # Number of threads to use
    7071    'outroot=s'         => \$outroot,   # Output root name
     72    'run-state=s'       => \$run_state, # 'new' or 'update'
    7173    'path_base=s'       => \$path_base, # path_base of input
    7274    'filter=s'          => \$filter,    # filter for input stack
     
    112114# generate the input
    113115my $cmdflags = "";
     116
     117unless ($run_state eq 'new' or $run_state eq 'update') {
     118    &my_die("$run_state is not a valid value for run-state\n", $skycal_id, $PS_EXIT_CONFIG_ERROR);
     119}
     120my $updateMode = $run_state eq 'update';
    114121
    115122my $recipe_psastro  = $ipprc->reduction($reduction, 'STATICSKY_CALIBRATION'); # Recipe to use for psastro
     
    223230# Perform psastro analysis
    224231my $output_sources_filerule =  'PSASTRO.OUTPUT.CMF';
     232my $quality = 0;
    225233{
    226234    my $command = "$psastro $outroot";
     
    230238    $command .= " -recipe PSPHOT   $recipe_psphot";
    231239    $command .= " -F PSASTRO.OUTPUT $output_sources_filerule";
     240    $command .= " -Db PSASTRO.SAVE.CFF F" if $updateMode;
    232241    $command .= " -stats $stats";
    233242    # $command .= " -recipe PPSTATS CAMSTATS";
     
    262271        $cmdflags .= $compatability_flags unless ($cmdflags =~ /-n_detections/);
    263272
    264         my $quality;
    265273        ($quality) =  $cmdflags =~ /-quality (\d+)/;
    266274        if (!$quality) {
     
    279287
    280288# Add the result to the database
    281 {
     289if (!$updateMode) {
    282290    my $command = "$staticskytool -skycal_id $skycal_id";
    283291    $command .= " -addskycalresult -path_base $outroot";
     
    292300        unless ($success) {
    293301            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    294             my $err_message = "Unable to perform staticskytool -addresult";
     302            my $err_message = "Unable to perform $command";
     303            warn($err_message);
     304            exit $error_code;
     305        }
     306    } else {
     307        print "skipping $command\n";
     308    }
     309} else {
     310    if ($quality) {
     311        # First update the result
     312        my $command = "$staticskytool -updateresult $skycal_id -set_fault 0";
     313        $command .= " -set_quality $quality";
     314        $command .= " -dbname $dbname" if defined $dbname;
     315
     316        unless($no_update) {
     317            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     318                run(command => $command, verbose => $verbose);
     319            unless ($success) {
     320                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     321                my $err_message = "Unable to perform $command";
     322                warn($err_message);
     323                exit $error_code;
     324            }
     325        } else {
     326            print "skipping $command\n";
     327        }
     328    }
     329    my $command = "$staticskytool -skycal_id $skycal_id";
     330    $command .= ' -updaterun -set_state full';
     331    $command .= " -dbname $dbname" if defined $dbname;
     332
     333    unless($no_update) {
     334        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     335            run(command => $command, verbose => $verbose);
     336        unless ($success) {
     337            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     338            my $err_message = "Unable to perform $command";
    295339            warn($err_message);
    296340            exit $error_code;
     
    315359    if (defined $skycal_id and not $no_update) {
    316360        my $command = "$staticskytool -skycal_id $skycal_id -fault $exit_code";
    317         $command .= " -addskycalresult";
    318         $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    319         $command .= " -hostname $host" if defined $host;
    320         $command .= " -path_base $outroot" if defined $outroot;
     361        if ($updateMode) {
     362            $command .= ' -updateskycalresult';
     363        } else {
     364            $command .= " -addskycalresult";
     365            $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
     366            $command .= " -hostname $host" if defined $host;
     367            $command .= " -path_base $outroot" if defined $outroot;
     368        }
    321369        $command .= " -dbname $dbname" if defined $dbname;
    322370        run(command => $command, verbose => $verbose);
Note: See TracChangeset for help on using the changeset viewer.