IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15399


Ignore:
Timestamp:
Oct 28, 2007, 3:40:54 PM (19 years ago)
Author:
eugene
Message:

merging diffs from cvs head

Location:
branches/eam_branch_20071023/psModules/src
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20071023/psModules/src/camera/Makefile.am

    r13898 r15399  
    2727        pmFPAExtent.c \
    2828        pmCellSquish.c \
    29         pmReadoutStack.c
     29        pmReadoutStack.c \
     30        pmReadoutFake.c
    3031
    3132pkginclude_HEADERS = \
     
    5354        pmFPAExtent.h \
    5455        pmCellSquish.h \
    55         pmReadoutStack.h
     56        pmReadoutStack.h \
     57        pmReadoutFake.h
    5658
    5759CLEANFILES = *~
  • branches/eam_branch_20071023/psModules/src/concepts/pmConceptsAverage.c

    r14468 r15399  
    9797    int xBin = 0, yBin = 0;             // Binning
    9898    int x0 = 0, y0 = 0;                 // Offset
     99    int xParity = 0, yParity = 0;       // Parity
    99100
    100101    int nCells = 0;                     // Number of cells;
     
    121122            if (same) {
    122123                // 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");
    125128            }
    126129        } else {
     
    154157                    psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Differing CELL.Y0 in use: %d vs %d\n",
    155158                            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"));
    156169                    success = false;
    157170                }
     
    189202        MD_UPDATE(target->concepts, "CELL.X0", S32, x0);
    190203        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);
    191206    }
    192207
  • branches/eam_branch_20071023/psModules/src/concepts/pmConceptsAverage.h

    r14466 r15399  
    44 * @author Paul Price, IfA
    55 *
    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 $
    88 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    99 */
     
    4242/// - CELL.TIMESYS
    4343/// - CELL.X0, CELL.Y0
     44/// - CELL.XPARITY, CELL.YPARITY
    4445/// And for others, it takes the "worst" possible value:
    4546/// - CELL.SATURATION
     
    4748/// These concepts are only handled if the cells are all the same cell (mosaicking vs stacking):
    4849/// - CELL.X0, CELL.Y0
     50/// - CELL.XPARITY, CELL.YPARITY
    4951bool pmConceptsAverageCells(pmCell *target,///< Target cell
    5052                            psList *sources, ///< List of source cells
  • branches/eam_branch_20071023/psModules/src/config/pmConfig.c

    r15252 r15399  
    3737#define PS_DEFAULT_SITE ".ipprc"  // Default site config file
    3838
     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
    3942static bool readCameraConfig = true;    // Read the camera config on startup (with pmConfigRead)?
    4043static psArray *configPath = NULL;      // Search path for configuration files
     
    5962    psFree(config->arguments);
    6063    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;
    6174}
    6275
     
    7992    config->defaultRecipe = NULL;
    8093
     94    config->traceFD = DEFAULT_TRACE;
     95    config->logFD = DEFAULT_LOG;
     96
    8197    // the file structure is used to carry pmFPAfiles
    8298    config->files = psMetadataAlloc ();
     
    124140}
    125141
     142
    126143void pmConfigSet(const char *path)
    127144{
     
    144161    psFree(configPath);
    145162    configPath = NULL;
     163
     164    return;
    146165}
    147166
     
    379398        psArgumentRemove(argNum, argc, argv);
    380399        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");
    383401        } else {
    384402            siteName = psStringCopy(argv[argNum]);
     
    446464
    447465        argNum = psArgumentGet(*argc, argv, "-log");
    448         if (argNum > 0)
    449         {
     466        if (argNum > 0) {
    450467            psArgumentRemove(argNum, argc, argv);
    451468            if (argNum >= *argc) {
    452                 psLogMsg("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");
    454471            } 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]);
    459473                psArgumentRemove(argNum, argc, argv);
    460474            }
    461         } else
    462         {
     475        } else {
    463476            // Set logging destination
    464477            psString logDest = psMetadataLookupStr(&mdok, config->site, "LOGDEST");
    465478            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);
    473484        }
    474485
    475486        // Set trace levels
    476487        psMetadata *trace = psMetadataLookupMetadata(&mdok, config->site, "TRACE");
    477         if (mdok && trace)
    478         {
     488        if (mdok && trace) {
    479489            psMetadataIterator *traceIter = psMetadataIteratorAlloc(trace, PS_LIST_HEAD, NULL); // Iterator
    480490            psMetadataItem *traceItem = NULL; // Item from MD iteration
    481491            while ((traceItem = psMetadataGetAndIncrement(traceIter))) {
    482492                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",
    485494                             traceItem->name, traceItem->type);
    486495                    continue;
    487496                }
    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);
    489499                (void)psTraceSetLevel(traceItem->name, traceItem->data.S32);
    490500            }
     
    494504        // Set trace formats
    495505        psString traceFormat = psMetadataLookupStr(&mdok, config->site, "TRACEFORMAT");
    496         if (mdok && traceFormat)
    497         {
     506        if (mdok && traceFormat) {
    498507            psTrace("psModules.config", 7, "Setting trace format to %s\n", traceFormat);
    499508            (void)psTraceSetFormat(traceFormat);
     
    502511        // Set trace destinations
    503512        #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);
    514532        }
    515533        #endif
     
    741759        psArgumentRemove(argNum, argc, argv);
    742760        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 --- ");
    745762        } else {
    746763            char *dbserver = argv[argNum]; // The camera configuration file to read
    747764            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");
    750766            }
    751767
     
    758774        psArgumentRemove(argNum, argc, argv);
    759775        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");
    762777        } else {
    763778            char *dbname = argv[argNum]; // The camera configuration file to read
    764779            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");
    767781            }
    768782
     
    775789        psArgumentRemove(argNum, argc, argv);
    776790        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");
    779792        } else {
    780793            char *dbuser = argv[argNum]; // The camera configuration file to read
    781794            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");
    784796            }
    785797
     
    792804        psArgumentRemove(argNum, argc, argv);
    793805        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");
    796807        } else {
    797808            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");
    801812            }
    802813
     
    809820        psArgumentRemove(argNum, argc, argv);
    810821        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");
    813823        } else {
    814824            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");
    818828            }
    819829
     
    963973                result = true;
    964974            } 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",
    967976                         cameraName, formatsItem->name);
    968977            }
     
    10501059    }
    10511060
     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
    10521067    if (!config->format && !config->formatName) {
    10531068        config->formatName = name;
     
    10811096
    10821097    if (!pmConfigFileRead(&camera, cameraPath, cameraName)) {
    1083         psLogMsg("psModules.config", PS_LOG_WARN, "Trouble reading reading camera configuration %s", cameraName);
     1098        psWarning("Trouble reading reading camera configuration %s", cameraName);
    10841099        psFree(camera);
    10851100        return NULL;
     
    11181133    }
    11191134    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");
    11221136        return NULL;
    11231137    }
  • branches/eam_branch_20071023/psModules/src/config/pmConfig.h

    r15217 r15399  
    55 *  @author Eugene Magnier, IfA
    66 *
    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 *
    910 *  Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    1011 */
     
    3637/// This structure stores the configuration information: the site, camera and recipe configuration, the
    3738/// command-line arguments, the pmFPAfiles used, and the database handle.
    38 typedef struct
    39 {
     39typedef struct {
    4040    psMetadata *site;                   ///< Site configuration
    4141    psMetadata *camera;                 ///< Camera specification
     
    5151    pmRecipeSource recipesRead;         ///< Which recipe sources have been read
    5252    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;
    6156
    6257/// Allocator for pmConfig
  • branches/eam_branch_20071023/psModules/src/detrend/pmShutterCorrection.c

    r15254 r15399  
    832832    for (int j = 0; j < MEASURE_SAMPLES; j++) {
    833833        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
    835840        psImage *subMask = NULL;        // Sub-image of mask
    836841        if (readout->mask) {
    837             subMask = psImageSubset(readout->mask, *region);
     842            subMask = psImageSubset(readout->mask, adjusted);
    838843        }
    839844        if (!psImageStats(stats, subImage, subMask, maskVal)) {
    840             psString regionString = psRegionToString(*region);
     845            psString regionString = psRegionToString(adjusted);
    841846            psWarning("Unable to measure sample statistics at %s in image.\n",
    842847                      regionString);
  • branches/eam_branch_20071023/psModules/src/imcombine/pmStack.c

    r14648 r15399  
    88 *  @author GLG, MHPCC
    99 *
    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 $
    1212 *
    1313 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    221221    for (int i = 0; i < num; i++) {
    222222        pmStackData *data = inputs->data[i]; // Stack data of interest
     223        if (!data) {
     224            continue;
     225        }
    223226        psImage *image = data->readout->image; // Image of interest
    224227        psImage *weight = data->readout->weight; // Weight map of interest
     
    292295                // Add the pixel as one to inspect
    293296                pmStackData *data = inputs->data[j]; // Stack data of interest
     297                if (!data) {
     298                    continue;
     299                }
    294300                data->pixels = psPixelsAdd(data->pixels, PIXEL_LIST_BUFFER, x, y);
    295301                // Mask it so it's not considered in other iterations within this function
     
    315321    *num = input->n;
    316322
    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    }
    319327    PS_ASSERT_PTR_NON_NULL(data, false);
    320328    assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type
     
    338346    for (int i = 1; i < *num; i++) {
    339347        pmStackData *data = input->data[i]; // Stack data for this input
     348        if (!data) {
     349            continue;
     350        }
    340351        assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type
    341352        if (!data->readout) {
     
    469480    for (int i = 0; i < input->n; i++) {
    470481        pmStackData *data = input->data[i];
    471         assert(data && data->pixels);
     482        if (!data) {
     483            continue;
     484        }
     485        assert(data->pixels);
    472486        psPixels *pixels = data->pixels;// The pixels of interest
    473487        for (int j = 0; j < pixels->n; j++) {
     
    544558    for (int i = 0; i < num; i++) {
    545559        pmStackData *data = input->data[i]; // Stack data for this input
     560        if (!data) {
     561            weights->data.F32[i] = 0.0;
     562        }
    546563        weights->data.F32[i] = data->weight;
    547564    }
     
    561578        for (int i = 0; i < num; i++) {
    562579            pmStackData *data = input->data[i]; // Stacking data; contains the list of pixels
     580            if (!data) {
     581                continue;
     582            }
    563583            pixels = psPixelsConcatenate(pixels, data->pixels);
    564584            data->pixels = psPixelsRealloc(data->pixels, PIXEL_LIST_BUFFER); // Just in case more rejection
     
    596616            for (int i = 0; i < num; i++) {
    597617                pmStackData *data = input->data[i]; // Stack data for this input
     618                if (!data) {
     619                    continue;
     620                }
    598621                data->pixels = psPixelsAllocEmpty(PIXEL_LIST_BUFFER);
    599622            }
     
    611634            for (int i = 0; i < num; i++) {
    612635                pmStackData *data = input->data[i]; // Stack data for this input
     636                if (!data) {
     637                    continue;
     638                }
    613639                psTrace("psModules.imcombine", 5, "Image %d: %ld pixels to inspect.\n", i, data->pixels->n);
    614640            }
  • branches/eam_branch_20071023/psModules/src/imcombine/pmSubtraction.c

    r15325 r15399  
    44 *  @author GLG, MHPCC
    55 *
    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 $
    88 *
    99 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    907907                    for (int j = 0; j < numKernels; j++) {
    908908                        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.
    909912                        double polynomial = 0.0; // Value of the polynomial
    910913                        for (int yOrder = 0, index = j; yOrder <= spatialOrder; yOrder++) {
     
    928931            deviations->data.F32[i] = devNorm * deviation;
    929932            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]);
    931934            totalSquareDev += PS_SQR(deviations->data.F32[i]);
    932935            numStamps++;
     
    947950    }
    948951
     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
    949962    float limit = sigmaRej * sqrt(totalSquareDev / numStamps); // Limit on maximum deviation
    950963    psTrace("psModules.imcombine", 1, "Deviation limit: %f\n", limit);
    951964
    952     int numRejected = 0;
    953965    for (int i = 0; i < stamps->num; i++) {
    954966        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                    }
    963977                }
    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));
    975995
    976996    psFree(deviations);
  • branches/eam_branch_20071023/psModules/src/imcombine/pmSubtractionKernels.c

    r15247 r15399  
    495495        int fibIndex = 1, fibIndexMinus1 = 0; // Fibonnacci parameters
    496496        int radius = inner;
    497         while (radius < size) {
     497        while (radius + fibIndex < size) {
    498498            radius++;
    499499            int fibNew = fibIndex + fibIndexMinus1;
     
    502502            radius += fibIndex;
    503503            fibNum++;
    504             printf("%d ", radius);
    505         }
    506         printf("\n");
     504        }
    507505    }
    508506
  • branches/eam_branch_20071023/psModules/src/psmodules.h

    r14977 r15399  
    106106#include <pmSourcePhotometry.h>
    107107
     108// The following headers are from random locations, here because they cross bounds
     109#include <pmReadoutFake.h>
     110
    108111#endif
Note: See TracChangeset for help on using the changeset viewer.