IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27953


Ignore:
Timestamp:
May 13, 2010, 2:00:40 PM (16 years ago)
Author:
bills
Message:

For chip stage postage stamps use the camera stage mask files.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm

    r27916 r27953  
    248248        # With the mdc file it has all of the information that it needs.
    249249        $image_name   = "PPIMAGE.CHIP";
    250         $mask_name    = "PPIMAGE.CHIP.MASK";
     250        # $mask_name    = "PPIMAGE.CHIP.MASK";
     251        # XXX: really need to handle this properly!
     252        $mask_name    = "PSASTRO.OUTPUT.MASK";
    251253        $weight_name  = "PPIMAGE.CHIP.VARIANCE";
    252254        $cmf_name     = "PSPHOT.OUTPUT";
     
    430432        $out->{imagedb} = $imagedb;
    431433
     434        my $mask_base;
     435        if ($want_astrom) {
     436            if (! defined $out->{astrom}) {
     437                if (! find_astrometry($ipprc, $imagedb, $out, $verbose)) {
     438                    print STDERR "failed to find astrometry for $stage $stage_id\n";
     439                    next;
     440                }
     441            }
     442            # XXX: do this right by looking at the recipe
     443            $mask_base = $out->{cam_path_base};
     444        } else {
     445            $mask_base = $base;
     446        }
     447
    432448        if ($base) {
    433449            $out->{image}  = $ipprc->filename($image_name,  $base, $class_id) if $image_name;
    434             $out->{mask}   = $ipprc->filename($mask_name,   $base, $class_id) if $mask_name;
     450            $out->{mask}   = $ipprc->filename($mask_name,   $mask_base, $class_id) if $mask_name;
    435451            $out->{weight} = $ipprc->filename($weight_name, $base, $class_id) if $weight_name;
    436452            $out->{cmf}    = $ipprc->filename($cmf_name, $base, $class_id) if $cmf_name;
    437453            $out->{psf}    = $ipprc->filename($psf_name, $base, $class_id) if $psf_name;
    438454            $out->{backmdl}= $ipprc->filename($backmdl_name, $base, $class_id) if $backmdl_name;
    439         }
    440         if ($want_astrom and ! defined $out->{astrom}) {
    441             $out->{astrom} = find_astrometry($ipprc, $imagedb, $image, $verbose);
    442455        }
    443456
     
    842855# cache of results of ppConfigDump
    843856my %astromSources;
    844 my $last_exp_id = 0;
    845 my $lastAstromFile;
     857# my $last_exp_id = 0;
     858my $lastCamRun;
    846859
    847860# find the astrometry file for a given exposure
    848861# return undef if no completed camRun exists
     862# XXX Right now this probably only works cameras where the astrometry is done at the camera stage
    849863sub find_astrometry {
    850864    my $ipprc = shift;
     
    856870
    857871    my $exp_id = $image->{exp_id};
    858     if (($exp_id eq $last_exp_id) and $lastAstromFile) {
     872    if (defined $lastCamRun) {
    859873        # running camtool 60 times is really expensive when the answer is the same every time
    860         return $lastAstromFile;
    861     }
    862     $last_exp_id = 0;
    863     $lastAstromFile = undef;
     874        $image->{astrom} = $lastCamRun->{astrom};
     875        $image->{cam_path_base} = $lastCamRun->{path_base};
     876        return 1;
     877    }
     878    # $last_exp_id = 0;
     879    # $lastAstromFile = undef;
     880    $lastCamRun = undef;
    864881
    865882    my $camRun = getCamRunByExpID($exp_id);
     
    871888        unless ($success) {
    872889            print STDERR @$stderr_buf;
    873             return undef;
     890            return 0;
    874891        }
    875892
     
    879896        if (!$output) {
    880897            print STDERR "no output returned from $command\n" if $verbose;
    881             return undef;
     898            return 0;
    882899        }
    883900        my $camruns = parse_md_fast($mdcParser, $output);
    884901        if (!$camruns) {
    885             return undef;
     902            return 0;
    886903        }
    887904
     
    897914        if (!$camRun) {
    898915            # no cam runs for this exposure id therefore best astrometry is whatever is in the header
    899             return undef;
     916            return 0;
    900917        }
    901918        updateCamRunCache($camRun);
     
    927944    my $astromFile = $ipprc->filename($astromSource, $camRoot);
    928945    if ($astromFile) {
    929         $lastAstromFile = $astromFile;
    930         $last_exp_id = $exp_id;
    931     }
    932 
    933     return $astromFile;
     946        $lastCamRun = $camRun;
     947        $lastCamRun->{astrom} = $astromFile;
     948#        $last_exp_id = $exp_id;
     949    } else {
     950        return 0;
     951    }
     952
     953    $image->{astrom} = $astromFile;
     954    $image->{cam_path_base} = $camRoot;
     955
     956    return 1;
    934957}
    935958
  • trunk/pstamp/scripts/pstamp_job_run.pl

    r27947 r27953  
    8989    $argString = $params->{job_args};
    9090
     91    # XXX: should we do any other sanity checking?
     92    my_die("argument list is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString;
     93
     94    # XXX: remove -astrom from argString and add it here
     95
    9196    $argString .= " -file $params->{image}";
    9297    $argString .= " -mask $params->{mask}";
     
    9499        $argString .= " -variance $params->{weight}";
    95100    }
    96 
    97     # XXX: should we do any other sanity checking?
    98     my_die("argument list is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString;
    99101
    100102    my $command = "$ppstamp $outputBase $argString";
Note: See TracChangeset for help on using the changeset viewer.