Changeset 5371 for trunk/archive/scripts/src/phase2/papPhase2.c
- Timestamp:
- Oct 18, 2005, 4:19:41 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/archive/scripts/src/phase2/papPhase2.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/src/phase2/papPhase2.c
r5104 r5371 45 45 static psMemId memPrintAlloc(const psMemBlock *mb) 46 46 { 47 printf("Allocated memory block %l ld (%lld):\n"47 printf("Allocated memory block %ld (%ld):\n" 48 48 "\tFile %s, line %d, size %d\n" 49 49 "\tPosts: %x %x %x\n", … … 54 54 static psMemId memPrintFree(const psMemBlock *mb) 55 55 { 56 printf("Freed memory block %l ld (%lld):\n"56 printf("Freed memory block %ld (%ld):\n" 57 57 "\tFile %s, line %d, size %d\n" 58 58 "\tPosts: %x %x %x\n", … … 64 64 { 65 65 psMemBlock *mb = ((psMemBlock*)ptr) - 1; 66 printf("Memory block %l ld (%lld):\n"66 printf("Memory block %ld (%ld):\n" 67 67 "\tFile %s, line %d, size %d\n" 68 68 "\tPosts: %x %x %x\n", … … 75 75 #if 0 76 76 // Hunting memory leaks 77 psMemAlloc ateCallbackSetID(23289);78 psMemFreeCallbackSetID(2 3289);79 psMemAlloc ateCallbackSet(memPrintAlloc);77 psMemAllocCallbackSetID(22367); 78 psMemFreeCallbackSetID(22367); 79 psMemAllocCallbackSet(memPrintAlloc); 80 80 psMemFreeCallbackSet(memPrintFree); 81 81 #endif … … 198 198 bool doAstrom = false; // Astrometry 199 199 pmOverscanAxis overscanMode = PM_OVERSCAN_NONE; // Axis for overscan 200 pmFit overscanFit = PM_FIT_NONE;// Fit type for overscan200 pmFit overscanFitType = PM_FIT_NONE; // Fit type for overscan 201 201 int overscanBins = 1; // Number of pixels per bin for overscan 202 202 psStats *overscanStats = NULL; // Statistics for overscan 203 void *overscanFit = NULL; // Overscan fit (polynomial or spline) 203 204 204 205 if (psMetadataLookupBool(NULL, recipe, "MASK")) { … … 243 244 psString fit = psMetadataLookupString(NULL, recipe, "OVERSCAN.FIT"); 244 245 if (strcasecmp(fit, "POLYNOMIAL") == 0) { 245 overscanFit = PM_FIT_POLYNOMIAL; 246 overscanFitType = PM_FIT_POLYNOMIAL; 247 int order = psMetadataLookupS32(NULL, recipe, "OVERSCAN.ORDER"); // Order of polynomial fit 248 overscanFit = psPolynomial1DAlloc(order, PS_POLYNOMIAL_ORD); 246 249 } else if (strcasecmp(fit, "SPLINE") == 0) { 247 overscanFit = PM_FIT_SPLINE; 250 overscanFitType = PM_FIT_SPLINE; 251 int order = psMetadataLookupS32(NULL, recipe, "OVERSCAN.ORDER"); // Order of polynomial fit 252 // overscanFit = psSpline1DAlloc(order, PS_POLYNOMIAL_ORD); 248 253 } else if (strcasecmp(fit, "NONE") != 0) { 249 254 psLogMsg("phase2", PS_LOG_WARN, "OVERSCAN.FIT (%s) is not one of NONE, POLYNOMIAL, or SPLINE:" … … 297 302 #endif 298 303 299 pmFPAPrint(input);304 //pmFPAPrint(input); 300 305 301 306 // Load the calibration frames, if required … … 475 480 pmReadout *inputReadout = inputReadouts->data[k]; // Readout of interest in input image 476 481 psImage *inputImage = inputReadout->image; // The actual image 477 psList *inputOverscans = inputReadout->overscans; // List of overscan bias regions478 482 479 483 // Mask bad pixels … … 656 660 } 657 661 658 printf("mode: %d\n", overscanMode);659 660 662 if (doBias || doOverscan || doDark) { 661 void *overscanResult = NULL; // Result of overscan fit 662 #ifdef PRODUCTION 663 (void)pmSubtractBias(inputReadout, overscanResult, inputOverscans, overscanMode, 664 overscanStats, overscanBins, overscanFit, pedestal); 665 #else 666 (void)pmSubtractBias(inputReadout, overscanResult, inputOverscans, overscanMode, 667 overscanStats, overscanBins, overscanFit, biasReadout); 668 #endif 669 663 psList *inputOverscans = pmReadoutGetBias(inputReadout); // List of overscan bias regions 664 #ifdef PRODUCTION 665 (void)pmSubtractBias(inputReadout, overscanFit, inputOverscans, overscanMode, 666 overscanStats, overscanBins, overscanFitType, pedestal); 667 #else 668 (void)pmSubtractBias(inputReadout, overscanFit, inputOverscans, overscanMode, 669 overscanStats, overscanBins, overscanFitType, biasReadout); 670 #endif 671 psFree(inputOverscans); 672 670 673 // Output overscan fit results, if required 671 674 if (doOverscan) { 672 switch (overscanFit ) {675 switch (overscanFitType) { 673 676 case PM_FIT_POLYNOMIAL: 674 677 { 675 psPolynomial1D *poly = (psPolynomial1D*)overscan Result; // The polynomial678 psPolynomial1D *poly = (psPolynomial1D*)overscanFit; // The polynomial 676 679 psString coeffs = NULL; // String containing the coefficients 677 680 for (int i = 0; i < poly->n; i++) { 678 psStringAppend(&coeffs, "% .2f", poly->coeff[i]);681 psStringAppend(&coeffs, "%e ", poly->coeff[i]); 679 682 } 680 683 psLogMsg("phase2", PS_LOG_INFO, "Overscan polynomial coefficients:\n%s\n", … … 685 688 case PM_FIT_SPLINE: 686 689 { 687 psSpline1D *spline = (psSpline1D*)overscan Result; // The spline690 psSpline1D *spline = (psSpline1D*)overscanFit; // The spline 688 691 psString coeffs = NULL; // String containing the coefficients 689 692 for (int i = 0; i < spline->n; i++) { … … 691 694 psStringAppend(&coeffs, "%d: ", i); 692 695 for (int j = 0; j < poly->n; j++) { 693 psStringAppend(&coeffs, "% .2f", poly->coeff[i]);696 psStringAppend(&coeffs, "%e ", poly->coeff[i]); 694 697 } 695 698 psStringAppend(&coeffs, "\n"); … … 755 758 psFree(dark); 756 759 psFree(flat); 760 psFree(overscanFit); 757 761 psFree(overscanStats); 758 762 … … 764 768 #if 1 765 769 for (int i = 0; i < nLeaks; i++) { 766 printf("Memory leak detection: memBlock %lld (%lld)\n" 767 "\tFile %s, line %d, size %d\n", 768 leaks[i]->id, leaks[i]->refCounter, leaks[i]->file, leaks[i]->lineno, 769 leaks[i]->userMemorySize); 770 psMemBlock *mb = leaks[i]; 771 printf("Memory leak %ld (%ld):\n" 772 "\tFile %s, line %d, size %d\n" 773 "\tPosts: %x %x %x\n", 774 mb->id, mb->refCounter, mb->file, mb->lineno, mb->userMemorySize, mb->startblock, mb->endblock, 775 *(void**)((int8_t *)(mb + 1) + mb->userMemorySize)); 770 776 } 771 777 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
