Index: trunk/tools/listcmf
===================================================================
--- trunk/tools/listcmf	(revision 33938)
+++ trunk/tools/listcmf	(revision 33939)
@@ -27,7 +27,4 @@
 #   listcmf my.i.band.cmf i.list --opihi-read-file i.mana
 #
-# (The mana command files may be re-used for different sets of inputs that have the same OUTPUT.FORMAT and
-# sets of extensions
-#
 # To read the data into mana
 #
@@ -35,17 +32,18 @@
 #       input r.mana
 #
+#   The vectors are populated and the variables $ZPT_r  and  $EXPTIME_r are set
+#
 #       datafile i.list
 #       input i.mana
 #
-#       set i_minus_r = PSF_INST_MAG_i - PSF_INST_MAG_r
+#       set i_minus_r = $ZPT_i + PSF_INST_MAG_i + 2.5 * log($EXPTIME_i) - ($ZPT_r + PSF_INST_MAG_r + 2.5 * log($EXPTIME_r))
 #
 # The model fits columns names are appended with a tag for the model name as well as the filter
 # So to compare the de Vaucouleurs model magnitude in two filters
 #
-#       set dev_i_minus_r = EXT_INST_MAG_DEV_i - EXT_INST_MAG_DEV_r
-#
-# similarly
-#
-#       set sersic_i_minus_r = EXT_INST_MAG_SERSIC_i - EXT_INST_MAG_SERSIC_r
+#       set dev_i_minus_r = $ZPT_i + EXT_INST_MAG_DEV_i + 2.5 * log($EXPTIME_i) - ($ZPT_r + EXT_INST_MAG_DEV_r + 2.5 * log($EXPTIME_r))
+#
+#
+#       set sersic_i_minus_r = $ZPT_i + EXT_INST_MAG_SERSIC_i + 2.5 * log($EXPTIME_i) - ($ZPT_r + EXT_INST_MAG_SERSIC_r + 2.5 * log($EXPTIME_r))
 
 use strict;
@@ -215,5 +213,5 @@
     print $oh "# ";
 
-    print $oh "IPP_IDET 1";
+    print $oh "IPP_IDET ";
     for (my $i = 1; $i < scalar @psf_cols; $i++) {
         print $oh " $psf_cols[$i]_$filter";
@@ -225,4 +223,5 @@
         print $oh " $xfit_cols[$i]_$filter";
     }
+    print $oh "\n";
 }
 
@@ -234,6 +233,8 @@
 if ($opihi_read_file) {
     open OUT, ">$opihi_read_file" or die "failed to open $opihi_read_file\n";
+    printf OUT '$EXPTIME_%s = %f' .  "\n", $filter, $exp_time;
+    printf OUT '$ZPT_%s = %f' . "\n", $filter, $zero_point;
     print OUT "read IPP_IDET 1";
-    my $n = 1;
+    my $n = 2;
     for (my $i = 1; $i < scalar @psf_cols; $i++) {
         print OUT " $psf_cols[$i]_$filter ",  $n++;
