Changeset 15770
- Timestamp:
- Dec 7, 2007, 5:15:37 PM (18 years ago)
- Location:
- trunk/psModules/src/concepts
- Files:
-
- 3 edited
-
pmConcepts.c (modified) (2 diffs)
-
pmConceptsStandard.c (modified) (1 diff)
-
pmConceptsStandard.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConcepts.c
r15740 r15770 505 505 } 506 506 507 // FPA.COMMENT 508 { 509 psMetadataItem *item = psMetadataItemAllocStr("FPA.COMMENT", "Obs Comment", ""); 510 pmConceptRegister(item, NULL, NULL, false, PM_FPA_LEVEL_FPA); 511 psFree(item); 512 } 513 507 514 // FPA.FOCUS 508 515 { … … 697 704 psMetadataItem *item = psMetadataItemAllocF32("FPA.ENV.DIR", "Environment: Wind Direction", NAN); 698 705 pmConceptRegister(item, NULL, NULL, false, PM_FPA_LEVEL_FPA); 706 psFree(item); 707 } 708 709 // FPA.TELTEMP.* 710 { 711 psMetadataItem *item = psMetadataItemAllocF32("FPA.TELTEMP.M1", "Telescope Temperatures: M1", NAN); 712 pmConceptRegister(item, p_pmConceptParse_TELTEMPS, NULL, false, PM_FPA_LEVEL_FPA); 713 psFree(item); 714 } 715 { 716 psMetadataItem *item = psMetadataItemAllocF32("FPA.TELTEMP.M1CELL", "Telescope Temperatures: M1 CELL", NAN); 717 pmConceptRegister(item, p_pmConceptParse_TELTEMPS, NULL, false, PM_FPA_LEVEL_FPA); 718 psFree(item); 719 } 720 { 721 psMetadataItem *item = psMetadataItemAllocF32("FPA.TELTEMP.M2", "Telescope Temperatures: M2", NAN); 722 pmConceptRegister(item, p_pmConceptParse_TELTEMPS, NULL, false, PM_FPA_LEVEL_FPA); 723 psFree(item); 724 } 725 { 726 psMetadataItem *item = psMetadataItemAllocF32("FPA.TELTEMP.SPIDER", "Telescope Temperatures: SPIDER", NAN); 727 pmConceptRegister(item, p_pmConceptParse_TELTEMPS, NULL, false, PM_FPA_LEVEL_FPA); 728 psFree(item); 729 } 730 { 731 psMetadataItem *item = psMetadataItemAllocF32("FPA.TELTEMP.TRUSS", "Telescope Temperatures: TRUSS", NAN); 732 pmConceptRegister(item, p_pmConceptParse_TELTEMPS, NULL, false, PM_FPA_LEVEL_FPA); 733 psFree(item); 734 } 735 { 736 psMetadataItem *item = psMetadataItemAllocF32("FPA.TELTEMP.EXTRA", "Telescope Temperatures: EXTRA", NAN); 737 pmConceptRegister(item, p_pmConceptParse_TELTEMPS, NULL, false, PM_FPA_LEVEL_FPA); 699 738 psFree(item); 700 739 } -
trunk/psModules/src/concepts/pmConceptsStandard.c
r15416 r15770 45 45 psAbort("Should never ever get here.\n"); 46 46 return NAN; 47 } 48 49 // TELTEMPS : parse a list of the form 'X1 X2 X3 X4 X5 ...' : for now use median 50 psMetadataItem *p_pmConceptParse_TELTEMPS(const psMetadataItem *concept, 51 const psMetadataItem *pattern, 52 pmConceptSource source, 53 const psMetadata *cameraFormat, 54 const pmFPA *fpa, 55 const pmChip *chip, 56 const pmCell *cell) 57 { 58 assert(concept); 59 assert(pattern); 60 61 double value = NAN; 62 switch (concept->type) { 63 case PS_TYPE_F32: 64 value = concept->data.F32; 65 break; 66 case PS_TYPE_F64: 67 value = concept->data.F64; 68 break; 69 case PS_DATA_STRING: { 70 // parse the list of values into an array of substrings 71 psArray *strValues = psStringSplitArray (concept->data.V, " ,;", false); 72 assert (strValues); 73 74 // convert the substrings into a vector 75 psVector *fltValues = psVectorAlloc (strValues->n, PS_DATA_F32); 76 for (int i = 0; i < strValues->n; i++) { 77 fltValues->data.F32[i] = atof(strValues->data[i]); 78 } 79 80 // take the (for now) MEDIAN of the data 81 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN); 82 83 if (!psVectorStats (stats, fltValues, NULL, NULL, 0)) { 84 psAbort ("how can this stats function fail?"); 85 } 86 87 value = stats->sampleMedian; 88 psFree (stats); 89 psFree (fltValues); 90 psFree (strValues); 91 break; 92 } 93 94 default: 95 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Invalid type for %s (%x)\n", pattern->name, concept->type); 96 return NULL; 97 } 98 99 psMetadataItem *item = psMetadataItemAllocF32(pattern->name, pattern->comment, value); 100 return (item); 47 101 } 48 102 -
trunk/psModules/src/concepts/pmConceptsStandard.h
r15299 r15770 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $7 * @date $Date: 2007-1 0-12 03:18:11$6 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-12-08 03:15:37 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 18 18 psList *p_pmConceptParseRegions(const char *region ///< Regions, separated by whitespace 19 19 ); 20 21 // Parse the TELTEMPS concept : parse a list of the form 'X1 X2 X3 X4 X5 ...' : for now use median 22 psMetadataItem *p_pmConceptParse_TELTEMPS(const psMetadataItem *concept, 23 const psMetadataItem *pattern, 24 pmConceptSource source, 25 const psMetadata *cameraFormat, 26 const pmFPA *fpa, 27 const pmChip *chip, 28 const pmCell *cell); 20 29 21 30 /// Parse the FPA.FILTER concept to apply a lookup table
Note:
See TracChangeset
for help on using the changeset viewer.
