IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 3, 2013, 4:01:29 PM (13 years ago)
Author:
bills
Message:

Changes for version 2 of the postage stamp request specification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/psmkreq

    r34611 r35353  
    2828my ($ra, $dec, $x, $y, $list, $output, $req_name, $req_name_base);
    2929
    30 my ($image, $mask, $variance, $cmf, $psf, $backmdl, $inverse);
    31 my ($unconvolved, $use_imfile_id, $no_wait);
     30my ($image, $mask, $variance, $jpeg, $cmf, $psf, $backmdl, $inverse);
     31my ($convolved, $unconvolved, $uncompressed, $use_imfile_id, $no_wait);
     32
     33# new header keywords for version 2
     34my $action = 'PROCESS';
     35my $email = 'null';
    3236
    3337my $default_size = 100;
     
    5256my $comment;
    5357
     58# new request specification columns for version 2
     59my $survey_name ='null';
     60my $release_name = 'null';
     61my $run_type ='null';
     62my $fwhm_min = 0;
     63my $fwhm_max = 0;
     64
     65
    5466my $missing_tools;
    5567my $pstamp_request_file  = can_run('pstamp_request_file')  or (warn "Can't find required program pstamp_request_file"  and $missing_tools = 1);
     
    6274GetOptions(
    6375    'list=s'            => \$list,          # list of coordinates if undef ra and dec or x and y are required
    64     'ra=s'              => \$ra,            #
     76    'ra=s'              => \$ra,
    6577    'dec=s'             => \$dec,
    6678    'x=s'               => \$x,
     
    8799    'comment=s'         => \$comment,
    88100
     101    'survey=s'          => \$survey_name,
     102    'release=s'         => \$release_name,
     103    'run_type=s'        => \$run_type,
     104    'fwhm_min=s'        => \$fwhm_min,
     105    'fwhm_max=s'        => \$fwhm_max,
     106
    89107    'option_mask=i'     => \$option_mask,
    90108    'image'             => \$image,
    91109    'mask'              => \$mask,
     110    'jpeg'              => \$jpeg,
    92111    'variance'          => \$variance,
    93112    'cmf'               => \$cmf,
     
    96115    'inverse'           => \$inverse,
    97116    'unconvolved'       => \$unconvolved,
     117    'convolved'         => \$convolved,
     118    'uncompressed'      => \$uncompressed,
    98119    'use_imfile_id'     => \$use_imfile_id,
    99120    'do_not_wait'       => \$no_wait,
     121
     122    'action=s'          => \$action,
     123    'email=s'           => \$email,
    100124
    101125    'verbose'           => \$verbose,
     
    156180}
    157181
     182if ($stage eq 'stack') {
     183    # default is to do convolved stack
     184    unless (defined $option_mask || $convolved) {
     185        $unconvolved = 1;
     186    }
     187}
     188
    158189checkFilter($filter, 'null', $filter)  if $filter;
    159190checkMJD($mjd_min, 0, "") if $mjd_min;
     
    167198        $option_mask |= $PSTAMP_SELECT_MASK     if $mask;
    168199        $option_mask |= $PSTAMP_SELECT_VARIANCE if $variance;
     200        $option_mask |= $PSTAMP_SELECT_JPEG     if $jpeg;
     201
     202        # if no image was requested make a stamp of the image
    169203        $option_mask = $PSTAMP_SELECT_IMAGE    if $option_mask == 0;
    170204
    171         # if no image was requested make a stamp of the image
    172205
    173206        $option_mask |= $PSTAMP_SELECT_CMF      if $cmf;
     
    207240} else {
    208241    $rows = [];
    209     push @$rows, buildRow("", $comment, $x, $y, $filter, $mjd_min, $mjd_max);
     242    push @$rows, buildRow("", $comment, 1, $x, $y, $filter, $mjd_min, $mjd_max);
    210243}
    211244
    212245my ($tdf, $table_def_name) = tempfile ("/tmp/tabledef.XXXX", UNLINK => !$save_temps);
    213 print $tdf "$req_name 1\n";
     246my $line = "$req_name 2 $action $email";
     247print "$line\n" if $verbose;
     248print $tdf "$line\n";
    214249my $rownum = 0;
    215250foreach my $row (@$rows) {
    216251    $rownum++;
    217252    my $line = "$rownum $row->{ra}\t$row->{dec}\t$width $height"
    218         . " $coord_mask $job_type $option_mask $project $req_type"
     253        . " $coord_mask $job_type $option_mask $project $survey_name $release_name $req_type"
    219254        . " $stage $id $tess_id $component $data_group"
    220         . " $row->{filter} $row->{mjd_min} $row->{mjd_max}";
     255        . " $row->{filter} $row->{mjd_min} $row->{mjd_max} $run_type $fwhm_min $fwhm_max";
    221256
    222257    if ($row->{comment} and $row->{comment} ne '') {
     
    235270    $command .= " --output $output" if $output;
    236271    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    237         run(command => $command, verbose => 0);
     272        run(command => $command, verbose => $verbose);
    238273    unless ($success) {
    239274        print STDERR @$stderr_buf;
     
    274309
    275310    my $row = {};
    276     $row->{ra}      = checkRA($vals[0], $linenumber);
    277     $row->{dec}     = checkDEC($vals[1], $linenumber);
    278     $row->{filter}  = checkFilter($vals[2], $filter, $linenumber);
    279     $row->{mjd_min} = checkMJD($vals[3], $mjd_min, $linenumber);;
    280     $row->{mjd_max} = checkMJD($vals[4], $mjd_max, $linenumber);;
     311    $row->{rownum}  = checkRownum($vals[0], $linenumber);
     312    $row->{ra}      = checkRA($vals[1], $linenumber);
     313    $row->{dec}     = checkDEC($vals[2], $linenumber);
     314    $row->{filter}  = checkFilter($vals[3], $filter, $linenumber);
     315    $row->{mjd_min} = checkMJD($vals[4], $mjd_min, $linenumber);;
     316    $row->{mjd_max} = checkMJD($vals[5], $mjd_max, $linenumber);;
    281317    $row->{comment} = $comment;
    282318
     
    305341    my $linenumber = shift;
    306342
    307     my $result;
     343   my $result;
    308344    if ($c =~ /\:/) {
    309345        # sexagesmial format not valid for pixel coordinates
     
    329365}
    330366
     367sub checkRownum {
     368    my $rownum = shift;
     369    my $linenumber = shift;
     370    die "rownum can not be null at $linenumber\n" unless defined $rownum;
     371
     372    # XXX: For now just check that rownum is defined and a single word
     373    # extend this. Should we require a number?
     374    my @words = split " ", $rownum;
     375    die "$rownum is not a vaild rownum at $linenumber\n" unless (scalar @words) == 1;
     376}
     377
    331378sub checkRA {
    332379    my $ra = shift;
     
    335382
    336383    if ($ra =~ /\:/) {
     384        # assume RA is in hours:minutes:seconds
    337385        return $checked * 360. / 24.;
    338386    } else {
Note: See TracChangeset for help on using the changeset viewer.