Changeset 15257
- Timestamp:
- Oct 9, 2007, 9:57:03 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroLoadRefstars.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroLoadRefstars.c
r15200 r15257 54 54 // psStringAppend (&getstarCommand, " -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile); 55 55 // XXX TEST : no magnitude limit 56 // XXX need to specify the desired photometry system 56 57 psStringAppend (&getstarCommand, " -D CATMODE mef -region %f %f %f %f -o %s", RAmin, DECmin, RAmax, DECmax, tempFile); 57 58 psTrace ("psastro", 3, "%s\n", getstarCommand); … … 77 78 78 79 psTimerStart ("psastro"); 79 psMetadata *header = psFitsReadHeader (NULL, fits); 80 psArray *table = psFitsReadTable (fits); 81 psFitsClose (fits); 82 83 unlink (tempFile); 84 85 if (table == NULL) { 86 psError(PSASTRO_ERR_REFSTARS, true, "failure to load astrometric reference\n"); 87 return NULL; 88 } 89 90 psLogMsg ("psastro", 3, "read getstar output table : %f sec\n", psTimerMark ("psastro")); 80 long numSources = psFitsTableSize(fits); // Number of sources in table 91 81 92 82 // convert the Average table to the pmAstromObj entries 93 psTimerStart ("psastro"); 94 95 psArray *refstars = psArrayAllocEmpty (table->n); 96 for (int i = 0; i < table->n; i++) { 83 psArray *refstars = psArrayAllocEmpty (numSources); 84 for (int i = 0; i < numSources; i++) { 97 85 pmAstromObj *ref = pmAstromObjAlloc (); 98 86 99 psMetadata *row = table->data[i];87 psMetadata *row = psFitsReadTableRow(fits, i); // Table row 100 88 101 89 // DVO tables are stored in degrees … … 112 100 psArrayAdd (refstars, 100, ref); 113 101 psFree (ref); 102 psFree (row); 114 103 } 115 psFree (header); 116 psFree (table); 117 psLogMsg ("psastro", 3, "converted table to pmAstromObj : %f sec\n", psTimerMark ("psastro")); 104 psLogMsg ("psastro", 3, "loaded %ld reference stars : %f sec\n", refstars->n, psTimerMark ("psastro")); 118 105 119 106 psTrace ("psastro", 3, "loaded %ld reference stars from (%10.6f,%10.6f) - (%10.6f,%10.6f)\n", 120 107 refstars->n, RAmin, DECmin, RAmax, DECmax); 108 109 psFitsClose (fits); 110 unlink (tempFile); 121 111 122 112 // dump or plot the available refstars
Note:
See TracChangeset
for help on using the changeset viewer.
