Index: /trunk/Ohana/src/opihi/dvo/avextract.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/avextract.c	(revision 4605)
+++ /trunk/Ohana/src/opihi/dvo/avextract.c	(revision 4606)
@@ -47,5 +47,5 @@
     }
   } 
-  if (!TestPhotSelections (&code, param)) goto escape;
+  if (!TestPhotSelections (&code, &mode, param)) goto escape;
 
   /* load region corresponding to selection above */
Index: /trunk/Ohana/src/opihi/dvo/calmextract.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/calmextract.c	(revision 4605)
+++ /trunk/Ohana/src/opihi/dvo/calmextract.c	(revision 4606)
@@ -40,5 +40,5 @@
   if (!GetPhotcodeInfo (argv[1], &code[0], &mode[0])) goto usage;
   if (!GetPhotcodeInfo (argv[3], &code[1], &mode[1])) goto usage;
-  if (!TestPhotSelections (&code[0], MEAS_ZERO)) goto escape;
+  if (!TestPhotSelections (&code[0], &mode[0], MEAS_ZERO)) goto escape;
 
   /* returned vectors are dmag, mag, color, time, airmass, ra, dec, x, y, exptime */
Index: /trunk/Ohana/src/opihi/dvo/ccd.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/ccd.c	(revision 4605)
+++ /trunk/Ohana/src/opihi/dvo/ccd.c	(revision 4606)
@@ -43,5 +43,5 @@
   if (!GetPhotcodeInfo (argv[5], &code[2], &mode[2])) return (FALSE);
   if (!GetPhotcodeInfo (argv[7], &code[3], &mode[3])) return (FALSE);
-  if (!TestPhotSelections (&code[0], MEAS_ZERO)) goto escape;
+  if (!TestPhotSelections (&code[0], &mode[0], MEAS_ZERO)) goto escape;
 
   /* load region corresponding to selection above */
Index: /trunk/Ohana/src/opihi/dvo/cmd.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/cmd.c	(revision 4605)
+++ /trunk/Ohana/src/opihi/dvo/cmd.c	(revision 4606)
@@ -41,5 +41,5 @@
   if (!GetPhotcodeInfo (argv[3], &code[1], &mode[1])) return (FALSE);
   if (!GetPhotcodeInfo (argv[5], &code[2], &mode[2])) return (FALSE);
-  if (!TestPhotSelections (&code[0], MEAS_ZERO)) goto escape;
+  if (!TestPhotSelections (&code[0], &mode[0], MEAS_ZERO)) goto escape;
 
   /* load region corresponding to selection above */
Index: /trunk/Ohana/src/opihi/dvo/ddmags.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/ddmags.c	(revision 4605)
+++ /trunk/Ohana/src/opihi/dvo/ddmags.c	(revision 4606)
@@ -43,5 +43,5 @@
   if (!GetPhotcodeInfo (argv[5], &code[2], &mode[2])) return (FALSE);
   if (!GetPhotcodeInfo (argv[7], &code[3], &mode[3])) return (FALSE);
-  if (!TestPhotSelections (&code[0], MEAS_ZERO)) goto escape;
+  if (!TestPhotSelections (&code[0], &mode[0], MEAS_ZERO)) goto escape;
 
   /* load region corresponding to selection above */
Index: /trunk/Ohana/src/opihi/dvo/dmagaves.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/dmagaves.c	(revision 4605)
+++ /trunk/Ohana/src/opihi/dvo/dmagaves.c	(revision 4606)
@@ -40,5 +40,5 @@
   if (!GetPhotcodeInfo (argv[3], &code[1], &mode[1])) goto usage;
   if ((param = GetAverageParam (argv[5])) == AVE_ZERO) goto usage;
-  if (!TestPhotSelections (&code[2], param)) goto escape;
+  if (!TestPhotSelections (&code[2], &mode[2], param)) goto escape;
 
   /* load region corresponding to selection above */
Index: /trunk/Ohana/src/opihi/dvo/dmagmeas.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/dmagmeas.c	(revision 4605)
+++ /trunk/Ohana/src/opihi/dvo/dmagmeas.c	(revision 4606)
@@ -41,5 +41,5 @@
   if (!GetPhotcodeInfo (argv[3], &code[1], &mode[1])) goto usage;
   if ((param = GetMeasureParam (argv[5])) == MEAS_ZERO) goto usage;
-  if (!TestPhotSelections (&code[2], MEAS_ZERO)) goto escape;
+  if (!TestPhotSelections (&code[2], &mode[2], MEAS_ZERO)) goto escape;
 
   /* load region corresponding to selection above */
Index: /trunk/Ohana/src/opihi/dvo/mextract.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/mextract.c	(revision 4605)
+++ /trunk/Ohana/src/opihi/dvo/mextract.c	(revision 4606)
@@ -48,5 +48,5 @@
     }
   }
-  if (!TestPhotSelections (&code, MEAS_ZERO)) goto escape;
+  if (!TestPhotSelections (&code, &mode, MEAS_ZERO)) goto escape;
 
   /* load region corresponding to selection above */
Index: /trunk/Ohana/src/opihi/dvo/photometry.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/photometry.c	(revision 4605)
+++ /trunk/Ohana/src/opihi/dvo/photometry.c	(revision 4606)
@@ -63,4 +63,5 @@
 static int PhotcodeSelect;
 static PhotCode *PhotcodeValue;
+static int PhotcodeMode;
 
 /* selections based on Average quantities */
@@ -247,5 +248,5 @@
 
 /* I've set some selections - if these require a photcode, check if I set one */
-int TestPhotSelections (PhotCode **code, int param) {
+int TestPhotSelections (PhotCode **code, int *mode, int param) {
 
   int NeedPhotcode;
@@ -281,4 +282,5 @@
     if (!PhotcodeSelect) return (FALSE);
     code[0] = PhotcodeValue;
+    mode[0] = PhotcodeMode;
     if (code[0][0].type == PHOT_DEP) return (FALSE);
     if (code[0][0].type == PHOT_REF) return (FALSE);
@@ -386,5 +388,5 @@
     PhotcodeSelect = TRUE;
     remove_argument (N, argc, argv);
-    PhotcodeValue = GetPhotcodebyName (argv[N]);
+    GetPhotcodeInfo (argv[N], &PhotcodeValue, &PhotcodeMode);
     if (PhotcodeValue == NULL) {
       fprintf (stderr, "photcode not found in photcode table\n");
Index: /trunk/Ohana/src/opihi/include/dvo1.h
===================================================================
--- /trunk/Ohana/src/opihi/include/dvo1.h	(revision 4605)
+++ /trunk/Ohana/src/opihi/include/dvo1.h	(revision 4606)
@@ -67,5 +67,5 @@
 int	      SetSelectionParam	    PROTO((int param));
 int	      TestAverage	    PROTO((PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure));
-int	      TestPhotSelections    PROTO((PhotCode **code, int param));
+int	      TestPhotSelections    PROTO((PhotCode **code, int *mode, int param));
 void          print_value           PROTO((FILE *f, double value, short int ival));
 
