Index: trunk/psastro/src/psastroLoadRefstars.c
===================================================================
--- trunk/psastro/src/psastroLoadRefstars.c	(revision 9587)
+++ trunk/psastro/src/psastroLoadRefstars.c	(revision 9627)
@@ -20,4 +20,5 @@
     float DECmin = DEG_RAD*psMetadataLookupF32(NULL, recipe, "DEC_MIN");
     float DECmax = DEG_RAD*psMetadataLookupF32(NULL, recipe, "DEC_MAX");
+    float MAGmax = psMetadataLookupF32(NULL, recipe, "MAG_MAX");
 
     char *CATDIR = psMetadataLookupStr(NULL, recipe, "DVO.CATDIR");
@@ -38,17 +39,19 @@
     close (fd);
 
+    psTimerStart ("psastro");
+
     // use fork to add timeout capability
     // use cfitsio |filename format to avoid tempFile
     # if ELIXIR_MODE
     if (CATDIR) {
-	sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT elixir -D CATMODE mef -region %f %f %f %f -o %s", CATDIR, RAmin, DECmin, RAmax, DECmax, tempFile);
+	sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT elixir -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", CATDIR, MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile);
     } else {
-	sprintf (tempLine, "getstar -D CATFORMAT elixir -D CATMODE mef -region %f %f %f %f -o %s", RAmin, DECmin, RAmax, DECmax, tempFile);
+	sprintf (tempLine, "getstar -D CATFORMAT elixir -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile);
     }
     # else
     if (CATDIR) {
-	sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT panstarrs -D CATMODE mef -region %f %f %f %f -o %s", CATDIR, RAmin, DECmin, RAmax, DECmax, tempFile);
+	sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT panstarrs -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", CATDIR, MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile);
     } else {
-	sprintf (tempLine, "getstar -D CATFORMAT panstarrs -D CATMODE mef -region %f %f %f %f -o %s", RAmin, DECmin, RAmax, DECmax, tempFile);
+	sprintf (tempLine, "getstar -D CATFORMAT panstarrs -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile);
     }
     # endif
@@ -61,4 +64,6 @@
     }
 
+    psLogMsg ("psastro", 3, "ran getstar : %f sec\n", psTimerMark ("psastro"));
+
     // the output from getstar is a file with the Average table
     psFits *fits = psFitsOpen (tempFile, "r");
@@ -70,10 +75,14 @@
     # endif
 
+    psTimerStart ("psastro");
     psMetadata *header = psFitsReadHeader (NULL, fits);
     psArray *table = psFitsReadTable (fits);
     psFitsClose (fits);
+
     unlink (tempFile);
+    psLogMsg ("psastro", 3, "read getstar output table : %f sec\n", psTimerMark ("psastro"));
 
     // convert the Average table to the pmAstromObj entries
+    psTimerStart ("psastro");
     psArray *refs = psArrayAlloc (table->n);
     for (int i = 0; i < table->n; i++) {
@@ -98,7 +107,9 @@
     psFree (header);
     psFree (table);
+    psLogMsg ("psastro", 3, "converted table to pmAstromObj : %f sec\n", psTimerMark ("psastro"));
 
     psTrace ("psastro", 3, "loaded %ld reference stars from (%10.6f,%10.6f) - (%10.6f,%10.6f)\n",
              refs->n, RAmin, DECmin, RAmax, DECmax);
+
     return refs;
 }
