Changeset 15399
- Timestamp:
- Oct 28, 2007, 3:40:54 PM (19 years ago)
- Location:
- branches/eam_branch_20071023/psModules/src
- Files:
-
- 2 added
- 10 edited
-
camera/Makefile.am (modified) (2 diffs)
-
camera/pmReadoutFake.c (added)
-
camera/pmReadoutFake.h (added)
-
concepts/pmConceptsAverage.c (modified) (4 diffs)
-
concepts/pmConceptsAverage.h (modified) (3 diffs)
-
config/pmConfig.c (modified) (18 diffs)
-
config/pmConfig.h (modified) (3 diffs)
-
detrend/pmShutterCorrection.c (modified) (1 diff)
-
imcombine/pmStack.c (modified) (10 diffs)
-
imcombine/pmSubtraction.c (modified) (4 diffs)
-
imcombine/pmSubtractionKernels.c (modified) (2 diffs)
-
psmodules.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20071023/psModules/src/camera/Makefile.am
r13898 r15399 27 27 pmFPAExtent.c \ 28 28 pmCellSquish.c \ 29 pmReadoutStack.c 29 pmReadoutStack.c \ 30 pmReadoutFake.c 30 31 31 32 pkginclude_HEADERS = \ … … 53 54 pmFPAExtent.h \ 54 55 pmCellSquish.h \ 55 pmReadoutStack.h 56 pmReadoutStack.h \ 57 pmReadoutFake.h 56 58 57 59 CLEANFILES = *~ -
branches/eam_branch_20071023/psModules/src/concepts/pmConceptsAverage.c
r14468 r15399 97 97 int xBin = 0, yBin = 0; // Binning 98 98 int x0 = 0, y0 = 0; // Offset 99 int xParity = 0, yParity = 0; // Parity 99 100 100 101 int nCells = 0; // Number of cells; … … 121 122 if (same) { 122 123 // Only makes sense to update these if they are the same cell 123 x0 = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0"); 124 y0 = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0"); 124 x0 = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0"); 125 y0 = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0"); 126 xParity = psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY"); 127 yParity = psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY"); 125 128 } 126 129 } else { … … 154 157 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Differing CELL.Y0 in use: %d vs %d\n", 155 158 y0, psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0")); 159 success = false; 160 } 161 if (xParity != psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY")) { 162 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Differing CELL.XPARITY in use: %d vs %d\n", 163 xParity, psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY")); 164 success = false; 165 } 166 if (yParity != psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY")) { 167 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Differing CELL.YPARITY in use: %d vs %d\n", 168 yParity, psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY")); 156 169 success = false; 157 170 } … … 189 202 MD_UPDATE(target->concepts, "CELL.X0", S32, x0); 190 203 MD_UPDATE(target->concepts, "CELL.Y0", S32, y0); 204 MD_UPDATE(target->concepts, "CELL.XPARITY", S32, xParity); 205 MD_UPDATE(target->concepts, "CELL.YPARITY", S32, yParity); 191 206 } 192 207 -
branches/eam_branch_20071023/psModules/src/concepts/pmConceptsAverage.h
r14466 r15399 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $7 * @date $Date: 2007- 08-11 01:05:59$6 * @version $Revision: 1.9.10.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-10-29 01:40:54 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 42 42 /// - CELL.TIMESYS 43 43 /// - CELL.X0, CELL.Y0 44 /// - CELL.XPARITY, CELL.YPARITY 44 45 /// And for others, it takes the "worst" possible value: 45 46 /// - CELL.SATURATION … … 47 48 /// These concepts are only handled if the cells are all the same cell (mosaicking vs stacking): 48 49 /// - CELL.X0, CELL.Y0 50 /// - CELL.XPARITY, CELL.YPARITY 49 51 bool pmConceptsAverageCells(pmCell *target,///< Target cell 50 52 psList *sources, ///< List of source cells -
branches/eam_branch_20071023/psModules/src/config/pmConfig.c
r15252 r15399 37 37 #define PS_DEFAULT_SITE ".ipprc" // Default site config file 38 38 39 #define DEFAULT_LOG STDERR_FILENO // Default file descriptor for log messages 40 #define DEFAULT_TRACE STDERR_FILENO // Default file descriptor for trace messages 41 39 42 static bool readCameraConfig = true; // Read the camera config on startup (with pmConfigRead)? 40 43 static psArray *configPath = NULL; // Search path for configuration files … … 59 62 psFree(config->arguments); 60 63 psFree(config->database); 64 65 // Close log and trace files 66 if (config->logFD != STDOUT_FILENO && config->logFD != STDERR_FILENO) { 67 close(config->logFD); 68 } 69 if (config->traceFD != STDOUT_FILENO && config->traceFD != STDERR_FILENO) { 70 close(config->traceFD); 71 } 72 73 return; 61 74 } 62 75 … … 79 92 config->defaultRecipe = NULL; 80 93 94 config->traceFD = DEFAULT_TRACE; 95 config->logFD = DEFAULT_LOG; 96 81 97 // the file structure is used to carry pmFPAfiles 82 98 config->files = psMetadataAlloc (); … … 124 140 } 125 141 142 126 143 void pmConfigSet(const char *path) 127 144 { … … 144 161 psFree(configPath); 145 162 configPath = NULL; 163 164 return; 146 165 } 147 166 … … 379 398 psArgumentRemove(argNum, argc, argv); 380 399 if (argNum >= *argc) { 381 psLogMsg("psModules.config", PS_LOG_WARN, 382 "-site command-line switch provided without the required filename --- ignored.\n"); 400 psWarning("-site command-line switch provided without the required filename --- ignored.\n"); 383 401 } else { 384 402 siteName = psStringCopy(argv[argNum]); … … 446 464 447 465 argNum = psArgumentGet(*argc, argv, "-log"); 448 if (argNum > 0) 449 { 466 if (argNum > 0) { 450 467 psArgumentRemove(argNum, argc, argv); 451 468 if (argNum >= *argc) { 452 ps LogMsg("psModules.config", PS_LOG_WARN, "-log command-line switch provided without the"453 "required log destination--- ignored.\n");469 psWarning("-log command-line switch provided without the required log destination " 470 "--- ignored.\n"); 454 471 } else { 455 if (!psLogSetDestination(psMessageDestination(argv[argNum]))) { 456 psLogMsg("psModules.config", PS_LOG_WARN, "Unable to set log destination to %s\n", 457 argv[argNum]); 458 } 472 config->logFD = psMessageDestination(argv[argNum]); 459 473 psArgumentRemove(argNum, argc, argv); 460 474 } 461 } else 462 { 475 } else { 463 476 // Set logging destination 464 477 psString logDest = psMetadataLookupStr(&mdok, config->site, "LOGDEST"); 465 478 if (mdok && logDest && strlen(logDest) > 0) { 466 // XXX: Only stdout and stderr are provided for now; this section should be 467 // expanded in the future to do files, and perhaps even sockets. 468 if (!psLogSetDestination(psMessageDestination(logDest))) { 469 psLogMsg("psModules.config", PS_LOG_WARN, "Unable to set log destination to %s\n", 470 argv[argNum]); 471 } 472 } 479 config->logFD = psMessageDestination(logDest); 480 } 481 } 482 if (!psLogSetDestination(config->logFD)) { 483 psWarning("Unable to set log destination to file number %d --- ignored", config->logFD); 473 484 } 474 485 475 486 // Set trace levels 476 487 psMetadata *trace = psMetadataLookupMetadata(&mdok, config->site, "TRACE"); 477 if (mdok && trace) 478 { 488 if (mdok && trace) { 479 489 psMetadataIterator *traceIter = psMetadataIteratorAlloc(trace, PS_LIST_HEAD, NULL); // Iterator 480 490 psMetadataItem *traceItem = NULL; // Item from MD iteration 481 491 while ((traceItem = psMetadataGetAndIncrement(traceIter))) { 482 492 if (traceItem->type != PS_DATA_S32) { 483 psLogMsg("psModules.config", PS_LOG_WARN, 484 "The level for trace component %s is not of type S32 (%x)\n", 493 psWarning("The level for trace component %s is not of type S32 (%x)\n", 485 494 traceItem->name, traceItem->type); 486 495 continue; 487 496 } 488 psTrace("psModules.config", 7, "Setting trace level for %s to %d\n", traceItem->name, traceItem->data.S32); 497 psTrace("psModules.config", 7, "Setting trace level for %s to %d\n", 498 traceItem->name, traceItem->data.S32); 489 499 (void)psTraceSetLevel(traceItem->name, traceItem->data.S32); 490 500 } … … 494 504 // Set trace formats 495 505 psString traceFormat = psMetadataLookupStr(&mdok, config->site, "TRACEFORMAT"); 496 if (mdok && traceFormat) 497 { 506 if (mdok && traceFormat) { 498 507 psTrace("psModules.config", 7, "Setting trace format to %s\n", traceFormat); 499 508 (void)psTraceSetFormat(traceFormat); … … 502 511 // Set trace destinations 503 512 #ifndef PS_NO_TRACE 504 psString traceDest = psMetadataLookupStr(&mdok, config->site, "TRACEDEST"); 505 if (mdok && traceDest && strlen(traceDest) > 0) 506 { 507 psTrace("psModules.config", 7, "Setting trace destination to %s\n", traceDest); 508 // XXX: Only stdout and stderr are provided for now; this section should be 509 // expanded in the future to do files, and perhaps even sockets. 510 if (!psTraceSetDestination(psMessageDestination(traceDest))) { 511 psLogMsg("psModules.config", PS_LOG_WARN, "Unable to set trace destination to %s\n", traceDest); 512 513 } 513 argNum = psArgumentGet(*argc, argv, "-tracedest"); 514 if (argNum > 0) { 515 psArgumentRemove(argNum, argc, argv); 516 if (argNum >= *argc) { 517 psWarning("-tracedest command-line switch provided without the required trace destination " 518 "--- ignored.\n"); 519 } else { 520 config->traceFD = psMessageDestination(argv[argNum]); 521 psArgumentRemove(argNum, argc, argv); 522 } 523 } else { 524 psString traceDest = psMetadataLookupStr(&mdok, config->site, "TRACEDEST"); 525 if (mdok && traceDest && strlen(traceDest) > 0) { 526 psTrace("psModules.config", 7, "Setting trace destination to %s\n", traceDest); 527 config->traceFD = psMessageDestination(traceDest); 528 } 529 } 530 if (!psTraceSetDestination(config->traceFD)) { 531 psWarning("Unable to set log destination to file %d\n", config->traceFD); 514 532 } 515 533 #endif … … 741 759 psArgumentRemove(argNum, argc, argv); 742 760 if (argNum >= *argc) { 743 psLogMsg("psModules.config", PS_LOG_WARN, 744 "-dbserver command-line switch provided without the required server name --- "); 761 psWarning("-dbserver command-line switch provided without the required server name --- "); 745 762 } else { 746 763 char *dbserver = argv[argNum]; // The camera configuration file to read 747 764 if (!psMetadataAddStr(config->site, PS_LIST_TAIL, "DBSERVER", PS_META_REPLACE, NULL, dbserver)) { 748 psLogMsg("psModules.config", PS_LOG_WARN, 749 "failed to overwrite .ipprc DBSERVER value --- "); 765 psWarning("Failed to overwrite .ipprc DBSERVER value"); 750 766 } 751 767 … … 758 774 psArgumentRemove(argNum, argc, argv); 759 775 if (argNum >= *argc) { 760 psLogMsg("psModules.config", PS_LOG_WARN, 761 "-dbname command-line switch provided without the required database name --- "); 776 psWarning("-dbname command-line switch provided without the required database name"); 762 777 } else { 763 778 char *dbname = argv[argNum]; // The camera configuration file to read 764 779 if (!psMetadataAddStr(config->site, PS_LIST_TAIL, "DBNAME", PS_META_REPLACE, NULL, dbname)) { 765 psLogMsg("psModules.config", PS_LOG_WARN, 766 "failed to overwrite .ipprc DBNAME value --- "); 780 psWarning("Failed to overwrite .ipprc DBNAME value"); 767 781 } 768 782 … … 775 789 psArgumentRemove(argNum, argc, argv); 776 790 if (argNum >= *argc) { 777 psLogMsg("psModules.config", PS_LOG_WARN, 778 "-dbuser command-line switch provided without the required database name --- "); 791 psWarning("-dbuser command-line switch provided without the required database name"); 779 792 } else { 780 793 char *dbuser = argv[argNum]; // The camera configuration file to read 781 794 if (!psMetadataAddStr(config->site, PS_LIST_TAIL, "DBUSER", PS_META_REPLACE, NULL, dbuser)) { 782 psLogMsg("psModules.config", PS_LOG_WARN, 783 "failed to overwrite .ipprc DBUSER value --- "); 795 psWarning("Failed to overwrite .ipprc DBUSER value"); 784 796 } 785 797 … … 792 804 psArgumentRemove(argNum, argc, argv); 793 805 if (argNum >= *argc) { 794 psLogMsg("psModules.config", PS_LOG_WARN, 795 "-dbpassword command-line switch provided without the required password --- "); 806 psWarning("-dbpassword command-line switch provided without the required password"); 796 807 } else { 797 808 char *dbpassword = argv[argNum]; // The camera configuration file to read 798 if (!psMetadataAddStr(config->site, PS_LIST_TAIL, "DBPASSWORD", PS_META_REPLACE, NULL, dbpassword)) {799 psLogMsg("psModules.config", PS_LOG_WARN,800 "failed to overwrite .ipprc DBPASSWORD value ---");809 if (!psMetadataAddStr(config->site, PS_LIST_TAIL, "DBPASSWORD", PS_META_REPLACE, 810 NULL, dbpassword)) { 811 psWarning("Failed to overwrite .ipprc DBPASSWORD value"); 801 812 } 802 813 … … 809 820 psArgumentRemove(argNum, argc, argv); 810 821 if (argNum >= *argc) { 811 psLogMsg("psModules.config", PS_LOG_WARN, 812 "-dbpport command-line switch provided without the required port number --- "); 822 psWarning("-dbpport command-line switch provided without the required port number"); 813 823 } else { 814 824 char *dbport = argv[argNum]; // The camera configuration file to read 815 if (!psMetadataAddS32(config->site, PS_LIST_TAIL, "DBPORT", PS_META_REPLACE, NULL, (psS32)atoi(dbport))) {816 psLogMsg("psModules.config", PS_LOG_WARN,817 "failed to overwrite .ipprc DBPORT value ---");825 if (!psMetadataAddS32(config->site, PS_LIST_TAIL, "DBPORT", PS_META_REPLACE, NULL, 826 (psS32)atoi(dbport))) { 827 psWarning("Failed to overwrite .ipprc DBPORT value"); 818 828 } 819 829 … … 963 973 result = true; 964 974 } else { 965 psLogMsg("psModules.config", PS_LOG_WARN, 966 "Camera %s, format %s also matches header --- ignored.\n", 975 psWarning("Camera %s, format %s also matches header --- ignored.\n", 967 976 cameraName, formatsItem->name); 968 977 } … … 1050 1059 } 1051 1060 1061 // Now that we have the camera, we can apply recipes based on command-line arguments 1062 if (readRecipes && !pmConfigReadRecipes(config, PM_RECIPE_SOURCE_CL)) { 1063 psError(PS_ERR_IO, false, "Error reading recipes from camera config for %s", config->cameraName); 1064 return NULL; 1065 } 1066 1052 1067 if (!config->format && !config->formatName) { 1053 1068 config->formatName = name; … … 1081 1096 1082 1097 if (!pmConfigFileRead(&camera, cameraPath, cameraName)) { 1083 ps LogMsg("psModules.config", PS_LOG_WARN,"Trouble reading reading camera configuration %s", cameraName);1098 psWarning("Trouble reading reading camera configuration %s", cameraName); 1084 1099 psFree(camera); 1085 1100 return NULL; … … 1118 1133 } 1119 1134 if (!(mdStatus01 && mdStatus02 && mdStatus03 && mdStatus04)) { 1120 psLogMsg("psModules.config", PS_LOG_WARN, 1121 "Could not determine database server, name, user, and password from site metadata.\n"); 1135 psWarning("Could not determine database server, name, user, and password from site metadata.\n"); 1122 1136 return NULL; 1123 1137 } -
branches/eam_branch_20071023/psModules/src/config/pmConfig.h
r15217 r15399 5 5 * @author Eugene Magnier, IfA 6 6 * 7 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-10-04 20:15:48 $ 7 * @version $Revision: 1.31.2.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-10-29 01:40:54 $ 9 * 9 10 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 10 11 */ … … 36 37 /// This structure stores the configuration information: the site, camera and recipe configuration, the 37 38 /// command-line arguments, the pmFPAfiles used, and the database handle. 38 typedef struct 39 { 39 typedef struct { 40 40 psMetadata *site; ///< Site configuration 41 41 psMetadata *camera; ///< Camera specification … … 51 51 pmRecipeSource recipesRead; ///< Which recipe sources have been read 52 52 psMetadata *recipeSymbols; ///< Where each recipe came from 53 54 // dropping the argc, argv info from pmConfig 55 # if (0) 56 int *argc; ///< Number of command-line arguments 57 char **argv; ///< Command-line arguments (raw version) 58 # endif 59 } 60 pmConfig; 53 int traceFD; ///< File descriptor for trace messages 54 int logFD; ///< File descriptor for log messages 55 } pmConfig; 61 56 62 57 /// Allocator for pmConfig -
branches/eam_branch_20071023/psModules/src/detrend/pmShutterCorrection.c
r15254 r15399 832 832 for (int j = 0; j < MEASURE_SAMPLES; j++) { 833 833 psRegion *region = data->regions->data[j]; // Region of interest 834 psImage *subImage = psImageSubset(readout->image, *region); // Sub-image 834 psRegion adjusted = *region; // Adjusted region, compensating for offsets 835 adjusted.x0 += readout->image->col0; 836 adjusted.x1 += readout->image->col0; 837 adjusted.y0 += readout->image->row0; 838 adjusted.y1 += readout->image->row0; 839 psImage *subImage = psImageSubset(readout->image, adjusted); // Sub-image 835 840 psImage *subMask = NULL; // Sub-image of mask 836 841 if (readout->mask) { 837 subMask = psImageSubset(readout->mask, *region);842 subMask = psImageSubset(readout->mask, adjusted); 838 843 } 839 844 if (!psImageStats(stats, subImage, subMask, maskVal)) { 840 psString regionString = psRegionToString( *region);845 psString regionString = psRegionToString(adjusted); 841 846 psWarning("Unable to measure sample statistics at %s in image.\n", 842 847 regionString); -
branches/eam_branch_20071023/psModules/src/imcombine/pmStack.c
r14648 r15399 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $11 * @date $Date: 2007- 08-23 23:43:12$10 * @version $Revision: 1.13.8.1 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-10-29 01:40:54 $ 12 12 * 13 13 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii … … 221 221 for (int i = 0; i < num; i++) { 222 222 pmStackData *data = inputs->data[i]; // Stack data of interest 223 if (!data) { 224 continue; 225 } 223 226 psImage *image = data->readout->image; // Image of interest 224 227 psImage *weight = data->readout->weight; // Weight map of interest … … 292 295 // Add the pixel as one to inspect 293 296 pmStackData *data = inputs->data[j]; // Stack data of interest 297 if (!data) { 298 continue; 299 } 294 300 data->pixels = psPixelsAdd(data->pixels, PIXEL_LIST_BUFFER, x, y); 295 301 // Mask it so it's not considered in other iterations within this function … … 315 321 *num = input->n; 316 322 317 // The first is a template 318 pmStackData *data = input->data[0]; // First image off the rank 323 pmStackData *data = NULL; // First image off the rank, used as a template 324 for (int i = 0; !data && i < input->n; i++) { 325 data = input->data[i]; 326 } 319 327 PS_ASSERT_PTR_NON_NULL(data, false); 320 328 assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type … … 338 346 for (int i = 1; i < *num; i++) { 339 347 pmStackData *data = input->data[i]; // Stack data for this input 348 if (!data) { 349 continue; 350 } 340 351 assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type 341 352 if (!data->readout) { … … 469 480 for (int i = 0; i < input->n; i++) { 470 481 pmStackData *data = input->data[i]; 471 assert(data && data->pixels); 482 if (!data) { 483 continue; 484 } 485 assert(data->pixels); 472 486 psPixels *pixels = data->pixels;// The pixels of interest 473 487 for (int j = 0; j < pixels->n; j++) { … … 544 558 for (int i = 0; i < num; i++) { 545 559 pmStackData *data = input->data[i]; // Stack data for this input 560 if (!data) { 561 weights->data.F32[i] = 0.0; 562 } 546 563 weights->data.F32[i] = data->weight; 547 564 } … … 561 578 for (int i = 0; i < num; i++) { 562 579 pmStackData *data = input->data[i]; // Stacking data; contains the list of pixels 580 if (!data) { 581 continue; 582 } 563 583 pixels = psPixelsConcatenate(pixels, data->pixels); 564 584 data->pixels = psPixelsRealloc(data->pixels, PIXEL_LIST_BUFFER); // Just in case more rejection … … 596 616 for (int i = 0; i < num; i++) { 597 617 pmStackData *data = input->data[i]; // Stack data for this input 618 if (!data) { 619 continue; 620 } 598 621 data->pixels = psPixelsAllocEmpty(PIXEL_LIST_BUFFER); 599 622 } … … 611 634 for (int i = 0; i < num; i++) { 612 635 pmStackData *data = input->data[i]; // Stack data for this input 636 if (!data) { 637 continue; 638 } 613 639 psTrace("psModules.imcombine", 5, "Image %d: %ld pixels to inspect.\n", i, data->pixels->n); 614 640 } -
branches/eam_branch_20071023/psModules/src/imcombine/pmSubtraction.c
r15325 r15399 4 4 * @author GLG, MHPCC 5 5 * 6 * @version $Revision: 1.65 $ $Name: not supported by cvs2svn $7 * @date $Date: 2007-10- 17 02:45:40$6 * @version $Revision: 1.65.2.1 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-10-29 01:40:54 $ 8 8 * 9 9 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii … … 907 907 for (int j = 0; j < numKernels; j++) { 908 908 psKernel *convolution = convolutions->data[j]; // Convolution of reference 909 910 // XXX Precalculate these values, so that we're not calculating the same thing for 911 // every pixel. 909 912 double polynomial = 0.0; // Value of the polynomial 910 913 for (int yOrder = 0, index = j; yOrder <= spatialOrder; yOrder++) { … … 928 931 deviations->data.F32[i] = devNorm * deviation; 929 932 psTrace("psModules.imcombine", 5, "Deviation for stamp %d (%d,%d): %f\n", 930 i, (int) stamp->x, (int)stamp->y, deviations->data.F32[i]);933 i, (int)(stamp->x + 0.5), (int)(stamp->y + 0.5), deviations->data.F32[i]); 931 934 totalSquareDev += PS_SQR(deviations->data.F32[i]); 932 935 numStamps++; … … 947 950 } 948 951 952 if (!isfinite(sigmaRej) || sigmaRej <= 0.0) { 953 psLogMsg("psModules.imcombine", PS_LOG_INFO, "RMS deviation: %f", sqrt(totalSquareDev / numStamps)); 954 psFree(deviations); 955 return 0; 956 } 957 958 int numRejected = 0; // Number of stamps rejected 959 int numGood = 0; // Number of good stamps 960 double newSquareDev = 0.0; // New square deviation 961 949 962 float limit = sigmaRej * sqrt(totalSquareDev / numStamps); // Limit on maximum deviation 950 963 psTrace("psModules.imcombine", 1, "Deviation limit: %f\n", limit); 951 964 952 int numRejected = 0;953 965 for (int i = 0; i < stamps->num; i++) { 954 966 pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest 955 if (stamp->status == PM_SUBTRACTION_STAMP_USED && deviations->data.F32[i] > limit) { 956 // Mask out the stamp in the image so you it's not found again 957 psTrace("psModules.imcombine", 3, "Rejecting stamp %d (%d,%d)\n", i, 958 (int)(stamp->x + 0.5), (int)(stamp->y + 0.5)); 959 numRejected++; 960 for (int y = stamp->y - footprint; y <= stamp->y + footprint; y++) { 961 for (int x = stamp->x - footprint; x <= stamp->x + footprint; x++) { 962 subMask->data.PS_TYPE_MASK_DATA[y][x] |= PM_SUBTRACTION_MASK_REJ; 967 if (stamp->status == PM_SUBTRACTION_STAMP_USED) { 968 if (deviations->data.F32[i] > limit) { 969 // Mask out the stamp in the image so you it's not found again 970 psTrace("psModules.imcombine", 3, "Rejecting stamp %d (%d,%d)\n", i, 971 (int)(stamp->x + 0.5), (int)(stamp->y + 0.5)); 972 numRejected++; 973 for (int y = stamp->y - footprint; y <= stamp->y + footprint; y++) { 974 for (int x = stamp->x - footprint; x <= stamp->x + footprint; x++) { 975 subMask->data.PS_TYPE_MASK_DATA[y][x] |= PM_SUBTRACTION_MASK_REJ; 976 } 963 977 } 964 } 965 966 // Set stamp for replacement 967 stamp->x = 0; 968 stamp->y = 0; 969 stamp->status = PM_SUBTRACTION_STAMP_REJECTED; 970 // Recalculate convolutions 971 psFree(stamp->convolutions); 972 stamp->convolutions = NULL; 973 } 974 } 978 979 // Set stamp for replacement 980 stamp->x = 0; 981 stamp->y = 0; 982 stamp->status = PM_SUBTRACTION_STAMP_REJECTED; 983 // Recalculate convolutions 984 psFree(stamp->convolutions); 985 stamp->convolutions = NULL; 986 } else { 987 numGood++; 988 newSquareDev += PS_SQR(deviations->data.F32[i]); 989 } 990 } 991 } 992 993 psLogMsg("psModules.imcombine", PS_LOG_INFO, "%d good stamps; %d rejected.\nRMS deviation: %f --> %f\n", 994 numGood, numRejected, sqrt(totalSquareDev / numStamps), sqrt(newSquareDev / numGood)); 975 995 976 996 psFree(deviations); -
branches/eam_branch_20071023/psModules/src/imcombine/pmSubtractionKernels.c
r15247 r15399 495 495 int fibIndex = 1, fibIndexMinus1 = 0; // Fibonnacci parameters 496 496 int radius = inner; 497 while (radius < size) {497 while (radius + fibIndex < size) { 498 498 radius++; 499 499 int fibNew = fibIndex + fibIndexMinus1; … … 502 502 radius += fibIndex; 503 503 fibNum++; 504 printf("%d ", radius); 505 } 506 printf("\n"); 504 } 507 505 } 508 506 -
branches/eam_branch_20071023/psModules/src/psmodules.h
r14977 r15399 106 106 #include <pmSourcePhotometry.h> 107 107 108 // The following headers are from random locations, here because they cross bounds 109 #include <pmReadoutFake.h> 110 108 111 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
