Index: /trunk/Ohana/src/relphot/Makefile
===================================================================
--- /trunk/Ohana/src/relphot/Makefile	(revision 8388)
+++ /trunk/Ohana/src/relphot/Makefile	(revision 8389)
@@ -20,34 +20,27 @@
 
 RELPHOT = \
-$(SRC)/relphot.$(ARCH).o	 \
-$(SRC)/initialize.$(ARCH).o	 \
 $(SRC)/ConfigInit.$(ARCH).o	 \
-$(SRC)/args.$(ARCH).o		 \
-$(SRC)/liststats.$(ARCH).o	 \
-$(SRC)/load_images.$(ARCH).o	 \
-$(SRC)/select_images.$(ARCH).o	 \
-$(SRC)/load_catalogs.$(ARCH).o	 \
-$(SRC)/bcatalog.$(ARCH).o	 \
 $(SRC)/GridOps.v2.$(ARCH).o	 \
-$(SRC)/StarOps.$(ARCH).o	 \
 $(SRC)/ImageOps.$(ARCH).o	 \
 $(SRC)/MosaicOps.$(ARCH).o	 \
+$(SRC)/SetSignals.$(ARCH).o 	 \
+$(SRC)/Shutdown.$(ARCH).o 	 \
+$(SRC)/StarOps.$(ARCH).o	 \
+$(SRC)/args.$(ARCH).o		 \
+$(SRC)/bcatalog.$(ARCH).o	 \
 $(SRC)/global_stats.$(ARCH).o	 \
+$(SRC)/initialize.$(ARCH).o	 \
+$(SRC)/liststats.$(ARCH).o	 \
+$(SRC)/load_catalogs.$(ARCH).o	 \
+$(SRC)/load_images.$(ARCH).o	 \
 $(SRC)/plot_scatter.$(ARCH).o	 \
 $(SRC)/plotstuff.$(ARCH).o	 \
+$(SRC)/reload_catalogs.$(ARCH).o \
+$(SRC)/relphot.$(ARCH).o	 \
+$(SRC)/select_images.$(ARCH).o	 \
+$(SRC)/setExclusions.$(ARCH).o 	 \
+$(SRC)/setMrelFinal.$(ARCH).o 	 \
 $(SRC)/sort.$(ARCH).o		 \
-$(SRC)/reload_catalogs.$(ARCH).o \
-$(SRC)/setMrelFinal.$(ARCH).o 	 \
-$(SRC)/write_coords.$(ARCH).o 	 \
-$(SRC)/setExclusions.$(ARCH).o 	 \
-$(SRC)/Shutdown.$(ARCH).o 	 \
-$(SRC)/SetSignals.$(ARCH).o 	
-
-OLD = \
-$(SRC)/find_images.$(ARCH).o	 \
-$(SRC)/find_regions.$(ARCH).o	 \
-$(SRC)/get_regions.$(ARCH).o	 \
-$(SRC)/name_region.$(ARCH).o	 \
-$(SRC)/check_permissions.$(ARCH).o
+$(SRC)/write_coords.$(ARCH).o
 
 OBJ = $(RELPHOT)
Index: unk/Ohana/src/relphot/src/check_permissions.c
===================================================================
--- /trunk/Ohana/src/relphot/src/check_permissions.c	(revision 8388)
+++ 	(revision )
@@ -1,67 +1,0 @@
-# include "relphot.h"
-
-void check_permissions (char *basefile) {
-  
-  char *c, dir[256], filename[256];
-  struct stat filestat;
-  uid_t uid;
-  gid_t gid;
-  int status, cmode;
-
-  uid = getuid();
-  gid = getgid();
-
-  /* check permission to write to directory */
-  sprintf (filename, "%s", basefile);
-  c = strrchr (filename, '/');
-  if (c == (char *) NULL) {
-    strcpy (dir, ".");
-  } else {
-    *c = 0;
-    strcpy (dir, filename);
-  }
-  status = stat (dir, &filestat);
-  if (status == -1) {
-    fprintf (stderr, "directory %s does not exist, creating...\n", dir);
-    cmode = S_IRWXU | S_IRWXG | S_IRWXO;
-    status = mkdir (dir, cmode);
-    if (status == -1) {
-      fprintf (stderr, "ERROR: can't create %s\n", dir);
-      exit (1);
-    }
-  } 
-  status = stat (dir, &filestat);
-  if (((uid == filestat.st_uid) && (filestat.st_mode & S_IRWXU)) ||
-      ((gid == filestat.st_gid) && (filestat.st_mode & S_IRWXG)) || 
-      (filestat.st_mode & S_IRWXO)) {
-  } else {
-    fprintf (stderr, "ERROR: can't write to %s\n", dir);
-    exit (1);
-  }
-  
-  /* check permission to write to file */
-  sprintf (filename, "%s", basefile);
-  status = stat (filename, &filestat);
-  if (status == 0) { /* file exists, are permissions OK? */
-    if (((uid == filestat.st_uid) && (filestat.st_mode & S_IRUSR) && (filestat.st_mode & S_IWUSR)) ||
-	((gid == filestat.st_gid) && (filestat.st_mode & S_IRGRP) && (filestat.st_mode & S_IWGRP)) || 
-	((filestat.st_mode & S_IROTH) && (filestat.st_mode & S_IWOTH))) {
-    } else {
-      fprintf (stderr, "ERROR: can't write to %s\n", filename);
-      exit (1);
-    }
-  }
-  
-  /* check permission to write to backup file */
-  sprintf (filename, "%s~", basefile);
-  status = stat (filename, &filestat);
-  if (status == 0) { /* file exists, are permissions OK? */
-    if (((uid == filestat.st_uid) && (filestat.st_mode & S_IRUSR) && (filestat.st_mode & S_IWUSR)) ||
-	((gid == filestat.st_gid) && (filestat.st_mode & S_IRGRP) && (filestat.st_mode & S_IWGRP)) || 
-	((filestat.st_mode & S_IROTH) && (filestat.st_mode & S_IWOTH))) {
-    } else {
-      fprintf (stderr, "ERROR: can't write to %s\n", filename);
-      exit (1);
-    }
-  }
-}
Index: unk/Ohana/src/relphot/src/find_images.c
===================================================================
--- /trunk/Ohana/src/relphot/src/find_images.c	(revision 8388)
+++ 	(revision )
@@ -1,207 +1,0 @@
-# include "relphot.h"
-
-/* this function returns a list of all images which overlap the given
-   set of region files.  All images in the image catalog are tested
-   once, so there is no check that an image already has been included.
-   LineNum stores the locations in the Image database of the list of
-   images */
-
-Image *find_images (FITS_DB *db, GSCRegion *region, int Nregion, int *Nimage, int **LineNum) {
-  
-  Image *timage, *image;
-  int i, j, k, m, found, nimage, Ntimage, NIMAGE;
-  int InRange, ecode;
-  double Xc[5], Yc[5], Xi[5], Yi[5], r, d, dx, dy;
-  int *line_number;
-  Coords tcoords;
-
-  if (VERBOSE) fprintf (stderr, "finding images\n");
-
-  /* we make positional comparisons in the projection of catalog */
-  tcoords.crval1 = 0.5*(region[0].RA[0]  + region[0].RA[1]);
-  tcoords.crval2 = 0.5*(region[0].DEC[0] + region[0].DEC[1]);
-  tcoords.crpix1 = tcoords.crpix2 = 0.0;
-  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
-  tcoords.pc1_1  = tcoords.pc2_2 = 1.0;
-  tcoords.pc1_2  = tcoords.pc2_1 = 0.0;
-  strcpy (tcoords.ctype, "RA---TAN");
-
-  timage = gfits_table_get_Image (&db[0].ftable, &Ntimage, &db[0].swapped);
-
-  nimage = 0;
-  NIMAGE = 100;
-  ALLOCATE (image, Image, NIMAGE);
-  ALLOCATE (line_number, int, NIMAGE);
-  
-  for (i = 0; i < Ntimage; i++) {
-      
-    /* select images by photcode */
-    ecode = GetPhotcodeEquivCodebyCode (timage[i].source);
-    if (ecode != photcode[0].code) continue;
-
-    /* select images by time */
-    if (TimeSelect) {
-      if (timage[i].tzero < TSTART) continue;
-      if (timage[i].tzero > TSTOP) continue;
-    }
-    
-    /* ignore image set to SKIP 
-    if (timage[i].code & ID_IMAGE_SKIP) continue; */ 
-
-    /* define image corners */
-    Xi[0] = 0;            Yi[0] = 0;
-    Xi[1] = timage[i].NX; Yi[1] = 0;
-    Xi[2] = timage[i].NX; Yi[2] = timage[i].NY;
-    Xi[3] = 0;            Yi[3] = timage[i].NY;
-    Xi[4] = 0;            Yi[4] = 0;
-    found = FALSE;
-    /* transform to tcoords */
-    for (j = 0; j < 5; j++) {
-      XY_to_RD (&r, &d, Xi[j], Yi[j], &timage[i].coords);
-      InRange = RD_to_XY (&Xi[j], &Yi[j], r, d, &tcoords);
-      if (!InRange) goto imskip;
-    }
-    /* compare with each region file */
-    for (m = 0; (m < Nregion) && !found; m++) { 
-      /* define catalog corners */
-      Xc[0] = region[m].RA[0]; Yc[0] = region[m].DEC[0];
-      Xc[1] = region[m].RA[1]; Yc[1] = region[m].DEC[0];
-      Xc[2] = region[m].RA[1]; Yc[2] = region[m].DEC[1];
-      Xc[3] = region[m].RA[0]; Yc[3] = region[m].DEC[1];
-      Xc[4] = region[m].RA[0]; Yc[4] = region[m].DEC[0];
-      for (j = 0; j < 5; j++) {
-	r = Xc[j]; d = Yc[j];
-	RD_to_XY (&Xc[j], &Yc[j], r, d, &tcoords);
-      }
-      dx = 0.02*(Xc[2] - Xc[0]);
-      dy = 0.02*(Yc[2] - Yc[0]);
-      Xc[0] -= dx; Yc[0] -= dy;
-      Xc[1] += dx; Yc[1] -= dy;
-      Xc[2] += dx; Yc[2] += dy;
-      Xc[3] -= dx; Yc[3] += dy;
-      Xc[4] -= dx; Yc[4] -= dy;
-      
-      /* check if image corner inside catalog */
-      for (j = 0; (j < 4) && !found; j++) {
-	found |= corner_check (&Xi[j], &Yi[j], &Xc[0], &Yc[0]);
-      }
-      /* check if catalog corner inside image */
-      for (j = 0; (j < 4) && !found; j++) {
-	found |= corner_check (&Xc[j], &Yc[j], &Xi[0], &Yi[0]);
-      }
-      /* check if edges cross */
-      for (j = 0; (j < 4) && !found; j++) {
-	for (k = 0; (k < 4) && !found; k++) {
-	  found |= edge_check (&Xi[j], &Yi[j], &Xc[k], &Yc[k]);
-	}
-      }
-      if (found) {
-	image[nimage] = timage[i]; 
-	/* always allow a 'few' image to succeed, if possible */
-	if (image[nimage].code & ID_IMAGE_FEW) { 
-	  image[nimage].code &= ~(ID_IMAGE_FEW | ID_IMAGE_POOR);
-	}
-	if (RESET) {
-	  assignMcal (&image[nimage], (double *) NULL, -1);
-	  image[nimage].dMcal_PS = NO_MAG;
-	  image[nimage].code &= ~ID_IMAGE_POOR;
-	}
-	line_number[nimage] = i;
-	nimage ++;
-	if (nimage == NIMAGE) {
-	  NIMAGE += 100;
-	  REALLOCATE (image, Image, NIMAGE);
-	  REALLOCATE (line_number, int, NIMAGE);
-	}
-      }
-    }
-  imskip:
-    continue;
-  }
-      
-  if (VERBOSE) fprintf (stderr, "found %d images\n", nimage);
-
-  REALLOCATE (image, Image, MAX (nimage, 1));
-  REALLOCATE (line_number, int, MAX (nimage, 1));
-
-  *Nimage  = nimage;
-  *LineNum = line_number;
-  return (image);
-}
-
-/* check if line between points 0 and 1 of x1
-   crosses line between points 0 and 1 of x2 */
-int edge_check (double *x1, double *y1, double *x2, double *y2) {
-
-  double theta1, theta2;
-  double Theta1, Theta2;
-
-  theta1 = opening_angle (x1[0], y1[0], x2[0], y2[0], x1[1], y1[1]); 
-  theta2 = opening_angle (x1[0], y1[0], x2[0], y2[0], x2[1], y2[1]); 
-
-  if (theta1*theta2 < 0.0) {
-    return (FALSE);
-  }
-
-  if (fabs(theta1) < fabs(theta2)) {
-    return (FALSE);
-  }
-
-  Theta1 = theta1;
-  Theta2 = theta2;
-  theta1 = opening_angle (x2[0], y2[0], x1[1], y1[1], x2[1], y2[1]); 
-  theta2 = opening_angle (x2[0], y2[0], x1[1], y1[1], x1[0], y1[0]); 
-  
- 
-  if (theta1*theta2 < 0.0) {
-    return (FALSE);
-  }
-
-  if (fabs(theta1) < fabs(theta2)) {
-    return (FALSE);
-  }
-
-  return (TRUE);
-
-}
-
-/* check if point x1,y1 is in box formed by x2[0-4] */
-int corner_check (double *x1, double *y1, double *x2, double *y2) {
-
-  int i;
-  double theta;
-
-  theta = 0;
-
-  for (i = 0; i < 4; i++) {
-    theta += opening_angle (x2[i], y2[i], x1[0], y1[0], x2[i+1], y2[i+1]); 
-  }
-  if (fabs(theta) > 6) {
-    return (TRUE);
-  } else {
-    return (FALSE);
-  }
-}
-
-/* returns the opening angle between the three points (2 is in middle) 
-   in range -pi to pi */
-
-double opening_angle (double x1, double y1, double x2, double y2, double x3, double y3) {
-
-  double dx1, dy1, dx2, dy2, ct, st, theta;
-
-  dx1 = x1 - x2;
-  dy1 = y1 - y2;
-  
-  dx2 = x3 - x2;
-  dy2 = y3 - y2;
-  
-  ct = (dx1*dx2 + dy1*dy2);
-  st = (dx1*dy2 - dx2*dy1);
-
-  theta = atan2 (st, ct);
-
-  return (theta);
-
-}
-
Index: unk/Ohana/src/relphot/src/find_regions.c
===================================================================
--- /trunk/Ohana/src/relphot/src/find_regions.c	(revision 8388)
+++ 	(revision )
@@ -1,102 +1,0 @@
-# include "relphot.h"
-
-/* given a list of images, find all region files which overlap these images.
-   if a region file does not exist, we should recognize this fact somehow */
-
-GSCRegion *find_regions (Image *image, int Nimage, int *Nregions, GSCRegion *fullregion) {
-
-  int i, nregions;
-  double x, y;
-  GSCRegion *regions;
-  double MinRA, MaxRA, MinDEC, MaxDEC, ra, dec;
-
-  if (VERBOSE) fprintf (stderr, "finding regions: ");
-  
-  /* find RA and DEC range of images */
-  MinRA = MinDEC = +361;
-  MaxRA = MaxDEC = -361;
-  for (i = 0; i < Nimage; i++) {
-    for (x = 0.0; x <= 1.0; x+=0.25) {
-      for (y = 0.0; y <= 1.0; y+=0.25) {
-	XY_to_RD (&ra, &dec, image[i].NX*(1.1*x - 0.05), image[i].NY*(1.1*y - 0.05), &image[i].coords);
-	MinRA = MIN (ra, MinRA);
-	MaxRA = MAX (ra, MaxRA);
-	MinDEC = MIN (dec, MinDEC);
-	MaxDEC = MAX (dec, MaxDEC);
-      }
-    }
-  }
-
-  /* if images overlap 0,360 boundary, then use -180 to +180 range */
-  if (MaxRA - MinRA > 180) {
-    MinRA = +361;
-    MaxRA = -361;
-    for (i = 0; i < Nimage; i++) {
-      for (x = 0.0; x <= 1.0; x+=0.25) {
-	for (y = 0.0; y <= 1.0; y+=0.25) {
-	  XY_to_RD (&ra, &dec, image[i].NX*(1.1*x - 0.05), image[i].NY*(1.1*y - 0.05), &image[i].coords);
-	  if (ra > 180) ra -= 360;
-	  MinRA = MIN (ra, MinRA);
-	  MaxRA = MAX (ra, MaxRA);
-	}
-      }
-    }
-  }
-
-  fullregion[0].RA[0] = MinRA;
-  fullregion[0].RA[1] = MaxRA;
-  fullregion[0].DEC[0] = MinDEC;
-  fullregion[0].DEC[1] = MaxDEC;
-
-  /* find all region files containing specified ra, dec range */  
-  regions = get_regions (MinRA, MaxRA, MinDEC, MaxDEC, &nregions);
-
-  if (VERBOSE) fprintf (stderr, "%d found\n", nregions);
-
-  *Nregions = nregions;
-  return (regions);
-}
-
-
-void getfullregion (Image *image, int Nimage, GSCRegion *fullregion) {
-
-  int i;
-  double x, y;
-  double MinRA, MaxRA, MinDEC, MaxDEC, ra, dec;
-
-  /* find RA and DEC range of images */
-  MinRA = MinDEC = +361;
-  MaxRA = MaxDEC = -361;
-  for (i = 0; i < Nimage; i++) {
-    for (x = 0.0; x <= 1.0; x+=0.25) {
-      for (y = 0.0; y <= 1.0; y+=0.25) {
-	XY_to_RD (&ra, &dec, image[i].NX*(1.1*x - 0.05), image[i].NY*(1.1*y - 0.05), &image[i].coords);
-	MinRA = MIN (ra, MinRA);
-	MaxRA = MAX (ra, MaxRA);
-	MinDEC = MIN (dec, MinDEC);
-	MaxDEC = MAX (dec, MaxDEC);
-      }
-    }
-  }
-
-  /* if images overlap 0,360 boundary, then use -180 to +180 range */
-  if (MaxRA - MinRA > 180) {
-    MinRA = +361;
-    MaxRA = -361;
-    for (i = 0; i < Nimage; i++) {
-      for (x = 0.0; x <= 1.0; x+=0.25) {
-	for (y = 0.0; y <= 1.0; y+=0.25) {
-	  XY_to_RD (&ra, &dec, image[i].NX*(1.1*x - 0.05), image[i].NY*(1.1*y - 0.05), &image[i].coords);
-	  if (ra > 180) ra -= 360;
-	  MinRA = MIN (ra, MinRA);
-	  MaxRA = MAX (ra, MaxRA);
-	}
-      }
-    }
-  }
-
-  fullregion[0].RA[0] = MinRA;
-  fullregion[0].RA[1] = MaxRA;
-  fullregion[0].DEC[0] = MinDEC;
-  fullregion[0].DEC[1] = MaxDEC;
-}
Index: unk/Ohana/src/relphot/src/free_catalogs.c
===================================================================
--- /trunk/Ohana/src/relphot/src/free_catalogs.c	(revision 8388)
+++ 	(revision )
@@ -1,13 +1,0 @@
-# include "relphot.h"
-
-void free_catalogs (Catalog *catalog, int Ncatalog) {
-
-  int i;
-
-  for (i = 0; i < Ncatalog; i++) {
-    free (catalog[i].secfilt);
-    free (catalog[i].average);
-    free (catalog[i].measure);
-  }
-
-}
Index: unk/Ohana/src/relphot/src/get_regions.c
===================================================================
--- /trunk/Ohana/src/relphot/src/get_regions.c	(revision 8388)
+++ 	(revision )
@@ -1,167 +1,0 @@
-# include "relphot.h"
-double BigDecBounds[] = {0.0, 7.5, 15.0, 22.5, 30.0, 37.5, 45.0, 
-			 52.5, 60.0, 67.5, 75.0, 82.5, 90.0,
-			 0.0, -7.5, -15.0, -22.5, -30.0, -37.5, -45.0, 
-			 -52.5, -60.0, -67.5, -75.0, -82.5, -90.0};
-
-double Areas[] = {2700.0, 2665.4505, 2563.567, 2399.5344, 2181.6343, 1920.7299, 1629.5942, 1322.1251, 1012.5, 714.32555, 439.83856, 199.21043, 0.0,
-		  2700.0, 2665.4505, 2563.567, 2399.5344, 2181.6343, 1920.7299, 1629.5942, 1322.1251, 1012.5, 714.32555, 439.83856, 199.21043, 0.0};
-
-char *DecSections[] = {"N0000", "N0730", "N1500", "N2230", "N3000", "N3730", "N4500", 
-		       "N5230", "N6000", "N6730", "N7500", "N8230", "weirdness", 
-		       "S0000", "S0730", "S1500", "S2230", "S3000", "S3730", "S4500", 
-		       "S5230", "S6000", "S6730", "S7500", "S8230", "weirdness"};
-
-char *Dec2Sections[] = {"n0000", "n0730", "n1500", "n2230", "n3000", "n3730", "n4500", 
-			"n5230", "n6000", "n6730", "n7500", "n8230", "weirdness", 
-			"s0000", "s0730", "s1500", "s2230", "s3000", "s3730", "s4500", 
-			"s5230", "s6000", "s6730", "s7500", "s8230", "weirdness"};
-
-char *disk[] = {"disk 1", "disk 1", "disk 1", "disk 1", "disk 1", "disk 1", "disk 1", 
-		"disk 1", "disk 1", "disk 1", "disk 1", "disk 1", "weirdness", 
-		"disk 1", "disk 2", "disk 2", "disk 2", "disk 2", "disk 2", "disk 2", 
-		"disk 2", "disk 2", "disk 2", "disk 2", "disk 2", "weirdness"};
-
-int NBigRASections [] = {48, 47, 45, 43, 40, 36, 32, 28, 21, 15, 9, 3, 3, 48, 47, 45, 43, 40, 36, 32, 28, 21, 15, 9, 3, 3};
-
-int NDecLines[] = {593, 584, 551, 530, 522, 465, 406, 362, 280, 198, 123, 24, 
-                   0, 597, 578, 574, 577, 534, 499, 442, 376, 294, 212, 144, 48};
-
-/* returns a list of region files within the desired RA, DEC region */
-GSCRegion *get_regions (double minRa, double maxRa, double minDec, double maxDec, int *Nregions) {
-  
-  char buffer[28800], temp[50];
-  GSCRegion *regions;
-  FILE *f;
-  double RA0, RA1, DEC0, DEC1;
-  int i, j, NBigDec;
-  int NLINES, done, NREGIONS, nregions;
-  
-  f = fopen (GSCFILE, "r");
-  if (f == NULL) {
-    fprintf (stderr, "ERROR: can't find regions file %s\n", GSCFILE);
-    exit (0);
-  }
-  
-  NREGIONS = 50;
-  ALLOCATE (regions, GSCRegion, NREGIONS);
-  nregions = 0;
-
-  if ((minDec <= -90) || (maxDec >= 90)) {
-    minRa = 0;
-    maxRa = 360;
-  }
-  
-  /* use the pole regions, if near pole */
-  if (maxDec > 86.25) {
-    sprintf (regions[nregions].filename, "n8230/pole.cpt");
-    regions[nregions].RA[0] = 0;
-    regions[nregions].RA[1] = 360;
-    regions[nregions].DEC[0] = 86.25;
-    regions[nregions].DEC[1] = 90.0;
-    nregions ++;
-    if (nregions == NREGIONS) {
-      NREGIONS += 50;
-      REALLOCATE (regions, GSCRegion, NREGIONS);
-    }
-  }
-
-  if (minDec > 86.25) {
-    *Nregions = nregions;
-    return (regions);
-  }
-    
-  if ((minDec < 0) && (maxDec > 0)) {
-    /* Search Both Sides */
-    NBigDec = 0;
-  } else {
-    /* find large DEC region (directory) */
-    NBigDec = -1;
-    for (i = 0; i < 12; i++) {
-      if ((minDec >= BigDecBounds[i]) && (minDec < BigDecBounds[i+1])) {
-	NBigDec = i;
-	break;
-      }
-    }
-    if (NBigDec < 0) {
-      for (i = 13; i < 24; i++) {
-	if ((maxDec < BigDecBounds[i]) && (maxDec >= BigDecBounds[i+1])) {
-	  NBigDec = i;
-	  break;
-	}
-      }
-    }
-  }
-  if (NBigDec < 0) {
-    fprintf (stderr, "ERROR: Dec out of range: %f\n", minDec);
-    *Nregions = 0;
-    return ((GSCRegion *) NULL);
-  }
-  
-  /* count lines before section */
-  NLINES = 0;
-  for (i = 0; i < NBigDec; i++) {
-    NLINES += NDecLines[i];
-  }
-  fseek (f, 5*2880 + 48*NLINES, SEEK_SET);
-  
-  /* should be in this section.  if not, there is a problem counting... */
-  /* careful with the 0,360.0 boundary **/
-  done = FALSE;
-  for (j = 0; !done && (NBigDec + j < 25); j++) {
-    fread (buffer, 48*NDecLines[NBigDec + j], 1, f);
-    for (i = 0; (i < NDecLines[NBigDec + j]); i++) {
-      strncpy (temp, &buffer[i*48], 48);
-      temp[49] = 0;
-      hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
-      if (RA1 < RA0) RA1 += 360.0;
-      if ((DEC1 > 0) && (minDec < DEC1) && (maxDec > DEC0) && (minRa < RA1) && (maxRa > RA0)) {
-	temp[5] = 0;
-	sprintf (regions[nregions].filename, "%s/%s.cpt", Dec2Sections[NBigDec + j], &temp[1]);
-	regions[nregions].RA[0] = RA0;
-	regions[nregions].RA[1] = RA1;
-	regions[nregions].DEC[0] = DEC0;
-	regions[nregions].DEC[1] = DEC1;
-	nregions ++;
-	if (nregions == NREGIONS) {
-	  NREGIONS += 50;
-	  REALLOCATE (regions, GSCRegion, NREGIONS);
-	}
-      }
-      if ((DEC1 < 0) && (minDec < DEC0) && (maxDec > DEC1) && (minRa < RA1) && (maxRa > RA0)) {
-	temp[5] = 0;
-	sprintf (regions[nregions].filename, "%s/%s.cpt", Dec2Sections[NBigDec + j], &temp[1]);
-	regions[nregions].RA[0] = RA0;
-	regions[nregions].RA[1] = RA1;
-	regions[nregions].DEC[0] = DEC0;
-	regions[nregions].DEC[1] = DEC1;
-	nregions ++;
-	if (nregions == NREGIONS) {
-	  NREGIONS += 50;
-	  REALLOCATE (regions, GSCRegion, NREGIONS);
-	}
-      }
-      if (((DEC1 > 0) && (maxDec <= DEC1)) || ((DEC1 < 0) && (minDec >= DEC1))) {
-	done = TRUE;
-      }
-    }
-    if (done && (minDec < 0) && (maxDec > 0) && (BigDecBounds[NBigDec + j + 1] > 0)) {
-      /* skip remaining north sections, try south sections */
-      /* count lines before section */
-      NLINES = 0;
-      for (i = 0; i < 13; i++) { 
-	NLINES += NDecLines[i];
-      }
-      fseek (f, 5*2880 + 48*NLINES, SEEK_SET);
-      done = FALSE;
-      j = 12;
-    }
-  }
-
-  REALLOCATE (regions, GSCRegion, MAX (1,nregions));
-  *Nregions = nregions;
-  
-  fclose (f);
-  return (regions);
-  
-}
Index: unk/Ohana/src/relphot/src/image-db.c
===================================================================
--- /trunk/Ohana/src/relphot/src/image-db.c	(revision 8388)
+++ 	(revision )
@@ -1,2 +1,0 @@
-# include "relphot.h"
-
Index: unk/Ohana/src/relphot/src/name_region.c
===================================================================
--- /trunk/Ohana/src/relphot/src/name_region.c	(revision 8388)
+++ 	(revision )
@@ -1,24 +1,0 @@
-# include "relphot.h"
-
-GSCRegion *name_region (char *name, int *Nregions) {
-
-  GSCRegion *region;
-  Header header;
-
-  ALLOCATE (region, GSCRegion, 1);
-
-  sprintf (region[0].filename, "%s/%s", CATDIR, name);
-  if (!gfits_read_header (region[0].filename, &header)) {
-    if (VERBOSE) fprintf (stderr, "catalog file not yet available: %s\n", region[0].filename);
-    exit (0);
-  }
-  gfits_scan (&header, "RA0", "%lf", 1, &region[0].RA[0]);
-  gfits_scan (&header, "RA1", "%lf", 1, &region[0].RA[1]);
-  gfits_scan (&header, "DEC0", "%lf", 1, &region[0].DEC[0]);
-  gfits_scan (&header, "DEC1", "%lf", 1, &region[0].DEC[1]);
-  gfits_free_header (&header);
-
-  *Nregions = 1;
-  return (region);
-}
-
Index: unk/Ohana/src/relphot/src/wcatalog.c
===================================================================
--- /trunk/Ohana/src/relphot/src/wcatalog.c	(revision 8388)
+++ 	(revision )
@@ -1,29 +1,0 @@
-# include "relphot.h"
-
-void wcatalog (Catalog *catalog) {
-  
-  /* CATMODE and CATFORMAT determined from catalog */
-
-  if (!save_catalog (catalog, VERBOSE)) {
-    fprintf (stderr, "ERROR: failure saving catalog\n");
-    exit (1);
-  }
-
-  if (catalog[0].Naverage) {
-    free (catalog[0].average); 
-    catalog[0].Naverage = 0;
-  }
-  if (catalog[0].Nmeasure) {
-    free (catalog[0].measure); 
-    catalog[0].Nmeasure = 0;
-  }
-  if (catalog[0].Nmissing) {
-    free (catalog[0].missing); 
-    catalog[0].Nmissing = 0;
-  }
-  if (catalog[0].Nsecfilt) {
-    free (catalog[0].secfilt); 
-    catalog[0].Nsecfilt = 0;
-  }
-  gfits_free_header (&catalog[0].header);
-}
Index: unk/Ohana/src/relphot/src/wimages.c
===================================================================
--- /trunk/Ohana/src/relphot/src/wimages.c	(revision 8388)
+++ 	(revision )
@@ -1,45 +1,0 @@
-# include "relphot.h"
-
-/* add 1 image to image db */
-void wimages (FITS_DB *db, Image *image, int Nimage) {
-  
-  int status, Nimages;
-
-  /* set permissions somewhere ...
-  mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-  fchmod (ImageCat, mode); */
-
-  /* adjust header */
-  Nimages = 0;
-  gfits_scan (&db[0].header, "NIMAGES", "%d", 1, &Nimages);
-  Nimages ++;
-  gfits_modify (&db[0].header, "NIMAGES", "%d", 1, Nimages);
-
-  gfits_table_to_vtable (&db[0].ftable, &db[0].vtable, 0, 0);
-  for (i = 0; i < Nimage; i++) {
-    gfits_vadd_rows (&db[0].vtable, (char *) image, 1, sizeof(Image));
-  }
-
-  /* check that primary header and table header agree */
-  if (Nimages != db[0].header.Naxis[1]) {
-    fprintf (stderr, "header / table length mismatch!\n");
-  }
-
-  SetProtect (TRUE);
-  status = dvo_image_update (db, VERBOSE);
-  SetProtect (FALSE);
-
-  if (!status) {
-    fprintf (stderr, "ERROR: failed writing data to image catalog\n");
-    exit (1);
-  }
-}
-
-/* add the new image to the image table:
-   - use the table header (from ftable)
-   - create an empty vtable
-   - add the new image to the end of the vtable
-   
-   - write out the vtable, either as TEXT or FITS
-   * dvo_image_update performs the needed byte-swap on the image data
-*/
