Index: /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_galaxy.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_galaxy.c	(revision 37466)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_galaxy.c	(revision 37467)
@@ -30,5 +30,5 @@
 
   int Nloop = 1;
-  int Nstars = 2000000;
+  int Nstars = 5000000;
 
   for (n = 0; n < Nloop; n++) {
Index: /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/get_image_patch.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/get_image_patch.c	(revision 37466)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/get_image_patch.c	(revision 37467)
@@ -36,10 +36,11 @@
 }
 
+// region has region of Rmin <= R < Rmax, Dmin <= D < Dmax
 int SkyRegionHasPoint (SkyRegion *region, double R, double D) {
 
-  if (D >= region->Dmin) return FALSE;
-  if (D <  region->Dmax) return FALSE;
-  if (R >= region->Rmin) return FALSE;
-  if (R <  region->Rmax) return FALSE;
+  if (D <  region->Dmin) return FALSE;
+  if (D >= region->Dmax) return FALSE;
+  if (R <  region->Rmin) return FALSE;
+  if (R >= region->Rmax) return FALSE;
   return TRUE;
 }
Index: /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_images.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_images.c	(revision 37466)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_images.c	(revision 37467)
@@ -48,5 +48,5 @@
 
       fakeImage[N].coords.pc1_2 = 0.0;
-      fakeImage[N].coords.pc1_2 = 0.0;
+      fakeImage[N].coords.pc2_1 = 0.0;
 
       strcpy (fakeImage[N].coords.ctype, "DEC--WRP");
Index: /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars_catalog.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars_catalog.c	(revision 37466)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars_catalog.c	(revision 37467)
@@ -11,7 +11,7 @@
 
 /* used in find_matches, find_matches_refstars */
-# define IN_PATCH(REGION,R,D) (			     \
-((D) >= REGION[0].Dmin) && ((D) < REGION[0].Dmax) && \
-((R) >= REGION[0].Rmin) && ((R) < REGION[0].Rmax))
+# define IN_PATCH(REGION,R,D) (					\
+    ((D) >= REGION[0].Dmin) && ((D) < REGION[0].Dmax) &&	\
+    ((R) >= REGION[0].Rmin) && ((R) < REGION[0].Rmax))
 
 // region corresponds to the catalog
@@ -19,7 +19,7 @@
 
   int Nstars = *nstars;
-
+  
   time_t timeRef = ohana_date_to_sec("2011/05/11,00:00:00");
-
+  
   if (!stars) {
     ALLOCATE (stars, Stars, catalog->Naverage);
@@ -27,14 +27,14 @@
     REALLOCATE (stars, Stars, Nstars + catalog->Naverage);
   }
-
+  
   int Nsecfilt = GetPhotcodeNsecfilt ();
-
+  
   // use photcode to get zero point
   PhotCode *code = GetPhotcodebyCode (image->photcode);
   int Nsec = GetPhotcodeNsec (code->equiv);
   myAssert (Nsec >= 0, "undefined Nsec?");
-
+  
   float Mtime = 2.5*log10(image->exptime);
-
+  
   // XXX fix this!!
   double plateScale = 0.257;
@@ -43,5 +43,5 @@
   float ZP = SCALE*code->C - image->Mcal + Mtime;
   // float ZP = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal;
-
+  
   // generate a set of measurements for each star entry
 
@@ -49,5 +49,5 @@
   SecFilt *secfilt = catalog->secfilt;
   StarPar *starpar = catalog->starpar;
-
+  
   int i;
   for (i = 0; i < catalog->Naverage; i++) {
@@ -74,6 +74,6 @@
     // * proper motion
     // * gaussian scatter (~ seeing) 
-    double uR = starpar[nStar].uRA / 1000.0; // starpar are (currently) in mas / year
-    double uD = starpar[nStar].uDEC / 1000.0;
+    double uR = starpar[nStar].uRA; // starpar are in arcsec / year
+    double uD = starpar[nStar].uDEC;
     
     // tzero, timeRef are in UNIX seconds, Toffset should be in years
@@ -91,5 +91,5 @@
     double dDoff = (dDpm + dDsee) / 3600.0;
 
-    double Robs = Rtru + dRoff / cos(Dtru*DEG_RAD);
+    double Robs = Rtru + dRoff / cos(Dtru*RAD_DEG);
     double Dobs = Dtru + dDoff;
 
@@ -119,4 +119,16 @@
     stars[Nstars].measure.photFlags2 = 0;
 
+    stars[Nstars].average.R = Robs;
+    stars[Nstars].average.D = Dobs;
+
+    /* 
+       XXX need to set these?
+       stars[N].measure.airmass = airmass (image[0].secz, stars[N].average.R, stars[N].average.D, image[0].sidtime, image[0].latitude);
+       stars[N].measure.az      = azimuth (15.0*image[0].sidtime - stars[N].average.R, stars[N].average.D, image[0].latitude);
+       stars[N].measure.Mcal    = image[0].Mcal;
+       stars[N].measure.t       = image[0].tzero + 1e-4*stars[N].measure.Yccd*image[0].trate;  // trate is in 0.1 msec / row 
+       stars[N].measure.dt      = MTIME;
+    */
+
     // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     stars[Nstars].measure.detID      = Nstars + 1;
Index: /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fakestars.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fakestars.c	(revision 37466)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fakestars.c	(revision 37467)
@@ -1,8 +1,9 @@
 # include "fakeastro.h"
 
-# define Z_GAL 500.0
+// # define Z_GAL 500.0
+# define Z_GAL 2000.0
 # define R_GAL 2000.0
 
-static double iFkap = 1.0 / 4.74047; // (km/sec/kpc) / (milli-arcsec/ year)
+static double iFkap = 0.001 / 4.74047; // (km/sec/kpc) / (arcsec/ year)
 static double A_oort = +14.5;  // km/sec/kpc
 static double B_oort = -13.0;  // km/sec/kpc
