Changeset 4395 for trunk/archive/scripts/src/pmCameraFromHeader.c
- Timestamp:
- Jun 24, 2005, 4:48:22 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/archive/scripts/src/pmCameraFromHeader.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/src/pmCameraFromHeader.c
r4309 r4395 5 5 6 6 // Work out what camera we have, based on the FITS header and a set of rules specified in the IPP 7 // configuration 8 char*pmCameraFromHeader(const psMetadata *header, // The FITS header9 const psMetadata *ipprc // The IPP configuration7 // configuration; return the camera configuration 8 psMetadata *pmCameraFromHeader(const psMetadata *header, // The FITS header 9 const psMetadata *ipprc // The IPP configuration 10 10 ) 11 11 { … … 17 17 } 18 18 19 char *winner = NULL; // The instrument whose rule first matches the supplied header 19 psMetadata *winner = NULL; // The instrument configuration whose rule first matches the supplied 20 // header 20 21 21 22 // Iterate over the instruments … … 31 32 } else if (instrumentItem->type == PS_META_STR) { 32 33 psTrace(__func__, 5, "Reading instrument configuration for %s...\n", instrumentItem->name); 33 instrument = psMetadataConfigParse(NULL, NULL, instrumentItem->data.V, true); 34 int badLines = 0; // Number of bad lines in reading instrument configuration 35 instrument = psMetadataConfigParse(NULL, &badLines, instrumentItem->data.V, true); 36 if (badLines > 0) { 37 psLogMsg(__func__, PS_LOG_WARN, "%d bad lines encountered while reading camera" 38 "configuration %s\n", badLines, instrumentItem->name); 39 } 34 40 } 35 41 … … 58 64 switch (ruleItem->type) { 59 65 case PS_META_STR: 60 match = (strcmp(ruleItem->data.V, headerItem->data.V) == 0) ? true : false; 66 psTrace(__func__, 8, "Matching %s: '%s' vs '%s'\n", ruleItem->name, 67 ruleItem->data.V, headerItem->data.V); 68 match = (strncmp(ruleItem->data.V, headerItem->data.V, 69 strlen(ruleItem->data.V)) == 0) ? true : false; 61 70 break; 62 71 case PS_TYPE_S32: 72 case PS_TYPE_BOOL: 73 psTrace(__func__, 8, "Matching %s: %d vs %d\n", ruleItem->name, 74 ruleItem->data.S32, headerItem->data.S32); 63 75 if (ruleItem->data.S32 != headerItem->data.S32) { 64 76 match = false; … … 66 78 break; 67 79 case PS_TYPE_F32: 80 psTrace(__func__, 8, "Matching %s: %f vs %f\n", ruleItem->name, 81 ruleItem->data.F32, headerItem->data.F32); 68 82 if (ruleItem->data.F32 != headerItem->data.F32) { 69 83 match = false; … … 71 85 break; 72 86 case PS_TYPE_F64: 87 psTrace(__func__, 8, "Matching %s: %g vs %g\n", ruleItem->name, 88 ruleItem->data.F64, headerItem->data.F64); 73 89 if (ruleItem->data.F64 != headerItem->data.F64) { 74 90 match = false; … … 85 101 if (! winner) { 86 102 // This is the first match 87 winner = instrumentItem->name; 103 winner = instrument; 104 psLogMsg(__func__, PS_LOG_INFO, "FITS header matches instrument %s\n", 105 instrumentItem->name); 88 106 } else { 89 107 // We have a duplicate match … … 100 118 psFree(iterator); 101 119 120 if (! winner) { 121 psError(PS_ERR_IO, true, "Unable to find an instrument that matches input FITS header!\n"); 122 } 123 102 124 return winner; 103 125 }
Note:
See TracChangeset
for help on using the changeset viewer.
