Index: /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos.c
===================================================================
--- /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos.c	(revision 40816)
+++ /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos.c	(revision 40817)
@@ -4,5 +4,5 @@
 int deimos_fitslit (int argc, char **argv);
 int deimos_mkobj (int argc, char **argv);
-int deimos_mkalt (int argc, char **argv);
+// int deimos_mkalt (int argc, char **argv); -- deprecated: mkobj adds slit vs psf traces as well as red vs blu chips
 int deimos_getobj (int argc, char **argv);
 int deimos_getalt (int argc, char **argv);
@@ -18,5 +18,5 @@
   {1, "getalt", deimos_getalt, "determine crude object parameters"},
   {1, "mkobj", deimos_mkobj, "make a full object image"},
-  {1, "mkalt", deimos_mkalt, "make a full object image (uses deimos_make_object, for a test)"},
+//   {1, "mkalt", deimos_mkalt, "make a full object image (uses deimos_make_object, for a test)"},
   {1, "mkslit", deimos_mkslit, "make a slit image"},
   {1, "fitslit", deimos_fitslit, "fit slit image to observed slit flux"},
Index: /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos_arclines.c
===================================================================
--- /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos_arclines.c	(revision 40816)
+++ /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos_arclines.c	(revision 40817)
@@ -56,4 +56,5 @@
   for (int iy = 0; iy < Ny; iy++) {
     float Fsum = 0;
+    float Ksum = 0;
     // cross-correlation of buffer values and kernel values
     for (int ix = 0; ix < Nx; ix++) {
@@ -62,5 +63,8 @@
 	if ((iy + ky) < 0) continue;
 	if ((iy + ky) >= Ny) continue;
+	if (!isfinite(Fin[ix + (iy + ky)*Nx])) continue;
+	if (!isfinite(kernel[ix + ko*Nx])) continue;
 	Fsum += Fin[ix + (iy + ky)*Nx] * kernel[ix + ko*Nx];
+	Ksum += kernel[ix + ko*Nx];
       }
     }
Index: /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos_getalt.c
===================================================================
--- /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos_getalt.c	(revision 40816)
+++ /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos_getalt.c	(revision 40817)
@@ -24,4 +24,8 @@
   // output : object sky background
   // not used : LSF -- not needed (measurement per disp pixel)
+
+  // This version uses the median of the pixels in the image which are
+  // in regions where the slit profile is < 15% (as opposed to the
+  // getobj version which attempts to fit both background and sky regions
 
   // input parameters:
@@ -40,5 +44,6 @@
   int N;
 
-  Spline *slit_trace = NULL;
+  Spline *slit_trace_red = NULL;
+  Spline *slit_trace_blu = NULL;
   Spline *psf_trace  = NULL;
   Vector *profile = NULL;
@@ -54,10 +59,25 @@
   float stilt = 0.0; // angle of the slit
 
+  // for a red vs blu spline, we need to specify the split point
+  // XXX this is REALLY ad-hoc for Deimos.  not sure how to make
+  // this more generic (need to define the ranges somewhere)
+  int redlimit = 4096;
+  if ((N = get_argument (argc, argv, "-redlimit"))) {
+    remove_argument (N, &argc, argv);
+    redlimit = atoi (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+
   // Input parameters:
-  if ((N = get_argument (argc, argv, "-slit-trace"))) {
-    remove_argument (N, &argc, argv);
-    if ((slit_trace = FindSpline (argv[N])) == NULL) return (FALSE);
-    remove_argument (N, &argc, argv);
-  } else { goto usage; }
+  if ((N = get_argument (argc, argv, "-slit-trace-red"))) {
+    remove_argument (N, &argc, argv);
+    if ((slit_trace_red = FindSpline (argv[N])) == NULL) return (FALSE);
+    remove_argument (N, &argc, argv);
+  }
+  if ((N = get_argument (argc, argv, "-slit-trace-blu"))) {
+    remove_argument (N, &argc, argv);
+    if ((slit_trace_blu = FindSpline (argv[N])) == NULL) return (FALSE);
+    remove_argument (N, &argc, argv);
+  }
   if ((N = get_argument (argc, argv, "-psf-trace"))) {
     remove_argument (N, &argc, argv);
@@ -156,4 +176,5 @@
 
     // evaluate the trace spline at this y-coord to find the x-coord offset of the profile center
+    Spline *slit_trace = (iy < redlimit) ? slit_trace_red : slit_trace_blu;
     float dXtraceSLIT = spline_apply_dbl (slit_trace->xk, slit_trace->yk, slit_trace->y2, slit_trace->Nknots, iy);
     float dXtracePSF  = spline_apply_dbl (psf_trace->xk, psf_trace->yk, psf_trace->y2, psf_trace->Nknots, iy);
Index: /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos_mkobj.c
===================================================================
--- /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos_mkobj.c	(revision 40816)
+++ /branches/eam_branches/ohana.20190329/src/opihi/mana/deimos_mkobj.c	(revision 40817)
@@ -19,5 +19,6 @@
 
   // if any of these are not defined, they will have assumed identity values
-  Spline *slit_trace = NULL;
+  Spline *slit_trace_red = NULL;
+  Spline *slit_trace_blu = NULL;
   Spline *psf_trace  = NULL;
   Vector *profile    = NULL;
@@ -34,7 +35,22 @@
   float stilt = 0.0; // angle of the slit
 
-  if ((N = get_argument (argc, argv, "-slit-trace"))) {
-    remove_argument (N, &argc, argv);
-    if ((slit_trace = FindSpline (argv[N])) == NULL) return (FALSE);
+  // for a red vs blu spline, we need to specify the split point
+  // XXX this is REALLY ad-hoc for Deimos.  not sure how to make
+  // this more generic (need to define the ranges somewhere)
+  int redlimit = 4096;
+  if ((N = get_argument (argc, argv, "-redlimit"))) {
+    remove_argument (N, &argc, argv);
+    redlimit = atoi (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+
+  if ((N = get_argument (argc, argv, "-slit-trace-red"))) {
+    remove_argument (N, &argc, argv);
+    if ((slit_trace_red = FindSpline (argv[N])) == NULL) return (FALSE);
+    remove_argument (N, &argc, argv);
+  }
+  if ((N = get_argument (argc, argv, "-slit-trace-blu"))) {
+    remove_argument (N, &argc, argv);
+    if ((slit_trace_blu = FindSpline (argv[N])) == NULL) return (FALSE);
     remove_argument (N, &argc, argv);
   }
@@ -138,9 +154,10 @@
   // if we are appying a trace offset spline, we need to generate an output window which
   // is Nx + the full swing of the trace, then window back down
-  if (slit_trace) {
+  if (slit_trace_red && slit_trace_blu) {
     float dXmin = +1000;
     float dXmax = -1000;
     for (int iy = 0; iy < Ny; iy++) {
       // evaluate the trace spline at this y-coord to find the x-coord offset of the profile center
+      Spline *slit_trace = (iy < redlimit) ? slit_trace_red : slit_trace_blu;
       float dx = spline_apply_dbl (slit_trace->xk, slit_trace->yk, slit_trace->y2, slit_trace->Nknots, iy);
       dXmin = MIN (dx, dXmin);
@@ -369,5 +386,5 @@
 
   // shift pixels in x based on the trace
-  if (slit_trace) {
+  if (slit_trace_red && slit_trace_blu) {
     ALLOCATE_PTR (outTraceBuffer, char, NxBase*Ny*sizeof(float));
     float *outTrace = (float *) outTraceBuffer;
@@ -377,4 +394,5 @@
 
       // evaluate the trace spline at this y-coord to find the x-coord offset of the profile center
+      Spline *slit_trace = (iy < redlimit) ? slit_trace_red : slit_trace_blu;
       float dx = -spline_apply_dbl (slit_trace->xk, slit_trace->yk, slit_trace->y2, slit_trace->Nknots, iy);
       
