Changeset 19213
- Timestamp:
- Aug 26, 2008, 10:40:58 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppStack/src/ppStackSources.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackSources.c
r18918 r19213 117 117 psMemSetDeallocator(list, (psFreeFunc)stackSourceListFree); 118 118 119 list->sources = psMemIncrRefCounter(sources); 119 // Copy the sources onto a new array, so there's no confusion between the inputs and outputs 120 long num = sources->n; // Number of sources 121 list->sources = psArrayAlloc(num); 122 for (long i = 0; i < num; i++) { 123 list->sources->data[i] = psMemIncrRefCounter(sources->data[i]); 124 } 125 120 126 list->bounds = NULL; 121 127 list->indices = NULL; … … 447 453 return psMemIncrRefCounter(firstList->sources); 448 454 } 455 456 457 458 void ppStackSourcesPrint(const psArray *sources) 459 { 460 static int num = 0; // Number of source array 461 psString filename = NULL; // Name of file 462 psStringAppend(&filename, "sources_%d.reg", num++); 463 464 const char *goodColour = "green"; // Colour for good sources 465 const char *badColour = "red"; // Colour for bad sources 466 float radius = 5; // Radius for circle 467 468 FILE *file = fopen(filename, "w"); // File to which to write 469 psFree(filename); 470 for (int i = 0; i < sources->n; i++) { 471 pmSource *source = sources->data[i]; // Source of interest 472 if (!source) { 473 continue; 474 } 475 476 float x, y; // Source coordinates 477 coordsFromSource(&x, &y, source); 478 479 bool bad = (source->mode & SOURCE_MASK) || !isfinite(source->psfMag) || 480 source->psfMag > SOURCE_FAINTEST; // Is this a bad source? 481 482 fprintf(file, "image; circle(%f,%f,%f) # color = %s\n", x, y, radius, bad ? badColour : goodColour); 483 } 484 fclose(file); 485 486 return; 487 }
Note:
See TracChangeset
for help on using the changeset viewer.
