IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26246


Ignore:
Timestamp:
Nov 22, 2009, 11:47:44 AM (17 years ago)
Author:
eugene
Message:

updates from trunk

Location:
branches/eam_branches/20091113
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091113

  • branches/eam_branches/20091113/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm

    r26236 r26246  
    166166    my $mask_name;
    167167    my $weight_name;
     168    my $cmf_name;
     169    my $psf_name;
     170    my $backmdl_name;
    168171    my $base_name;
    169172    my $want_astrom;
     
    198201        $mask_name    = "PPIMAGE.CHIP.MASK";
    199202        $weight_name  = "PPIMAGE.CHIP.VARIANCE";
     203        $cmf_name     = "PSPHOT.OUTPUT";
     204        $psf_name     = "PSPHOT.PSF.SAVE";
     205        $backmdl_name = "PSPHOT.BACKMDL";
    200206        $base_name    = "path_base"; # name of the field for the chiptool output
    201207        $want_astrom  = 1;
     
    209215        $mask_name    = "PSWARP.OUTPUT.MASK";
    210216        $weight_name  = "PSWARP.OUTPUT.VARIANCE";
     217        $cmf_name     = "PSWARP.OUTPUT.SOURCES";
     218        $psf_name     = "PSPHOT.PSF.SKY.SAVE";
    211219        $base_name    = "path_base"; # name of the field for the warptool output
    212220    } elsif ($img_type eq "diff") {
     
    218226        $mask_name   = "PPSUB.OUTPUT.MASK";
    219227        $weight_name = "PPSUB.OUTPUT.VARIANCE";
     228        $cmf_name    = "PPSUB.OUTPUT.SOURCES";
     229        $psf_name     = "PSPHOT.PSF.SKY.SAVE";
    220230        $base_name   = "path_base";
    221231    } elsif ($img_type eq "stack") {
     
    228238        $mask_name   = "PPSTACK.OUTPUT.MASK";
    229239        $weight_name = "PPSTACK.OUTPUT.VARIANCE";
     240        # this is wrong but gets the right answer. Need to figure out how to find the
     241        # rule properly
     242        #$cmf_name    = "PSPHOT.OUTPUT";    # this puts .fpa. in the name
     243        $cmf_name     = "PSWARP.OUTPUT.SOURCES";
     244        $psf_name    = "PPSTACK.TARGET.PSF";
    230245        $base_name   = "path_base";
    231246    } else {
     
    340355        $out->{image_db} = $image_db;
    341356
    342         # find the mask and weight images
    343357        if ($base) {
    344358            $out->{image}  = $ipprc->filename($image_name,  $base, $class_id) if $image_name;
    345359            $out->{mask}   = $ipprc->filename($mask_name,   $base, $class_id) if $mask_name;
    346360            $out->{weight} = $ipprc->filename($weight_name, $base, $class_id) if $weight_name;
     361            $out->{cmf}    = $ipprc->filename($cmf_name, $base, $class_id) if $cmf_name;
     362            $out->{psf}    = $ipprc->filename($psf_name, $base, $class_id) if $psf_name;
     363            $out->{backmdl}= $ipprc->filename($backmdl_name, $base, $class_id) if $backmdl_name;
    347364        }
    348365        $out->{astrom} = find_astrometry($ipprc, $image_db, $image, $verbose) if $want_astrom;
  • branches/eam_branches/20091113/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm

    r25794 r26246  
    2222                    $PSTAMP_SELECT_MASK
    2323                    $PSTAMP_SELECT_WEIGHT
     24                    $PSTAMP_SELECT_CMF
     25                    $PSTAMP_SELECT_PSF
     26                    $PSTAMP_SELECT_BACKMDL
    2427                    $PSTAMP_SELECT_INVERSE
    2528                    $PSTAMP_WAIT_FOR_UPDATE
     
    4851our $PSTAMP_SELECT_MASK      = 2;
    4952our $PSTAMP_SELECT_WEIGHT    = 4;
     53our $PSTAMP_SELECT_CMF       = 8;
     54our $PSTAMP_SELECT_PSF       = 16;
     55our $PSTAMP_SELECT_BACKMDL   = 32;
     56our $PSTAMP_SELECT_INVERSE   = 1024;
    5057
    51 our $PSTAMP_SELECT_INVERSE   = 1024;
    5258our $PSTAMP_WAIT_FOR_UPDATE  = 2048;
    5359
  • branches/eam_branches/20091113/archive/ducttape

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/catalyst

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/catalyst/2007.0-specs

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/catalyst/2008.0-specs

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/catalyst/2008.0-specs/hardened

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/hardware

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/ippScripts/scripts/magic_destreak_revert.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/ippTasks/pstamp.pro

    r25837 r26246  
    421421        book getword pstampJob $pageName dbname -var DBNAME
    422422        book getword pstampJob $pageName outputBase -var OUTPUT_BASE
     423        book getword pstampJob $pageName options -var OPTIONS
    423424
    424425        if ($VERBOSE > 1)
     
    428429        host anyhost
    429430
    430         $run = pstamp_job_run.pl --job_id $JOB_ID --job_type $JOB_TYPE --rownum $ROWNUM --output_base $OUTPUT_BASE --redirect-output
     431        $run = pstamp_job_run.pl --job_id $JOB_ID --job_type $JOB_TYPE --rownum $ROWNUM --output_base $OUTPUT_BASE --options $OPTIONS --redirect-output
    431432        add_standard_args run
    432433
  • branches/eam_branches/20091113/ippTests/tap

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/psphot/doc/efficiency.txt

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/psphot/src/psphotFake.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/pstamp/scripts/pstamp_job_run.pl

    r26236 r26246  
    1313use Carp;
    1414use File::Basename;
     15use File::Copy;
    1516use Digest::MD5::File qw( file_md5_hex );
    1617use PS::IPP::PStamp::RequestFile qw( :standard );
     
    2021use PS::IPP::Metadata::Config;
    2122#use PS::IPP::Metadata::Stats;
    22 #use PS::IPP::Metadata::List qw( parse_md_list );
     23use PS::IPP::Metadata::List qw( parse_md_list );
    2324
    2425use PS::IPP::Config qw( :standard );
    2526
    26 my ($job_id, $redirect_output, $outputBase, $rownum, $jobType);
     27my ($job_id, $redirect_output, $outputBase, $rownum, $jobType, $options);
    2728my ($verbose, $dbname, $dbserver, $no_update);
    2829
     
    3233    'rownum=s'          =>  \$rownum,
    3334    'output_base=s'     =>  \$outputBase,
     35    'options=s'         =>  \$options,
    3436    'redirect-output'   =>  \$redirect_output,
    3537    'dbname=s'          =>  \$dbname,
     
    5153my_die("rownum is required", $job_id, $PS_EXIT_PROG_ERROR) if !$rownum;
    5254my_die("output_base is required", $job_id, $PS_EXIT_PROG_ERROR) if !$outputBase;
     55
     56$options = 1 if !$options;
    5357
    5458
     
    107111        my $reglist = "$dir/reglist$job_id";
    108112
    109         open F, ">$reglist" or my_die( "can't open $reglist for output", $job_id, $PS_EXIT_UNKNOWN_ERROR);
     113        my $F;
     114        open $F, ">$reglist" or my_die( "can't open $reglist for output", $job_id, $PS_EXIT_UNKNOWN_ERROR);
    110115
    111116        # Figure out what output images were produced
     
    116121                           $PSTAMP_SELECT_WEIGHT => "wt.fits");
    117122
    118         # we always create a stamp of the image
    119         my $output_mask = $PSTAMP_SELECT_IMAGE;
    120 
    121         # we search the argString for -mask and -variance.
    122         # searching the arg string allows us to avoid adding a column in pstampJob
    123         $output_mask   |= $PSTAMP_SELECT_MASK   if ($argString =~ /-mask/);
    124         $output_mask   |= $PSTAMP_SELECT_WEIGHT if ($argString =~ /-variance/);
     123        my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_WEIGHT);
    125124
    126125        foreach my $key (keys (%extensions)) {
     
    137136
    138137            # XXX is pstamp always the right file type, if not where do we get the right one?
    139             print F file_registration_line($filename, $path, "pstamp") . "\n";
    140         }
    141 
    142         close F;
     138            print $F file_registration_line($filename, $path, "pstamp") . "\n";
     139        }
     140
     141        get_other_outputs($F, $outputBase, $options);
     142
     143        close $F;
    143144        $jobStatus = $PS_EXIT_SUCCESS;
    144145    } elsif ($exitStatus == $PSTAMP_NO_OVERLAP) {
    145         $jobStatus = $PSTAMP_NO_OVERLAP
     146        $jobStatus = $PSTAMP_NO_OVERLAP;
    146147    } else {
    147148        my_die( "ppstamp failed with error code: $exitStatus", $job_id, $exitStatus);
     
    206207    }
    207208}
     209       
     210sub get_other_outputs {
     211    my $f = shift;
     212    my $output_base = shift;
     213    my $options = shift;
     214
     215    if ($options & ( $PSTAMP_SELECT_CMF | $PSTAMP_SELECT_PSF | $PSTAMP_SELECT_BACKMDL)) {
     216if (0) {
     217        my $params_file = $output_base . ".mdc";
     218        open (IN, "<$params_file")
     219            or my_die("failed to open params file: $params_file", $job_id, $PS_EXIT_UNKNOWN_ERROR);
     220
     221        my $data = $mdcParser->parse(join "", (<IN>))
     222            or my_die("failed to parse params file: $params_file", $job_id, $PS_EXIT_UNKNOWN_ERROR);
     223
     224        my $components = parse_md_list($data);
     225
     226        my $n = scalar @$components;
     227        if ($n != 1) {
     228            my_die("params file $params_file contains unexpected number of components: $n",
     229                $job_id, $PS_EXIT_PROG_ERROR);
     230        }
     231        my $comp = $components->[0];
     232}
     233        my $comp = read_params_file($output_base);
     234
     235        my $stage = $comp->{stage};
     236
     237        # raw files don't have any other data products
     238        return 1 if $stage eq "raw";
     239
     240        # add the other data products if they are selected and exist.
     241        # silently skip them if they don't exist. Perhaps this should be
     242        # detected in pstampparse so that the user can be notified with
     243        # a message in parse_error.txt ("warp do not have a background model")
     244        my $cmf_file = $comp->{cmf} if ($options & $PSTAMP_SELECT_CMF);
     245        my $psf_file = $comp->{psf} if ($options & $PSTAMP_SELECT_PSF);
     246        my $backmdl_file = $comp->{backmdl} if ($options & $PSTAMP_SELECT_BACKMDL);
     247
     248        my $outdir = dirname($output_base);
     249        my $basename = basename($output_base);
     250        my ($rownum, $jobnum, $therest) = split /_/, $basename;
     251        &my_die("failed to split basename: $basename", $job_id, $PS_EXIT_CONFIG_ERROR)
     252            if (!$therest or !$rownum or !$jobnum);
     253
     254        my $prefix = "${rownum}_${jobnum}_";
     255
     256        if ($cmf_file) {
     257            print "cmf file is $cmf_file\n";
     258            copy_and_register_file($f, $cmf_file, $outdir, $prefix);
     259        }
     260        if ($psf_file) {
     261            print "psf_file is $psf_file\n";
     262            copy_and_register_file($f, $psf_file, $outdir, $prefix);
     263        }
     264        if ($backmdl_file) {
     265            print "backmdl_file is $backmdl_file\n";;
     266            copy_and_register_file($f, $backmdl_file, $outdir, $prefix);
     267        }
     268    }
     269}
     270sub read_params_file {
     271    my $output_base = shift;
     272
     273    my $params_file = $output_base . ".mdc";
     274    open (IN, "<$params_file")
     275        or my_die("failed to open params file: $params_file", $job_id, $PS_EXIT_UNKNOWN_ERROR);
     276
     277    my $data = $mdcParser->parse(join "", (<IN>))
     278        or my_die("failed to parse params file: $params_file", $job_id, $PS_EXIT_UNKNOWN_ERROR);
     279
     280    my $components = parse_md_list($data);
     281
     282    my $n = scalar @$components;
     283    if ($n != 1) {
     284        my_die("params file $params_file contains unexpected number of components: $n",
     285                $job_id, $PS_EXIT_PROG_ERROR);
     286    }
     287    return $components->[0];
     288}
     289
     290# copy_and_register_file ($f, $src, $destdir, $prefix);
     291sub copy_and_register_file {
     292    my $F = shift;
     293    my $src = shift;
     294    my $destdir = shift;
     295    my $prefix = shift;
     296
     297    my $fn = $prefix . basename($src);
     298    my $dst = "$destdir/$fn";
     299
     300    my $resolved = $ipprc->file_resolve($src);
     301
     302    my_die("failed to resolve $src", $job_id, $PS_EXIT_UNKNOWN_ERROR) if !$resolved;
     303
     304    copy($resolved, $dst) or my_die("failed to copy $resolved to $dst", $job_id, $PS_EXIT_UNKNOWN_ERROR);
     305
     306    print $F file_registration_line($fn, $dst, "fits") . "\n";
     307}
    208308
    209309sub my_die
  • branches/eam_branches/20091113/pstamp/scripts/pstampparse.pl

    r26236 r26246  
    371371            $args .= " -astrom $image->{astrom}" if $image->{astrom};
    372372        }
     373
     374        $image->{job_args} = $args;
     375
     376        # XXX: we can get rid of the following everything that we need is
     377        # in the params file
    373378
    374379        $args .= " -file $imagefile";
  • branches/eam_branches/20091113/pstamp/src/pstamp.h

    r25709 r26246  
    33
    44// error codes returned to users in results flie
    5 // These must match the values in  PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
     5// PS-IPP-PStamp::RequestFile
     6// These must match the values in the perl module PS-IPP-PStamp::RequestFile
     7// i.e. PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
     8
    69typedef enum {
    710        PSTAMP_SUCCESS          = 0,
     
    2124
    2225
    23 #define PSTAMP_SELECT_IMAGE  1
    24 #define PSTAMP_SELECT_MASK   2
    25 #define PSTAMP_SELECT_WEIGHT 4
     26// values for options mask.
     27#define PSTAMP_SELECT_IMAGE      1
     28#define PSTAMP_SELECT_MASK       2
     29#define PSTAMP_SELECT_WEIGHT     4
     30#define PSTAMP_SELECT_CMF        8
     31#define PSTAMP_SELECT_PSF       16
     32#define PSTAMP_SELECT_BACKMDL   32
    2633#define PSTAMP_SELECT_INVERSE 1024
     34
     35#define PSTAMP_WAIT_FOR_UPDATE 2048
    2736
    2837#define PSTAMP_CENTER_IN_PIXELS 1
     
    3544#define STAMP_RESULTS_VERSION "1"
    3645
     46// end of values tha must match PS-IPP-PStamp::RequestFile
     47
    3748#endif
  • branches/eam_branches/20091113/pstamp/test/ps1-0905001-all.txt

    r26236 r26246  
    2222#
    2323# various looks at the location of SN candidate PS1-0905001
    24 1         243.035580     55.128140          250   250      2        stamp       7        gpc1    byid     raw   70853         null   null       null        null    0      0    |PS1-0905001 r
    25 2         243.035580     55.128140          250   250      2        stamp       7        gpc1    byid     chip  20272         null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
     241         243.035580     55.128140          250   250      2        stamp       63        gpc1    byid     raw   70853         null   null       null        null    0      0    |PS1-0905001 r
     252         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     chip  20272         null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
    2626
    2727# 3 and 4 will fail because the weight images was damaged by the destreaking
    2828# process
    29 3         243.035580     55.128140          250   250      2        stamp       7        gpc1    byid     warp  6323          null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
    30 4         243.035580     55.128140          250   250      2        stamp       7        gpc1    byid     diff  16880         null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
     293         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     warp  6323          null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
     304         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     diff  16880         null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
    3131# these will work
    32 103       243.035580     55.128140          250   250      2        stamp       3        gpc1    byid     warp  6323          null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
    33 104       243.035580     55.128140          250   250      2        stamp       3        gpc1    byid     diff  16880         null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
     32103       243.035580     55.128140          250   250      2        stamp       59       gpc1    byid     warp  6323          null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
     33104       243.035580     55.128140          250   250      2        stamp       59       gpc1    byid     diff  16880         null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
    3434
    35 5         243.035580     55.128140          250   250      2        stamp       7        gpc1    byid     stack 14032         null   null  null             null    0      0    |PS1-0905001 r
     355         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     stack 14032         null   null  null             null    0      0    |PS1-0905001 r
    3636
    37376         243.035580     55.128140          250   250      2        stamp       1        gpc1    byexp    raw   o4973g0133o   null   null       null        null    0      0    |PS1-0905001 r
Note: See TracChangeset for help on using the changeset viewer.