Index: /branches/eam_branches/ipp-20130419/pstamp/scripts/psmkreq
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/scripts/psmkreq	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/scripts/psmkreq	(revision 35545)
@@ -1,7 +1,8 @@
 #!/bin/env perl
 ###
-### pstamprequest
+### psmkreq
 ###
-###     Program to make a postage stamp request table for a set of coordinates
+###     Program to make a postage stamp request table for a set of coordinates using supplied command
+###     line options and defaults
 ###
 
Index: /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_checkdependent.pl
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_checkdependent.pl	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_checkdependent.pl	(revision 35545)
@@ -344,4 +344,5 @@
 }
 
+if (0) {
     my $tess_id = $metadata->{tess_id};
     if ($tess_id eq 'RINGS.V0') {
@@ -349,4 +350,5 @@
         return $PSTAMP_GONE
     }
+}
     if (($state =~ /error/) or ($state =~ /purged/) or ($state =~ /scrubbed/) or ($state eq 'drop') or
          ($data_state =~ /error/) or ($data_state =~ /purged/) or ($data_state =~ /scrubbed/) or ($data_state eq 'drop')) {
Index: /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_insert_request.pl
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_insert_request.pl	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_insert_request.pl	(revision 35545)
@@ -128,6 +128,7 @@
         run(command => $command, verbose => $verbose);
     unless ($success) {
+	my $status = $error_code >> 8;
         print STDERR @$stderr_buf;
-        die("Unable to perform pstamptool -getwebrequestnum: $error_code");
+        die("Unable to perform $command: $error_code : $status");
     }
     my $webreq_num = ${$stdout_buf}[0];
Index: /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_job_run.pl
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_job_run.pl	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_job_run.pl	(revision 35545)
@@ -151,4 +151,5 @@
         } elsif ($params->{cmf}) {
             $argString .= " -write_cmf";
+            $fileArgs  .= " -sources $params->{cmf}";
             push @file_list, $params->{cmf};
         } else {
Index: /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_request_file
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_request_file	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_request_file	(revision 35545)
@@ -18,4 +18,5 @@
      $output,			# Name of output table
      $req_name, 
+     $email, 
      $help
      );
@@ -25,5 +26,6 @@
 	   'output|o=s'   => \$output,
 	   'req_name|r=s' => \$req_name,
-           'help|h'         => \$help,
+	   'email=s'      => \$email,
+           'help|h'       => \$help,
 ) or pod2usage( 2 );
 
@@ -66,4 +68,6 @@
 ];
 
+my $email_column_num = 3;
+
 # Specification of columns to write
 my $columns = [ 
@@ -165,4 +169,8 @@
     $req_name = $header->[0]->{value};
 }
+if ($email) {
+    $header->[$email_column_num]->{value} = $email;
+}
+
 
 die "no request name defined" unless defined $req_name;
@@ -302,5 +310,5 @@
 
             $$r_extver = $vals[1];
-            if ($extver > 1) {
+            if ($$r_extver > 1) {
                 die "number of header columns in input $nvals does not equal expected number of header words $nhead"
                     if (@vals != @$header);
Index: /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_server_status
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_server_status	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_server_status	(revision 35545)
@@ -65,16 +65,19 @@
 
 
+    my $serverRunning = 0;
     my $command = "$pantasks_client < $pantasks_script";
     my  ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
-    unless ($success) {
+    if ($success) {
+        $serverRunning = 1;
+    } else {
         $error_code = (($error_code >> 8) or 1);
-        if ($error_code == 12) {
-            print "Postage Stamp Server is not running\n";
+        if ($error_code == 12 || $error_code == 13) {
+            print "Postage Stamp Server is not running\n<br>";
             #print "Postage Stamp Server will be down for maintenance it will back shortly.\n";
-            exit 0;
+#            exit 0;
         } else {
-            warn("$command failed. exit status: $error_code");
-            exit $error_code;
+            warn("\nError: $command failed. exit status: $error_code\n");
+#            exit $error_code;
         }
     }
@@ -119,10 +122,10 @@
         } else {
             print STDERR "Controller state not found";
-            exit 1;
+#            exit 1;
         }
         print "$br$br\n";
-    } else {
+    } elsif ($serverRunning) {
         print STDERR "Scheduler state not found";
-        exit 1;
+#        exit 1;
     }
 
@@ -148,6 +151,6 @@
             print "Task pstamp.job.run not found.<br />\n";
         }
-    } else {
-        print "Task pstamp.request.run not found.\n";
+    } elsif ($serverRunning) {
+        print "Task pstamp.request.run not found.<br >\n";
     }
 }
Index: /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_webrequest.pl
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_webrequest.pl	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/scripts/pstamp_webrequest.pl	(revision 35545)
@@ -71,9 +71,10 @@
 }
 
-# make a request file
+# make a request file in a sub directory of the current directory
 my $cur_dir = getcwd();
 
 #print STDERR "cur_dir is $cur_dir\n";
 
+# put file in directory for the current date
 my $datestr = strftime "%Y/%m/%d", gmtime;
 my $datedir = "$cur_dir/webreq/$datestr";
Index: /branches/eam_branches/ipp-20130419/pstamp/scripts/pstampparse.pl
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/scripts/pstampparse.pl	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/scripts/pstampparse.pl	(revision 35545)
@@ -360,5 +360,6 @@
 
     my $wholefile = 0;
-    if (!$skycenter && $row->{CENTER_X} == 0 && $row->{CENTER_Y} == 0) {
+    if (($row->{WIDTH} == 0 && $row->{HEIGHT} == 0) ||
+       (!$skycenter && $row->{CENTER_X} == 0 && $row->{CENTER_Y} == 0)) {
         # Secret code for returning the whole file
         $wholefile = 1;
@@ -628,23 +629,32 @@
     my $h = $row->{HEIGHT};
     my $coord_mask = $row->{COORD_MASK};
+
     my $wholeFile = 0; 
-    if ($coord_mask & $PSTAMP_CENTER_IN_PIXELS) {
-        # Center of 0, 0 in pixel coordinates is interpreted to mean
-        # return the entire file
-        if ($x == 0 && $y == 0) {
-            $roi_string = "-wholefile";
-            $wholeFile = 1;
+    # For historical reasons there are two ways to specify that the entire file be returned 
+    # rather than a postage stamp ...
+    if ($w == 0 and $h == 0) {
+        # ... The right way: width and height both zero ...
+        $wholeFile = 1;
+    } else {
+        if ($coord_mask & $PSTAMP_CENTER_IN_PIXELS) {
+            if ($x == 0 && $y == 0) {
+                # ... and pixel coordinate center of 0, 0
+                # I made this one up without thinking through the API clearly.
+                # allowing width and height to do it works much better
+                $wholeFile = 1;
+            } else {
+                $roi_string = "-pixcenter $x $y";
+            }
         } else {
-            $roi_string = "-pixcenter $x $y";
-        }
+            $roi_string = "-skycenter $x $y";
+        }
+    }
+
+    if ($wholeFile) {
+        $roi_string = "-wholefile";
+    } elsif ($coord_mask & $PSTAMP_RANGE_IN_PIXELS) {
+            $roi_string .= " -pixrange $w $h";
     } else {
-        $roi_string = "-skycenter $x $y";
-    }
-    if (!$wholeFile) {
-        if ($coord_mask & $PSTAMP_RANGE_IN_PIXELS) {
-            $roi_string .= " -pixrange $w $h";
-        } else {
             $roi_string .= " -arcrange $w $h";
-        }
     }
 
@@ -1005,5 +1015,5 @@
     my $command = "$pstamptool -getdependent -stage $stage -stage_id $stage_id -imagedb $imagedb -component $component -outdir $outdir";
     $command .= " -need_magic" if $need_magic;
-    $command .= ' -hold' if $action eq 'PREVIEW';
+#    $command .= ' -hold' if $action eq 'PREVIEW';
 
     if ($label) {
Index: /branches/eam_branches/ipp-20130419/pstamp/src/ppstampMakeStamp.c
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/src/ppstampMakeStamp.c	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/src/ppstampMakeStamp.c	(revision 35545)
@@ -359,9 +359,11 @@
 
         if (options->writeCMF) {
-            pmReadout *astromReadout = NULL;
+            pmReadout *sourcesReadout = NULL;
             if (astrom->fpa != input->fpa) {
-                astromReadout = pmFPAviewThisReadout(srcView, astrom->fpa);
-            }
-            if (!copySources(outReadout, astromReadout, astromReadout, extractRegion)) {
+                sourcesReadout = pmFPAviewThisReadout(srcView, astrom->fpa);
+            } else {
+                sourcesReadout = readout;
+            }
+            if (!copySources(outReadout, sourcesReadout, sourcesReadout, extractRegion)) {
                 psError(PS_ERR_UNKNOWN, false, "failed to extract sources from region of interest.\n");
                 status = false;
@@ -784,4 +786,8 @@
 
     // first look for detections in the input readout. Those would have come from the -sources file
+    if (!inReadout->analysis) {
+        psLogMsg("ppstampMakeStamp", PS_LOG_WARN, "no analysis metadata found on input\n");
+        return false;
+    }
     pmDetections *inDetections = psMetadataLookupPtr (&status, inReadout->analysis, "PSPHOT.DETECTIONS");
     if (!inDetections) {
Index: /branches/eam_branches/ipp-20130419/pstamp/src/ppstampParseCamera.c
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/src/ppstampParseCamera.c	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/src/ppstampParseCamera.c	(revision 35545)
@@ -101,7 +101,7 @@
     }
     if (astrom) {
-        psLogMsg ("ppstamp", 3, "Using supplied astrometry\n");
+        psLogMsg ("ppstamp", 3, "Using supplied astrometry.\n");
     } else {
-        psLogMsg ("ppstamp", 3, "Using header astrometry\n");
+        psLogMsg ("ppstamp", 3, "Using header astrometry.\n");
     }
 
@@ -119,5 +119,5 @@
         // see if -sources file was supplied. 
         // If so define the file.
-        psPtr sourcesFile = psMetadataLookupStr(&status, config->arguments, "SOURCES");
+        psPtr sourcesFile = psMetadataLookupPtr(&status, config->arguments, "SOURCES");
         if (sourcesFile) {
             pmFPAfile *sources = pmFPAfileBindFromArgs(&status, input, config, "PPSTAMP.INPUT.SOURCES", "SOURCES");
Index: /branches/eam_branches/ipp-20130419/pstamp/src/pstampdump.c
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/src/pstampdump.c	(revision 35544)
+++ /branches/eam_branches/ipp-20130419/pstamp/src/pstampdump.c	(revision 35545)
@@ -94,4 +94,6 @@
         if (!strcmp(extname, "PS1_PS_REQUEST")) {
             psString extver = psMetadataLookupStr(NULL, header, "EXTVER");
+            psString action = psMetadataLookupStr(NULL, header, "ACTION");
+            psString email = psMetadataLookupStr(NULL, header, "EMAIL");
             if (!extver) {
                 // work around bug in MOPS request files
@@ -105,5 +107,17 @@
                 }
             }
-            printf("%s %s %s\n", extname, extver, req_name);
+            if (!strcmp(extver, "1")) {
+                printf("%s %s %s\n", extname, extver, req_name);
+            } else {
+                if (!action) {
+                    psErrorStackPrint(stderr, "failed to find action in fits header of: %s\n", fileName);
+                    return PS_EXIT_DATA_ERROR;
+                }
+                if (!email) {
+                    psErrorStackPrint(stderr, "failed to find action in fits header of: %s\n", email);
+                    return PS_EXIT_DATA_ERROR;
+                }
+                printf("%s %s %s %s %s\n", extname, extver, req_name, action, email);
+            }
         } else if (!strcmp(extname, "PS1_PS_RESULTS")) {
             psS64 req_id = psMetadataLookupS64(NULL, header, "REQ_ID");
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bycoord.norelease.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bycoord.norelease.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bycoord.norelease.txt	(revision 35545)
@@ -0,0 +1,7 @@
+#  TEST: bycoord chip
+#
+#  chip bycoord no survey or release date cuts
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+0         241.54949 55.4273   500  500   2      stamp         65         gpc1      null         null     bycoord  chip  null null     null      null       i%       55674    55697  null      0    0          |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bycoord.preview.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bycoord.preview.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bycoord.preview.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: bycoord chip
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PREVIEW null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+0         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      3PI         null     bycoord  chip  null null     null      null       i%     0        0      null      0    0    | norelease
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bycoord.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bycoord.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bycoord.txt	(revision 35545)
@@ -0,0 +1,8 @@
+#  TEST: bycoord chip. 3 different releases
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+0         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      3PI         null     bycoord  chip  null null     null      null       i%     0        0      null      0    0    | norelease
+0         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      3PI         3PI.PV1     bycoord  chip  null null     null      null       i%     0        0      null      0    0    | GR1
+0         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      3PI         3PI.nightly     bycoord  chip  null null     null      null       i%     0        0      null      0    0    | nightly
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bydiff.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bydiff.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.bydiff.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: bydiff chip
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     bydiff    chip  16124276 null null   null       i   0    0      null      0        0    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.byexp.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.byexp.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.byexp.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: byexp chip
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     byexp    chip  o6136g0055o null null   null       null   0    0      null      0        0    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.byid.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.byid.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/chip.byid.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: byid chip
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     byid    chip  723948 null null   null       null   0    0      null      0        0    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/diff.bydiff.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/diff.bydiff.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/diff.bydiff.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: bydiff diff
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 500  500      2          stamp     65         gpc1      MD08         null     bydiff    diff  16124276 null     null     null       null        0    0     null       0        0    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/diff.byid.inverse.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/diff.byid.inverse.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/diff.byid.inverse.txt	(revision 35545)
@@ -0,0 +1,8 @@
+#  TEST: byid diff
+#
+#  options mask selects inverse but first row is not bothway
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 500  500      2          stamp     1089         gpc1      MD08         null     byid    diff  261112 null     null     null       null        0    0     null       0        0    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/diff.byid.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/diff.byid.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/diff.byid.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: byid diff
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 500  500      2          stamp     65         gpc1      MD08         null     byid    diff  261112 null     null     null       null        0    0     null       0        0    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/extver.1.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/extver.1.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/extver.1.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  REQ_NAME EXTVER ACTION USERNAME EMAIL
+CHANGEME 1
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX | COMMENT
+0         241.54949 55.4273  1500  1500       2      stamp      2049      gpc1     byid    stack  875274 null   null      null       null     0      0     | sample v1 request tadpole galaxy i band
+
+
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/raw.bycoord.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/raw.bycoord.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/raw.bycoord.txt	(revision 35545)
@@ -0,0 +1,8 @@
+#  TEST: bycoord raw. 3 different releases (should get the same results)
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+0         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      3PI         null        bycoord  raw  null null     null      null       i%     0        0      null      0    0    | norelease
+0         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      3PI         3PI.PV1     bycoord  raw  null null     null      null       i%     0        0      null      0    0    | GR1
+0         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      3PI         3PI.nightly bycoord  raw  null null     null      null       i%     0        0      null      0    0    | nightly
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/raw.byexp.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/raw.byexp.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/raw.byexp.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: byexp raw
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     byexp    raw  o6136g0055o null null   null       null   0    0      null      0        0    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/raw.byid.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/raw.byid.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/raw.byid.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: byid raw
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     byid    raw  176316 null null   null       null   0    0      null      0        0    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.bycoord.3pi.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.bycoord.3pi.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.bycoord.3pi.txt	(revision 35545)
@@ -0,0 +1,7 @@
+#  stack bycoord from 3PI released
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp      2119         gpc1      3PI         null     bycoord    stack  null null   null      null       r        0      0        null      0        10    | tadpole galaxy r band
+2         241.54949 55.4273 1500  1500   2      stamp      2119         gpc1      3PI         null     bycoord    stack  null null   null      null       i        0      0        null      0        10    | tadpole galaxy i band
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.bydiff.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.bydiff.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.bydiff.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: bydiff stack
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+0         241.54949 55.4273 1500  1500   2      stamp      2113         gpc1      3PI         null     bydiff    stack  16124276 null   null      null       i        0      0        null      0        10    | 
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.byid.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.byid.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.byid.txt	(revision 35545)
@@ -0,0 +1,7 @@
+#  TEST: byid stack
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp      2113         gpc1      3PI         null     byid    stack  1422246 null   null      null       r        0      0        null      0        10    | tadpole galaxy r band
+2         241.54949 55.4273 1500  1500   2      stamp      2113         gpc1      3PI         null     byid    stack  1422346 null   null      null       i        0      0        null      0        10    | tadpole galaxy i band
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.byskycell.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.byskycell.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.byskycell.txt	(revision 35545)
@@ -0,0 +1,7 @@
+#  TEST: byid stack
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp      2113         gpc1      3PI         null     byskycell    stack  null RINGS.V3 skycell.2386.085   null       r        0      0        null      0        10    | tadpole galaxy r band
+2         241.54949 55.4273 1500  1500   2      stamp      2113         gpc1      3PI         null     byskycell    stack  null RINGS.V3 skycell.2386.085   null       i        0      0        null      0        10    | tadpole galaxy i band
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.md08.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.md08.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/stack.md08.txt	(revision 35545)
@@ -0,0 +1,10 @@
+#  stack bycoord from MD08.refstack
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP              REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp      2119         gpc1      null         null     bycoord    stack  null null   null      MD08.refstack.20130401       g        0      0        null      0        0       | tadpole galaxy g band
+2         241.54949 55.4273 1500  1500   2      stamp      2119         gpc1      null         null     bycoord    stack  null null   null      MD08.refstack.20130401       r        0      0        null      0        0       | tadpole galaxy r band
+3         241.54949 55.4273 1500  1500   2      stamp      2119         gpc1      null         null     bycoord    stack  null null   null      MD08.refstack.20130401       i        0      0        null      0        0       | tadpole galaxy i band
+4         241.54949 55.4273 1500  1500   2      stamp      2119         gpc1      null         null     bycoord    stack  null null   null      MD08.refstack.20130401       z        0      0        null      0        0       | tadpole galaxy z band
+5         241.54949 55.4273 1500  1500   2      stamp      2119         gpc1      null         null     bycoord    stack  null null   null      MD08.refstack.20130401       y        0      0        null      0        0       | tadpole galaxy y band
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/test_qub_ps_request_20130426_225546.tbl
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/test_qub_ps_request_20130426_225546.tbl	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/test_qub_ps_request_20130426_225546.tbl	(revision 35545)
@@ -0,0 +1,17 @@
+SIMPLE  =                    T / file does conform to FITS standard             BITPIX  =                    8 / number of bits per data pixel                  NAXIS   =                    0 / number of data axes                            EXTEND  =                    T / FITS dataset may contain extensions            COMMENT   FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             XTENSION= 'BINTABLE'           / binary table extension                         BITPIX  =                    8 / array data type                                NAXIS   =                    2 / number of array dimensions                     NAXIS1  =                  412 / length of dimension 1                          NAXIS2  =                   63 / length of dimension 2                          PCOUNT  =                    0 / number of group parameters                     GCOUNT  =                    1 / number of groups                               TFIELDS =                   19 / number of table fields                         TTYPE1  = 'ROWNUM  '                                                            TFORM1  = 'J       '                                                            TTYPE2  = 'CENTER_X'                                                            TFORM2  = 'D       '                                                            TTYPE3  = 'CENTER_Y'                                                            TFORM3  = 'D       '                                                            TTYPE4  = 'WIDTH   '                                                            TFORM4  = 'D       '                                                            TTYPE5  = 'HEIGHT  '                                                            TFORM5  = 'D       '                                                            TTYPE6  = 'COORD_MASK'                                                          TFORM6  = 'J       '                                                            TTYPE7  = 'JOB_TYPE'                                                            TFORM7  = '16A     '                                                            TTYPE8  = 'OPTION_MASK'                                                         TFORM8  = 'J       '                                                            TTYPE9  = 'PROJECT '                                                            TFORM9  = '16A     '                                                            TTYPE10 = 'REQ_TYPE'                                                            TFORM10 = '16A     '                                                            TTYPE11 = 'IMG_TYPE'                                                            TFORM11 = '16A     '                                                            TTYPE12 = 'ID      '                                                            TFORM12 = '16A     '                                                            TTYPE13 = 'TESS_ID '                                                            TFORM13 = '64A     '                                                            TTYPE14 = 'COMPONENT'                                                           TFORM14 = '64A     '                                                            TTYPE15 = 'LABEL   '                                                            TFORM15 = '64A     '                                                            TTYPE16 = 'REQFILT '                                                            TFORM16 = '16A     '                                                            TTYPE17 = 'MJD_MIN '                                                            TFORM17 = 'D       '                                                            TTYPE18 = 'MJD_MAX '                                                            TFORM18 = 'D       '                                                            TTYPE19 = 'COMMENT '                                                            TFORM19 = '64A     '                                                            EXTNAME = 'PS1_PS_REQUEST'     / name of this binary table extension            REQ_NAME= 'test_qub_ps_request_20130426_225546' / Postage Stamp request name    EXTVER  = '1       '           / Extension version                              HISTORY File modified by user 'bills' with fv  on 2013-04-26T13:24:49           END                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @jº7³÷@JE	èã@rÀ     @rÀ        stamp             gpc1            byid            diff            423090          MD07                                                            skycell.034                                                     null                                                            null                            1141516631523220800_56402.560_25666082_2_diff                      @jº7³÷@JE	èã@rÀ     @rÀ        stamp             gpc1            byid            stack           1964771         MD07                                                            skycell.034                                                     null                                                            null                            1141516631523220800_56402.560_25666082_2_ref                       @jº7³÷@JE	èã@rÀ     @rÀ        stamp             gpc1            byid            stack           2211920         MD07                                                            skycell.034                                                     null                                                            null                            1141516631523220800_56402.560_25666082_2_target                    @jº7œ©@JDÿ7ü§@rÀ     @rÀ        stamp             gpc1            byid            diff            427003          MD07                                                            skycell.034                                                     null                                                            null                            1141516631523220800_56408.416_25881073_81_diff                     @jº7œ©@JDÿ7ü§@rÀ     @rÀ        stamp             gpc1            byid            stack           1964705         MD07                                                            skycell.034                                                     null                                                            null                            1141516631523220800_56408.416_25881073_81_ref                      @jº7œ©@JDÿ7ü§@rÀ     @rÀ        stamp             gpc1            byid            stack           2220425         MD07                                                            skycell.034                                                     null                                                            null                            1141516631523220800_56408.416_25881073_81_target                   @jº­³T\	@JDÕ  +@rÀ     @rÀ        stamp             gpc1            byid            diff            423090          MD07                                                            skycell.034                                                     null                                                            null                            1141520081523215900_56402.560_25666082_380_diff                    @jº­³T\	@JDÕ  +@rÀ     @rÀ        stamp             gpc1            byid            stack           1964771         MD07                                                            skycell.034                                                     null                                                            null                            1141520081523215900_56402.560_25666082_380_ref                     	@jº­³T\	@JDÕ  +@rÀ     @rÀ        stamp             gpc1            byid            stack           2211920         MD07                                                            skycell.034                                                     null                                                            null                            1141520081523215900_56402.560_25666082_380_target                  
+@jº¯+Ä@JDÖª*@rÀ     @rÀ        stamp             gpc1            byid            diff            427003          MD07                                                            skycell.034                                                     null                                                            null                            1141520081523215900_56408.416_25881073_19_diff                     
+@jº¯+Ä@JDÖª*@rÀ     @rÀ        stamp             gpc1            byid            stack           1964705         MD07                                                            skycell.034                                                     null                                                            null                            1141520081523215900_56408.416_25881073_19_ref                      
+@jº¯+Ä@JDÖª*@rÀ     @rÀ        stamp             gpc1            byid            stack           2220425         MD07                                                            skycell.034                                                     null                                                            null                            1141520081523215900_56408.416_25881073_19_target                   
+@jÀR<`Û@Jdåé
+sÁ@rÀ     @rÀ        stamp             gpc1            byid            diff            423090          MD07                                                            skycell.034                                                     null                                                            null                            1141600911524717700_56402.560_25666082_300_diff                    @jÀR<`Û@Jdåé
+sÁ@rÀ     @rÀ        stamp             gpc1            byid            stack           1964771         MD07                                                            skycell.034                                                     null                                                            null                            1141600911524717700_56402.560_25666082_300_ref                     @jÀR<`Û@Jdåé
+sÁ@rÀ     @rÀ        stamp             gpc1            byid            stack           2211920         MD07                                                            skycell.034                                                     null                                                            null                            1141600911524717700_56402.560_25666082_300_target                  @jÀ *N6@Jdâox@rÀ     @rÀ        stamp             gpc1            byid            diff            427003          MD07                                                            skycell.034                                                     null                                                            null                            1141600911524717700_56408.416_25881073_101_diff                    @jÀ *N6@Jdâox@rÀ     @rÀ        stamp             gpc1            byid            stack           1964705         MD07                                                            skycell.034                                                     null                                                            null                            1141600911524717700_56408.416_25881073_101_ref                     @jÀ *N6@Jdâox@rÀ     @rÀ        stamp             gpc1            byid            stack           2220425         MD07                                                            skycell.034                                                     null                                                            null                            1141600911524717700_56408.416_25881073_101_target                  @j§ÐÅ9{@J?å@òÍ­@rÀ     @rÀ        stamp             gpc1            byid            diff            416773          MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56392.509_25353215_4_diff                      @j§ÐÅ9{@J?å@òÍ­@rÀ     @rÀ        stamp             gpc1            byid            stack           1964772         MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56392.509_25353215_4_ref                       @j§ÐÅ9{@J?å@òÍ­@rÀ     @rÀ        stamp             gpc1            byid            stack           2201969         MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56392.509_25353215_4_target                    @j§ÐÈP@J?ãZâ/@rÀ     @rÀ        stamp             gpc1            byid            diff            427003          MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56408.416_25881074_4_diff                      @j§ÐÈP@J?ãZâ/@rÀ     @rÀ        stamp             gpc1            byid            stack           1964706         MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56408.416_25881074_4_ref                       @j§ÐÈP@J?ãZâ/@rÀ     @rÀ        stamp             gpc1            byid            stack           2220426         MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56408.416_25881074_4_target                    @j§Ïù]Ç@J?çx_ó@rÀ     @rÀ        stamp             gpc1            byid            diff            423090          MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56402.560_25666083_35_diff                     @j§Ïù]Ç@J?çx_ó@rÀ     @rÀ        stamp             gpc1            byid            stack           1964772         MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56402.560_25666083_35_ref                      @j§Ïù]Ç@J?çx_ó@rÀ     @rÀ        stamp             gpc1            byid            stack           2211921         MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56402.560_25666083_35_target                   
+@j§Ñ|[w(@J?ãBV@rÀ     @rÀ        stamp             gpc1            byid            diff            419665          MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56397.431_25498242_17_diff                     
+@j§Ñ|[w(@J?ãBV@rÀ     @rÀ        stamp             gpc1            byid            stack           1964772         MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56397.431_25498242_17_ref                      
+@j§Ñ|[w(@J?ãBV@rÀ     @rÀ        stamp             gpc1            byid            stack           2204406         MD07                                                            skycell.035                                                     null                                                            null                            1141258611522957000_56397.431_25498242_17_target                   @jaô¶Æ!@J[ì7Íö[@rÀ     @rÀ        stamp             gpc1            byid            diff            419665          MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56397.431_25498242_49_diff                      @jaô¶Æ!@J[ì7Íö[@rÀ     @rÀ        stamp             gpc1            byid            stack           1964772         MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56397.431_25498242_49_ref                      !@jaô¶Æ!@J[ì7Íö[@rÀ     @rÀ        stamp             gpc1            byid            stack           2204406         MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56397.431_25498242_49_target                   "@jaÑ7Ù8@J[ëxy|@rÀ     @rÀ        stamp             gpc1            byid            diff            427003          MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56408.416_25881074_25_diff                     #@jaÑ7Ù8@J[ëxy|@rÀ     @rÀ        stamp             gpc1            byid            stack           1964706         MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56408.416_25881074_25_ref                      $@jaÑ7Ù8@J[ëxy|@rÀ     @rÀ        stamp             gpc1            byid            stack           2220426         MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56408.416_25881074_25_target                   %@j`ÿ$SŸ@J[éÑV{@rÀ     @rÀ        stamp             gpc1            byid            diff            424459          MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56404.546_25741368_14_diff                     &@j`ÿ$SŸ@J[éÑV{@rÀ     @rÀ        stamp             gpc1            byid            stack           1964772         MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56404.546_25741368_14_ref                      '@j`ÿ$SŸ@J[éÑV{@rÀ     @rÀ        stamp             gpc1            byid            stack           2212743         MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56404.546_25741368_14_target                   (@j`ÞJc@J[éD+£=@rÀ     @rÀ        stamp             gpc1            byid            diff            423090          MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56402.560_25666083_34_diff                     )@j`ÞJc@J[éD+£=@rÀ     @rÀ        stamp             gpc1            byid            stack           1964772         MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56402.560_25666083_34_ref                      *@j`ÞJc@J[éD+£=@rÀ     @rÀ        stamp             gpc1            byid            stack           2211921         MD07                                                            skycell.035                                                     null                                                            null                            1141125361524305300_56402.560_25666083_34_target                   +@jq^PTxá@JX±óvI
+@rÀ     @rÀ        stamp             gpc1            byid            diff            410657          MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56383.565_25053115_30_diff                     ,@jq^PTxá@JX±óvI
+@rÀ     @rÀ        stamp             gpc1            byid            stack           1964774         MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56383.565_25053115_30_ref                      -@jq^PTxá@JX±óvI
+@rÀ     @rÀ        stamp             gpc1            byid            stack           2196005         MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56383.565_25053115_30_target                   .@jq_d`
+k@JX³(:;@rÀ     @rÀ        stamp             gpc1            byid            diff            427003          MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56408.416_25881076_37_diff                     /@jq_d`
+k@JX³(:;@rÀ     @rÀ        stamp             gpc1            byid            stack           1964708         MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56408.416_25881076_37_ref                      0@jq_d`
+k@JX³(:;@rÀ     @rÀ        stamp             gpc1            byid            stack           2220428         MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56408.416_25881076_37_target                   1@jq]i(Š@JX®k<Ú@rÀ     @rÀ        stamp             gpc1            byid            diff            424459          MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56404.546_25741370_9_diff                      2@jq]i(Š@JX®k<Ú@rÀ     @rÀ        stamp             gpc1            byid            stack           1964774         MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56404.546_25741370_9_ref                       3@jq]i(Š@JX®k<Ú@rÀ     @rÀ        stamp             gpc1            byid            stack           2212745         MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56404.546_25741370_9_target                    4@jq^·]@JX°k¶@rÀ     @rÀ        stamp             gpc1            byid            diff            423090          MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56402.560_25666085_42_diff                     5@jq^·]@JX°k¶@rÀ     @rÀ        stamp             gpc1            byid            stack           1964774         MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56402.560_25666085_42_ref                      6@jq^·]@JX°k¶@rÀ     @rÀ        stamp             gpc1            byid            stack           2211923         MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56402.560_25666085_42_target                   7@jq^÷ÉT(@JXŽí*H@rÀ     @rÀ        stamp             gpc1            byid            diff            419665          MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56397.431_25498244_45_diff                     8@jq^÷ÉT(@JXŽí*H@rÀ     @rÀ        stamp             gpc1            byid            stack           1964774         MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56397.431_25498244_45_ref                      9@jq^÷ÉT(@JXŽí*H@rÀ     @rÀ        stamp             gpc1            byid            stack           2204408         MD07                                                            skycell.037                                                     null                                                            null                            1140610261524134500_56397.431_25498244_45_target                   :@já<;@Ju£œIß@rÀ     @rÀ        stamp             gpc1            byid            diff            422486          MD07                                                            skycell.042                                                     null                                                            null                            1142009271525508600_56401.503_25632812_13_diff                     ;@já<;@Ju£œIß@rÀ     @rÀ        stamp             gpc1            byid            stack           1964910         MD07                                                            skycell.042                                                     null                                                            null                            1142009271525508600_56401.503_25632812_13_ref                      <@já<;@Ju£œIß@rÀ     @rÀ        stamp             gpc1            byid            stack           2210439         MD07                                                            skycell.042                                                     null                                                            null                            1142009271525508600_56401.503_25632812_13_target                   =@já;µÐ@Ju£ÐÞ@rÀ     @rÀ        stamp             gpc1            byid            diff            427003          MD07                                                            skycell.042                                                     null                                                            null                            1142009271525508600_56408.416_25881079_7_diff                      >@já;µÐ@Ju£ÐÞ@rÀ     @rÀ        stamp             gpc1            byid            stack           1964712         MD07                                                            skycell.042                                                     null                                                            null                            1142009271525508600_56408.416_25881079_7_ref                       ?@já;µÐ@Ju£ÐÞ@rÀ     @rÀ        stamp             gpc1            byid            stack           2220432         MD07                                                            skycell.042                                                     null                                                            null                            1142009271525508600_56408.416_25881079_7_target                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/tests_todo
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/tests_todo	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/tests_todo	(revision 35545)
@@ -0,0 +1,10 @@
+each img_type
+each req_type
+        make a request using each of the modes
+        add qualifiers
+    test options
+    test using data from various epochs
+    test coordinates that are outside of the selected image to insure error code is ok
+both request versions
+a few samples were done
+
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.bycoord.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.bycoord.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.bycoord.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: bycoord warp
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     bycoord    warp  null null null   null       i   56136    56137      null      0        10    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.bycoord.wrongskycell.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.bycoord.wrongskycell.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.bycoord.wrongskycell.txt	(revision 35545)
@@ -0,0 +1,7 @@
+#  TEST: bycoord warp coordinates do not match skycell_id 
+#  should get no overlap error
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     bycoord    warp  null null skycell.065   null       i   56136    56137      null      0        10    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.bydiff.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.bydiff.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.bydiff.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: bydiff stack
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     bydiff    warp  16124276 null null   null       i   0    0      null      0        10    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byexp.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byexp.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byexp.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: byid stack
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     byid    warp  471197 null null   null       i   0    0      null      0        10    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byid.noverlap.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byid.noverlap.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byid.noverlap.txt	(revision 35545)
@@ -0,0 +1,9 @@
+#  TEST: byid warp no overlap. Coordinates are in skycell.065 not the
+#  requested skycell.066.
+#  Note that this causes a job to be queued even though the result is going to
+#  be PSTAMP_NO_OVERLAP
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         242.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     byid    warp  471197 null skycell.066   null       i   0    0      null      0        0    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byid.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byid.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byid.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: byexp warp
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     byexp    warp  o6136g0055o null null   null       i   0    0      null      0        10    |
Index: /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byskycell.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byskycell.txt	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/gpc1/warp.byskycell.txt	(revision 35545)
@@ -0,0 +1,6 @@
+#  TEST: byskycell warp
+#
+#  REQ_NAME EXTVER ACTION EMAIL
+CHANGEME 2 PROCESS null
+#  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT
+1         241.54949 55.4273 1500  1500   2      stamp         65         gpc1      MD08         null     byskycell    warp  null MD08.V3 skycell.066   null       i   56136    56137      null      0        10    | tadpole galaxy i band
Index: /branches/eam_branches/ipp-20130419/pstamp/test/maketestreq
===================================================================
--- /branches/eam_branches/ipp-20130419/pstamp/test/maketestreq	(revision 35545)
+++ /branches/eam_branches/ipp-20130419/pstamp/test/maketestreq	(revision 35545)
@@ -0,0 +1,143 @@
+#!/bin/env perl
+###
+### maketest
+###
+###     Program to take a text format postage stamp request specification
+###     and generate a postage stamp request fits file and optionally submit it for processing
+###
+
+use warnings;
+use strict;
+
+use Getopt::Long qw( GetOptions ) ; # :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+use PS::IPP::Config qw( :standard );
+use PS::IPP::PStamp::RequestFile qw( :standard );
+use PS::IPP::PStamp::Job qw( :standard );
+use File::Temp qw(tempfile);
+use File::Basename qw(basename);
+use IPC::Cmd 0.36 qw( can_run run );
+use Carp;
+use POSIX;
+
+my $missing_tools;
+my $pstamp_request_file  = can_run('pstamp_request_file')  or (warn "Can't find required program pstamp_request_file"  and $missing_tools = 1);
+my $pstamptool  = can_run('pstamptool')  or (warn "Can't find required program pstamptool"  and $missing_tools = 1);
+my $pstampdump  = can_run('pstampdump')  or (warn "Can't find required program pstampdump"  and $missing_tools = 1);
+if ($missing_tools) {
+    warn("Can't find required tools.");
+    exit ($PS_EXIT_CONFIG_ERROR);
+}
+
+# XXX: get these from site.config
+$pstamptool .= " -dbserver ippc19 -dbname ippRequestServer";
+
+
+my ($input, $submit, $listfile, $delete, $simple, $tag_req_name, $req_name, $email);
+my ($save_temps, $verbose);
+
+my $req_name_base = 'test.';
+my $label = 'TEST';
+my $outdir = $ENV{PWD};
+
+GetOptions(
+    'input|i=s'         => \$input,
+    'outdir=s'          => \$outdir,
+    'submit|s'          => \$submit,
+    'req_name=s'        => \$req_name,
+    'req_name_base=s'   => \$req_name_base,
+    'tag_req_name'      => \$tag_req_name,
+    'label=s'           => \$label,
+    'email=s'           => \$email,
+
+    'listfile|l'        => \$listfile,
+    'simple'            => \$simple,
+    'delete'            => \$delete,        # delete request file (after listing perhaps disabled if $submit
+
+    'verbose|v'         => \$verbose,
+    'save-temps'        => \$save_temps,
+) or pod2usage(2);
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+
+pod2usage( -msg => "Required options: --input") 
+    unless (defined $input) ;
+pod2usage( -msg => "Required options: --req_name or --req_name_base") 
+    unless (defined $req_name or defined $req_name_base);
+
+die ("Input file $input not found\n") unless (-e $input);
+die ("Input file $input not readable\n") unless (-r $input);
+
+# if request name was not supplied make one
+if (!$req_name) {
+    if ($tag_req_name) {
+        # use the input file name with .txt removed as the tag
+        my $tag = $input;
+        $tag =~ s/\.txt$//;
+        $req_name_base = "$req_name_base$tag.";
+    }
+    my $datestr = strftime "%Y%m%dT%H%M%S", gmtime;
+    $req_name .= $req_name_base . $datestr;
+}
+
+my $table_extension = 'tbl';
+
+if (! ($outdir =~ /^\//) ) {
+    # turn relative path into absolute
+    $outdir = $ENV{PWD} . "/$outdir";
+}
+
+my $request_file_name = "$outdir/$req_name.$table_extension";
+
+# build the request fits table
+{
+    my $command = "$pstamp_request_file --input $input --output $request_file_name";
+    $command .= " --req_name $req_name" if $req_name;
+    $command .= " --email $email" if $email;
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        print STDERR @$stderr_buf;
+        exit $error_code >> 8;
+    }
+}
+die ("cannot find request file $request_file_name\n") unless -e $request_file_name;
+
+# optionally use pstampdump to show the contents of the request file
+if ($listfile) {
+    my $command = "$pstampdump -header $request_file_name";
+    $command .= " -simple" if $simple;
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        print STDERR @$stderr_buf;
+        exit $error_code >> 8;
+    }
+    print join "", @$stdout_buf;
+}
+
+# optionally submit the request by adding it to the database.
+# Note that once the request has been processed the request file is copied to the postage stamp working
+# directories so these files may be deleted.
+if ($submit) {
+    my $command = "$pstamptool -addreq -uri $request_file_name -label $label";
+    $command .= " -username $email" if $email;
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        print STDERR @$stderr_buf;
+        exit $error_code >> 8;
+    }
+    my $output = join "", @$stdout_buf;
+    print "RequestFile $request_file_name submitted. req_id $output";
+} else {
+    # we aren't submitting the file that we just built
+    # optionally delete it
+    if ($delete) {
+        unlink $request_file_name or die "failed to delete request file $request_file_name\n";
+    } else {
+        print "RequestFile $request_file_name\n";
+    }
+}
+
+exit 0;
