Index: trunk/ippToPsps/config/IN/tables.vot
===================================================================
--- trunk/ippToPsps/config/IN/tables.vot	(revision 34882)
+++ trunk/ippToPsps/config/IN/tables.vot	(revision 34884)
@@ -102092,4 +102092,84 @@
       </DATA>
     </TABLE>
+    <TABLE name="StackDetectionFlags">
+      <DESCRIPTION>VOTable description of PSPS table DetectionFlags</DESCRIPTION>
+      <PARAM arraysize="1" datatype="char" ucd="meta.bib.author" name="Author" value="PSPS"></PARAM>
+      <FIELD name="name" arraysize="100" datatype="char">
+        <DESCRIPTION>Name of flag</DESCRIPTION>
+      </FIELD>
+      <FIELD name="value" arraysize="1" datatype="long">
+        <DESCRIPTION>Flag value</DESCRIPTION>
+      </FIELD>
+      <FIELD name="description" arraysize="100" datatype="char">
+        <DESCRIPTION>Description of the flag</DESCRIPTION>
+      </FIELD>
+        <DATA>
+        <TABLEDATA>
+          <TR><TD>DEFAULT</TD><TD>0</TD><TD>Initial value: resets all bits</TD></TR>
+          <TR><TD>PSFMODEL</TD><TD>1</TD><TD>Source fitted with a psf model (linear or non-linear)</TD></TR>
+          <TR><TD>EXTMODEL</TD><TD>2</TD><TD>Source fitted with an extended-source model</TD></TR>
+	  <TR><TD>FITTED</TD><TD>4</TD><TD>Source fitted with non-linear model (PSF or EXT; good or bad)</TD></TR>
+	  <TR><TD>FAIL</TD><TD>8</TD><TD>Fit (non-linear) failed (non-converge, off-edge, run to zero)</TD></TR>
+	  <TR><TD>POOR</TD><TD>16</TD><TD>Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)</TD></TR>
+	  <TR><TD>PAIR</TD><TD>32</TD><TD>Source fitted with a double psf</TD></TR>
+	  <TR><TD>PSFSTAR</TD><TD>64</TD><TD>Source used to define PSF model</TD></TR>
+	  <TR><TD>SATSTAR</TD><TD>128</TD><TD>Source model peak is above saturation</TD></TR>
+	  <TR><TD>BLEND</TD><TD>256</TD><TD>Source is a blend with other sources</TD></TR>
+	  <TR><TD>EXTERNAL</TD><TD>512</TD><TD>Source based on supplied input position</TD></TR>
+	  <TR><TD>BADPSF</TD><TD>1024</TD><TD>Failed to get good estimate of object's PSF</TD></TR>
+	  <TR><TD>DEFECT</TD><TD>2048</TD><TD>Source is thought to be a defect</TD></TR>
+	  <TR><TD>SATURATED</TD><TD>4096</TD><TD>Source is thought to be saturated pixels (bleed trail)</TD></TR>
+	  <TR><TD>CR_LIMIT</TD><TD>8192</TD><TD>Source has crNsigma above limit</TD></TR>
+	  <TR><TD>EXT_LIMIT</TD><TD>16384</TD><TD>Source has extNsigma above limit</TD></TR>
+	  <TR><TD>MOMENTS_FAILURE</TD><TD>32768</TD><TD>could not measure the moments</TD></TR>
+	  <TR><TD>SKY_FAILURE</TD><TD>65536</TD><TD>could not measure the local sky</TD></TR>
+	  <TR><TD>SKYVAR_FAILURE</TD><TD>131072</TD><TD>could not measure the local sky variance</TD></TR>
+	  <TR><TD>BELOW_MOMENTS_SN</TD><TD>262144</TD><TD>moments not measured due to low S/N</TD></TR>
+	  <TR><TD>BIG_RADIUS</TD><TD>1048576</TD><TD>poor moments for small radius, try large radius</TD></TR>
+	  <TR><TD>AP_MAGS</TD><TD>2097152</TD><TD>source has an aperture magnitude</TD></TR>
+	  <TR><TD>BLEND_FIT</TD><TD>4194304</TD><TD>source was fitted as a blend</TD></TR>
+	  <TR><TD>EXTENDED_FIT</TD><TD>8388608</TD><TD>full extended fit was used</TD></TR>
+	  <TR><TD>EXTENDED_STATS</TD><TD>16777216</TD><TD>extended aperture stats calculated</TD></TR>
+	  <TR><TD>LINEAR_FIT</TD><TD>33554432</TD><TD>source fitted with the linear fit</TD></TR>
+	  <TR><TD>NONLINEAR_FIT</TD><TD>67108864</TD><TD>source fitted with the non-linear fit</TD></TR>
+	  <TR><TD>RADIAL_FLUX</TD><TD>134217728</TD><TD>radial flux measurements calculated</TD></TR>
+	  <TR><TD>SIZE_SKIPPED</TD><TD>268435456</TD><TD>size could not be determined</TD></TR>
+	  <TR><TD>ON_SPIKE</TD><TD>536870912</TD><TD>peak lands on diffraction spike</TD></TR>
+	  <TR><TD>ON_GHOST</TD><TD>1073741824</TD><TD>peak lands on ghost or glint</TD></TR>
+	  <TR><TD>OFF_CHIP</TD><TD>2147483648</TD><TD>peak lands off edge of chip</TD></TR>
+	  <TR><TD>DIFF_WITH_SINGLE</TD><TD>4294967296</TD><TD>diff source matched to a single positive detection</TD></TR>
+	  <TR><TD>DIFF_WITH_DOUBLE</TD><TD>8589934592</TD><TD>diff source matched to positive detections in both images</TD></TR>
+	  <TR><TD>MATCHED</TD><TD>17179869184</TD><TD>diff source matched to positive detections in both images</TD></TR>
+	  <TR><TD>ON_SPIKE</TD><TD>34359738368</TD><TD>>25% of (PSF-weighted) pixels land on diffraction spike</TD></TR>
+	  <TR><TD>ON_STARCORE</TD><TD>68719476736</TD><TD>>25% of (PSF-weighted) pixels land on starcore</TD></TR>
+	  <TR><TD>ON_BURNTOOL</TD><TD>137438953472</TD><TD>>25% of (PSF-weighted) pixels land on burntool</TD></TR>
+	  <TR><TD>ON_CONVPOOR</TD><TD>274877906944</TD><TD>>25% of (PSF-weighted) pixels land on convpoor</TD></TR>
+	  <TR><TD>PASS1_SRC</TD><TD>549755813888</TD><TD>source detected in first pass analysis</TD></TR>
+	  <TR><TD>HAS_BRIGHTER_NEIGHBOR</TD><TD>1099511627776</TD><TD>peak is not the brightest in its footprint</TD></TR>
+	  <TR><TD>BRIGHT_NEIGHBOR_1</TD><TD>2199023255552</TD><TD>flux_n / (r^2 flux_p) >1</TD></TR>
+	  <TR><TD>BRIGHT_NEIGHBOR_10</TD><TD>4398046511104</TD><TD>flux_n / (r^2 flux_p) >10</TD></TR>
+	  <TR><TD>DIFF_SELF_MATCH</TD><TD>8796093022208</TD><TD>positive detection match is probably this source</TD></TR>
+	  <TR><TD>SATSTAR_PROFILE</TD><TD>17592186044416</TD><TD>saturated source is modeled with a radial profile</TD></TR>
+	  <TR><TD>NOCAL</TD><TD>35184372088832</TD><TD>detection ignored for this analysis (photcode, time range) -- internal only</TD></TR>
+	  <TR><TD>POOR_PHOTOM</TD><TD>70368744177664</TD><TD>detection is photometry outlier</TD></TR>                              
+	  <TR><TD>SKIP_PHOTOM</TD><TD>140737488355328</TD><TD>detection was ignored for photometry measurement</TD></TR>                      
+	  <TR><TD>AREA</TD><TD>281474976710656</TD><TD>detection near image edge</TD></TR>                      
+	  <TR><TD>POOR_ASTROM</TD><TD>562949953421312</TD><TD>detection is astrometry outlier</TD></TR>                                  
+	  <TR><TD>SKIP_ASTROM</TD><TD>1125899906842624</TD><TD>detection was ignored for astrometry measurement</TD></TR>                          
+	  <TR><TD>USED_OBJ</TD><TD>2251799813685248</TD><TD>detection was used during update objects</TD></TR>
+	  <TR><TD>USED_CHIP</TD><TD>4503599627370496</TD><TD>detection was used during update chips (XXX this probably does not make it into the db)</TD></TR>
+	  <TR><TD>BLEND_MEAS</TD><TD>9007199254740992</TD><TD>detection is within radius of multiple objects</TD></TR>
+	  <TR><TD>BLEND_OBJ</TD><TD>18014398509481984</TD><TD>multiple detections within radius of object</TD></TR>
+	  <TR><TD>UNDEF_3</TD><TD>36028797018963968</TD><TD>unused</TD></TR>
+	  <TR><TD>UNDEF_4</TD><TD>72057594037927936</TD><TD>unused</TD></TR>
+	  <TR><TD>BLEND_MEAS_X</TD><TD>144115188075855872</TD><TD>detection is within radius of multiple objects across catalogs</TD></TR>               
+	  <TR><TD>ARTIFACT</TD><TD>288230376151711744</TD><TD>detection is thought to be non-astronomical</TD></TR>        
+	  <TR><TD>UNDEF_5</TD><TD>576460752303423488</TD><TD>unused</TD></TR>
+	  <TR><TD>PHOTOM_UBERCAL</TD><TD>1152921504606846976</TD><TD>externally-supplied zero point from ubercal analysis</TD></TR>
+	  <TR><TD>STACK_PRIMARY</TD><TD>2305843009213693952</TD><TD>externally-supplied zero point from ubercal analysis</TD></TR>            
+	  <TR><TD>STACK_PHOT_SRC</TD><TD>4611686018427387904</TD><TD>this measurement supplied the stack photometry</TD></TR>
+        </TABLEDATA>
+      </DATA>
+    </TABLE>
     <TABLE name="DetectionFlags">
       <DESCRIPTION>VOTable description of PSPS table DetectionFlags</DESCRIPTION>
@@ -102109,48 +102189,150 @@
           <TR><TD>PSFMODEL</TD><TD>1</TD><TD>Source fitted with a psf model (linear or non-linear)</TD></TR>
           <TR><TD>EXTMODEL</TD><TD>2</TD><TD>Source fitted with an extended-source model</TD></TR>
-          <TR><TD>FITTED</TD><TD>4</TD><TD>Source fitted with non-linear model (PSF or EXT; good or bad)</TD></TR>
-          <TR><TD>FITFAIL</TD><TD>8</TD><TD>Fit (non-linear) failed (non-converge, off-edge, run to zero)</TD></TR>
-          <TR><TD>POORFIT</TD><TD>16</TD><TD>Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)</TD></TR>
-          <TR><TD>PAIR</TD><TD>32</TD><TD>Source fitted with a double psf</TD></TR>
-          <TR><TD>PSFSTAR</TD><TD>64</TD><TD>Source used to define PSF model</TD></TR>
-          <TR><TD>SATSTAR</TD><TD>128</TD><TD>Source model peak is above saturation</TD></TR>
-          <TR><TD>BLEND</TD><TD>256</TD><TD>Source is a blend with other sourcers</TD></TR>
-          <TR><TD>EXTERNALPOS</TD><TD>512</TD><TD>Source based on supplied input position</TD></TR>
-          <TR><TD>BADPSF</TD><TD>1024</TD><TD>Failed to get good estimate of object's PSF</TD></TR>
-          <TR><TD>DEFECT</TD><TD>2048</TD><TD>Source is thought to be a defect</TD></TR>
-          <TR><TD>SATURATED</TD><TD>4096</TD><TD>Source is thought to be saturated pixels (bleed trail)</TD></TR>
-          <TR><TD>CR_LIMIT</TD><TD>8192</TD><TD>Source has crNsigma above limit</TD></TR>
-          <TR><TD>EXT_LIMIT</TD><TD>16384</TD><TD>Source has extNsigma above limit</TD></TR>
-          <TR><TD>MOMENTS_FAILURE</TD><TD>32768</TD><TD>could not measure the moments</TD></TR>
-          <TR><TD>SKY_FAILURE</TD><TD>65536</TD><TD>could not measure the local sky</TD></TR>
-          <TR><TD>SKYVAR_FAILURE</TD><TD>131072</TD><TD>could not measure the local sky variance</TD></TR>
-          <TR><TD>MOMENTS_SN</TD><TD>262144</TD><TD>moments not measured due to low S/N</TD></TR>
-          <TR><TD>BIG_RADIUS</TD><TD>1048576</TD><TD>poor moments for small radius, try large radius</TD></TR>
-          <TR><TD>AP_MAGS</TD><TD>2097152</TD><TD>source has an aperture magnitude</TD></TR>
-          <TR><TD>BLEND_FIT</TD><TD>4194304</TD><TD>source was fitted as a blend</TD></TR>
-          <TR><TD>EXTENDED_FIT</TD><TD>8388608</TD><TD>full extended fit was used</TD></TR>
-          <TR><TD>EXTENDED_STATS</TD><TD>16777216</TD><TD>extended aperture stats calculated</TD></TR>
-          <TR><TD>LINEAR_FIT</TD><TD>33554432</TD><TD>source fitted with the linear fit</TD></TR>
-          <TR><TD>NONLINEAR_FIT</TD><TD>67108864</TD><TD>source fitted with the non-linear fit</TD></TR>
-          <TR><TD>RADIAL_FLUX</TD><TD>134217728</TD><TD>radial flux measurements calculated</TD></TR>
-          <TR><TD>SIZE_SKIPPED</TD><TD>268435456</TD><TD>size could not be determined</TD></TR>
-          <TR><TD>ON_SPIKE</TD><TD>536870912</TD><TD>peak lands on diffraction spike</TD></TR>
-          <TR><TD>ON_GHOST</TD><TD>1073741824</TD><TD>peak lands on ghost or glint</TD></TR>
-          <TR><TD>OFF_CHIP</TD><TD>2147483648</TD><TD>peak lands off edge of chip</TD></TR>
-          <TR><TD>NOCAL</TD><TD>4294967296</TD><TD>detection ignored for this analysis (photcode, time range) -- internal only</TD></TR>
-          <TR><TD>POOR_PHOTOM</TD><TD>8589934592</TD><TD>detection is photometry outlier</TD></TR>
-          <TR><TD>SKIP_PHOTOM</TD><TD>17179869184</TD><TD>detection was ignored for photometry measurement</TD></TR>
-          <TR><TD>MEAS_AREA</TD><TD>34359738368</TD><TD>detection near image edge</TD></TR>
-          <TR><TD>POOR_ASTROM</TD><TD>68719476736</TD><TD>detection is astrometry outlier</TD></TR>
-          <TR><TD>SKIP_ASTROM</TD><TD>137438953472</TD><TD>detection was ignored for astrometry measurement</TD></TR>
-          <TR><TD>USED_OBJ</TD><TD>274877906944</TD><TD>detection was used during opdate objects</TD></TR>
-          <TR><TD>USED_CHIP</TD><TD>549755813888</TD><TD>detection was used during update chips</TD></TR>
-          <TR><TD>BLEND_MEAS</TD><TD>1099511627776</TD><TD>detection is within radius of multiple objects</TD></TR>
-          <TR><TD>BLEND_OBJ</TD><TD>2199023255552</TD><TD>multiple detections within radius of object</TD></TR>
-          <TR><TD>BLEND_MEAS_X</TD><TD>17592186044416</TD><TD>detection is within radius of multiple objects across catalogs</TD></TR>
-          <TR><TD>ARTIFACT</TD><TD>35184372088832</TD><TD>detection is thought to be non-astronomical</TD></TR>
+	  <TR><TD>FITTED</TD><TD>4</TD><TD>Source fitted with non-linear model (PSF or EXT; good or bad)</TD></TR>
+	  <TR><TD>FAIL</TD><TD>8</TD><TD>Fit (non-linear) failed (non-converge, off-edge, run to zero)</TD></TR>
+	  <TR><TD>POOR</TD><TD>16</TD><TD>Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)</TD></TR>
+	  <TR><TD>PAIR</TD><TD>32</TD><TD>Source fitted with a double psf</TD></TR>
+	  <TR><TD>PSFSTAR</TD><TD>64</TD><TD>Source used to define PSF model</TD></TR>
+	  <TR><TD>SATSTAR</TD><TD>128</TD><TD>Source model peak is above saturation</TD></TR>
+	  <TR><TD>BLEND</TD><TD>256</TD><TD>Source is a blend with other sources</TD></TR>
+	  <TR><TD>EXTERNAL</TD><TD>512</TD><TD>Source based on supplied input position</TD></TR>
+	  <TR><TD>BADPSF</TD><TD>1024</TD><TD>Failed to get good estimate of object's PSF</TD></TR>
+	  <TR><TD>DEFECT</TD><TD>2048</TD><TD>Source is thought to be a defect</TD></TR>
+	  <TR><TD>SATURATED</TD><TD>4096</TD><TD>Source is thought to be saturated pixels (bleed trail)</TD></TR>
+	  <TR><TD>CR_LIMIT</TD><TD>8192</TD><TD>Source has crNsigma above limit</TD></TR>
+	  <TR><TD>EXT_LIMIT</TD><TD>16384</TD><TD>Source has extNsigma above limit</TD></TR>
+	  <TR><TD>MOMENTS_FAILURE</TD><TD>32768</TD><TD>could not measure the moments</TD></TR>
+	  <TR><TD>SKY_FAILURE</TD><TD>65536</TD><TD>could not measure the local sky</TD></TR>
+	  <TR><TD>SKYVAR_FAILURE</TD><TD>131072</TD><TD>could not measure the local sky variance</TD></TR>
+	  <TR><TD>BELOW_MOMENTS_SN</TD><TD>262144</TD><TD>moments not measured due to low S/N</TD></TR>
+	  <TR><TD>BIG_RADIUS</TD><TD>1048576</TD><TD>poor moments for small radius, try large radius</TD></TR>
+	  <TR><TD>AP_MAGS</TD><TD>2097152</TD><TD>source has an aperture magnitude</TD></TR>
+	  <TR><TD>BLEND_FIT</TD><TD>4194304</TD><TD>source was fitted as a blend</TD></TR>
+	  <TR><TD>EXTENDED_FIT</TD><TD>8388608</TD><TD>full extended fit was used</TD></TR>
+	  <TR><TD>EXTENDED_STATS</TD><TD>16777216</TD><TD>extended aperture stats calculated</TD></TR>
+	  <TR><TD>LINEAR_FIT</TD><TD>33554432</TD><TD>source fitted with the linear fit</TD></TR>
+	  <TR><TD>NONLINEAR_FIT</TD><TD>67108864</TD><TD>source fitted with the non-linear fit</TD></TR>
+	  <TR><TD>RADIAL_FLUX</TD><TD>134217728</TD><TD>radial flux measurements calculated</TD></TR>
+	  <TR><TD>SIZE_SKIPPED</TD><TD>268435456</TD><TD>size could not be determined</TD></TR>
+	  <TR><TD>ON_SPIKE</TD><TD>536870912</TD><TD>peak lands on diffraction spike</TD></TR>
+	  <TR><TD>ON_GHOST</TD><TD>1073741824</TD><TD>peak lands on ghost or glint</TD></TR>
+	  <TR><TD>OFF_CHIP</TD><TD>2147483648</TD><TD>peak lands off edge of chip</TD></TR>
+	  <TR><TD>DIFF_WITH_SINGLE</TD><TD>4294967296</TD><TD>diff source matched to a single positive detection</TD></TR>
+	  <TR><TD>DIFF_WITH_DOUBLE</TD><TD>8589934592</TD><TD>diff source matched to positive detections in both images</TD></TR>
+	  <TR><TD>MATCHED</TD><TD>17179869184</TD><TD>diff source matched to positive detections in both images</TD></TR>
+	  <TR><TD>ON_SPIKE</TD><TD>34359738368</TD><TD>>25% of (PSF-weighted) pixels land on diffraction spike</TD></TR>
+	  <TR><TD>ON_STARCORE</TD><TD>68719476736</TD><TD>>25% of (PSF-weighted) pixels land on starcore</TD></TR>
+	  <TR><TD>ON_BURNTOOL</TD><TD>137438953472</TD><TD>>25% of (PSF-weighted) pixels land on burntool</TD></TR>
+	  <TR><TD>ON_CONVPOOR</TD><TD>274877906944</TD><TD>>25% of (PSF-weighted) pixels land on convpoor</TD></TR>
+	  <TR><TD>PASS1_SRC</TD><TD>549755813888</TD><TD>source detected in first pass analysis</TD></TR>
+	  <TR><TD>HAS_BRIGHTER_NEIGHBOR</TD><TD>1099511627776</TD><TD>peak is not the brightest in its footprint</TD></TR>
+	  <TR><TD>BRIGHT_NEIGHBOR_1</TD><TD>2199023255552</TD><TD>flux_n / (r^2 flux_p) >1</TD></TR>
+	  <TR><TD>BRIGHT_NEIGHBOR_10</TD><TD>4398046511104</TD><TD>flux_n / (r^2 flux_p) >10</TD></TR>
+	  <TR><TD>DIFF_SELF_MATCH</TD><TD>8796093022208</TD><TD>positive detection match is probably this source</TD></TR>
+	  <TR><TD>SATSTAR_PROFILE</TD><TD>17592186044416</TD><TD>saturated source is modeled with a radial profile</TD></TR>
+	  <TR><TD>NOCAL</TD><TD>35184372088832</TD><TD>detection ignored for this analysis (photcode, time range) -- internal only</TD></TR>
+	  <TR><TD>POOR_PHOTOM</TD><TD>70368744177664</TD><TD>detection is photometry outlier</TD></TR>                              
+	  <TR><TD>SKIP_PHOTOM</TD><TD>140737488355328</TD><TD>detection was ignored for photometry measurement</TD></TR>                      
+	  <TR><TD>AREA</TD><TD>281474976710656</TD><TD>detection near image edge</TD></TR>                      
+	  <TR><TD>POOR_ASTROM</TD><TD>562949953421312</TD><TD>detection is astrometry outlier</TD></TR>                                  
+	  <TR><TD>SKIP_ASTROM</TD><TD>1125899906842624</TD><TD>detection was ignored for astrometry measurement</TD></TR>                          
+	  <TR><TD>USED_OBJ</TD><TD>2251799813685248</TD><TD>detection was used during update objects</TD></TR>
+	  <TR><TD>USED_CHIP</TD><TD>4503599627370496</TD><TD>detection was used during update chips (XXX this probably does not make it into the db)</TD></TR>
+	  <TR><TD>BLEND_MEAS</TD><TD>9007199254740992</TD><TD>detection is within radius of multiple objects</TD></TR>
+	  <TR><TD>BLEND_OBJ</TD><TD>18014398509481984</TD><TD>multiple detections within radius of object</TD></TR>
+	  <TR><TD>UNDEF_3</TD><TD>36028797018963968</TD><TD>unused</TD></TR>
+	  <TR><TD>UNDEF_4</TD><TD>72057594037927936</TD><TD>unused</TD></TR>
+	  <TR><TD>BLEND_MEAS_X</TD><TD>144115188075855872</TD><TD>detection is within radius of multiple objects across catalogs</TD></TR>               
+	  <TR><TD>ARTIFACT</TD><TD>288230376151711744</TD><TD>detection is thought to be non-astronomical</TD></TR>        
+	  <TR><TD>UNDEF_5</TD><TD>576460752303423488</TD><TD>unused</TD></TR>
+	  <TR><TD>PHOTOM_UBERCAL</TD><TD>1152921504606846976</TD><TD>externally-supplied zero point from ubercal analysis</TD></TR>
+	  <TR><TD>STACK_PRIMARY</TD><TD>2305843009213693952</TD><TD>externally-supplied zero point from ubercal analysis</TD></TR>            
+	  <TR><TD>STACK_PHOT_SRC</TD><TD>4611686018427387904</TD><TD>this measurement supplied the stack photometry</TD></TR>
         </TABLEDATA>
       </DATA>
     </TABLE>
+    <TABLE name="ObjectInfoFlags">
+      <DESCRIPTION>VOTable description of PSPS table ObjectInfoFlags</DESCRIPTION>
+      <PARAM arraysize="1" datatype="char" ucd="meta.bib.author" name="Author" value="PSPS"></PARAM>
+      <FIELD name="name" arraysize="100" datatype="char">
+        <DESCRIPTION>Name of flag</DESCRIPTION>
+      </FIELD>
+      <FIELD name="value" arraysize="1" datatype="long">
+        <DESCRIPTION>Flag value</DESCRIPTION>
+      </FIELD>
+      <FIELD name="description" arraysize="100" datatype="char">
+        <DESCRIPTION>Description of the flag</DESCRIPTION>
+      </FIELD>
+        <DATA>
+        <TABLEDATA>
+	  <TR><TD>FEW</TD><TD>1</TD><TD>used within relphot: skip star</TD></TR>
+	  <TR><TD>POOR</TD><TD>2</TD><TD>used within relphot: skip star</TD></TR>
+	  <TR><TD>FIT_AVE</TD><TD>65536</TD><TD>average position fitted</TD></TR>
+	  <TR><TD>FIT_PM</TD><TD>131072</TD><TD>proper motion fitted</TD></TR>
+	  <TR><TD>FIT_PAR</TD><TD>262144</TD><TD>parallax fitted</TD></TR>
+	  <TR><TD>USE_AVE</TD><TD>524288</TD><TD>average position used (not PM or PAR)</TD></TR>
+	  <TR><TD>USE_PM</TD><TD>1048576</TD><TD>proper motion used (not AVE or PAR)</TD></TR>
+	  <TR><TD>USE_PAR</TD><TD>2097152</TD><TD>parallax used (not AVE or PM)</TD></TR>
+	  <TR><TD>NO_ASTROM</TD><TD>4194304</TD><TD>mean astrometry could not be measured</TD></TR>
+	  <TR><TD>EXT</TD><TD>16777216</TD><TD>extended in our data (eg, PS)</TD></TR>
+	  <TR><TD>EXT_ALT</TD><TD>33554432</TD><TD>extended in external data (eg, 2MASS)</TD></TR>
+	  <TR><TD>GOOD</TD><TD>67108864</TD><TD>good-quality measurement in our data (eg,PS)</TD></TR>
+	  <TR><TD>GOOD_ALT</TD><TD>134217728</TD><TD>good-quality measurement in  external data (eg, 2MASS)</TD></TR>
+        </TABLEDATA>
+      </DATA>
+    </TABLE>
+     <TABLE name="ObjectFilterFlags">
+      <DESCRIPTION>VOTable description of PSPS table ObjectInfoFlags</DESCRIPTION>
+      <PARAM arraysize="1" datatype="char" ucd="meta.bib.author" name="Author" value="PSPS"></PARAM>
+      <FIELD name="name" arraysize="100" datatype="char">
+        <DESCRIPTION>Name of flag</DESCRIPTION>
+      </FIELD>
+      <FIELD name="value" arraysize="1" datatype="long">
+        <DESCRIPTION>Flag value</DESCRIPTION>
+      </FIELD>
+      <FIELD name="description" arraysize="100" datatype="char">
+        <DESCRIPTION>Description of the flag</DESCRIPTION>
+      </FIELD>
+        <DATA>
+        <TABLEDATA>
+	  <TR><TD>SECF_STAR_FEW</TD><TD>1</TD><TD>used within relphot: skip star</TD></TR>
+	  <TR><TD>SECF_STAR_POOR</TD><TD>2</TD><TD>used within relphot: skip star</TD></TR>
+	  <TR><TD>SECF_USE_SYNTH</TD><TD>4</TD><TD>synthetic photometry used in average measurement</TD></TR>
+	  <TR><TD>SECF_USE_UBERCAL</TD><TD>8</TD><TD>synthetic photometry used in average measurement</TD></TR>
+	  <TR><TD>SECF_HAS_PS1</TD><TD>16</TD><TD>PS1 photometry used in average measurement</TD></TR>
+	  <TR><TD>SECF_HAS_STACK</TD><TD>32</TD><TD>PS1 stack photometry exists</TD></TR>
+	  <TR><TD>PHOTOM_PASS_0</TD><TD>256</TD><TD>average magnitude calculated in 0th pass</TD></TR>
+	  <TR><TD>PHOTOM_PASS_1</TD><TD>512</TD><TD>average magnitude calculated in 1th pass</TD></TR>
+	  <TR><TD>PHOTOM_PASS_2</TD><TD>1024</TD><TD>average magnitude calculated in 2th pass</TD></TR>
+	  <TR><TD>PHOTOM_PASS_3</TD><TD>2048</TD><TD>average magnitude calculated in 3th pass</TD></TR>
+	  <TR><TD>PHOTOM_PASS_4</TD><TD>4096</TD><TD>average magnitude calculated in 4th pass</TD></TR>
+	  <TR><TD>PSPS_OBJ_EXT</TD><TD>8192</TD><TD>extended in this band (PSPS only)</TD></TR>
+        </TABLEDATA>
+      </DATA>
+    </TABLE>
+     <TABLE name="ObjectQualityFlags">
+      <DESCRIPTION>VOTable description of PSPS table ObjectInfoFlags</DESCRIPTION>
+      <PARAM arraysize="1" datatype="char" ucd="meta.bib.author" name="Author" value="PSPS"></PARAM>
+      <FIELD name="name" arraysize="100" datatype="char">
+        <DESCRIPTION>Name of flag</DESCRIPTION>
+      </FIELD>
+      <FIELD name="value" arraysize="1" datatype="long">
+        <DESCRIPTION>Flag value</DESCRIPTION>
+      </FIELD>
+      <FIELD name="description" arraysize="100" datatype="char">
+        <DESCRIPTION>Description of the flag</DESCRIPTION>
+      </FIELD>
+        <DATA>
+        <TABLEDATA>
+	  <TR><TD>QF_OBJ_EXT</TD><TD>1</TD><TD>extended in our data (eg, PS)</TD></TR>
+	  <TR><TD>QF_OBJ_EXT_ALT</TD><TD>2</TD><TD>extended in external data (eg, 2MASS)</TD></TR>
+	  <TR><TD>QF_OBJ_GOOD</TD><TD>4</TD><TD>good-quality measurement in our data (eg,PS)</TD></TR>
+	  <TR><TD>QF_OBJ_GOOD_ALT</TD><TD>8</TD><TD>good-quality measurement in  external data (eg, 2MASS)</TD></TR>
+	  <TR><TD>QF_OBJ_GOOD_STACK</TD><TD>16</TD><TD>good-quality object in the stack (> 1 good stack)</TD></TR>
+	  <TR><TD>QF_OBJ_SUSPECT_STACK</TD><TD>32</TD><TD>suspect object in the stack (> 1 good or suspect stack, less tham 2 good)</TD></TR>
+	  <TR><TD>QF_OBJ_BAD_STACK</TD><TD>64</TD><TD>good-quality object in the stack (> 1 good stack)</TD></TR>
+	</TABLEDATA>
+      </DATA>
+    </TABLE>   
   </RESOURCE>
 </VOTABLE>
Index: trunk/ippToPsps/jython/gpc1db.py
===================================================================
--- trunk/ippToPsps/jython/gpc1db.py	(revision 34882)
+++ trunk/ippToPsps/jython/gpc1db.py	(revision 34884)
@@ -61,8 +61,10 @@
                    JOIN rawExp USING (exp_id) \
                    JOIN mergedvodbRun using (minidvodb_id) \
+                   JOIN mergedvodbProcessed using (merge_id) \
                    WHERE mergedvodbRun.mergedvodb = '" + dvoDb + "' \
                    AND minidvodbRun.state = 'merged' \
                    AND mergedvodbRun.state = 'full' \
                    AND minidvodbProcessed.fault = 0 \
+                   AND mergedvodbProcessed.fault = 0 \
                    AND addRun.stage = '" + stage + "' \
                    AND addRun.state = 'full' \
@@ -77,13 +79,17 @@
                    JOIN minidvodbRun USING(minidvodb_name) \
                    JOIN minidvodbProcessed USING(minidvodb_id) \
+                   JOIN mergedvodbRun USING(minidvodb_id) \
+                   JOIN mergedvodbProcessed USING (merge_id) \
                    JOIN  stackRun USING(stack_id) JOIN skycell USING(skycell_id) \
-                   WHERE minidvodbRun.minidvodb_group = '" + dvoDb + "' \
+                   WHERE mergedvodbRun.mergedvodb = '" + dvoDb + "' \
                    AND minidvodbRun.state = 'merged' \
                    AND minidvodbProcessed.fault = 0 \
+                   AND mergedvodbRun.state = 'full' \
+                   AND mergedvodbProcessed.fault = 0 \
                    AND addRun.stage = '" + stage + "' \
                    AND addRun.state = 'full' \
                    AND decdeg BETWEEN " + str(minDec) + " AND " + str(maxDec) + " \
                    AND radeg BETWEEN " + str(minRA) + " AND " + str(maxRA) 
-
+            
         try:
             rs = self.executeQuery(sql)
