Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/SEDfit.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/SEDfit.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/SEDfit.c	(revision 38318)
@@ -152,5 +152,5 @@
 
     for (j = 0; j < Nsec; j++) {
-      dvo_secfilt_init (&outcat[0].secfilt[Nave*Nsec+j]);
+      dvo_secfilt_init (&outcat[0].secfilt[Nave*Nsec+j], SECFILT_RESET_ALL);
     }
 
Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches.c	(revision 38318)
@@ -264,5 +264,5 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsecfilt+j]);
+      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsecfilt+j], SECFILT_RESET_ALL);
     }
 
Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_closest.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_closest.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_closest.c	(revision 38318)
@@ -297,5 +297,5 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsecfilt+j]);
+      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsecfilt+j], SECFILT_RESET_ALL);
     }
 
Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_closest_refstars.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_closest_refstars.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_closest_refstars.c	(revision 38318)
@@ -300,5 +300,5 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsecfilt+j]);
+      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsecfilt+j], SECFILT_RESET_ALL);
     }
 
Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_refstars.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_refstars.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_refstars.c	(revision 38318)
@@ -250,5 +250,5 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsecfilt+j]);
+      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsecfilt+j], SECFILT_RESET_ALL);
     }
 
Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_starpar.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_starpar.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/find_matches_starpar.c	(revision 38318)
@@ -182,5 +182,5 @@
 
     for (j = 0; j < Nsecfilt; j++) {
-      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsecfilt+j]);
+      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsecfilt+j], SECFILT_RESET_ALL);
     }
 
Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/load2mass_catalog.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/load2mass_catalog.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/src/load2mass_catalog.c	(revision 38318)
@@ -29,5 +29,5 @@
 
     for (j = 0; j < Nsec; j++) {
-      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsec+j]);
+      dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsec+j], SECFILT_RESET_ALL);
     }
 
Index: /branches/eam_branches/ipp-20150419/Ohana/src/addstar/test/relphot.flatcorr.dvo
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/addstar/test/relphot.flatcorr.dvo	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/addstar/test/relphot.flatcorr.dvo	(revision 38318)
@@ -21,9 +21,9 @@
 if (not($?PLOT)) set PLOT = 0
 
-$USE_CELL_OFFSETS = 0; # turn on non-zero cell offsets
+$USE_CELL_OFFSETS = 1; # turn on non-zero cell offsets
 $SET_UC_RESID = 1; # write a non-zero resid value to the ubercal table (should not have an impact)
-$DO_2MASS = 0
-$DO_SYNTH = 0
-$DO_TYCHO = 0
+$DO_2MASS = 1
+$DO_SYNTH = 1
+$DO_TYCHO = 1
 $NC_CLOUDS = 0.08
 $UC_CLOUDS = 0.02
@@ -196,10 +196,12 @@
   tapEXEC relphot -images g,r -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -D IMAGE_OFFSET 0.5 -update -synthphot_zpts $fileroot.synthzpts.fits
   for i 0 mjd_uc[]
-    ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot
+    ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot_uc
   end
   for i 0 mjd_nc[]
-    ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot
+    ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
   end
   ck2mass relphot
+  cksynth relphot
+  cktycho relphot
 
   tapDONE
@@ -207,12 +209,24 @@
 
 macro try.relphot
+  if ($0 != 3)
+    echo "go (fileroot) (catdir)"
+    break
+  end
+
+  local i fileroot rootdir catdir
+
+  $fileroot = $1
+  $catdir = $2
+
   # run relphot on the db and check that the images now match the expected values
-  # tapEXEC relphot -images g,r -v -region 9.5 10.5 19.5 20.5 -D CATDIR $1 -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -D IMAGE_OFFSET 0.5 -update -synthphot_zpts $fileroot.synthzpts.fits
-  tapEXEC relphot -images g,r -v -region 9.5 10.5 19.5 20.5 -D CATDIR $1 -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -D IMAGE_OFFSET 0.5 -update
+  tapEXEC relphot -images g,r -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -D IMAGE_OFFSET 0.5 -update -synthphot_zpts $fileroot.synthzpts.fits -nloop 24
+
   for i 0 mjd_uc[]
-    ckexposure $1 mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot
+    # ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot_uc
+      ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot_uc
   end
   for i 0 mjd_nc[]
-    ckexposure $1 mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot
+    # ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
+      ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc
   end
 end
@@ -256,5 +270,5 @@
   $AIRMASS     = $5
   $FILTER      = $6
-  $MODE        = $7
+  $FUNC_MODE   = $7
 
   # XXX need a function to extract the nominal zpt for a given filter / photcode from the db
@@ -325,5 +339,5 @@
   $ZPT_REAL_NORM = $ZPT_REAL - 2.5*log($EXPTIME) - $KLAM_NOMINAL*($AIRMASS - 1.0)
 
-  if ("$MODE" == "raw") 
+  if ("$FUNC_MODE" == "raw") 
     for ix 0 $NCELL_X
       for iy 0 $NCELL_Y
@@ -342,5 +356,5 @@
   end
 
-  if ("$MODE" == "setphot_uc") 
+  if ("$FUNC_MODE" == "setphot_uc") 
     vstat -q dm_good
     sprintf line "setphot_uc  ZP %8.2f $FILTER %6.3f %6.3f %6.3f: %7.4f %7.4f : %3d" $MJD_IMAGE $ZPT_REAL $ZPT_REAL_NORM $ZPT_NOMINAL $MEAN $SIGMA dm_good[]
@@ -357,5 +371,5 @@
   end
 
-  if ("$MODE" == "setphot_nc") 
+  if ("$FUNC_MODE" == "setphot_nc") 
     vstat -q dm_good
     sprintf line "setphot_nc  ZP %8.2f $FILTER %6.3f %6.3f %6.3f: %7.4f %7.4f : %3d" $MJD_IMAGE $ZPT_REAL $ZPT_REAL_NORM $ZPT_NOMINAL $MEAN $SIGMA dm_good[]
@@ -372,9 +386,17 @@
   end
 
-  if ("$MODE" == "relphot") 
+  if (("$FUNC_MODE" == "relphot_uc") || ("$FUNC_MODE" == "relphot_nc"))
     vstat -q dm_good
     sprintf line "relphot     ZP %8.2f $FILTER %6.3f %6.3f %6.3f: %7.4f %7.4f : %3d" $MJD_IMAGE $ZPT_REAL $ZPT_REAL_NORM $ZPT_NOMINAL $MEAN $SIGMA dm_good[]
-    tapOK {abs($MEAN) < 0.001} "$line"
-    tapOK {abs($SIGMA) < 0.001} "$line"
+
+    if ("$FUNC_MODE" == "relphot_uc")
+      tapOK {abs($MEAN) < 0.001} "$line"
+      tapOK {abs($SIGMA) < 0.001} "$line"
+    end
+    if ("$FUNC_MODE" == "relphot_nc")
+      # XXX NOTE relaxed condition : bad photometry points are partly clipped but still cause a bias
+      tapOK {abs($MEAN) < 0.020} "$line"
+      tapOK {abs($SIGMA) < 0.020} "$line"
+    end
 
     mextract ra dec dbflags
@@ -390,4 +412,6 @@
     return
   end
+
+  echo "ERROR: unknown mode for ckexposure : $FUNC_MODE"
 
 end
@@ -704,5 +728,5 @@
   tapEXEC addstar -ref $ROOT.tycho.dat -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass -photcode TYCHO_B
 
-  # $KAPA = kapa -noX
+  $KAPA = kapa -noX
   dev -n tmpdev
   # resize 100 100
@@ -714,5 +738,5 @@
   cdensify tmpmap tmp tmp
   set map = zero(tmpmap) + 0.2
-  # close
+  close
   $KAPA = kapa
 
@@ -746,9 +770,18 @@
 
   if ("$1" == "relphot")
-    subset rs = r_tycho if (m_tycho < 12)
-    subset ds = d_tycho if (m_tycho < 12)
-    avmatch rs ds 0.1 g:flags
-    subset tmp = rs if (g:flags & 0x04); # tycho used for photometry
-    tapOK {tmp[] == rs[]} "tycho objects used for photometry properly marked"
+    subset rst = r_tycho if (m_tycho < 12)
+    subset dst = d_tycho if (m_tycho < 12)
+    # XXX : should not restrict to 'g'
+    avmatch rst dst 0.1 g:flags
+    subset tmp = rst if (g:flags & 0x40); # tycho used for photometry
+    tapOK {tmp[] == rst[]} "tycho objects used for photometry properly marked"
+
+    # non-tycho stars with synth phot should be repaired
+    subset rsn = r_synth if (m_synth > 12) && (m_synth < 13.5)
+    subset dsn = d_synth if (m_synth > 12) && (m_synth < 13.5)
+    # XXX : should not restrict to 'g'
+    avmatch rsn dsn 0.1 g:flags
+    subset tmp = rsn if (g:flags & 0x80); # synth photometry repaired
+    tapOK {tmp[] == rsn[]} "tycho objects used for photometry properly marked"
   end
 end
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/include/dvo.h	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/include/dvo.h	(revision 38318)
@@ -48,4 +48,12 @@
 } DVO_INT_NAN;
 
+// init all data, or just catalog data
+typedef enum {
+  SECFILT_RESET_CHIP  = 0x01,
+  SECFILT_RESET_WARP  = 0x02,
+  SECFILT_RESET_STACK = 0x04,
+  SECFILT_RESET_ALL   = 0x07,
+} SecFiltInitMode;
+  
 // max path length
 # define DVO_MAX_PATH 1024
@@ -182,12 +190,17 @@
   ID_SECF_HAS_PS1     	= 0x00000010, // PS1 photometry used in average measurement
   ID_SECF_HAS_STACK   	= 0x00000020, // PS1 stack photometry exists
-  ID_PHOTOM_PASS_0    	= 0x00000100, // average magnitude calculated in 0th pass
-  ID_PHOTOM_PASS_1    	= 0x00000200, // average magnitude calculated in 1th pass
-  ID_PHOTOM_PASS_2    	= 0x00000400, // average magnitude calculated in 2th pass
-  ID_PHOTOM_PASS_3    	= 0x00000800, // average magnitude calculated in 3th pass
-  ID_PHOTOM_PASS_4    	= 0x00001000, // average magnitude calculated in 4th pass
-  ID_PSPS_OBJ_EXT     	= 0x00002000, // In PSPS ID_SECF_OBJ_EXT is moved here so it fits within 16 bits
+  ID_SECF_HAS_TYCHO   	= 0x00000040, // Tycho photometry used for synth mags
+  ID_SECF_FIX_SYNTH   	= 0x00000080, // synth mags repaired with zpt map
+  ID_SECF_RANK_0    	= 0x00000100, // average magnitude uses rank 0 values
+  ID_SECF_RANK_1    	= 0x00000200, // average magnitude uses rank 1 values
+  ID_SECF_RANK_2    	= 0x00000400, // average magnitude uses rank 2 values
+  ID_SECF_RANK_3    	= 0x00000800, // average magnitude uses rank 3 values
+  ID_SECF_RANK_4    	= 0x00001000, // average magnitude uses rank 4 values
+  ID_SECF_OBJ_EXT_PSPS  = 0x00002000, // In PSPS ID_SECF_OBJ_EXT is moved here so it fits within 16 bits
   ID_SECF_STACK_PRIMARY = 0x00004000, // PS1 stack photometry comes from primary skycell
   ID_SECF_OBJ_EXT       = 0x01000000, // extended in this band
+
+  ID_SECF_CHIP_FLAGS    = 0x01003f1f, // all chip-related bits (used to reset the correct bits only)
+  ID_SECF_STACK_FLAGS   = 0x00004020, // all stack-related bits (
 } DVOSecfiltFlags;
 
@@ -1104,5 +1117,5 @@
 void dvo_average_init (Average *average);
 void dvo_averageT_init (AverageTiny *average);
-void dvo_secfilt_init (SecFilt *secfilt);
+void dvo_secfilt_init (SecFilt *secfilt, SecFiltInitMode mode);
 void dvo_measure_init (Measure *measure);
 void dvo_measureT_init (MeasureTiny *measure);
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_catalog.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_catalog.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_catalog.c	(revision 38318)
@@ -170,71 +170,82 @@
 }
 
-// init all data, or just catalog data
-void dvo_secfilt_init (SecFilt *secfilt) {
-  secfilt->M           = NAN;
-  secfilt->dM          = NAN;
-  secfilt->Map         = NAN;
-  secfilt->dMap        = NAN;
-  secfilt->sMap        = NAN;
-  secfilt->Mkron       = NAN;
-  secfilt->dMkron      = NAN;
-  secfilt->sMkron      = NAN;
-
-  secfilt->psfQfMax     = NAN;
-  secfilt->psfQfPerfMax = NAN;
-
-  secfilt->Mstdev      = NAN;
-  secfilt->Mmin        = NAN;
-  secfilt->Mmax        = NAN;
-  secfilt->Mchisq      = NAN;
-
-  secfilt->Ncode       = 0;
-  secfilt->Nused       = 0;
-  secfilt->NusedKron   = 0;
-  secfilt->NusedAp     = 0;
-
-  secfilt->flags       = 0;
-
-  secfilt->MpsfStk     = NAN;
-  secfilt->FpsfStk     = NAN;
-  secfilt->dFpsfStk    = NAN;
-
-  secfilt->MkronStk    = NAN;
-  secfilt->FkronStk    = NAN;
-  secfilt->dFkronStk   = NAN;
-
-  secfilt->MapStk      = NAN;
-  secfilt->FapStk      = NAN;
-  secfilt->dFapStk     = NAN;
-
-  secfilt->Nstack      = 0;
-  secfilt->NstackDet   = 0;
-
-  secfilt->stackPrmryOff = -1;
-  secfilt->stackBestOff  = -1;
-
-  secfilt->MpsfWrp     = NAN;
-  secfilt->FpsfWrp     = NAN;
-  secfilt->dFpsfWrp    = NAN;
-  secfilt->sFpsfWrp    = NAN;
-
-  secfilt->MkronWrp    = NAN;
-  secfilt->FkronWrp    = NAN;
-  secfilt->dFkronWrp   = NAN;
-  secfilt->sFkronWrp   = NAN;
-
-  secfilt->MapWrp      = NAN;
-  secfilt->FapWrp      = NAN;
-  secfilt->dFapWrp     = NAN;
-  secfilt->sFapWrp     = NAN;
-
-  secfilt->NusedWrp     = 0;
-  secfilt->NusedKronWrp = 0;
-  secfilt->NusedApWrp   = 0;
-
-  secfilt->Nwarp        = 0;
-  secfilt->NwarpGood    = 0;
-
-  secfilt->ubercalDist = 1000;
+void dvo_secfilt_init (SecFilt *secfilt, SecFiltInitMode mode) {
+
+  myAssert (mode & SECFILT_RESET_ALL, "at least one of the CHIP,WARP,STACK bits must be set");
+
+  if ((mode & SECFILT_RESET_ALL) == SECFILT_RESET_ALL) {
+    secfilt->flags       = 0;
+  }
+
+  if (mode & SECFILT_RESET_CHIP) {
+    secfilt->M           = NAN;
+    secfilt->dM          = NAN;
+    secfilt->Map         = NAN;
+    secfilt->dMap        = NAN;
+    secfilt->sMap        = NAN;
+    secfilt->Mkron       = NAN;
+    secfilt->dMkron      = NAN;
+    secfilt->sMkron      = NAN;
+
+    secfilt->psfQfMax     = NAN;
+    secfilt->psfQfPerfMax = NAN;
+
+    secfilt->Mstdev      = NAN;
+    secfilt->Mmin        = NAN;
+    secfilt->Mmax        = NAN;
+    secfilt->Mchisq      = NAN;
+
+    secfilt->Ncode       = 0;
+    secfilt->Nused       = 0;
+    secfilt->NusedKron   = 0;
+    secfilt->NusedAp     = 0;
+    secfilt->ubercalDist = 1000;
+    secfilt->flags      &= ~ID_SECF_CHIP_FLAGS;
+  }
+
+  if (mode & SECFILT_RESET_STACK) {
+    secfilt->MpsfStk     = NAN;
+    secfilt->FpsfStk     = NAN;
+    secfilt->dFpsfStk    = NAN;
+
+    secfilt->MkronStk    = NAN;
+    secfilt->FkronStk    = NAN;
+    secfilt->dFkronStk   = NAN;
+
+    secfilt->MapStk      = NAN;
+    secfilt->FapStk      = NAN;
+    secfilt->dFapStk     = NAN;
+
+    secfilt->Nstack      = 0;
+    secfilt->NstackDet   = 0;
+
+    secfilt->stackPrmryOff = -1;
+    secfilt->stackBestOff  = -1;
+    secfilt->flags      &= ~ID_SECF_STACK_FLAGS;
+  }
+
+  if (mode & SECFILT_RESET_WARP) {
+    secfilt->MpsfWrp     = NAN;
+    secfilt->FpsfWrp     = NAN;
+    secfilt->dFpsfWrp    = NAN;
+    secfilt->sFpsfWrp    = NAN;
+
+    secfilt->MkronWrp    = NAN;
+    secfilt->FkronWrp    = NAN;
+    secfilt->dFkronWrp   = NAN;
+    secfilt->sFkronWrp   = NAN;
+
+    secfilt->MapWrp      = NAN;
+    secfilt->FapWrp      = NAN;
+    secfilt->dFapWrp     = NAN;
+    secfilt->sFapWrp     = NAN;
+
+    secfilt->NusedWrp     = 0;
+    secfilt->NusedKronWrp = 0;
+    secfilt->NusedApWrp   = 0;
+
+    secfilt->Nwarp        = 0;
+    secfilt->NwarpGood    = 0;
+  }
 }
 
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c	(revision 38318)
@@ -178,5 +178,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M     = in[i].M;      
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c	(revision 38318)
@@ -173,5 +173,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M     = in[i].M;      
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c	(revision 38318)
@@ -110,5 +110,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M     = in[i].M;      
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c	(revision 38318)
@@ -195,5 +195,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M             = in[i].M;      
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c	(revision 38318)
@@ -193,5 +193,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M     = in[i].M;      
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c	(revision 38318)
@@ -202,5 +202,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M     = in[i].M;      
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c	(revision 38318)
@@ -206,5 +206,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M           = in[i].M;      
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c	(revision 38318)
@@ -230,5 +230,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M             = in[i].M;      
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 38318)
@@ -299,5 +299,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M             = in[i].M;      
@@ -1359,5 +1359,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M             = in[i].M;      
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_elixir.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_elixir.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_elixir.c	(revision 38318)
@@ -103,5 +103,5 @@
   for (i = 0; i < Nvalues; i++) {
     dvo_average_init (&out[i]);
-    dvo_secfilt_init (&primary[0][i]);
+    dvo_secfilt_init (&primary[0][i], SECFILT_RESET_ALL);
 
     out[i].R       	 = in[i].R;      
@@ -167,5 +167,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].Mchisq = pow (10.0, 0.01*in[i].Xm);     
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_loneos.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_loneos.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_loneos.c	(revision 38318)
@@ -83,5 +83,5 @@
   for (i = 0; i < Nvalues; i++) {
     dvo_average_init (&out[i]);
-    dvo_secfilt_init (&primary[0][i]);
+    dvo_secfilt_init (&primary[0][i], SECFILT_RESET_ALL);
 
     out[i].R       	 = in[i].R;      
@@ -147,5 +147,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].Mchisq= pow (10.0, 0.01*in[i].Xm);     
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c	(revision 38318)
@@ -184,5 +184,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M     = in[i].M;      
Index: /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
===================================================================
--- /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 38317)
+++ /branches/eam_branches/ipp-20150419/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 38318)
@@ -184,5 +184,5 @@
 
   for (i = 0; i < Nvalues; i++) {
-    dvo_secfilt_init (&out[i]);
+    dvo_secfilt_init (&out[i], SECFILT_RESET_ALL);
 
     out[i].M     = in[i].M;      
