Index: branches/cnb_branch_20080830/Ohana/src/imregister/base/get_fwhm.c
===================================================================
--- trunk/Ohana/src/imregister/base/get_fwhm.c	(revision 19299)
+++ 	(revision )
@@ -1,130 +1,0 @@
-# include "imregister.h"
-
-/* see note at end of file */
-double get_fwhm (char *filename) {
-
-  FILE *f;
-  char line[1024];
-  double *fwhm, *mag, *Mag, *FWHM, *Nfwhm, flags;
-  double F, value, Mlim, Vmode, Fmin, Fmax;
-  int i, N, n, Nwant, bin, mode, Nmode;
-
-  /* get sextract file (has fwhm info) */
-  f = fopen (filename, "r");
-  if (f == (FILE *) NULL) {
-    fprintf (stderr, "ERROR: can't open file.sdat\n");
-    return (-1.0);
-  }
-
-  n = 0;
-  N = 1000;
-  ALLOCATE (fwhm, double, N);
-  ALLOCATE (mag, double, N);
-  
-  /* load in data from file */
-  while (scan_line (f, line) != EOF) {
-    dparse (&flags, 2, line);
-    if (flags > 0) continue;
-    dparse (&mag[n], 4, line);
-    if (mag[n] > 0) continue;
-    dparse (&fwhm[n], 1, line);
-    n++;
-    if (n == N) {
-      N += 1000;
-      REALLOCATE (fwhm, double, N);
-      REALLOCATE (mag, double, N);
-    }
-  }    
-  if (n == 0) { return (-1.0); }
-
-  /* find the mag threshold */
-  ALLOCATE (Mag, double, n);
-  memcpy (Mag, mag, n*sizeof(double));
-  dsort (Mag, n);
-  Nwant = MIN (MAX (0.25*n, 10), n-1);
-  Mlim = Mag[Nwant];
-
-  /* create subset of fwhm with mag < Mlim */
-  ALLOCATE (FWHM, double, n);
-  ALLOCATE (Nfwhm, double, 1024);
-  bzero (FWHM, n*sizeof(double));
-  bzero (Nfwhm, 1024*sizeof(double));
-  
-  N = 0;
-  for (i = 0; i < n; i++) {
-    if (mag[i] > Mlim) continue;
-    FWHM[N] = fwhm[i];
-    N++;
-
-    /* accumulate mag histogram */
-    bin = fwhm[i]*10.0;
-    if (bin < 0) continue;
-    if (bin > 999) continue;
-    Nfwhm[bin] ++;
-  }
-
-  /* find the mode (bin size = 0.1 pixels) */
-  mode = 0; 
-  Nmode = Nfwhm[mode];
-  for (i = 0; i < 1000; i++) {
-    if (Nfwhm[i] > Nmode) {
-      mode = i;
-      Nmode = Nfwhm[i];
-    }
-  }
-  Vmode = mode * 0.1;
-  Fmin = Vmode - 0.2;
-  Fmax = Vmode + 0.2;
-
-  /* average bins within 0.2 of mode */
-  F = 0;
-  n = 0;
-  for (i = 0; i < N; i++) {
-    if (FWHM[i] < Fmin) continue;
-    if (FWHM[i] > Fmax) continue;
-    n++;
-    F+=FWHM[i];
-  }
-  if (n > 3) {
-    value = F / n;
-    return (value);
-  }
-
-  /* if we don't get the answer from the above, resort to median */
-  dsort (FWHM, N);
-  F = 0;
-  n = 0;
-  for (i = 0.25*N; i < 0.75*N; i++) {
-    n++;
-    F+=FWHM[i];
-  }
-  if (n > 0) {
-    value = F / n;
-  } else {
-    value = -1;
-  }
-  return (value);
-
-}
-
-/* 
-
-   calculate the fwhm from the data in the given file.
-   The file contains output from sextractor (or other program, perhaps).
-   The columns that matter are: 
-     1) fwhm (pixels)
-     2) flags
-     4) mag
-
-   this function determines the magnitude range for the file,
-   selects stars in the upper 25% of that magnitude range (by number),
-   rejecting bad stars (flags > 0) along the way
-   
-   the resulting list of fwhms are examined for the mode, in 0.1 pixel bins.
-   stars with fwhm within 0.2 pix of that mode are averaged to find the
-   best fwhm value.
-
-   in the database, a value of 0 means the measurement has not been tried.
-   a value of -1 means the measurement failed
-
-*/
Index: branches/cnb_branch_20080830/Ohana/src/imregister/detrend/usage.c
===================================================================
--- trunk/Ohana/src/imregister/detrend/usage.c	(revision 19299)
+++ 	(revision )
@@ -1,30 +1,0 @@
-# include "imregister.h"
-# include "detrend.h"
-
-int usage () {
-  
-  fprintf (stderr, "detsearch : select images from the detrend database\n");
-  fprintf (stderr, " USAGE: detsearch [-options...]\n");
-  fprintf (stderr, " -h : show this list\n");
-  fprintf (stderr, " --help : show this list\n");
-  fprintf (stderr, " -image filename (ccd) (mode) : find matching detrend data for this image \n");
-  fprintf (stderr, " -type (type) : limit selection by image type (bias, dark, flat, etc)\n");
-  fprintf (stderr, " -time yyyy/mm/dd,HH:MM:SS : specify time for selection\n");
-  fprintf (stderr, " -ccd (N) : limit selection to this ccd\n");
-  fprintf (stderr, " -filter (name) : limit selection to this filter\n");
-  fprintf (stderr, " -exptime (value) : limit selection to match this exposure time\n");
-  fprintf (stderr, " -tstop : display end of valid time range\n");
-  fprintf (stderr, " -treg  : display time of image registration\n");
-  fprintf (stderr, " -ve    : Elixir verbose (SUCCESS / ERROR) \n");
-  fprintf (stderr, " -quiet : Elixir quiet (no SUCCESS / ERROR) \n");
-  fprintf (stderr, " -close : select detrend data which is closest in time, overlap not forced\n");
-  fprintf (stderr, " -entry (value) : limit selection to match this entry\n");
-  fprintf (stderr, " -match (value) : only list the Nth matched entry\n");
-  fprintf (stderr, " -label (word)  : limit selection to match this label\n");
-  fprintf (stderr, " -select : force selection of the 'best' match\n");
-  fprintf (stderr, " -del    : delete the matched entries\n");
-  fprintf (stderr, " -delete : delete the matched entries\n");
-  fprintf (stderr, " -modify (entry) (value) : change entry in the selection to value\n");
-  fprintf (stderr, "   possible -modify entries: label, order, tstart, tstop\n");
-  exit (2);
-}
Index: branches/cnb_branch_20080830/Ohana/src/imregister/imreg/load_probes.c
===================================================================
--- trunk/Ohana/src/imregister/imreg/load_probes.c	(revision 19299)
+++ 	(revision )
@@ -1,108 +1,0 @@
-# include "imregister.h"
-# define NBYTES 1024
-# define WINDOW 1800
-/* probes are updated every 600 seconds.  give us some leeway here */
-
-int load_probes (char *filename, unsigned long tzero, int *wantprobe, double *values, int Nprobe) {
-
-  FILE *f;
-  char line[256], closeline[256], *buffer, *c, *p;
-  int nprobe, probe[10];
-  int i, Nstart, Nread, Nbytes, Nshift, Nleft, done, close_enough;
-  double time, jdstart, tmp;
-  int Nsec, sec;
-
-  f = fopen (filename, "r");
-  if (f == (FILE *) NULL) {
-    fprintf (stderr, "can't open DataLogger file: %s\n", filename);
-    return (FALSE);
-  }
-
-  /* assume fixed format */
-  scan_line (f, line);
-  scan_line (f, line);
-  scan_line (f, line);
-  sscanf (line, "%*s %*s %*s %*s %lf", &jdstart);
-  Nsec = (jdstart - 2440587.5)*86400;
-  if (tzero < Nsec - WINDOW) {
-    fprintf (stderr, "missing time in DataLogger file\n");
-    return (FALSE);
-  }
-
-  scan_line (f, line);
-  scan_line (f, line);
-  scan_line (f, line);
-  sscanf (line, "%*s %*s %d", &nprobe);
-  for (i = 0; (i < nprobe) && (i < 10); i++) {
-    dparse (&tmp, i+4, line);
-    probe[i] = tmp;
-  }
-
-  /* check that probes match desired probes -- demand same order in file */
-  if (nprobe != Nprobe) {
-    fprintf (stderr, "wrong number of probes\n");
-    return (FALSE);
-  }
-  for (i = 0; (i < nprobe) && (i < 10); i++) {
-    if (probe[i] != wantprobe[i]) {
-      fprintf (stderr, "probe mismatch\n");
-      return (FALSE);
-    }
-  }
-  
-  ALLOCATE (buffer, char, NBYTES+1);
-    
-  Nstart = 0;
-  done = FALSE;
-  close_enough = FALSE;
-  while (!done && ((Nread = fread (&buffer[Nstart], 1, NBYTES - Nstart, f)) > 0)) {
-    Nbytes = Nread + Nstart;
-    buffer[Nbytes] = 0;
-    
-    /* we are using strchr lib functions - buffer can't have NULLs */
-    c = strrchr (buffer, '\n');
-    if (c == (char *) NULL) c = &buffer[Nbytes-1];
-    Nshift = c - buffer + 1;
-    
-    /* limit searches to the range buffer[0] - buffer[Nshift] */
-    p = &buffer[0];
-    while (1) {
-      c = strchr (p, '\n');
-      if (c == (char *) NULL) break;
-      if (c > &buffer[Nshift]) break;
-      *c = 0;
-      dparse (&time, 0, p);
-      sec = Nsec + time*86400;
-      if (sec + WINDOW > tzero) {
-	strcpy (closeline, p);
-	close_enough = TRUE;
-      }
-      if (sec > tzero) {
-	for (i = 0; i < Nprobe; i++) {
-	  dparse (&values[i], i+5, p);
-	}
-	free (buffer);
-	return (TRUE);
-      }
-      *c = '\n';
-      p = c + 1;
-    }
-    
-    Nleft  = Nbytes - Nshift;
-    if (Nleft > 0) memmove (buffer, &buffer[Nshift], Nleft);
-    
-    Nstart = Nleft;
-  }
-
-  if (close_enough) {
-    for (i = 0; i < Nprobe; i++) {
-      dparse (&values[i], i+5, closeline);
-    }
-    free (buffer);
-    return (TRUE);
-  }
-
-  fprintf (stderr, "time not in DataLogger file %ld\n", tzero);
-  free (buffer);
-  return (FALSE);
-}
