Index: /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/args.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/args.c	(revision 37457)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/args.c	(revision 37458)
@@ -99,4 +99,32 @@
     VERBOSE = VERBOSE2 = TRUE;
     remove_argument (N, &argc, argv);
+  }
+
+  if (FAKEASTRO_OP == OP_IMAGES) {
+    // mandatory arguments to fakeastro -images -input catdir -output -catdir -images images.fits
+    if ((N = get_argument (argc, argv, "-input"))) {
+      remove_argument (N, &argc, argv);
+      CATDIR_INPUT = strcreate (argv[N]);
+      remove_argument (N, &argc, argv);
+    } else {
+      fprintf (stderr, "missing -input (catdir)\n");
+      exit (2);
+    }
+    if ((N = get_argument (argc, argv, "-output"))) {
+      remove_argument (N, &argc, argv);
+      CATDIR_OUTPUT = strcreate (argv[N]);
+      remove_argument (N, &argc, argv);
+    } else {
+      fprintf (stderr, "missing -output (catdir)\n");
+      exit (2);
+    }
+    if ((N = get_argument (argc, argv, "-images"))) {
+      remove_argument (N, &argc, argv);
+      IMAGES_INPUT = strcreate (argv[N]);
+      remove_argument (N, &argc, argv);
+    } else {
+      fprintf (stderr, "missing -images (images)\n");
+      exit (2);
+    }
   }
 
Index: /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro.c	(revision 37457)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro.c	(revision 37458)
@@ -5,29 +5,4 @@
   /* get configuration info, args */
   initialize (argc, argv);
-
-  SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
-  SkyTableSetFilenames (sky, CATDIR, "cpt");
-  SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch);
-
-  // load the list of hosts
-  HostTable *hosts = NULL;
-  if (PARALLEL) {
-    hosts = HostTableLoad (CATDIR, sky->hosts);
-    if (!hosts) {
-      fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
-      exit (1);
-    }    
-
-    // ensure that the paths are absolute path names
-    int i;
-    for (i = 0; i < hosts->Nhosts; i++) {
-      char *tmppath = abspath (hosts->hosts[i].pathname, DVO_MAX_PATH);
-      free (hosts->hosts[i].pathname);
-      hosts->hosts[i].pathname = tmppath;
-    }
-
-    // set up the array of active hosts
-    init_remote_hosts ();
-  }
 
   switch (FAKEASTRO_OP) {
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 37457)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_galaxy.c	(revision 37458)
@@ -2,4 +2,29 @@
 
 int fakeastro_galaxy (SkyList *skylistInput, HostTable *hosts) {
+
+  SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
+  SkyTableSetFilenames (sky, CATDIR, "cpt");
+  SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch);
+
+  // load the list of hosts
+  HostTable *hosts = NULL;
+  if (PARALLEL) {
+    hosts = HostTableLoad (CATDIR, sky->hosts);
+    if (!hosts) {
+      fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
+      exit (1);
+    }    
+
+    // ensure that the paths are absolute path names
+    int i;
+    for (i = 0; i < hosts->Nhosts; i++) {
+      char *tmppath = abspath (hosts->hosts[i].pathname, DVO_MAX_PATH);
+      free (hosts->hosts[i].pathname);
+      hosts->hosts[i].pathname = tmppath;
+    }
+
+    // set up the array of active hosts
+    init_remote_hosts ();
+  }
 
   int n, i;
Index: /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_images.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_images.c	(revision 37457)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_images.c	(revision 37458)
@@ -1,12 +1,18 @@
 # include "fakeastro.h"
 
-int fakeastro_images (SkyList *skylistInput, HostTable *hosts) {
+int fakeastro_images (HostTable *hosts) {
+
+  SkyTable *skyTableInput = SkyTableLoadOptimal (CATDIR_INPUT, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
+  SkyTableSetFilenames (skyTableInput, CATDIR_INPUT, "cpt");
+  // SkyList *skyListInput = SkyListByPatch (skyInpt, -1, &UserPatch);
+
+  SkyTable *skyTableOutput = SkyTableLoadOptimal (CATDIR_OUTPUT, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
+  SkyTableSetFilenames (skyTableOutput, CATDIR_OUTPUT, "cpt");
+  // SkyList *skyListOutput = SkyListByPatch (skyInpt, -1, &UserPatch);
 
   int Nimages;
   Images *images = load_template_images (&Nimages);
   
-  Images *bores = make_boresites (images, Nimages, Nbores);
-
-  for (i = 0; i < Nbores; i++) {
+  for (i = 0; i < Nimages; i++) {
 
     // we only want to make fake images for the exposures
@@ -16,5 +22,5 @@
     
     for (j = 0; j < NfakeImages; j++) {
-      Stars *fakeStars = make_fake_stars (&fakeImages[i], &NfakeStars);
+      Stars *fakeStars = make_fake_stars (skyTableInput, skyTableOutput, &fakeImages[i], &NfakeStars);
       
       // save fake stars...
Index: /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars.c	(revision 37457)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars.c	(revision 37458)
@@ -1,5 +1,5 @@
 # include "fakeastro.h"
 
-Stars *make_fake_stars (Image *image, int *nfakeStars) {
+Stars *make_fake_stars (SkyTable *skyTableInput, SkyTable *skyTableOutput, Image *image, int *nfakeStars) {
 
   // find the R,D coords of the 4 corners and 4 edge midpoints
@@ -24,36 +24,37 @@
   }
 
-  SkyRegion *regions = SkyListByBounds (skyTable, -1, Rmin, Rmax, Dmin, Dmax);
+  SkyList *skyInput  = SkyListByBounds (skyTableInput, -1, Rmin, Rmax, Dmin, Dmax);
+
+  int Nstars = 0;
 
   // load stars from database in these regions
-  for (i = 0; i < regions->Nregions; i++) {
+  for (i = 0; i < skyInput->Nregions; i++) {
 
     // set the parameters which guide catalog open/load/create
-    catalog.filename  = skylist[0].filename[i];
-    catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
-    catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
-    catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF | LOAD_LENSING;
-    catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
-    if (options.update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF;
-
-      if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "r")) {
-	continue;
-      }
-    } else {
-      // an error exit status here is a significant error (disk I/O or file access)
-      // XXX should this be "a" for options.update?
-      if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
-	fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", catalog.filename);
-	exit (2);
-      }
-
-    // load refstars in region
-    load_something ();
+    catInput.filename  = skyInput[0].filename[i];
+    catInput.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
+    catInput.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
+    catInput.catflags  = LOAD_AVES | LOAD_SECF;
+    catInput.Nsecfilt  = GetPhotcodeNsecfilt ();
+    if (!dvo_catalog_open (&catInput, skylist[0].regions[i], VERBOSE, "r")) {
+      continue;
+    }
 
     // generate fake measurements for this image
-    stars = make_fake_stars_region (inCatalog);
+    stars = make_fake_stars_catalog (catInput, stars, &Nstars);
+   
+  }
 
-    save_fake_stars (stars);
+  // will these match, or should I mangle the input cpt names?
+  SkyList *skyOutput = SkyListByBounds (skyTableOutput, -1, Rmin, Rmax, Dmin, Dmax);
+
+  // load stars from database in these regions
+  for (i = 0; i < skyOutput->Nregions; i++) {
+    if (!dvo_catalog_open (&catOutput, skyOutput[0].regions[i], VERBOSE, "w")) {
+      fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", catalog.filename);
+      exit (2);
+    }
+
+    save_fake_stars (stars, Nstars, catOutput);
   }
 }
-
