Index: /branches/pap_mops/ippScripts/scripts/publish_file.pl
===================================================================
--- /branches/pap_mops/ippScripts/scripts/publish_file.pl	(revision 25201)
+++ /branches/pap_mops/ippScripts/scripts/publish_file.pl	(revision 25202)
@@ -79,9 +79,5 @@
 
 # Retrieve file name of interest
-my %files;                      # Input filenames
-my %zp;                         # Zero points
-my %exp_id;                     # Exposure identifiers
-my %exp_name;                   # Exposure names
-my %direction;                  # Direction of subtraction
+my %data;                       # Data to publish
 {
     my $command;                # Command to run
@@ -116,27 +112,49 @@
             my $skycell_id = $comp->{skycell_id};
 
-            # Positive direction
-            $files{"$skycell_id.pos"} = $ipprc->filename( "PPSUB.OUTPUT.SOURCES", $path_base );
-            $zp{"$skycell_id.pos"} = $zp;
-            $exp_id{"$skycell_id.pos"} = $comp->{exp_id_1};
-            $exp_name{"$skycell_id.pos"} = $comp->{exp_name_1};
-            $direction{"$skycell_id.pos"} = 1;
+            my $data = { filename => $ipprc->filename( "PPSUB.OUTPUT.SOURCES", $path_base ),
+                         zp => $zp,
+                         zp_err => $comp->{zpt_stdev},
+                         astrom => sqrt($comp->{sigma_ra_1}**2 + $comp->{sigma_dec_1}**2),
+                         exp_name => $comp->{exp_name_1},
+                         exp_id => $comp->{exp_id_1},
+                         chip_id => $comp->{chip_id_1},
+                         cam_id => $comp->{cam_id_1},
+                         fake_id => $comp->{fake_id_1},
+                         warp_id => $comp->{warp1},
+                         direction => 1,
+                     };
+
+            $data{"$skycell_id.pos"} = $data;
 
             # Negative direction
             if (defined $comp->{bothways} and $comp->{bothways}) {
-                $files{"$skycell_id.neg"} = $ipprc->filename( "PPSUB.INVERSE.SOURCES", $path_base );
-                $zp{"$skycell_id.neg"} = $zp;
-                $exp_id{"$skycell_id.neg"} = $comp->{exp_id_2};
-                $direction{"$skycell_id.neg"} = 0;
-                $exp_name{"$skycell_id.neg"} = $comp->{exp_name_2};
+                my $data = { filename => $ipprc->filename( "PPSUB.OUTPUT.SOURCES", $path_base ),
+                             zp => $zp,
+                             zp_err => $comp->{zpt_stdev},
+                             astrom => sqrt($comp->{sigma_ra_2}**2 + $comp->{sigma_dec_2}**2),
+                             exp_name => $comp->{exp_name_2},
+                             exp_id => $comp->{exp_id_2},
+                             chip_id => $comp->{chip_id_2},
+                             cam_id => $comp->{cam_id_2},
+                             fake_id => $comp->{fake_id_2},
+                             warp_id => $comp->{warp2},
+                             direction => 0,
+                         };
+
+                $data{"$skycell_id.neg"} = $data;
             }
-
         } elsif ($stage eq 'camera') {
+            my $data = { filename => $ipprc->filename( "PSASTRO.OUTPUT", $path_base ),
+                         zp => $zp,
+                         zp_err => $comp->{zpt_stdev},
+                         astrom => sqrt($comp->{sigma_ra_2}**2 + $comp->{sigma_dec_2}**2),
+                         exp_name => $comp->{exp_name},
+                         exp_id => $comp->{exp_id},
+                         chip_id => $comp->{chip_id},
+                         cam_id => $comp->{cam_id},
+                     };
+
             my $cam_id = $comp->{cam_id};
-            $files{$cam_id} = $ipprc->filename( "PSASTRO.OUTPUT", $path_base );
-            $zp{$cam_id} = $zp;
-            $exp_id{$cam_id} = $comp->{exp_id};
-            $exp_name{$cam_id} = $comp->{exp_name};
-            $direction{$cam_id} = 1;
+            $data{"cam.$cam_id"} = $data;
         }
     }
@@ -147,13 +165,33 @@
 
 # Process each file
-foreach my $comp ( keys %files ) {
-    my $file = $ipprc->file_resolve( $files{$comp} ) or
+my ($zp, $zp_err, $astrom, $exp_name, $exp_id, $chip_id, $cam_id, $fake_id, $warp_id, $direction);
+foreach my $comp ( keys %data ) {
+    my $data = $data{$comp};
+    my $file = $ipprc->file_resolve( $data->{filename} ) or
         &my_die("Unable to resolve file $files{$comp}", $pub_id, $PS_EXIT_SYS_ERROR);
     my_die("Unable to find file $file", $pub_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $file );
 
-    my $zp = $zp{$comp};
-    my $exp_id = $exp_id{$comp};
-    my $exp_name = $exp_name{$comp};
-    my $direction = $direction{$comp};
+    $zp = $data->{zp} unless defined $zp;
+    $zp_err = $data->{zp_err} unless defined $zp_err;
+    $astrom = $data->{astrom} unless defined $astrom;
+    $exp_name = $data->{exp_name} unless defined $exp_name;
+    $exp_id = $data->{exp_id} unless defined $exp_id;
+    $chip_id = $data->{chip_id} unless defined $chip_id;
+    $cam_id = $data->{cam_id} unless defined $cam_id;
+    $fake_id = $data->{fake_id} unless defined $fake_id;
+    $warp_id = $data->{warp_id} unless defined $warp_id;
+    $direction = $data->{direction} unless defined $direction;
+
+    &my_die("zp value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $zp and $zp != $data->{zp};
+    &my_die("zp_err value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $zp_err and $zp_err != $data->{zp_err};
+    &my_die("astrom value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $astrom and $astrom != $data->{astrom};
+    &my_die("exp_name value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $exp_name and $exp_name ne $data->{exp_name};
+    &my_die("exp_id value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $exp_id and $zp != $data->{exp_id};
+    &my_die("chip_id value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $chip_id and $chip_id != $data->{chip_id};
+    &my_die("cam_id value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $cam_id and $cam_id != $data->{cam_id};
+    &my_die("fake_id value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $fake_id and $fake_id != $data->{fake_id};
+    &my_die("warp_id value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $warp_id and $warp_id != $data->{warp_id};
+    &my_die("direction value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $direction and $direction != $data->{direction};
+
     if ($product eq "IPP-MOPS") {
         my $outuri = "$outroot.$comp.fits";
