IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17898 for trunk/psModules


Ignore:
Timestamp:
Jun 3, 2008, 3:58:43 PM (18 years ago)
Author:
Paul Price
Message:

Need to truncate ourselves, otherwise can get "22:07:60.00", rather than "22:07:59.99"

File:
1 edited

Legend:

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

    r16646 r17898  
    4949// TELTEMPS : parse a list of the form 'X1 X2 X3 X4 X5 ...' : for now use median
    5050psMetadataItem *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)
     51                                          const psMetadataItem *pattern,
     52                                          pmConceptSource source,
     53                                          const psMetadata *cameraFormat,
     54                                          const pmFPA *fpa,
     55                                          const pmChip *chip,
     56                                          const pmCell *cell)
    5757{
    5858    assert(concept);
     
    6868        break;
    6969      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;
     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;
    9292      }
    9393
     
    334334    coords -= medium / 60.0;
    335335    small = 3600.0 * coords;
     336    small = (float)((int)(small * 100.0)) / 100.0;
    336337    if (negative) {
    337338        big *= -1;
     
    526527    psString sys = concept->data.V;     // The time system string
    527528    if (concept->type != PS_DATA_STRING || strlen(sys) <= 0) {
    528         // XXX is this too low verbosity?
    529         psLogMsg ("psModules.concepts", PS_LOG_DETAIL, "Can't interpret %s --- assuming UTC.\n", pattern->name);
     529        // XXX is this too low verbosity?
     530        psLogMsg ("psModules.concepts", PS_LOG_DETAIL, "Can't interpret %s --- assuming UTC.\n", pattern->name);
    530531    } else if (strcasecmp(sys, "TAI") == 0) {
    531532        timeSys = PS_TIME_TAI;
     
    537538        timeSys = PS_TIME_TT;
    538539    } else {
    539         // XXX is this too low verbosity?
    540         psLogMsg ("psModules.concepts", PS_LOG_DETAIL, "Can't interpret %s --- assuming UTC.\n", pattern->name);
     540        // XXX is this too low verbosity?
     541        psLogMsg ("psModules.concepts", PS_LOG_DETAIL, "Can't interpret %s --- assuming UTC.\n", pattern->name);
    541542    }
    542543
Note: See TracChangeset for help on using the changeset viewer.