IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15770


Ignore:
Timestamp:
Dec 7, 2007, 5:15:37 PM (18 years ago)
Author:
eugene
Message:

adding FPA.COMMENT, FPA.TELTEMP.* concepts and TELTEMP parse function

Location:
trunk/psModules/src/concepts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConcepts.c

    r15740 r15770  
    505505        }
    506506
     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
    507514        // FPA.FOCUS
    508515        {
     
    697704            psMetadataItem *item = psMetadataItemAllocF32("FPA.ENV.DIR", "Environment: Wind Direction", NAN);
    698705            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);
    699738            psFree(item);
    700739        }
  • trunk/psModules/src/concepts/pmConceptsStandard.c

    r15416 r15770  
    4545    psAbort("Should never ever get here.\n");
    4646    return NAN;
     47}
     48
     49// TELTEMPS : parse a list of the form 'X1 X2 X3 X4 X5 ...' : for now use median
     50psMetadataItem *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);
    47101}
    48102
  • trunk/psModules/src/concepts/pmConceptsStandard.h

    r15299 r15770  
    44 * @author Paul Price, IfA
    55 *
    6  * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-10-12 03:18:11 $
     6 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-12-08 03:15:37 $
    88 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    99 */
     
    1818psList *p_pmConceptParseRegions(const char *region ///< Regions, separated by whitespace
    1919    );
     20
     21// Parse the TELTEMPS concept : parse a list of the form 'X1 X2 X3 X4 X5 ...' : for now use median
     22psMetadataItem *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);
    2029
    2130/// Parse the FPA.FILTER concept to apply a lookup table
Note: See TracChangeset for help on using the changeset viewer.