IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 19, 2010, 6:50:13 PM (16 years ago)
Author:
eugene
Message:

updates from trunk

Location:
branches/eam_branches/ipp-20100621/pstamp
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/pstamp/scripts/detect_query_create

    r28043 r28980  
    1717     $query_id,
    1818     $nostage,
     19     $version,
    1920     );
    2021
     
    2223           'input|i=s'    => \$input,
    2324           'output|o=s'   => \$output,
    24            'query_id|q=s'  => \$query_id,
     25           'query_id|q=s' => \$query_id,
     26           'version|v=s'  => \$version,
    2527           'nostage'      => \$nostage,
    2628) or pod2usage( 2 );
     
    3032           -exitval => 3) unless defined $input and defined $output;
    3133
    32 # The header kewords
     34# Read what we've been given
     35my $in;
     36if ($input eq '-') {
     37    $in = \*STDIN;
     38} else {
     39    open $in, "<$input" or die "cannot open $input for reading";
     40}
     41my %colData;
     42my %headerData;
     43my $numRows = read_data_for_table($in,'\s+', \%colData, \%headerData);
     44if (!$numRows) {
     45    print STDERR "no data in $input\n";
     46    exit 1;
     47}
     48
     49# The header keywords
    3350my $header = [
    3451        { name =>  'QUERY_ID',
     
    6279                    value => undef
    6380        },
    64        { name =>  'STAGE',
     81        { name =>  'STAGE',
    6582                   writetype => TSTRING,
    6683                   comment => 'processing stage to examine',
    6784                   value => undef
    68        }
     85        }
    6986];
    70 unless(defined($nostage)) {
    71     push @{ $header },        { name =>  'STAGE',
    72                                 writetype => TSTRING,
    73                                 comment => 'processing stage to examine',
    74                                 value => undef
    75     };
     87
     88# Validate header.
     89
     90if (defined($query_id)) {
     91    $headerData{QUERY_ID} = $query_id;
     92}
     93unless (exists($headerData{QUERY_ID})) {
     94    die "No QUERY_ID specified for header.";
     95}
     96
     97unless (exists($headerData{EXTVER})) {
     98    die "No EXTVER specified for header.";
     99}
     100if ($headerData{EXTVER} == 1) {
     101    unless (exists($headerData{STAGE})) {
     102        warn "No STAGE value specified in header. Assuming default value of 'diff'";
     103        $headerData{STAGE} = 'diff';
     104    }
     105    foreach my $entry_ref (@{ $header }) {
     106        my $name = $entry_ref->{name};
     107        unless (exists($headerData{$name})) {
     108            die "Required header value $name not specified (try EXTVER=2?).";
     109        }
     110        $entry_ref->{value} = $headerData{$name};
     111    }
     112}   
     113elsif ($headerData{EXTVER} == 2) {
     114    unless (exists($headerData{STAGE})) {
     115        warn "No STAGE value specified in header. Assuming default value of 'diff'";
     116        $headerData{STAGE} = 'diff';
     117    }
     118    my $tmp_header;
     119    foreach my $entry_ref (@{ $header }) {
     120        my $name = $entry_ref->{name};
     121        if (exists($headerData{$name})) {
     122            $entry_ref->{value} = $headerData{$name};
     123            push @{ $tmp_header }, $entry_ref;
     124        }
     125    }
     126    $header = $tmp_header;
     127}
     128else {
     129    die "Unknown EXTVER = $headerData{EXTVER}.";
    76130}
    77131
     
    91145        { name => 'MAG',      type => 'D',   writetype => TDOUBLE },
    92146];
    93 
    94 my $in;
    95 if ($input eq '-') {
    96     $in = \*STDIN;
    97 } else {
    98     open $in, "<$input" or die "cannot open $input for reading";
    99 }
    100 
    101 my @colData;
    102 foreach (@$columns) {
    103     push @colData, [];
    104 }
    105 
    106 
    107 my $numRows = read_data_for_table($in,'\s+', \@colData, $header);
    108 if (!$numRows) {
    109     print STDERR "no data in $input\n";
    110     exit 1;
    111 }
    112 
    113 # overwrite the QUERY_ID value from the input file with the command
    114 # line argument
    115 
    116 if ($query_id) {
    117     $header->[0]->{value} = $query_id;
    118 }
    119 
    120 my $status = make_fits_table($output, EXTNAME, $numRows, \@colData, $columns, $header);
     147my $columns_v2 = [
     148    { name => 'FPA_ID', type => '20A', writetype => TSTRING },
     149    { name => 'MJD-OBS', type => 'D', writetype => TDOUBLE },
     150    { name => 'FILTER', type => '20A', writetype => TSTRING },
     151    { name => 'OBSCODE', type => '20A', writetype => TSTRING },
     152    { name => 'STAGE', type => '20A', writetype => TSTRING }
     153    ];
     154# Validate the data.
     155if ($headerData{EXTVER} == 1) {
     156    foreach my $entry_ref (@{ $columns }) {
     157        my $name = $entry_ref->{name};
     158        unless (exists($colData{$name})) {
     159            die "Required data column $name not found (try EXTVER=2?).";
     160        }
     161    }
     162}
     163if ($headerData{EXTVER} == 2) {
     164    my $tmp_columns;
     165    foreach my $entry_ref (@{ $columns }) {
     166        my $name = $entry_ref->{name};
     167        if (exists($colData{$name})) {
     168            push @{ $tmp_columns }, $entry_ref;
     169        }
     170    }
     171    foreach my $entry_ref (@{ $columns_v2 }) {
     172        my $name = $entry_ref->{name};
     173        if (exists($colData{$name})) {
     174            push @{ $tmp_columns }, $entry_ref;
     175        }
     176    }
     177    $columns = $tmp_columns;
     178}           
     179
     180# Construct the array of arrays
     181my @colDataAoA = ();
     182foreach my $col_def (@{ $columns }) {
     183    my $name = $col_def->{name};
     184    push @colDataAoA, $colData{$name};
     185}
     186
     187# foreach (@$columns) {
     188#     push @colData, [];
     189# }
     190
     191
     192
     193my $status = make_fits_table($output, EXTNAME, $numRows, \@colDataAoA, $columns, $header);
    121194
    122195exit $status;
     
    230303
    231304    my $line_num = 0;
    232 
    233     # read data for header if any data is expected
    234     if ($header) {
    235         my $nhead = @$header;
    236         while (my $line = <$in>) {
    237             $line_num++;
    238             chomp $line;
    239             next if !$line;             # skip blank lines
    240             next if ($line =~ /^#/);    # skip comment lines
    241             my @vals = split /$sep/, $line;
    242             my $nvals = @vals;
    243             die "number of header columns in input $nvals does not equal expected number of header words $nhead"
    244                     if (@vals != @$header);
    245 
    246             for (my $i=0; $i < @$header; $i++) {
    247                 $header->[$i]->{value} = $vals[$i];
    248             }
    249 
    250             last; # only one header line
    251         }
    252     }
    253 
    254     my $row_num = 0;
    255     my $ncols = @$colData;
    256     while (my $line = <$in>) {
    257         chomp $line;
    258         $line_num++;
    259         next if !$line;             # skip blank lines
    260         next if ($line =~ /^#/);    # skip comment lines
    261 
    262         my @vals = split /$sep/, $line;
    263         my $nvals = @vals;
    264         die "number of columns $nvals in input does not equal expected number of header "
    265                 . " words $ncols on line $line_num" if ($nvals != $ncols);
    266 
    267         for (my $col = 0; $col < @$colData; $col++) {
    268             $colData->[$col]->[$row_num] = $vals[$col];
    269         }
    270         $row_num++;
    271     }
    272 
     305    my @keywords = ();
     306    my $row_num;
     307    while (<$in>) {
     308        chomp;
     309        if ($line_num == 0) {
     310            # Parse header information keywords
     311            $_ =~ s/#//g;
     312            @keywords = split /\s+/;
     313            if ($keywords[0] eq '') {
     314                shift(@keywords);
     315            }
     316        }
     317        elsif ($line_num == 1) {
     318            # Parse header information values
     319            my @values = split /\s+/;
     320            if ($#values != $#keywords) {
     321                die "Number of header columns in input does not equal expected number of header words";
     322            }
     323            for (my $i = 0; $i <= $#values; $i++) {
     324                $header->{$keywords[$i]} = $values[$i];
     325            }           
     326        }
     327        elsif ($line_num == 2) {
     328            # Parse table information keywords, dumping old keywords
     329            $_ =~ s/#//g;
     330            @keywords = split /\s+/;
     331            if ($keywords[0] eq '') {
     332                shift(@keywords);
     333            }
     334        }
     335        else {
     336            # Parse table information values
     337            unless ($_ =~ /^#/) {
     338                my @values = split /\s+/;
     339                if ($#values != $#keywords) {
     340                    die "Number of header columns in input does not equal expected number of header words";
     341                }
     342                for (my $i = 0; $i <= $#values; $i++) {
     343                    push @{ $colData{$keywords[$i]} }, $values[$i];
     344                    $row_num = $#{ $colData{$keywords[$i] } } + 1;
     345                }               
     346            }
     347        }
     348        $line_num++;
     349    }
    273350    # we return the number of rows read
    274351    return $row_num;
  • branches/eam_branches/ipp-20100621/pstamp/scripts/detect_query_read

    r28794 r28980  
    2020use Math::Trig;
    2121use Data::Dumper;
     22use IPC::Cmd 0.36 qw( can_run run );
    2223
    2324use constant EXTNAME => 'MOPS_DETECTABILITY_QUERY'; # Extension name for table
     
    3132     $output,                   # Name of output table
    3233     $save_temps,               # Save temporary files?
     34     $dbname,                   # needed to do camtool lookups.
    3335     );
     36
     37my $regtool = can_run('regtool') or (die "Can't find regtool");
     38my $camtool = can_run('camtool') or (die "Can't find regtool");
     39
    3440
    3541GetOptions(
    3642           'input|i=s'    => \$input,
    3743           'output|o=s'   => \$output,
     44           'dbname=s'     => \$dbname,
    3845           'nolabel|l'    => \$no_print_label,
    3946           'noheader|h'   => \$no_print_header,
     
    6572
    6673# The keywords found in the header
    67 # my $header = {
    68 #         'EXTVER'   => { name => 'EXTVER',
    69 #                      writetype => TSTRING,
    70 #                      comment => 'Extension version',
    71 #                      value => undef
    72 #                       },
    73 #         'EXTNAME'  => { name => 'EXTNAME',
    74 #                      writetype => TSTRING,
    75 #                      comment => 'name of this binary table extension',
    76 #                      value => undef
    77 #                     },
    78 #         'QUERY_ID' => { name => 'QUERY_ID',
    79 #                         writetype => TSTRING,
    80 #                         comment => 'MOPS Query ID for this batch query',
    81 #                         value => undef
    82 #                       },
    83 #         'FPA_ID'   => { name => 'FPA_ID',
    84 #                         writetype => TSTRING,
    85 #                         comment => 'orginal FPA_ID used at ingest',
    86 #                         value => undef
    87 #                       },
    88 #         'MJD_OBS'  => { name => 'MJD-OBS',
    89 #                         writetype => TDOUBLE,
    90 #                         comment => 'starting time of the exposure, MJD',
    91 #                         value => undef
    92 #                       },
    93 #         'FILTER'   => { name => 'FILTER',
    94 #                         writetype => TSTRING,
    95 #                         comment => 'effective filter use for the exposure',
    96 #                         value => undef
    97 #                       },
    98 #         'OBSCODE'  => { name => 'OBSCODE',
    99 #                         writetype => TSTRING,
    100 #                         comment => 'site identifier (MPC observatory code)',
    101 #                         value => undef
    102 #                       },
    103 #       'STAGE'    => {
    104 #                       name => 'STAGE',
    105 #                       writetype => TSTRING,
    106 #                       comment => 'processing stage to examine',
    107 #                       value => undef
    108 #                     }
    109 # };
    11074
    11175my $parse_error = 0;
    112 # Parse the header to determine what we expect to find.
     76# Parse the header to determine what we have to work with.
     77# Clean up empty space and remove unneeded single quotes.
    11378foreach my $header_key (keys %{ $inHeader }) {
    11479    $inHeader->{$header_key} =~ s/\s+//g;
    11580    $inHeader->{$header_key} =~ s/\'//g;
    11681}
    117 my ($EXTVER,$headerEXTNAME,$QUERY_ID,$FPA_ID,$MJD_OBS,$FILTER,$OBSCODE,$STAGE) =
    118     ($inHeader->{EXTVER},$inHeader->{EXTNAME},$inHeader->{QUERY_ID},$inHeader->{FPA_ID},
    119      $inHeader->{'MJD-OBS'},$inHeader->{FILTER},$inHeader->{OBSCODE},$inHeader->{STAGE});
     82my ($EXTVER,$headerEXTNAME,$QUERY_ID,
     83    $FPA_ID,$MJD_OBS,$FILTER,
     84    $OBSCODE,$STAGE) =
     85    ($inHeader->{EXTVER},$inHeader->{EXTNAME},$inHeader->{QUERY_ID},
     86     $inHeader->{FPA_ID},$inHeader->{'MJD-OBS'},$inHeader->{FILTER},
     87     $inHeader->{OBSCODE},$inHeader->{STAGE});
     88
    12089unless(defined($EXTVER) && defined($headerEXTNAME) &&
    12190       (($EXTVER == 1)||($EXTVER == 2)) &&
    122        ($headerEXTNAME eq EXTNAME)) {
     91       ($headerEXTNAME eq EXTNAME)&&
     92       (defined($QUERY_ID))) {
    12393    $parse_error = 1;
    12494}
     
    143113        # apparent magnitude
    144114        { name => 'MAG',      type => 'D',   writetype => TDOUBLE, version => 1 },
    145     # v2 query_id: MOPS query ID for this batch query
     115    # v2 query_id: needs to be here.
    146116    { name => 'QUERY_ID', type => '20A', writetype => TSTRING, version => 2, default => $QUERY_ID },
    147117    # v2 fpa_id: original FPA_ID used at ingest
     
    172142
    173143    if ($col->{version} > $EXTVER) {
    174         @{ $colData{$col->{name}} } = map { $col->{default} } (0 .. $numRows);
     144        @{ $colData{$col->{name}} } = map { $col->{default} } (0 .. $numRows - 1);
    175145        next;
    176146    }
    177     $inFits->get_colnum(0, $col->{name}, $col_num, $status) and check_fitsio($status);
    178     $inFits->get_coltype($col_num, $col_type, undef, undef, $status) and check_fitsio($status);
    179     $inFits->read_col($col_type, $col_num, 1, 1, $numRows, 0, $col_data, undef, $status)
    180                                                                     and check_fitsio($status);
    181     $colData{$col->{name}} = $col_data;
    182     if ($col->{name} eq 'MJD-OBS') {
    183         print @{ $col_data } . "\n";
     147    else {
     148        if (defined($col->{default})) {
     149            @{ $colData{$col->{name}} } = map { $col->{default} } (0 .. $numRows - 1);
     150            next;
     151        }       
     152    }   
     153
     154    $inFits->get_colnum(0, $col->{name}, $col_num, $status);
     155    if ($status == 0) {
     156        $inFits->get_coltype($col_num, $col_type, undef, undef, $status) and check_fitsio($status);
     157        $inFits->read_col($col_type, $col_num, 1, 1, $numRows, 0, $col_data, undef, $status)
     158            and check_fitsio($status);
     159        $colData{$col->{name}} = $col_data;
     160        if ($col->{name} eq 'QUERY_ID') {
     161            print @{ $col_data } . "\n";
     162        }
     163
     164    }
     165    elsif ($status == 219) {
     166        @{ $colData{$col->{name}} } = map { "Not Set" } (0 .. $numRows - 1);
     167        $status = 0;
     168    }
     169}
     170
     171# Set things that aren't set.
     172for (my $i = 0; $i < $numRows; $i++) {
     173# Simple stuff first.
     174    my %known_filters = ();
     175    if ($colData{STAGE}[$i] eq "Not Set") {
     176        $colData{STAGE}[$i] = 'diff';
     177    }
     178    if ($colData{OBSCODE}[$i] eq "Not Set") {
     179        $colData{OBSCODE}[$i] = 566;
     180    }
     181# Define filter and MJD from FPA_ID
     182    if (($colData{FILTER}[$i] eq "Not Set")&&($colData{FPA_ID}[$i] ne "Not Set")) {
     183        if (exists($known_filters{$colData{FPA_ID}[$i]})) {
     184            $colData{FILTER}[$i] = $known_filters{$colData{FPA_ID}[$i]};
     185        }
     186        else {
     187            my $cmd = "$regtool -processedexp -dbname $dbname -exp_name $colData{FPA_ID}[$i]";
     188            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     189                run(command => $cmd, verbose => 0);
     190            unless ($success) {
     191                # This is a problem, because I'm not sure how we handle a failure to read something.
     192                # We need to return a $PSTAMP_INVALID_REQUEST, I think, but if we can't read it,
     193                # we can't send that response back.
     194                die("Unable to perform $cmd error code: $error_code");
     195            }
     196            foreach my $entry (split /\n/, (join "", @$full_buf)) {
     197                $entry =~ s/^\s+//;
     198                my @line = split /\s+/, $entry;
     199                if (scalar(@line) != 3) {
     200                    next;
     201                }
     202                my ($key,$type,$value) = @line;
     203#               print "$entry => $key / $type / $value \n";
     204                if ($key =~ /filter/i) {
     205                    $value =~ s/.00000//;
     206                    $colData{FILTER}[$i] = $value;
     207                    $known_filters{$colData{FPA_ID}[$i]} = $value;
     208                }
     209            }
     210        }
     211    }
     212    if (($colData{'MJD-OBS'}[$i] eq "Not Set")&&($colData{FPA_ID}[$i] ne "Not Set")) {
     213        # HACK!
     214        my $mjd = $colData{FPA_ID}[$i];
     215        $mjd =~ s/o(....)g.*/$1/;
     216        $mjd += 50000;
     217        $colData{'MJD-OBS'}[$i] = $mjd;
     218    }
     219    if (($colData{FPA_ID}[$i] eq "Not Set")&&(($colData{'FILTER'}[$i] ne "Not Set")&&
     220                                              ($colData{'MJD-OBS'}[$i] ne "Not Set"))) {
     221        my $dateobs_begin = mjd_to_dateobs($colData{'MJD-OBS'}[$i]);
     222        my $dateobs_end = mjd_to_dateobs($colData{'MJD-OBS'}[$i] + 1);
     223        my $ra = $colData{'RA1_DEG'}[$i];
     224        my $dec = $colData{'DEC1_DEG'}[$i];
     225        my $filter = $colData{'FILTER'}[$i] . ".00000";
     226        my $cmd = "$camtool -processedexp -dbname $dbname -filter $filter ";
     227        $cmd .= " -dateobs_begin $dateobs_begin -dateobs_end $dateobs_end ";
     228        $cmd .= " -ra $ra -decl $dec -radius 1.5 -limit 1";
     229        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     230            run(command => $cmd, verbose => 0);
     231        unless ($success) {
     232            # This is a problem, because I'm not sure how we handle a failure to read something.
     233            # We need to return a $PSTAMP_INVALID_REQUEST, I think, but if we can't read it,
     234            # we can't send that response back.
     235            die("Unable to perform $cmd error code: $error_code");
     236        }
     237        foreach my $entry (split /\n/, (join "", @$full_buf)) {
     238            $entry =~ s/^\s+//;
     239            my @line = split /\s+/, $entry;
     240            if (scalar(@line) != 3) {
     241                next;
     242            }
     243            my ($key,$type,$value) = @line;
     244#               print "$entry => $key / $type / $value \n";
     245            if ($key =~ /exp_name/i) {
     246                $colData{FPA_ID}[$i] = $value;
     247            }
     248        }
    184249    }
    185250}
     
    189254foreach my $colName (@unique_fields) {
    190255    my %counter = ();
     256    my $i = 0;
    191257    foreach my $row (@{ $colData{$colName} }) {
    192258        $counter{$row} = 1;
     
    232298        my $msg;                # Message to output
    233299        Astro::FITS::CFITSIO::fits_get_errstatus( $status , $msg );
    234         die "CFITSIO error: $msg\n";
     300        die "CFITSIO error: $status => $msg\n";
    235301    }
    236302}
     
    252318}
    253319
     320# Stolen from PStamp/Job.pm.  Thanks, Bill.
     321sub mjd_to_dateobs {
     322    my $mjd = shift;
     323
     324    my $ticks = ($mjd - 40587.0) * 86400;
     325
     326    my ($sec, $min, $hr, $day, $mon, $year) = gmtime($ticks);
     327
     328    return sprintf "'%4d-%02d-%02dT%02d:%02d:%02dZ'", $year+1900, $mon+1, $day, $hr, $min, $sec;
     329}
     330
    254331
    255332
  • branches/eam_branches/ipp-20100621/pstamp/scripts/detectability_respond.pl

    r28794 r28980  
    108108# Parse input request file using detect_query_read (as it's already written).
    109109#
    110     my $dqr_command = "$detect_query_read --input $request_file";
     110    my $dqr_command = "$detect_query_read --dbname $imagedb --input $request_file";
    111111    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    112112        run(command => $dqr_command, verbose => $verbose);
     
    308308}
    309309close(WISDOM);
     310
     311# If there is anything that needs to be updated, create the update request list, and then exit the program.
    310312my $exit_code = 0;
    311313my $update_request_file = "${workdir}/update_request.dat";
     
    316318            $exit_code = 25;
    317319        }
     320        elsif ($fault != 0) {
     321            $exit_code = 21;
     322        }
    318323        my $update_request = join ' ', @{ $update_request{$images}{$fault} };
    319324        print UPDATE_REQUEST "$update_request\n";
     
    321326}
    322327close(UPDATE_REQUEST);
    323 # if ($exit_code != 0) {
    324 #     exit($exit_code);
    325 # }
     328if ($exit_code != 0) {
     329    exit($exit_code);
     330}
    326331
    327332# This duplicates stuff returned by PSTAMP, but my thought is to convert that ---^ into a conditional, in which I read
     
    338343    }
    339344}
    340 #exit(10);
    341345
    342346# run ppCoord and psphotForced to calculate the required data.
     
    569573        $columns = [
    570574            # matching rownum from detectability original request
    571             { name => 'ROWNUM',   type => 'V', writetype => TULONG },
     575            { name => 'ROWNUM',   type => '20A', writetype => TSTRING },
    572576            # any errors that occurred during processing
    573577            { name => 'ERROR_CODE',   type => 'V', writetype => TULONG },
     
    715719#       print STDERR "$writeType $i $numRows $colName $status @{ $colData{$colName} }\n";
    716720        $outFits->write_col( $writeType, $i + 1, 1, 1, $numRows, $colData{$colName}, $status );
     721#       print "$writeType $i $numRows $colName $status\n";
    717722        check_fitsio( $status );
    718        
    719723    }
    720724    $outFits->close_file( $status );
     
    730734        my $msg;                # Message to output
    731735        Astro::FITS::CFITSIO::fits_get_errstatus( $status , $msg );
     736        carp("CFITSIO error: $status => $msg");
    732737        die "CFITSIO error: $msg\n";
    733738    }
  • branches/eam_branches/ipp-20100621/pstamp/scripts/dqueryparse.pl

    r28794 r28980  
    158158    }
    159159}
    160 else {
     160elsif ($fault == $PSTAMP_NOT_AVAILABLE) {
    161161    # Failed to run correctly, which means that we need to queue a job and flag data for updating.
    162162    # Get the dependency id for the data we're requesting be updated.
     
    191191    close(UPDATE_REQUEST);
    192192}
     193else {
     194    my_die ("Parse fault!!", $PS_EXIT_UNKNOWN_ERROR);
     195}
    193196
    194197# This does not set the request state to stop.  That will happen with the request_finish.pl script,
  • branches/eam_branches/ipp-20100621/pstamp/scripts/pstamp_checkdependent.pl

    r28794 r28980  
    147147    #       been updated we need to go and queue it.
    148148
    149     if ($it->{fault}) {
     149    if (($it->{state} ne 'cleaned') and $it->{fault}) {
    150150        my_die("Component faulted on update dep_id: $dep_id",
    151151                $PS_EXIT_SYS_ERROR);
  • branches/eam_branches/ipp-20100621/pstamp/scripts/pstamp_job_run.pl

    r28794 r28980  
    9393
    9494    $argString .= " -file $params->{image}";
    95     $argString .= " -mask $params->{mask}";
    96     my @file_list = ($params->{image}, $params->{mask});
     95    my @file_list = ($params->{image});
     96   
     97    my $nan_masked = 1;
     98    if (!$params->{magicked}) {
     99        $nan_masked = 0;
     100    }
     101    if ($nan_masked or ($options & $PSTAMP_SELECT_MASK)) {
     102        $argString .= " -mask $params->{mask}";
     103        push @file_list, $params->{mask};
     104    }
    97105    if ($options & $PSTAMP_SELECT_VARIANCE) {
    98106        $argString .= " -variance $params->{weight}";
     
    351359    foreach my $f (@_) {
    352360        if (!$ipprc->file_exists($f)) {
    353             my_die( "file $f does not exist:", $job_id, $PS_EXIT_SYS_ERROR);
     361            my_die( "file $f does not exist:", $job_id, $PSTAMP_GONE, 'stop');
    354362        }
    355363    }
     
    361369    my $job_id = shift;         # job identifier
    362370    my $exit_code = shift;      # Exit code to add
     371    my $job_state = shift;      # new pstampJob.state
    363372
    364373    $exit_code = $PS_EXIT_PROG_ERROR unless $exit_code;
     374    $job_state = 'run' unless $job_state;
    365375
    366376    carp($msg);
     
    370380        $command .= " -set_fault $exit_code";
    371381        # XXX: fix pstamptool to not require -state when -fault with nonzero value is provided
    372         $command .= " -set_state run";
     382        $command .= " -set_state $job_state";
    373383        $command .= " -dbname $dbname" if defined $dbname;
    374384        $command .= " -dbserver $dbserver" if defined $dbserver;
  • branches/eam_branches/ipp-20100621/pstamp/scripts/pstampparse.pl

    r28794 r28980  
    386386    $need_magic    = $proj_hash->{need_magic};
    387387
    388     # Temporary hack so that MOPS can get at non-magicked data
     388    # Temporary hack so that IFA can get at non-magicked data
    389389    my $allow_mops_unmagicked = 1;
    390390    if ($allow_mops_unmagicked) {
    391391        if ($product and (($product eq "mops-pstamp-results") or
    392                           ($product eq "mops-pstamp-results2"))) {
     392                          ($product eq "mops-pstamp-results2") or
     393                          ($product eq "ifa-pstamp-results"))) {
    393394            $need_magic = 0;
    394395        }
  • branches/eam_branches/ipp-20100621/pstamp/src/ppstampMakeStamp.c

    r28310 r28980  
    229229
    230230static int makeStamp(pmConfig *config, ppstampOptions *options, pmFPAfile *input,
    231                 pmChip *inChip, pmFPAview *view, pmAstromObj *center)
     231                pmChip *inChip, pmFPAview *view, pmAstromObj *center, pmFPAfile *astrom)
    232232{
    233233    int status = false;
     
    266266        srcFile = input;
    267267        *srcView = *view;
     268    }
     269
     270    if (astrom->camera != srcFile->camera) {
     271        psError(PS_ERR_UNKNOWN, true, "Input camera and astrometry camera do not match");
     272        return PS_EXIT_CONFIG_ERROR;
    268273    }
    269274
     
    583588    if (!astrom) {
    584589        astrom = input;
    585     } else if (astrom->camera != input->camera) {
    586         psError(PS_ERR_UNKNOWN, true, "Input camera and astrometry camera do not match");
    587         return PS_EXIT_CONFIG_ERROR;
    588590    }
    589591
     
    636638        case PPSTAMP_ON:
    637639        case PPSTAMP_PARTIALLY_ON:
    638             returnval = makeStamp(config, options, input, chip, view, center);
     640            returnval = makeStamp(config, options, input, chip, view, center, astrom);
    639641            allDone = true;
    640642            foundOverlap = true;
Note: See TracChangeset for help on using the changeset viewer.