Index: /branches/czw_branch/20160809/Ohana/src/uniphot/include/setphot.h
===================================================================
--- /branches/czw_branch/20160809/Ohana/src/uniphot/include/setphot.h	(revision 39712)
+++ /branches/czw_branch/20160809/Ohana/src/uniphot/include/setphot.h	(revision 39713)
@@ -67,4 +67,6 @@
 int          VERBOSE;
 int          RESET;
+int          PHOTCODE_MIN;
+int          PHOTCODE_MAX;
 int          UBERCAL; // load the supplied ubercal zero point fits table (with flat-field corrections)
 int          NO_METADATA; // the supplied ubercal data has no descriptive metadata
Index: /branches/czw_branch/20160809/Ohana/src/uniphot/src/initialize_setphot.c
===================================================================
--- /branches/czw_branch/20160809/Ohana/src/uniphot/src/initialize_setphot.c	(revision 39712)
+++ /branches/czw_branch/20160809/Ohana/src/uniphot/src/initialize_setphot.c	(revision 39713)
@@ -109,4 +109,14 @@
   if ((N = get_argument (argc, argv, "-reset"))) {
     RESET = TRUE;
+    remove_argument (N, &argc, argv);
+  }
+
+  PHOTCODE_MIN = 0;
+  PHOTCODE_MAX = 0;
+  if ((N = get_argument (argc, argv, "-photcode-range"))) {
+    remove_argument (N, &argc, argv);
+    PHOTCODE_MIN = atoi (argv[N]);    
+    remove_argument (N, &argc, argv);
+    PHOTCODE_MAX = atoi (argv[N]);    
     remove_argument (N, &argc, argv);
   }
Index: /branches/czw_branch/20160809/Ohana/src/uniphot/src/initialize_setphot_client.c
===================================================================
--- /branches/czw_branch/20160809/Ohana/src/uniphot/src/initialize_setphot_client.c	(revision 39712)
+++ /branches/czw_branch/20160809/Ohana/src/uniphot/src/initialize_setphot_client.c	(revision 39713)
@@ -96,4 +96,14 @@
   }
 
+  PHOTCODE_MIN = 0;
+  PHOTCODE_MAX = 0;
+  if ((N = get_argument (argc, argv, "-photcode-range"))) {
+    remove_argument (N, &argc, argv);
+    PHOTCODE_MIN = atoi (argv[N]);    
+    remove_argument (N, &argc, argv);
+    PHOTCODE_MAX = atoi (argv[N]);    
+    remove_argument (N, &argc, argv);
+  }
+
   // region of interest
   UserPatch.Rmin = 0;
Index: /branches/czw_branch/20160809/Ohana/src/uniphot/src/update_catalog_setphot.c
===================================================================
--- /branches/czw_branch/20160809/Ohana/src/uniphot/src/update_catalog_setphot.c	(revision 39712)
+++ /branches/czw_branch/20160809/Ohana/src/uniphot/src/update_catalog_setphot.c	(revision 39713)
@@ -26,4 +26,10 @@
     if (!code) continue; // invalid photcode
     if (code->type != PHOT_DEP) continue;
+
+    // allow a restriction on the modified zpts:
+    if (PHOTCODE_MAX) {
+      if (measure[0].photcode < PHOTCODE_MIN) continue;
+      if (measure[0].photcode > PHOTCODE_MAX) continue;
+    }
 
     off_t idx = measure[0].imageID;
Index: /branches/czw_branch/20160809/Ohana/src/uniphot/src/update_dvo_setphot.c
===================================================================
--- /branches/czw_branch/20160809/Ohana/src/uniphot/src/update_dvo_setphot.c	(revision 39712)
+++ /branches/czw_branch/20160809/Ohana/src/uniphot/src/update_dvo_setphot.c	(revision 39713)
@@ -179,4 +179,6 @@
     if (DCR_RESET)     	  { strextend (&command, "-DCR-reset"); }
     if (CAM_RESET)     	  { strextend (&command, "-CAM-reset"); }
+
+    if (PHOTCODE_MAX) 	  { strextend (&command, "-photcode-range %d %d", PHOTCODE_MIN, PHOTCODE_MAX); }
 
     fprintf (stderr, "command: %s\n", command);
