Index: /branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/mkcmf.c
===================================================================
--- /branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/mkcmf.c	(revision 27378)
+++ /branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/mkcmf.c	(revision 27379)
@@ -56,6 +56,14 @@
   }
 
+  // add support for all cmf types
+  static char *type = "PS1_V1";
+  if ((N = get_argument (argc, argv, "-type"))) {
+    remove_argument (N, &argc, argv);
+    type = strcreate (argv[N]);
+    remove_argument (N, &argc, argv);
+  }
+
   if (argc != 3) {
-    fprintf (stderr, "USAGE mkcmf (input) (output) [-date date] [-time time] [-radec ra dec]\n");
+    fprintf (stderr, "USAGE mkcmf (input) (output) [-date date] [-time time] [-radec ra dec] [-cmftype type]\n");
     exit (2);
   }
@@ -86,4 +94,5 @@
 
   // XXX add gaussian-distributed noise based on counts
+  // this needs to make different output 'stars' entries depending on the desired type
   ALLOCATE (stars, PS1_DEV_1, Nstars);
   gauss_init (2048);
@@ -162,8 +171,34 @@
 
   ftable.header = &theader;
-  gfits_table_set_PS1_DEV_1 (&ftable, stars, Nstars);
+
+  // set up desired CMF type:
+  found = FALSE;
+  if (!strcmp(type, "PS1_DEV_0")) {
+    gfits_table_set_PS1_DEV_1 (&ftable, stars, Nstars);
+    gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_DEV_0");
+    found = TRUE;
+  }
+  if (!strcmp(type, "PS1_DEV_1")) {
+    gfits_table_set_PS1_DEV_1 (&ftable, stars, Nstars);
+    gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_DEV_1");
+    found = TRUE;
+  }
+  if (!strcmp(type, "PS1_V1")) {
+    gfits_table_set_PS1_V1 (&ftable, stars, Nstars);
+    gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_V1");
+    found = TRUE;
+  }
+  if (!strcmp(type, "PS1_V2")) {
+    gfits_table_set_PS1_V2 (&ftable, stars, Nstars);
+    gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_V2");
+    found = TRUE;
+  }
+  if (!found) {
+    fprintf (stderr, "ERROR: unknown CMF type %s\n", type);
+    exit (1);
+  }
+
+  gfits_modify (&theader, "EXTHEAD",   "%s", 1, "Chip.hdr");
   gfits_modify (&theader, "EXTNAME",   "%s", 1, "Chip.psf");
-  gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_DEV_1");
-  gfits_modify (&theader, "EXTHEAD",   "%s", 1, "Chip.hdr");
 
   fits = fopen (argv[2], "w");
