Index: /trunk/Ohana/src/mosastro/src/mkstandards.c
===================================================================
--- /trunk/Ohana/src/mosastro/src/mkstandards.c	(revision 3295)
+++ /trunk/Ohana/src/mosastro/src/mkstandards.c	(revision 3295)
@@ -0,0 +1,69 @@
+# include "mosastro.h"
+# define DX 30.0
+# define DY 30.0
+
+/* build a grid of reference stars */
+int main (int argc, char **argv) {
+
+  int Nstars, NSTARS;
+  double x, y, dX, dY;
+  Header *header;
+  Coords coords;
+  Stars *stars;
+
+  if (argc != 5) {
+    fprintf (stderr, "USAGE: mkstandards (RA) (DEC) (half-width) (output)\n");
+    exit (2);
+  }
+
+  /* generate grid of stars */
+  dX = dY = 3600*atof (argv[3]);
+
+  /* bore site center guess */
+  strcpy (coords.ctype, "RA---TAN");
+  coords.crval1 = atof(argv[1]);
+  coords.crval2 = atof(argv[2]);
+  coords.crpix1 = dX;
+  coords.crpix2 = dX;
+  
+  coords.cdelt1 = 1/3600.0;
+  coords.cdelt2 = 1/3600.0;
+
+  coords.pc1_1  = 1;
+  coords.pc2_2  = 1;
+  coords.pc1_2  = 0;
+  coords.pc2_1  = 0;
+  coords.Npolyterms = 1;
+
+  Nstars = 0;
+  NSTARS = 1000;
+  ALLOCATE (stars, Stars, NSTARS);
+
+  for (x = 0; x < 2*dX; x += DX) {
+    for (y = 0; y < 2*dY; y += DY) {
+      stars[Nstars].X = x;
+      stars[Nstars].Y = y;
+      stars[Nstars].M = 16.0;
+      stars[Nstars].dM = 0.02;
+      stars[Nstars].dophot = 1;
+      stars[Nstars].sky = 1.0;
+      stars[Nstars].Mgal = 16.0;
+      stars[Nstars].Map = 16.0;
+      stars[Nstars].fx = 1.0;
+      stars[Nstars].fy = 1.0;
+      stars[Nstars].df = 0.0;
+
+      Nstars ++;
+      if (Nstars >= NSTARS) {
+	NSTARS += 1000;
+	REALLOCATE (stars, Stars, NSTARS);
+      }
+    }
+  }
+
+  header = mkheader (2*dX, 2*dY, Nstars, &coords);
+  wstars (argv[4], stars, Nstars, header);
+  fits_free_header (header);
+
+  exit (0);
+}
Index: /trunk/Ohana/src/mosastro/src/warptest.c
===================================================================
--- /trunk/Ohana/src/mosastro/src/warptest.c	(revision 3295)
+++ /trunk/Ohana/src/mosastro/src/warptest.c	(revision 3295)
@@ -0,0 +1,55 @@
+# include "mosastro.h"
+int XY_to_RD (double *ra, double *dec, double x, double y, Coords *coords);
+int RD_to_XY (double *x, double *y, double ra, double dec, Coords *coords);
+
+main (int argc, char **argv) {
+
+  int i, status;
+  double X, Y, x, y, p, q;
+  Coords coords;
+
+  if (argc != 2) {
+    fprintf (stderr, "USAGE: warptest (system)\n");
+    exit (2);
+  }
+
+  /* bore site center guess */
+  sprintf (coords.ctype, "RA---%s", argv[1]);
+  coords.crval1 = 0.0;
+  coords.crval2 = 0.0;
+  coords.crpix1 = 0.0;
+  coords.crpix2 = 0.0;
+  coords.cdelt1 = 1.0;
+  coords.cdelt2 = 1.0;
+
+  /* 
+  coords.cdelt1 = 1.0/3600.0;
+  coords.cdelt2 = 1.0/3600.0;
+  */
+  
+  /** allow guess at field rotation?? **/
+  coords.pc1_1  = 1;
+  coords.pc2_2  = 1;
+  coords.pc1_2  = 0;
+  coords.pc2_1  = 0;
+
+  /* allow 2nd and 3rd order? */
+  /* how do we handle renormalization? (fixed at 1000 pixels??) */
+  coords.Npolyterms = 3;
+  for (i = 0; i < 7; i++) {
+    coords.polyterms[0][i] = 0;
+    coords.polyterms[1][i] = 0;
+  }
+  coords.polyterms[3][0] = 1e-10;
+  coords.polyterms[6][1] = 1e-10;
+
+  for (x = -10000; x <= 10000; x+= 500) {
+    for (y = -10000; y <= 10000; y+= 500) {
+      status = XY_to_RD (&p, &q, x, y, &coords);
+      status = RD_to_XY (&X, &Y, p, q, &coords);
+      fprintf (stdout, "%f %f   %f %f   %f %f\n", x, y, p, q, X, Y);
+      if (!status) exit (1);
+    }
+  }
+  exit (0);
+}
