IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 22, 2024, 3:53:54 PM (2 years ago)
Author:
eugene
Message:

fixup tasks and tools for xcstack - xccal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/ippScripts/scripts/xcstack_skycell.pl

    r42602 r42663  
    120120        my $stack_id = $input->{stack_id};
    121121
     122        my $good_frac = $input->{good_frac};
     123        my $Nsources  = $input->{sources};
     124
     125        print "camera: $camera_name, stack_id: $stack_id, good_frac: $good_frac, Nsources: $Nsources\n";
     126        if ($good_frac < 1e-4) { my_escape("low good_frac ($good_frac) for $camera_name, stack_id $stack_id", $xcstack_id, 6000); }
     127        if ($Nsources < 1) { my_escape("no sources for $camera_name, stack_id $stack_id", $xcstack_id, 6001); }
     128
    122129        # check for the input files
    123130        my $image    = $ipprc->filename("PPSTACK.UNCONV",          $input->{path_base}); # Image name
     
    131138        my $have_sources = $ipprc->file_exists( $sources );
    132139       
    133         &my_die("Image $image does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $have_image;
    134         &my_die("Mask $mask does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $have_mask;
    135         &my_die("Weight $weight does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $have_weight;
    136         &my_die("Sources $sources does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $have_sources;
     140        &my_die("Image $image does not exist for $camera_name, stack_id $stack_id", $xcstack_id, $PS_EXIT_SYS_ERROR) unless $have_image;
     141        &my_die("Mask $mask does not exist for $camera_name, stack_id $stack_id", $xcstack_id, $PS_EXIT_SYS_ERROR) unless $have_mask;
     142        &my_die("Weight $weight does not exist for $camera_name, stack_id $stack_id", $xcstack_id, $PS_EXIT_SYS_ERROR) unless $have_weight;
     143        &my_die("Sources $sources does not exist for $camera_name, stack_id $stack_id", $xcstack_id, $PS_EXIT_SYS_ERROR) unless $have_sources;
    137144       
    138145        print $listFile "INPUT$num\tMETADATA\n";
     
    148155close($listFile);
    149156
    150 &my_die("input list contains less than two elements", $xcstack_id, $PS_EXIT_DATA_ERROR) unless scalar $num >= 2;
     157if ($num < 2) { &my_escape("not enough input stacks to make an xcstack", $xcstack_id, 6002); }
    151158
    152159print "I've loaded my inputs: $xcstack_id\n";
     
    333340        }
    334341        $command .= " -dbname $dbname" if defined $dbname;
     342        print "running in my_die: $command\n";
    335343        system ($command);
    336344    }
    337345    exit $exit_code;
     346}
     347
     348sub my_escape
     349{
     350    my $msg = shift;            # Warning message on exit
     351    my $xcstack_id = shift;       # Xcstack identifier
     352    my $quality = shift;      # Exit code to add
     353
     354    carp($msg);
     355
     356    if (defined $xcstack_id and not $no_update) {
     357        my $command = "$xcstacktool -xcstack_id $xcstack_id";
     358        if ($run_state eq 'new') {
     359            $command .= " -addsumskyfile";
     360            $command .= " -path_base $outroot" if defined $outroot;
     361            $command .= " -hostname $host" if defined $host;
     362            $command .= " -quality $quality" if defined $quality;
     363            $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
     364        } else {
     365            $command .= " -updatesumskyfile";
     366            $command .= " -set_quality $quality" if defined $quality;
     367        }
     368        $command .= " -dbname $dbname" if defined $dbname;
     369        print "running in my_die: $command\n";
     370        system ($command);
     371    }
     372    exit 0;
    338373}
    339374
Note: See TracChangeset for help on using the changeset viewer.