IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35398 for trunk/pstamp/scripts


Ignore:
Timestamp:
Apr 12, 2013, 11:03:47 AM (13 years ago)
Author:
bills
Message:

If user specifies RELEASE_NAME or SURVEY use releasetool
to look up images.
When sources are selected extract them from the region of interest
using ppstamp. Use skycal cmf if available.

Location:
trunk/pstamp/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstamp_job_run.pl

    r33512 r35398  
    113113
    114114    if ($stage eq "raw") {
     115        # zap options that don't apply to raw stage
    115116        $options &= ~($PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE);
    116117    }
     
    136137        $argString .= " -astrom $params->{astrom}";
    137138        push @file_list, $params->{astrom};
     139    }
     140
     141    if ($options & $PSTAMP_SELECT_SOURCES) {
     142        # Extract sources from astrometry file if provided. This will be the smf for chip stage
     143        # or the skycal cmf for stacks
     144        if ($params->{astrom}) {
     145            $argString .= " -write_cmf";
     146            if ($stage eq 'stack') {
     147                # Set psphot recipe to STACKPHOT so that the extended source paramters will
     148                # be copied from the cmf file.
     149                $argString .= " -recipe PSPHOT STACKPHOT"
     150            }
     151        } elsif ($params->{cmf}) {
     152            $argString .= " -write_cmf";
     153            push @file_list, $params->{cmf};
     154        } else {
     155            print "Could not find suitable sources file will not write cmf\n";
     156        }
    138157    }
    139158
     
    254273                           $PSTAMP_SELECT_MASK     => "mk.fits",
    255274                           $PSTAMP_SELECT_VARIANCE => "wt.fits",
     275                           $PSTAMP_SELECT_SOURCES  => "cmf",
    256276                           $PSTAMP_SELECT_JPEG     => "jpg");
    257277
    258         my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE | $PSTAMP_SELECT_JPEG);
     278        my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE | $PSTAMP_SELECT_JPEG | $PSTAMP_SELECT_SOURCES);
    259279
    260280        foreach my $key (keys (%extensions)) {
     
    400420        my $pattern_file = $params->{pattern} if ($options & $PSTAMP_SELECT_BACKMDL);
    401421        my $cmf_file;
    402         if ($stage ne 'chip') {
    403             # we don't ship chip stage cmf files because they may not be censored
    404             $cmf_file = $params->{cmf} if ($options & $PSTAMP_SELECT_CMF);
    405         }
     422#        if ($stage ne 'chip') {
     423#            # we don't ship chip stage cmf files because they may not be censored
     424#            $cmf_file = $params->{cmf} if ($options & $PSTAMP_SELECT_CMF);
     425#        }
    406426
    407427        my $outdir = dirname($output_base);
  • trunk/pstamp/scripts/pstampparse.pl

    r35384 r35398  
    2727my $outdir;
    2828my $product;
    29 my $label;
     29my $label = "";
    3030my $save_temps;
    3131my $no_update;
     
    5757    die "outdir is required"  if !$outdir;
    5858    die "product is required"  if !$product;
     59} else {
     60    $req_id = 0;
     61    $outdir = "nowhere";
     62    $product = "dummy";
    5963}
    6064
     
    8387$pstamptool .= " -dbserver $dbserver" if $dbserver;
    8488
    85 # list_job is a deugging mode
    86 $no_update = 1 if $mode eq "list_job";
     89# If $mode is not queue_job we are using a debugging mode
     90# do not update the database
     91$no_update = 1 if $mode ne "queue_job";
    8792
    8893my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    8994
    9095#
    91 # get the data from the extension header
     96# Read the keywords from the extension header
    9297#
    9398my $fields_output;
     
    96101    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    97102        run(command => $command, verbose => $verbose);
    98     # fields doesn't return zero when it succeeds
    99     #unless ($success) {
    100     #    print STDERR @$stderr_buf;
    101     #}
     103
     104    # note fields doesn't return zero when it succeeds.
    102105    $fields_output = join "", @$stdout_buf;
    103106}
     
    105108
    106109# make sure the file contains what we are expecting
    107 # This program shouldn't have been run if the request file is bogus.
    108 my_die("$request_file_name is not a PS1_PS_REQEST", $PS_EXIT_PROG_ERROR) if $extname ne "PS1_PS_REQUEST";
    109 my_die("REQ_NAME not found in $request_file_name", $PS_EXIT_PROG_ERROR)  if (!$req_name);
    110 my_die("wrong EXTVER $extver found in $request_file_name", $PS_EXIT_PROG_ERROR) if ($extver ne "1" and $extver ne "2");
     110# pstamp_parser_run.pl would not have run this program unless the request file was ok
     111my_die("$request_file_name does not contain EXTNAME\n", $PS_EXIT_PROG_ERROR) if !$extname;
     112my_die("$request_file_name is not a PS1_PS_REQUEST\n", $PS_EXIT_PROG_ERROR) if $extname ne "PS1_PS_REQUEST";
     113my_die("REQ_NAME not found in $request_file_name\n", $PS_EXIT_PROG_ERROR)  if (!$req_name);
     114my_die("wrong EXTVER $extver found in $request_file_name\n", $PS_EXIT_PROG_ERROR) if ($extver ne "1" and $extver ne "2");
    111115
    112116if ($extver >= 2) {
    113117    # We have a version 2 file. Require that the new keywords be supplied.
    114     my_die("action not supplied in version $extver request file $request_file_name", $PSTAMP_INVALID_REQUEST) unless defined $action;
    115 
    116     my_die("invalid action: $action supplied in version $extver request file $request_file_name", $PSTAMP_INVALID_REQUEST) unless (uc($action) eq 'PROCESS' or uc($action) eq 'PREVIEW');
    117 
    118     my_die("email not supplied in version $extver request file $request_file_name", $PSTAMP_INVALID_REQUEST) unless $email;
     118    my_die("action not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless defined $action;
     119
     120    my_die("invalid action: $action supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless (uc($action) eq 'PROCESS' or uc($action) eq 'PREVIEW');
     121
     122    my_die("email not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless $email;
    119123    # XXX check for "valid" $email
    120124} else {
     
    437441    # Since user can get unmagicked data "by coordinate" requests can go back in time
    438442    # to dredge unusable data from the "dark days"...
    439     if ($req_type eq 'bycoord' and $row->{MJD_MIN} == 0) {
     443    if ($req_type eq 'bycoord' and $row->{IMG_TYPE} ne 'stack' and $row->{MJD_MIN} == 0) {
    440444        # ... so unless the user sets mjd_min clamp it to 2009-04-01
    441445        # XXX: This value should live in the pstampProject table not be hardcoded here
     
    454458    print "\nCalling new_locate_images for row: $rownum\n";
    455459
    456     $imageList = new_locate_images($ipprc, $image_db, $camera, $row, $verbose);
     460    $imageList = locate_images_for_row($ipprc, $image_db, $camera, $row, $verbose);
    457461
    458462    my $dtime_locate = gettimeofday() - $start_locate;
     
    736740
    737741    if ($mode eq "list_uri") {
     742        $num_jobs = $imageList ? scalar @$imageList : 0;
     743        print "List of $num_jobs Images selected for row: $firstRow->{ROWNUM}\n";
    738744        foreach my $image (@$imageList) {
    739745            print "$image->{image}\n";
     746            ++$firstRow->{job_num};
    740747        }
    741748    } elsif ($job_type eq "get_image") {
     
    11561163    my $fault = shift;
    11571164
    1158     carp $msg;
     1165    print STDERR $msg;
    11591166
    11601167    # we don't fault the request here pstamp_parser_run.pl handles that if necessary
Note: See TracChangeset for help on using the changeset viewer.