Index: /trunk/Ohana/src/addstar/include/ukirt_uhs.h
===================================================================
--- /trunk/Ohana/src/addstar/include/ukirt_uhs.h	(revision 42076)
+++ /trunk/Ohana/src/addstar/include/ukirt_uhs.h	(revision 42077)
@@ -64,2 +64,4 @@
 char *iparse_csv_rpt (int *X,    int Nwant, int Nlast, char *line, int *status);
 char *jparse_csv_rpt (uint64_t *X, int Nwant, int Nlast, char *line, int *status);
+
+float psfQFfromXClass (int xClass);
Index: /trunk/Ohana/src/addstar/src/FilterStars.c
===================================================================
--- /trunk/Ohana/src/addstar/src/FilterStars.c	(revision 42076)
+++ /trunk/Ohana/src/addstar/src/FilterStars.c	(revision 42077)
@@ -7,4 +7,21 @@
  * *** bad photFlags
  */
+
+// As a temporary hack, I am going to overload the following fields with radial aperture values
+// from the convolved images:
+
+# define  F_ApR5_C1 X11_sm_obj
+# define dF_ApR5_C1  E1_sm_obj
+# define  F_ApR6_C1 X22_sm_obj
+# define dF_ApR6_C1  E2_sm_obj
+# define  F_ApR7_C1 X11_sh_obj
+# define dF_ApR7_C1  E2_sh_obj
+
+# define  F_ApR5_C2 X11_sm_psf
+# define dF_ApR5_C2  E1_sm_psf
+# define  F_ApR6_C2 X22_sm_psf
+# define dF_ApR6_C2  E2_sm_psf
+# define  F_ApR7_C2 X11_sh_psf
+# define dF_ApR7_C2  E2_sh_psf
 
 // the imageID supplied here is the sequence **within this set**
@@ -133,4 +150,19 @@
       if (!isnan(outcat->lensing[N].dF_ApR7)) outcat->lensing[N].dF_ApR7 /= image[0].exptime;
       if (!isnan(outcat->lensing[N].sF_ApR7)) outcat->lensing[N].sF_ApR7 /= image[0].exptime;
+
+      // XXX optionall use these overloaded names?
+      if (!isnan(outcat->lensing[N]. F_ApR5_C1)) outcat->lensing[N]. F_ApR5_C1 /= image[0].exptime;
+      if (!isnan(outcat->lensing[N].dF_ApR5_C1)) outcat->lensing[N].dF_ApR5_C1 /= image[0].exptime;
+      if (!isnan(outcat->lensing[N]. F_ApR6_C1)) outcat->lensing[N]. F_ApR6_C1 /= image[0].exptime;
+      if (!isnan(outcat->lensing[N].dF_ApR6_C1)) outcat->lensing[N].dF_ApR6_C1 /= image[0].exptime;
+      if (!isnan(outcat->lensing[N]. F_ApR7_C1)) outcat->lensing[N]. F_ApR7_C1 /= image[0].exptime;
+      if (!isnan(outcat->lensing[N].dF_ApR7_C1)) outcat->lensing[N].dF_ApR7_C1 /= image[0].exptime;
+
+      if (!isnan(outcat->lensing[N]. F_ApR5_C2)) outcat->lensing[N]. F_ApR5_C2 /= image[0].exptime;
+      if (!isnan(outcat->lensing[N].dF_ApR5_C2)) outcat->lensing[N].dF_ApR5_C2 /= image[0].exptime;
+      if (!isnan(outcat->lensing[N]. F_ApR6_C2)) outcat->lensing[N]. F_ApR6_C2 /= image[0].exptime;
+      if (!isnan(outcat->lensing[N].dF_ApR6_C2)) outcat->lensing[N].dF_ApR6_C2 /= image[0].exptime;
+      if (!isnan(outcat->lensing[N]. F_ApR7_C2)) outcat->lensing[N]. F_ApR7_C2 /= image[0].exptime;
+      if (!isnan(outcat->lensing[N].dF_ApR7_C2)) outcat->lensing[N].dF_ApR7_C2 /= image[0].exptime;
     }
     
Index: /trunk/Ohana/src/addstar/src/ReadXradFITS.c
===================================================================
--- /trunk/Ohana/src/addstar/src/ReadXradFITS.c	(revision 42076)
+++ /trunk/Ohana/src/addstar/src/ReadXradFITS.c	(revision 42077)
@@ -1,3 +1,20 @@
 # include "addstar.h"
+
+// As a temporary hack, I am going to overload the following fields with radial aperture values
+// from the convolved images:
+
+# define  F_ApR5_C1 X11_sm_obj
+# define dF_ApR5_C1  E1_sm_obj
+# define  F_ApR6_C1 X22_sm_obj
+# define dF_ApR6_C1  E2_sm_obj
+# define  F_ApR7_C1 X11_sh_obj
+# define dF_ApR7_C1  E2_sh_obj
+
+# define  F_ApR5_C2 X11_sm_psf
+# define dF_ApR5_C2  E1_sm_psf
+# define  F_ApR6_C2 X22_sm_psf
+# define dF_ApR6_C2  E2_sm_psf
+# define  F_ApR7_C2 X11_sh_psf
+# define dF_ApR7_C2  E2_sh_psf
 
 // given a file with the pointer at the start of the table block and the 
@@ -24,4 +41,6 @@
 
   // I want to read the following columns from this table:
+  // All of these fields should have the same number of rows
+  // the APER_* fields should have the same number of columns (number of radii)
   
   off_t Nrow, NrowAlt;
@@ -29,12 +48,23 @@
   char type[16], name[80];
 
+  strcpy (name, "IPP_IDET");
+  int *RadID = gfits_get_bintable_column_data (theader, &table, name, type, &Nrow, &Ncol);
+  myAssert (!strcmp(type, "int"), "wrong column type for %s\n", name);
+
+  strcpy (name, "PSF_FWHM");
+  float *PSFfwhm = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &Ncol);
+  myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name);
+  myAssert (Nrow == NrowAlt, "row mismatch?");
+
   strcpy (name, "APER_FLUX");
-  float *AperFlux = gfits_get_bintable_column_data (theader, &table, name, type, &Nrow, &Ncol);
+  float *AperFlux = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &Ncol);
   myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name);
+  myAssert (Nrow == NrowAlt, "row mismatch?");
+  fprintf (stderr, "reading APER_FLUX for %d apertures\n", Ncol);
 
   strcpy (name, "APER_FLUX_ERR");
   float *AperFluxErr = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt);
   myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name); 
-  myAssert (Nrow == NrowAlt, "column mismatch?");
+  myAssert (Nrow == NrowAlt, "row mismatch?");
   myAssert (Ncol == NcolAlt, "column mismatch?");
 
@@ -42,5 +72,5 @@
   float *AperFluxStd = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt);
   myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name);
-  myAssert (Nrow == NrowAlt, "column mismatch?");
+  myAssert (Nrow == NrowAlt, "row mismatch?");
   myAssert (Ncol == NcolAlt, "column mismatch?");
 
@@ -48,25 +78,33 @@
   float *AperFill = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt);
   myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name);
-  myAssert (Nrow == NrowAlt, "column mismatch?");
+  myAssert (Nrow == NrowAlt, "row mismatch?");
   myAssert (Ncol == NcolAlt, "column mismatch?");
 
-  strcpy (name, "IPP_IDET");
-  int *RadID = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt);
-  myAssert (!strcmp(type, "int"), "wrong column type for %s\n", name);
-  myAssert (Nrow == NrowAlt, "column mismatch?");
+  // XXX this is not a bug, it is guaranteed since we have 3 convolution targets (raw, 6pix, 8pix)
+  // if (Nrow > catalog->Nmeasure) {
+  //   myAbort("more radial measurements than stars?  seems like a bug\n");
+  // }
 
-  if (Nrow > catalog->Nmeasure) {
-    myAbort("more radial measurements than stars?  seems like a bug\n");
+  // myAssert (catalog->lensing, "lensing is not allocated");
+  // we could allocate here, or just insist this is an error?
+  if (!catalog->lensing) {
+    ALLOCATE (catalog->lensing, Lensing, catalog->Nmeasure);
+    catalog->Nlensing = catalog->Nmeasure;
   }
 
-  myAssert (catalog->lensing, "lensing is not allocated");
-  // we could allocate here, or just insist this is an error?
-  // if (!catalog->lensing) {
-  //   ALLOCATE (catalog->lensing, Lensing, catalog->Nmeasure);
-  // }
+  // In the loop below, we need to assign the 3 fwhm values to the three sets of structure
+  // elements. I believe the sequence is fixed (RAW, C1, C2).  Get the fwhm values from the
+  // first entry and compare to the rest
+
+  float fwhmValues[3];
+  fwhmValues[0] = PSFfwhm[0];
+  fwhmValues[1] = PSFfwhm[1];
+  fwhmValues[2] = PSFfwhm[2];
 
   int i;
-  int Nap = 0;
+  int Nap = 0; 
   for (i = 0; i < catalog->Nmeasure; i++) {
+    dvo_lensing_init (&catalog->lensing[i]);
+
     if (catalog->measure[i].detID < RadID[Nap]) {
       continue;
@@ -74,10 +112,14 @@
     }
     if (catalog->measure[i].detID > RadID[Nap]) {
-      myAbort("radial apertures out of order?  seems like a bug\n");
-      // this would be a radial aperture which does not have a radial aperture
+      myAbort("radial apertures for source not in psf list? sources out of order?  seems like a bug\n");
+      // this could be a radial aperture which does not have a PSF source, but that is not possible
     }
 
-    // we assumed we have already set up lensing in ReadStarsFITS.c
+    // confirm the 3 FWHM values:
+    myAssert (fwhmValues[0] == PSFfwhm[Nap+0], "FWHM mismatch %f vs %f", fwhmValues[0], PSFfwhm[Nap+0]);
+    myAssert (fwhmValues[1] == PSFfwhm[Nap+1], "FWHM mismatch %f vs %f", fwhmValues[1], PSFfwhm[Nap+1]);
+    myAssert (fwhmValues[2] == PSFfwhm[Nap+2], "FWHM mismatch %f vs %f", fwhmValues[2], PSFfwhm[Nap+2]);
 
+    // EAM 2022.02.17 : here is the comment for the PV3 load:
     // XXX this is all hard-wired and should make use of the headers. 
     // psphot cmfs have 5 radial apertures:
@@ -85,19 +127,50 @@
     // SDSS  3, 4, 5, 6, 7
 
-    catalog->lensing[i]. F_ApR5 = AperFlux   [Nap*Ncol + 2];
-    catalog->lensing[i].dF_ApR5 = AperFluxErr[Nap*Ncol + 2];
-    catalog->lensing[i].sF_ApR5 = AperFluxStd[Nap*Ncol + 2];
-    catalog->lensing[i].fF_ApR5 = AperFill   [Nap*Ncol + 2];
+    // EAM 2022.02.17 : here is the situation for UNIONS DR3:
+    // we have 3 convolutions (raw, 6", 8")
+    // for each we have 6 apertures with max radii of (4, 8, 16, 32, 48, 64) pixels = (1, 2, 4, 8, 12, 16) arcsec
+    // I am going to save (4, 16, 32) which have index of (0, 2, 3)
 
-    catalog->lensing[i]. F_ApR6 = AperFlux   [Nap*Ncol + 3];
-    catalog->lensing[i].dF_ApR6 = AperFluxErr[Nap*Ncol + 3];
-    catalog->lensing[i].sF_ApR6 = AperFluxStd[Nap*Ncol + 3];
-    catalog->lensing[i].fF_ApR6 = AperFill   [Nap*Ncol + 3];
+    # define RAD_0 0
+    # define RAD_1 2
+    # define RAD_2 3
+    catalog->lensing[i]. F_ApR5    = AperFlux   [(Nap + 0)*Ncol + RAD_0];
+    catalog->lensing[i].dF_ApR5    = AperFluxErr[(Nap + 0)*Ncol + RAD_0];
+    catalog->lensing[i].sF_ApR5    = AperFluxStd[(Nap + 0)*Ncol + RAD_0];
+    catalog->lensing[i].fF_ApR5    = AperFill   [(Nap + 0)*Ncol + RAD_0];
+				   
+    catalog->lensing[i]. F_ApR6    = AperFlux   [(Nap + 0)*Ncol + RAD_1];
+    catalog->lensing[i].dF_ApR6    = AperFluxErr[(Nap + 0)*Ncol + RAD_1];
+    catalog->lensing[i].sF_ApR6    = AperFluxStd[(Nap + 0)*Ncol + RAD_1];
+    catalog->lensing[i].fF_ApR6    = AperFill   [(Nap + 0)*Ncol + RAD_1];
+				   
+    catalog->lensing[i]. F_ApR7    = AperFlux   [(Nap + 0)*Ncol + RAD_2];
+    catalog->lensing[i].dF_ApR7    = AperFluxErr[(Nap + 0)*Ncol + RAD_2];
+    catalog->lensing[i].sF_ApR7    = AperFluxStd[(Nap + 0)*Ncol + RAD_2];
+    catalog->lensing[i].fF_ApR7    = AperFill   [(Nap + 0)*Ncol + RAD_2];
 
-    catalog->lensing[i]. F_ApR7 = AperFlux   [Nap*Ncol + 4];
-    catalog->lensing[i].dF_ApR7 = AperFluxErr[Nap*Ncol + 4];
-    catalog->lensing[i].sF_ApR7 = AperFluxStd[Nap*Ncol + 4];
-    catalog->lensing[i].fF_ApR7 = AperFill   [Nap*Ncol + 4];
-    Nap ++;
+    catalog->lensing[i]. F_ApR5_C1 = AperFlux   [(Nap + 1)*Ncol + RAD_0];
+    catalog->lensing[i].dF_ApR5_C1 = AperFluxErr[(Nap + 1)*Ncol + RAD_0];
+    catalog->lensing[i]. F_ApR6_C1 = AperFlux   [(Nap + 1)*Ncol + RAD_1];
+    catalog->lensing[i].dF_ApR6_C1 = AperFluxErr[(Nap + 1)*Ncol + RAD_1];
+    catalog->lensing[i]. F_ApR7_C1 = AperFlux   [(Nap + 1)*Ncol + RAD_2];
+    catalog->lensing[i].dF_ApR7_C1 = AperFluxErr[(Nap + 1)*Ncol + RAD_2];
+
+    catalog->lensing[i]. F_ApR5_C2 = AperFlux   [(Nap + 2)*Ncol + RAD_0];
+    catalog->lensing[i].dF_ApR5_C2 = AperFluxErr[(Nap + 2)*Ncol + RAD_0];
+    catalog->lensing[i]. F_ApR6_C2 = AperFlux   [(Nap + 2)*Ncol + RAD_1];
+    catalog->lensing[i].dF_ApR6_C2 = AperFluxErr[(Nap + 2)*Ncol + RAD_1];
+    catalog->lensing[i]. F_ApR7_C2 = AperFlux   [(Nap + 2)*Ncol + RAD_2];
+    catalog->lensing[i].dF_ApR7_C2 = AperFluxErr[(Nap + 2)*Ncol + RAD_2];
+
+    catalog->lensing[i].detID = catalog->measure[i].detID;
+
+    // XXX set the measure, object, etc ID values here
+    // catalog->lensing[i].objID : set in find_matches_closest.c
+    // catalog->lensing[i].catID : set in find_matches_closest.c
+    // catalog->lensing[i].averef : set in find_matches_closest.c
+    // catalog->lensing[i].imageID : set in FilterStars.c and UpdateImageIDs.c
+
+    Nap += 3;
   }
   myAssert (Nap == Nrow, "did we go too far???");
@@ -108,4 +181,5 @@
   free (AperFluxStd);
   free (AperFill);
+  free (PSFfwhm);
   free (RadID);
 
Index: /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars.c
===================================================================
--- /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars.c	(revision 42076)
+++ /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars.c	(revision 42077)
@@ -45,2 +45,17 @@
 }
 
+float psfQFfromXClass (int xClass) {
+
+  float value = NAN;
+  switch (xClass) {
+    case -1: value = 0.99; break; // star
+    case -2: value = 0.90; break; // probable star
+    case -3: value = 0.40; break; // probable galaxy
+    case +1: value = 0.20; break; // galaxy
+    case  0: value = 0.10; break; // noise
+    default: break;
+  }
+
+  return value;
+}
+
Index: /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugcs.c
===================================================================
--- /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugcs.c	(revision 42076)
+++ /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugcs.c	(revision 42077)
@@ -605,6 +605,6 @@
     stars[Nstars].measure[0].Mkron      = yAperMag4[i];
     stars[Nstars].measure[0].dMkron     = yAperMag4Err[i];
-    stars[Nstars].measure[0].posangle   = yPA[i]; // XXX units
-    stars[Nstars].measure[0].psfQF      = yClass[i];
+    stars[Nstars].measure[0].posangle   = ToShortDegrees(yPA[i]); // XXX units
+    stars[Nstars].measure[0].psfQF      = psfQFfromXClass(yClass[i]);
     stars[Nstars].measure[0].photFlags  = yppErrBits[i];
     stars[Nstars].measure[0].photFlags2 = photFlags2;
@@ -625,6 +625,6 @@
     stars[Nstars].measure[1].Mkron      = zAperMag4[i];
     stars[Nstars].measure[1].dMkron     = zAperMag4Err[i];
-    stars[Nstars].measure[1].posangle   = zPA[i]; // XXX units
-    stars[Nstars].measure[1].psfQF      = zClass[i];
+    stars[Nstars].measure[1].posangle   = ToShortDegrees(zPA[i]); // XXX units
+    stars[Nstars].measure[1].psfQF      = psfQFfromXClass(zClass[i]);
     stars[Nstars].measure[1].photFlags  = zppErrBits[i];
     stars[Nstars].measure[1].photFlags2 = photFlags2;
@@ -645,6 +645,6 @@
     stars[Nstars].measure[2].Mkron      = jAperMag4[i];
     stars[Nstars].measure[2].dMkron     = jAperMag4Err[i];
-    stars[Nstars].measure[2].posangle   = jPA[i]; // XXX units
-    stars[Nstars].measure[2].psfQF      = jClass[i];
+    stars[Nstars].measure[2].posangle   = ToShortDegrees(jPA[i]); // XXX units
+    stars[Nstars].measure[2].psfQF      = psfQFfromXClass(jClass[i]);
     stars[Nstars].measure[2].photFlags  = jppErrBits[i];
     stars[Nstars].measure[2].photFlags2 = photFlags2;
@@ -665,6 +665,6 @@
     stars[Nstars].measure[3].Mkron      = hAperMag4[i];
     stars[Nstars].measure[3].dMkron     = hAperMag4Err[i];
-    stars[Nstars].measure[3].posangle   = hPA[i]; // XXX units
-    stars[Nstars].measure[3].psfQF      = hClass[i];
+    stars[Nstars].measure[3].posangle   = ToShortDegrees(hPA[i]); // XXX units
+    stars[Nstars].measure[3].psfQF      = psfQFfromXClass(hClass[i]);
     stars[Nstars].measure[3].photFlags  = hppErrBits[i];
     stars[Nstars].measure[3].photFlags2 = photFlags2;
@@ -685,6 +685,6 @@
     stars[Nstars].measure[4].Mkron      = k1AperMag4[i];
     stars[Nstars].measure[4].dMkron     = k1AperMag4Err[i];
-    stars[Nstars].measure[4].posangle   = k1PA[i]; // XXX units
-    stars[Nstars].measure[4].psfQF      = k1Class[i];
+    stars[Nstars].measure[4].posangle   = ToShortDegrees(k1PA[i]); // XXX units
+    stars[Nstars].measure[4].psfQF      = psfQFfromXClass(k1Class[i]);
     stars[Nstars].measure[4].photFlags  = k1ppErrBits[i];
     stars[Nstars].measure[4].photFlags2 = photFlags2;
@@ -705,6 +705,6 @@
     stars[Nstars].measure[5].Mkron      = k2AperMag4[i];
     stars[Nstars].measure[5].dMkron     = k2AperMag4Err[i];
-    stars[Nstars].measure[5].posangle   = k2PA[i]; // XXX units
-    stars[Nstars].measure[5].psfQF      = k2Class[i];
+    stars[Nstars].measure[5].posangle   = ToShortDegrees(k2PA[i]); // XXX units
+    stars[Nstars].measure[5].psfQF      = psfQFfromXClass(k2Class[i]);
     stars[Nstars].measure[5].photFlags  = k2ppErrBits[i];
     stars[Nstars].measure[5].photFlags2 = photFlags2;
Index: /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugps.c
===================================================================
--- /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugps.c	(revision 42076)
+++ /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugps.c	(revision 42077)
@@ -516,6 +516,6 @@
     stars[Nstars].measure[0].Mkron      = jAperMag4[i];
     stars[Nstars].measure[0].dMkron     = jAperMag4Err[i];
-    stars[Nstars].measure[0].posangle   = jPA[i]; // XXX units
-    stars[Nstars].measure[0].psfQF      = jClass[i];
+    stars[Nstars].measure[0].posangle   = ToShortDegrees(jPA[i]); // XXX units
+    stars[Nstars].measure[0].psfQF      = psfQFfromXClass(jClass[i]);
     stars[Nstars].measure[0].photFlags  = jppErrBits[i];
     stars[Nstars].measure[0].photFlags2 = photFlags2;
@@ -536,6 +536,6 @@
     stars[Nstars].measure[1].Mkron      = hAperMag4[i];
     stars[Nstars].measure[1].dMkron     = hAperMag4Err[i];
-    stars[Nstars].measure[1].posangle   = hPA[i]; // XXX units
-    stars[Nstars].measure[1].psfQF      = hClass[i];
+    stars[Nstars].measure[1].posangle   = ToShortDegrees(hPA[i]); // XXX units
+    stars[Nstars].measure[1].psfQF      = psfQFfromXClass(hClass[i]);
     stars[Nstars].measure[1].photFlags  = hppErrBits[i];
     stars[Nstars].measure[1].photFlags2 = photFlags2;
@@ -556,6 +556,6 @@
     stars[Nstars].measure[2].Mkron      = k1AperMag4[i];
     stars[Nstars].measure[2].dMkron     = k1AperMag4Err[i];
-    stars[Nstars].measure[2].posangle   = k1PA[i]; // XXX units
-    stars[Nstars].measure[2].psfQF      = k1Class[i];
+    stars[Nstars].measure[2].posangle   = ToShortDegrees(k1PA[i]); // XXX units
+    stars[Nstars].measure[2].psfQF      = psfQFfromXClass(k1Class[i]);
     stars[Nstars].measure[2].photFlags  = k1ppErrBits[i];
     stars[Nstars].measure[2].photFlags2 = photFlags2;
@@ -576,6 +576,6 @@
     stars[Nstars].measure[3].Mkron      = k2AperMag4[i];
     stars[Nstars].measure[3].dMkron     = k2AperMag4Err[i];
-    stars[Nstars].measure[3].posangle   = k2PA[i]; // XXX units
-    stars[Nstars].measure[3].psfQF      = k2Class[i];
+    stars[Nstars].measure[3].posangle   = ToShortDegrees(k2PA[i]); // XXX units
+    stars[Nstars].measure[3].psfQF      = psfQFfromXClass(k2Class[i]);
     stars[Nstars].measure[3].photFlags  = k2ppErrBits[i];
     stars[Nstars].measure[3].photFlags2 = photFlags2;
@@ -596,6 +596,6 @@
     stars[Nstars].measure[4].Mkron      = h2AperMag4[i];
     stars[Nstars].measure[4].dMkron     = h2AperMag4Err[i];
-    stars[Nstars].measure[4].posangle   = h2PA[i]; // XXX units
-    stars[Nstars].measure[4].psfQF      = h2Class[i];
+    stars[Nstars].measure[4].posangle   = ToShortDegrees(h2PA[i]); // XXX units
+    stars[Nstars].measure[4].psfQF      = psfQFfromXClass(h2Class[i]);
     stars[Nstars].measure[4].photFlags  = h2ppErrBits[i];
     stars[Nstars].measure[4].photFlags2 = photFlags2;
Index: /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_uhs.c
===================================================================
--- /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_uhs.c	(revision 42076)
+++ /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_uhs.c	(revision 42077)
@@ -297,6 +297,6 @@
     stars[Nstars].measure[0].Mkron      = jAperMag4[i];
     stars[Nstars].measure[0].dMkron     = jAperMag4Err[i];
-    stars[Nstars].measure[0].posangle   = jPA[i]; // XXX units
-    stars[Nstars].measure[0].psfQF      = jClass[i];
+    stars[Nstars].measure[0].posangle   = ToShortDegrees(jPA[i]); // jPA is in degrees, posangle is short 
+    stars[Nstars].measure[0].psfQF      = psfQFfromXClass(jClass[i]);
     stars[Nstars].measure[0].photFlags  = jppErrBits[i];
     stars[Nstars].measure[0].photFlags2 = photFlags2;
Index: /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ulas.c
===================================================================
--- /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ulas.c	(revision 42076)
+++ /trunk/Ohana/src/addstar/src/loadukirt_uhs_readstars_ulas.c	(revision 42077)
@@ -543,6 +543,6 @@
     stars[Nstars].measure[0].Mkron      = yAperMag4[i];
     stars[Nstars].measure[0].dMkron     = yAperMag4Err[i];
-    stars[Nstars].measure[0].posangle   = yPA[i]; // XXX units
-    stars[Nstars].measure[0].psfQF      = yClass[i];
+    stars[Nstars].measure[0].posangle   = ToShortDegrees(yPA[i]); // XXX units
+    stars[Nstars].measure[0].psfQF      = psfQFfromXClass(yClass[i]);
     stars[Nstars].measure[0].photFlags  = yppErrBits[i];
     stars[Nstars].measure[0].photFlags2 = photFlags2;
@@ -563,6 +563,6 @@
     stars[Nstars].measure[1].Mkron      = j1AperMag4[i];
     stars[Nstars].measure[1].dMkron     = j1AperMag4Err[i];
-    stars[Nstars].measure[1].posangle   = j1PA[i]; // XXX units
-    stars[Nstars].measure[1].psfQF      = j1Class[i];
+    stars[Nstars].measure[1].posangle   = ToShortDegrees(j1PA[i]); // XXX units
+    stars[Nstars].measure[1].psfQF      = psfQFfromXClass(j1Class[i]);
     stars[Nstars].measure[1].photFlags  = j1ppErrBits[i];
     stars[Nstars].measure[1].photFlags2 = photFlags2;
@@ -583,6 +583,6 @@
     stars[Nstars].measure[2].Mkron      = j2AperMag4[i];
     stars[Nstars].measure[2].dMkron     = j2AperMag4Err[i];
-    stars[Nstars].measure[2].posangle   = j2PA[i]; // XXX units
-    stars[Nstars].measure[2].psfQF      = j2Class[i];
+    stars[Nstars].measure[2].posangle   = ToShortDegrees(j2PA[i]); // XXX units
+    stars[Nstars].measure[2].psfQF      = psfQFfromXClass(j2Class[i]);
     stars[Nstars].measure[2].photFlags  = j2ppErrBits[i];
     stars[Nstars].measure[2].photFlags2 = photFlags2;
@@ -603,6 +603,6 @@
     stars[Nstars].measure[3].Mkron      = hAperMag4[i];
     stars[Nstars].measure[3].dMkron     = hAperMag4Err[i];
-    stars[Nstars].measure[3].posangle   = hPA[i]; // XXX units
-    stars[Nstars].measure[3].psfQF      = hClass[i];
+    stars[Nstars].measure[3].posangle   = ToShortDegrees(hPA[i]); // XXX units
+    stars[Nstars].measure[3].psfQF      = psfQFfromXClass(hClass[i]);
     stars[Nstars].measure[3].photFlags  = hppErrBits[i];
     stars[Nstars].measure[3].photFlags2 = photFlags2;
@@ -623,6 +623,6 @@
     stars[Nstars].measure[4].Mkron      = kAperMag4[i];
     stars[Nstars].measure[4].dMkron     = kAperMag4Err[i];
-    stars[Nstars].measure[4].posangle   = kPA[i]; // XXX units
-    stars[Nstars].measure[4].psfQF      = kClass[i];
+    stars[Nstars].measure[4].posangle   = ToShortDegrees(kPA[i]); // XXX units
+    stars[Nstars].measure[4].psfQF      = psfQFfromXClass(kClass[i]);
     stars[Nstars].measure[4].photFlags  = kppErrBits[i];
     stars[Nstars].measure[4].photFlags2 = photFlags2;
