Changeset 4395
- Timestamp:
- Jun 24, 2005, 4:48:22 PM (21 years ago)
- Location:
- trunk/archive/scripts/src
- Files:
-
- 9 edited
-
gpc1_raw.config (modified) (1 diff)
-
ipprc.config (modified) (1 diff)
-
lris_blue.config (modified) (1 diff)
-
lris_red.config (modified) (1 diff)
-
megacam_raw.config (modified) (1 diff)
-
megacam_splice.config (modified) (1 diff)
-
pmCameraFromHeader.c (modified) (8 diffs)
-
pmCameraFromHeader.h (modified) (1 diff)
-
test_pmFPARead.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/src/gpc1_raw.config
r4386 r4395 3 3 # How to identify this type 4 4 RULE METADATA 5 TELESCOP STR PS16 DETECTOR STR GPC15 # TELESCOP STR PS1 6 # DETECTOR STR GPC1 7 7 EXTEND BOOL T 8 NEXTEND S32 64 9 NAMPS S32 64 8 10 END 9 11 -
trunk/archive/scripts/src/ipprc.config
r4386 r4395 12 12 MEGACAM_SPLICE STR megacam_splice.config 13 13 GPC1_RAW STR gpc1_raw.config 14 PS1_COMCAM STR ps1_comcam.config 14 LRIS_BLUE STR lris_blue.config 15 LRIS_RED STR lris_red.config 15 16 END 16 17 -
trunk/archive/scripts/src/lris_blue.config
r4386 r4395 26 26 AMPPSIZE STR [1:1024,1:4096] 27 27 NAXIS1 S32 4620 28 NAXIS2 S TR409628 NAXIS2 S32 4096 29 29 END 30 30 -
trunk/archive/scripts/src/lris_red.config
r4386 r4395 18 18 RULE METADATA 19 19 TELESCOP STR Keck I 20 DETECTORSTR LRIS20 INSTRUME STR LRIS 21 21 AMPLIST STR 2,1,0,0 22 22 WINDOW STR 0,0,0,2048,2048 -
trunk/archive/scripts/src/megacam_raw.config
r4386 r4395 158 158 ccd28 S32 1 159 159 ccd29 S32 1 160 ccd 20 S32 1160 ccd30 S32 1 161 161 ccd31 S32 1 162 162 ccd32 S32 1 -
trunk/archive/scripts/src/megacam_splice.config
r4386 r4395 1 # The processed MecaCam data is stored in single files for each chip1 # The spliced MecaCam data is stored in single extensions for each chip 2 2 3 3 # How to recognise this type 4 4 RULE METADATA 5 TELESCOP STR CFHT 5 TELESCOP STR CFHT 3.6m 6 6 DETECTOR STR MegaCam 7 EXTEND BOOL F 7 EXTEND BOOL T 8 NEXTEND S32 36 8 9 END 9 10 -
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 } -
trunk/archive/scripts/src/pmCameraFromHeader.h
r4092 r4395 3 3 4 4 // Work out what camera we have, based on the FITS header and a set of rules specified in the IPP 5 // configuration 6 char*pmCameraFromHeader(const psMetadata *header, // The FITS header7 const psMetadata *ipprc // The IPP configuration5 // configuration; return the camera configuration 6 psMetadata *pmCameraFromHeader(const psMetadata *header, // The FITS header 7 const psMetadata *ipprc // The IPP configuration 8 8 ); 9 9 -
trunk/archive/scripts/src/test_pmFPARead.c
r4386 r4395 25 25 #endif 26 26 27 (void)psTraceSetLevel(".", 10);27 (void)psTraceSetLevel(".", 0); 28 28 (void)psTraceSetLevel("readMultipleRegions", 0); 29 29 (void)psTraceSetLevel("portions", 0); 30 30 (void)psTraceSetLevel("pmFPARead", 10); 31 31 (void)psTraceSetLevel("pmFPAfromHeader", 10); 32 (void)psTraceSetLevel("pmCameraFromHeader", 10); 33 34 32 35 33 36 if (argc != 3) { 34 printf("Usage: %s CONFIG IMAGE\n", argv[0]);37 printf("Usage: %s IPP_CONFIG IMAGE\n", argv[0]); 35 38 exit(EXIT_FAILURE); 36 39 } 37 const char * cameraName = argv[1];40 const char *ipprcName = argv[1]; 38 41 const char *imageName = argv[2]; 39 42 40 43 int badLines = 0; // Number of bad lines in camera configuration 41 psMetadata * camera = psMetadataConfigParse(NULL, &badLines, cameraName, true); // Read cameraconfig file44 psMetadata *ipprc = psMetadataConfigParse(NULL, &badLines, ipprcName, true); // Read IPP config file 42 45 if (badLines > 0) { 43 psLogMsg(__func__, PS_LOG_WARN, "%d bad lines encountered while reading cameraconfiguration %s\n",44 badLines, cameraName);46 psLogMsg(__func__, PS_LOG_WARN, "%d bad lines encountered while reading IPP configuration %s\n", 47 badLines, ipprcName); 45 48 } 46 49 47 50 psFits *fits = psFitsAlloc(imageName); 51 psMetadata *header = psFitsReadHeader(NULL, fits); 52 53 psMetadata *camera = pmCameraFromHeader(header, ipprc); 54 48 55 papFPA *fpa = pmFPARead(fits, camera, NULL); 49 56 (void)pmFPAPrint(fpa); … … 55 62 printf("Test: %d %d\n", psCellGetValueS32(fpa, "ccd15", "left", "CELL.YPARITY"), 56 63 psCellGetValueS32(fpa, "ccd15", "right", "CELL.YPARITY")); 57 58 // (void)pmFPAPrint(fpa);59 64 60 65 // Tidy up
Note:
See TracChangeset
for help on using the changeset viewer.
