Changeset 30775
- Timestamp:
- Mar 2, 2011, 5:43:29 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psModules/src/objects
- Files:
-
- 3 edited
-
pmSource.c (modified) (2 diffs)
-
pmSource.h (modified) (1 diff)
-
pmSourceIO_CMF_PS1_SV1.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSource.c
r30621 r30775 1166 1166 } 1167 1167 1168 // sort by SN (descending) 1169 int pmSourceSortByParentSN (const void **a, const void **b) 1170 { 1171 pmSource *Ao = *(pmSource **)a; 1172 pmSource *Bo = *(pmSource **)b; 1173 pmSource *A = Ao->parent; 1174 pmSource *B = Bo->parent; 1175 1176 psF32 fA = (A->peak == NULL) ? 0 : A->peak->SN; 1177 psF32 fB = (B->peak == NULL) ? 0 : B->peak->SN; 1178 if (isnan (fA)) fA = 0; 1179 if (isnan (fB)) fB = 0; 1180 1181 psF32 diff = fA - fB; 1182 if (diff > FLT_EPSILON) return (-1); 1183 if (diff < FLT_EPSILON) return (+1); 1184 return (0); 1185 } 1186 1168 1187 // sort by Y (ascending) 1169 1188 int pmSourceSortByY (const void **a, const void **b) … … 1201 1220 pmSource *A = *(pmSource **)a; 1202 1221 pmSource *B = *(pmSource **)b; 1222 1223 int iA = A->seq; 1224 int iB = B->seq; 1225 1226 int diff = iA - iB; 1227 if (diff > 0) return (+1); 1228 if (diff < 0) return (-1); 1229 return (0); 1230 } 1231 1232 // sort by Seq (ascending) 1233 int pmSourceSortByParentSeq (const void **a, const void **b) 1234 { 1235 pmSource *Ao = *(pmSource **)a; 1236 pmSource *Bo = *(pmSource **)b; 1237 pmSource *A = Ao->parent; 1238 pmSource *B = Bo->parent; 1203 1239 1204 1240 int iA = A->seq; -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSource.h
r30621 r30775 286 286 bool pmSourceCachePSF (pmSource *source, psImageMaskType maskVal); 287 287 288 int pmSourceSortBySN (const void **a, const void **b);289 288 int pmSourceSortByY (const void **a, const void **b); 290 289 int pmSourceSortByX (const void **a, const void **b); 291 290 int pmSourceSortBySeq (const void **a, const void **b); 291 int pmSourceSortByParentSeq (const void **a, const void **b); 292 int pmSourceSortBySN (const void **a, const void **b); 293 int pmSourceSortByParentSN (const void **a, const void **b); 292 294 293 295 pmSourceMode pmSourceModeFromString (const char *name); -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourceIO_CMF_PS1_SV1.c
r30763 r30775 70 70 pmChip *chip = readout->parent->parent; 71 71 72 // if the sequence is defined, write these in seq order; otherwise 73 // write them in S/N order: 72 // if the sequence is defined, write these in seq order; otherwise write them in S/N order. 73 // Careful: if we are working with child sources, then we need to sort by the parent info, 74 // not our info 74 75 if (sources->n > 0) { 75 pmSource *source = (pmSource *)sources->data[0];76 pmSource *source = sources->data[0]; 76 77 if (source->seq == -1) { 77 // let's write these out in S/N order78 78 sources = psArraySort (sources, pmSourceSortBySN); 79 79 } else { … … 94 94 // by the time we call this function, all values should be assigned. let's use asserts to be sure in some cases. 95 95 for (int i = 0; i < sources->n; i++) { 96 pmSource *source = (pmSource *) sources->data[i]; 97 98 // If source->seq is -1, source was generated in this analysis. If source->seq is 99 // not -1, source was read from elsewhere: in the latter case, preserve the source 100 // ID. source.seq is used instead of source.id since the latter is a const 101 // generated on Alloc, and would thus be wrong for read in sources. 96 // this is the source associated with this image 97 pmSource *thisSource = sources->data[i]; 98 99 // this is the "real" version of this source 100 pmSource *source = thisSource->parent ? thisSource->parent : thisSource; 101 102 // If source->seq is -1, source is unique and generated in this analysis. If 103 // source->seq is not -1, source was read from elsewhere or tied to other source (eg 104 // from another image): in the latter case, preserve the source ID. source.seq is used 105 // instead of source.id since the latter is a const generated on Alloc, and would thus 106 // be wrong for read in sources. 102 107 if (source->seq == -1) { 103 108 source->seq = i; … … 398 403 // we write out all sources, regardless of quality. the source flags tell us the state 399 404 for (int i = 0; i < sources->n; i++) { 400 pmSource *source = sources->data[i]; 405 // this is the source associated with this image 406 pmSource *thisSource = sources->data[i]; 407 408 // this is the "real" version of this source 409 pmSource *source = thisSource->parent ? thisSource->parent : thisSource; 401 410 402 411 // skip sources without measurements … … 555 564 int nParamMax = 0; 556 565 for (int i = 0; i < sources->n; i++) { 557 pmSource *source = sources->data[i]; 566 // this is the source associated with this image 567 pmSource *thisSource = sources->data[i]; 568 569 // this is the "real" version of this source 570 pmSource *source = thisSource->parent ? thisSource->parent : thisSource; 571 558 572 if (source->modelFits == NULL) continue; 559 573 for (int j = 0; j < source->modelFits->n; j++) { … … 569 583 for (int i = 0; i < sources->n; i++) { 570 584 571 pmSource *source = sources->data[i]; 585 pmSource *thisSource = sources->data[i]; 586 587 // this is the "real" version of this source 588 pmSource *source = thisSource->parent ? thisSource->parent : thisSource; 572 589 573 590 // XXX if no model fits are saved, write out modelEXT? … … 719 736 for (int i = 0; i < sources->n; i++) { 720 737 721 pmSource *source = sources->data[i]; 738 // this is the source associated with this image 739 pmSource *thisSource = sources->data[i]; 740 741 // this is the "real" version of this source 742 pmSource *source = thisSource->parent ? thisSource->parent : thisSource; 722 743 723 744 // skip sources without radial aper measurements (or insufficient) 724 if (source->radialAper == NULL) continue; 745 if (source->radialAper == NULL) continue; 746 725 747 // psAssert (source->radialAper->n == fwhmValues->n, "inconsistent radial aperture set"); 726 748
Note:
See TracChangeset
for help on using the changeset viewer.
