Index: /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/Makefile
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/Makefile	(revision 33573)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/Makefile	(revision 33574)
@@ -44,4 +44,5 @@
 $(SRC)/dvosorts.$(ARCH).o	 \
 $(SRC)/dvo_photcode_ops.$(ARCH).o \
+$(SRC)/dvo_photcode_utils.$(ARCH).o \
 $(SRC)/LoadPhotcodes.$(ARCH).o   \
 $(SRC)/LoadPhotcodesText.$(ARCH).o   \
Index: /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/include/dvo.h
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/include/dvo.h	(revision 33573)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/include/dvo.h	(revision 33574)
@@ -470,9 +470,9 @@
 int PhotColorTiny (AverageTiny *average, SecFilt *secfilt, MeasureTiny *measure, int c1, int c2, double *color);
 
-
 PhotCodeData *GetPhotcodeTable (void);
 void SetPhotcodeTable (PhotCodeData *);
 
 int *GetSecFiltMap(PhotCodeData *ouput, PhotCodeData* input);
+PhotCode **ParsePhotcodeList (char *rawlist, int *nphotcodes, int needAve);
 
 int LoadPhotcodes (char *catdir_file, char *master_file, int readwrite);
Index: /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_photcode_ops.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_photcode_ops.c	(revision 33573)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_photcode_ops.c	(revision 33574)
@@ -857,36 +857,4 @@
 /***********************************************/
 
-// Create a map between the secfilt values from one photcode table to another
-int *GetSecFiltMap(PhotCodeData *output, PhotCodeData *input) {
-  int i, j;
-  int NsecfiltIn  = input[0].Nsecfilt;
-  int NsecfiltOut = output[0].Nsecfilt;
-  int *map;
-  ALLOCATE(map, int, NsecfiltIn);
-
-  // loop over entries in the input table
-  for (i = 0; i < NsecfiltIn; i++) {
-    int code  = input[0].codeNsec[i];
-    int entry = -1;
-    // find the matching entry in the output table
-    for (j = 0; j < NsecfiltOut; j++) {
-      int outcode = output[0].codeNsec[j];
-      if (code == outcode) {
-	 entry = j;
-	 break;
-      }
-    }
-    // if (entry == -1) {
-    //   // entry is missing fail (no printfs in this file)
-    //   free(map);
-    //   return(FALSE);
-    // }
-
-    // if entry is still -1, we will skip this one (not map into the output db)
-    map[i] = entry;
-  }
-
-  return map;
-}
 
 /* photcode table should have the following format: 
Index: /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_photcode_utils.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_photcode_utils.c	(revision 33574)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_photcode_utils.c	(revision 33574)
@@ -0,0 +1,68 @@
+# include <dvo.h>
+
+// Create a map between the secfilt values from one photcode table to another
+int *GetSecFiltMap(PhotCodeData *output, PhotCodeData *input) {
+  int i, j;
+  int NsecfiltIn  = input[0].Nsecfilt;
+  int NsecfiltOut = output[0].Nsecfilt;
+  int *map;
+  ALLOCATE(map, int, NsecfiltIn);
+
+  // loop over entries in the input table
+  for (i = 0; i < NsecfiltIn; i++) {
+    int code  = input[0].codeNsec[i];
+    int entry = -1;
+    // find the matching entry in the output table
+    for (j = 0; j < NsecfiltOut; j++) {
+      int outcode = output[0].codeNsec[j];
+      if (code == outcode) {
+	 entry = j;
+	 break;
+      }
+    }
+    // if (entry == -1) {
+    //   // entry is missing fail (no printfs in this file)
+    //   free(map);
+    //   return(FALSE);
+    // }
+
+    // if entry is still -1, we will skip this one (not map into the output db)
+    map[i] = entry;
+  }
+
+  return map;
+}
+
+PhotCode **ParsePhotcodeList (char *rawlist, int *nphotcodes, int needAve) {
+
+  *nphotcodes = 0;
+  if (!rawlist) return NULL;
+
+  int Nphotcodes = 0;
+  int NPHOTCODES = 10;
+  PhotCode **photcodes = NULL;
+  ALLOCATE (photcodes, PhotCode *, NPHOTCODES);
+
+  /* parse the comma-separated list of photcodes */
+  char *myList = strcreate(rawlist);
+  char *list = myList;
+  char *codename = NULL;
+  char *ptr = NULL;
+  while ((codename = strtok_r (list, ",", &ptr)) != NULL) {
+    list = NULL; // pass NULL on successive strtok_r calls
+    if ((photcodes[Nphotcodes] = GetPhotcodebyName (codename)) == NULL) {
+      fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
+      exit (1);
+    }
+    if (needAve && (photcodes[Nphotcodes][0].type != PHOT_SEC)) {
+      fprintf (stderr, "photcode %s is not an filter type (SEC)\n", codename);
+      exit (1);
+    }
+    Nphotcodes ++;
+    CHECK_REALLOCATE (photcodes, PhotCode *, NPHOTCODES, Nphotcodes, 10);
+  }
+  free (myList);
+
+  *nphotcodes = Nphotcodes;
+  return photcodes;
+}
Index: /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/Makefile
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/Makefile	(revision 33573)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/Makefile	(revision 33574)
@@ -23,4 +23,5 @@
 PHOTDBC = \
 $(SRC)/photdbc.$(ARCH).o	   \
+$(SRC)/photdbc_catalogs.$(ARCH).o  \
 $(SRC)/initialize.$(ARCH).o	   \
 $(SRC)/ConfigInit.$(ARCH).o	   \
Index: /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/include/photdbc.h
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/include/photdbc.h	(revision 33573)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/include/photdbc.h	(revision 33574)
@@ -20,4 +20,11 @@
   int    Nmeas;
 } StatType;
+
+int    PARALLEL;
+int    PARALLEL_MANUAL;
+int    PARALLEL_SERIAL;
+
+int          HOST_ID;
+char        *HOSTDIR;
 
 // need to get RADIUS from Config 
@@ -124,2 +131,5 @@
 int copy_images (char *outdir);
 void usage();
+
+int photdbc_catalogs (SkyList *skylist, int hostID);
+int photdbc_parallel (SkyList *skylist);
Index: /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/args.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/args.c	(revision 33573)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/args.c	(revision 33574)
@@ -83,4 +83,32 @@
   }
 
+  // XXX for the moment, make this selection manual.  it needs to be automatic 
+  // based on the state of the SkyTable
+  PARALLEL = FALSE;
+  if ((N = get_argument (argc, argv, "-parallel"))) {
+    PARALLEL = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+  // this is a test mode : rather than launching the remote jobs and waiting for completion,
+  // relphot will simply list the remote command and wait for the user to signal completion
+  PARALLEL_MANUAL = FALSE;
+  if ((N = get_argument (argc, argv, "-parallel-manual"))) {
+    PARALLEL = TRUE; // -parallel-manual implies -parallel
+    PARALLEL_MANUAL = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+  // this is a test mode : rather than launching the relphot_client jobs remotely, they are 
+  // run in serial via 'system'
+  PARALLEL_SERIAL = FALSE;
+  if ((N = get_argument (argc, argv, "-parallel-serial"))) {
+    if (PARALLEL_MANUAL) {
+      fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n");
+      exit (1);
+    }
+    PARALLEL = TRUE; // -parallel-serial implies -parallel
+    PARALLEL_SERIAL = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+
   if (argc != 2) usage();
 
Index: /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/initialize.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/initialize.c	(revision 33573)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/initialize.c	(revision 33574)
@@ -2,7 +2,4 @@
 
 void initialize (int argc, char **argv) {
-
-  int NPHOTCODES;
-  char *codename, *ptr, *list;
 
   /* are these set correctly? */
@@ -15,46 +12,6 @@
   args (argc, argv);
 
-  NphotcodesDrop = 0;
-  photcodesDrop = NULL;
-  ptr = NULL;
-  if (PHOTCODE_DROP_LIST != NULL) {
-    NPHOTCODES = 10;
-    ALLOCATE (photcodesDrop, PhotCode *, NPHOTCODES);
-
-    /* parse the comma-separated list of photcodesDrop */
-    list = PHOTCODE_DROP_LIST;
-    while ((codename = strtok_r (list, ",", &ptr)) != NULL) {
-      list = NULL; // pass NULL on successive strtok_r calls
-      fprintf (stderr, "PHOTCODE_LIST: %s\n", PHOTCODE_DROP_LIST);
-      fprintf (stderr, "codename: %s\n", codename);
-      if ((photcodesDrop[NphotcodesDrop] = GetPhotcodebyName (codename)) == NULL) {
-        fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
-        exit (1);
-      }
-      NphotcodesDrop ++;
-      CHECK_REALLOCATE (photcodesDrop, PhotCode *, NPHOTCODES, NphotcodesDrop, 10);
-    }
-  }
-
-  NphotcodesSkip = 0;
-  photcodesSkip = NULL;
-  if (PHOTCODE_SKIP_LIST != NULL) {
-    NPHOTCODES = 10;
-    ALLOCATE (photcodesSkip, PhotCode *, NPHOTCODES);
-
-    /* parse the comma-separated list of photcodesSkip */
-    list = PHOTCODE_SKIP_LIST;
-    while ((codename = strtok_r (list, ",", &ptr)) != NULL) {
-      list = NULL; // pass NULL on successive strtok_r calls
-      fprintf (stderr, "PHOTCODE_LIST: %s\n", PHOTCODE_SKIP_LIST);
-      fprintf (stderr, "codename: %s\n", codename);
-      if ((photcodesSkip[NphotcodesSkip] = GetPhotcodebyName (codename)) == NULL) {
-        fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
-        exit (1);
-      }
-      NphotcodesSkip ++;
-      CHECK_REALLOCATE (photcodesSkip, PhotCode *, NPHOTCODES, NphotcodesSkip, 10);
-    }
-  }
+  photcodesDrop = ParsePhotcodeList (PHOTCODE_DROP_LIST, &NphotcodeDrop, FALSE);
+  photcodesSkip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodeSkip, FALSE);
 
   if (SHOW_PARAMS) {
Index: /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/photdbc.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/photdbc.c	(revision 33573)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/photdbc.c	(revision 33574)
@@ -3,8 +3,4 @@
 int main (int argc, char **argv) {
 
-  int i;
-  char *skyfile;
-  Catalog incatalog;
-  Catalog outcatalog;
   SkyTable *sky;
   SkyList *skylist;
@@ -20,67 +16,7 @@
   SkyTableSetFilenames (sky, CATDIR, "cpt");
   skylist = SkyListByPatch (sky, -1, &REGION);
-  for (i = 0; i < skylist[0].Nregions; i++) {
-    if (VERBOSE) fprintf (stderr, "%s\n", skylist[0].regions[i][0].name);
 
-    // set the parameters which guide catalog open/load/create
-    incatalog.filename = skylist[0].filename[i];
-    incatalog.Nsecfilt = GetPhotcodeNsecfilt ();
-    incatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;
-
-    // an error exit status here is a significant error
-    if (!dvo_catalog_open (&incatalog, skylist[0].regions[i], VERBOSE, "r")) {
-      fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", incatalog.filename);
-      exit (2);
-    }
-    // skip empty input catalogs
-    if (!incatalog.Naves_disk) {
-      dvo_catalog_unlock (&incatalog);
-      dvo_catalog_free (&incatalog);
-      continue;
-    }
-
-    // create output catalog filename
-    outcatalog.filename = strsubs (incatalog.filename, CATDIR, argv[1]);
-    if (outcatalog.filename == NULL) Shutdown ("error with input catalog name");
-
-    // define outcatalog open parameters
-    outcatalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
-    outcatalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
-    outcatalog.Nsecfilt  = incatalog.Nsecfilt;                 // inherit from the incatalog
-    outcatalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
-
-    // output catalogs always represent the same skyregions as the input catalogs
-    if (!dvo_catalog_open (&outcatalog, skylist[0].regions[i], VERBOSE, "w")) {
-      fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", outcatalog.filename);
-      exit (2);
-    }
-
-    // the output catalog needs to have the same values for 'objID' and 'sorted' as the input
-    outcatalog.objID = incatalog.objID;
-    outcatalog.sorted = incatalog.sorted;
-    if (!incatalog.sorted) {
-      fprintf (stderr, "ERROR: input db must be sorted: %s\n", incatalog.filename);
-      exit (2);
-    }
-
-    /* limit number of measures based on selections */
-    make_subcatalog (&outcatalog, &incatalog, skylist[0].regions[i]);
-	
-    // XXX add other filters here:
-    // join_stars (&outcatalog);
-    // unique_measures (catalog);
-    // flag_measures (&db, catalog);
-    // get_mags (catalog);
-
-    dvo_catalog_save (&outcatalog, VERBOSE);
-    dvo_catalog_unlock (&outcatalog);
-    dvo_catalog_free (&outcatalog);
-
-    dvo_catalog_unlock (&incatalog);
-    dvo_catalog_free (&incatalog);
-  }
-
-  skyfile = SkyTableFilename (argv[1]);
-  SkyTableSave (sky, skyfile);
+  // hostID is 0 for master program
+  photdbc_catalogs (skylist, 0);
   exit (0);
 }
Index: /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/photdbc_catalogs.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/photdbc_catalogs.c	(revision 33574)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/photdbc_catalogs.c	(revision 33574)
@@ -0,0 +1,149 @@
+# include "photdbc.h"
+
+int photdbc_catalogs (SkyList *skylist, int hostID) {
+
+  int i;
+  char *skyfile;
+  Catalog incatalog;
+  Catalog outcatalog;
+
+  if (PARALLEL && !hostID) {
+      photdbc_parallel (skylist);
+      exit (0);
+  }
+
+  for (i = 0; i < skylist[0].Nregions; i++) {
+    if (VERBOSE) fprintf (stderr, "%s\n", skylist[0].regions[i][0].name);
+
+    // does this host ID match the desired location for the table?
+    if (!HostTableTestHost(skylist[0].regions[i], hostID)) continue;
+
+    // set the parameters which guide catalog open/load/create
+    char hostfile[1024];
+    snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
+    incatalog.filename  = hostID ? hostfile : skylist[0].filename[i];
+    incatalog.Nsecfilt = GetPhotcodeNsecfilt ();
+    incatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;
+
+    // an error exit status here is a significant error
+    if (!dvo_catalog_open (&incatalog, skylist[0].regions[i], VERBOSE, "r")) {
+      fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", incatalog.filename);
+      exit (2);
+    }
+    // skip empty input catalogs
+    if (!incatalog.Naves_disk) {
+      dvo_catalog_unlock (&incatalog);
+      dvo_catalog_free (&incatalog);
+      continue;
+    }
+
+    // create output catalog filename
+    outcatalog.filename = strsubs (incatalog.filename, CATDIR, argv[1]);
+    if (outcatalog.filename == NULL) Shutdown ("error with input catalog name");
+
+    // define outcatalog open parameters
+    outcatalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
+    outcatalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
+    outcatalog.Nsecfilt  = incatalog.Nsecfilt;                 // inherit from the incatalog
+    outcatalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
+
+    // output catalogs always represent the same skyregions as the input catalogs
+    if (!dvo_catalog_open (&outcatalog, skylist[0].regions[i], VERBOSE, "w")) {
+      fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", outcatalog.filename);
+      exit (2);
+    }
+
+    // the output catalog needs to have the same values for 'objID' and 'sorted' as the input
+    outcatalog.objID = incatalog.objID;
+    outcatalog.sorted = incatalog.sorted;
+    if (!incatalog.sorted) {
+      fprintf (stderr, "ERROR: input db must be sorted: %s\n", incatalog.filename);
+      exit (2);
+    }
+
+    /* limit number of measures based on selections */
+    make_subcatalog (&outcatalog, &incatalog, skylist[0].regions[i]);
+	
+    // XXX add other filters here:
+    // join_stars (&outcatalog);
+    // unique_measures (catalog);
+    // flag_measures (&db, catalog);
+    // get_mags (catalog);
+
+    dvo_catalog_save (&outcatalog, VERBOSE);
+    dvo_catalog_unlock (&outcatalog);
+    dvo_catalog_free (&outcatalog);
+
+    dvo_catalog_unlock (&incatalog);
+    dvo_catalog_free (&incatalog);
+  }
+
+  skyfile = SkyTableFilename (argv[1]);
+  SkyTableSave (sky, skyfile);
+  exit (0);
+}
+
+int photdbc_parallel (SkyList *skylist) {
+
+  // launch the photdbo_client jobs to the parallel hosts
+
+  // load the list of hosts
+  HostTable *table = HostTableLoad (CATDIR, skylist->hosts);
+  if (!table) {
+    fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", skylist->hosts, CATDIR);
+    exit (1);
+  }    
+
+  int i;
+  for (i = 0; i < table->Nhosts; i++) {
+
+    // ensure that the paths are absolute path names
+    char *tmppath = abspath (table->hosts[i].pathname, MAX_PATH_LENGTH);
+    free (table->hosts[i].pathname);
+    table->hosts[i].pathname = tmppath;
+
+    // options / arguments that can affect relastro_client -update-objects:
+    char command[1024];
+    snprintf (command, 1024, "photdbc_client -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f", 
+	      table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, REGION.Rmin, REGION.Rmax, REGION.Dmin, REGION.Dmax);
+
+    char tmpline[1024];
+    if (VERBOSE)            { snprintf (tmpline, 1024, "%s -v",                command);                             strcpy (command, tmpline); }
+    if (ExcludeByInstMag)   { snprintf (tmpline, 1024, "%s -instmag %f %f",    command, INST_MAG_MIN, INST_MAG_MAX); strcpy (command, tmpline); }
+    if (ExcludeByMinSigma)  { snprintf (tmpline, 1024, "%s -min-sigma %f",     command, SIGMA_MIN_KEEP); 	     strcpy (command, tmpline); }
+    if (ExcludeByMaxMinMag) { snprintf (tmpline, 1024, "%s -maxminmag %f",     command, MAX_MIN_MAG);    	     strcpy (command, tmpline); }
+    if (PHOTCODE_DROP_LIST) { snprintf (tmpline, 1024, "%s -photcode-drop %s", command, PHOTCODE_DROP_LIST); 	     strcpy (command, tmpline); }
+    if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode-skip %s", command, PHOTCODE_SKIP_LIST); 	     strcpy (command, tmpline); }
+
+    fprintf (stderr, "command: %s\n", command);
+
+    if (PARALLEL_MANUAL) continue;
+
+    if (PARALLEL_SERIAL) {
+      int status = system (command);
+      if (status) {
+	fprintf (stderr, "ERROR running photdbc_client\n");
+	exit (2);
+      }
+    } else {
+      // launch the job on the remote machine (no handshake)
+      int errorInfo = 0;
+      int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE);
+      if (!pid) {
+	if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo);
+	exit (1);
+      }
+      table->hosts[i].pid = pid; // save for future reference
+    }
+  }
+
+  if (PARALLEL_MANUAL) {
+    fprintf (stderr, "run the photdbc_client commands above.  when these are done, hit return\n");
+    getchar();
+  }
+  if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) {
+    HostTableWaitJobsGetIO (table, __FILE__, __LINE__);
+  }
+
+  return TRUE;
+}      
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/initialize.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/initialize.c	(revision 33573)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/initialize.c	(revision 33574)
@@ -63,35 +63,2 @@
 }
 
-PhotCode **ParsePhotcodeList (char *rawlist, int *nphotcodes, int needAve) {
-
-  *nphotcodes = 0;
-  if (!rawlist) return NULL;
-
-  int Nphotcodes = 0;
-  int NPHOTCODES = 10;
-  PhotCode **photcodes = NULL;
-  ALLOCATE (photcodes, PhotCode *, NPHOTCODES);
-
-  /* parse the comma-separated list of photcodes */
-  char *myList = strcreate(rawlist);
-  char *list = myList;
-  char *codename = NULL;
-  char *ptr = NULL;
-  while ((codename = strtok_r (list, ",", &ptr)) != NULL) {
-    list = NULL; // pass NULL on successive strtok_r calls
-    if ((photcodes[Nphotcodes] = GetPhotcodebyName (codename)) == NULL) {
-      fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);
-      exit (1);
-    }
-    if (needAve && (photcodes[Nphotcodes][0].type != PHOT_SEC)) {
-      fprintf (stderr, "photcode %s is not an filter type (SEC)\n", codename);
-      exit (1);
-    }
-    Nphotcodes ++;
-    CHECK_REALLOCATE (photcodes, PhotCode *, NPHOTCODES, Nphotcodes, 10);
-  }
-  free (myList);
-
-  *nphotcodes = Nphotcodes;
-  return photcodes;
-}
Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/initialize.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/initialize.c	(revision 33573)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/initialize.c	(revision 33574)
@@ -1,5 +1,3 @@
 # include "relphot.h"
-
-void ParsePhotcodeList (char *word);
 
 void initialize (int argc, char **argv) {
@@ -13,5 +11,5 @@
     // only a single remaining argument in this mode (the list of photcodes, eg g,r,i)
     PhotcodeList = strcreate (argv[1]);
-    ParsePhotcodeList (PhotcodeList);
+    photcodes = ParsePhotcodeList (PhotcodeList, &Nphotcodes, TRUE); // require SEC photcodes
   }
   if (USE_GRID && (Nphotcodes > 1)) {
@@ -69,8 +67,8 @@
   // load the list of photcodes into the globals (photcodes, Nphotcodes)
   PhotcodeList = strcreate (argv[1]);
-  ParsePhotcodeList (PhotcodeList);
+  photcodes = ParsePhotcodeList (PhotcodeList, &Nphotcodes, TRUE); // require SEC photcodes
 }
 
-void ParsePhotcodeList (char *word) {
+void ParsePhotcodeList_old (char *word) {
 
   Nphotcodes = 0;
