IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17626


Ignore:
Timestamp:
May 9, 2008, 5:03:50 PM (18 years ago)
Author:
Paul Price
Message:

Attempting to kick out an input if we have trouble convolving it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackLoop.c

    r17625 r17626  
    307307    psArray *subRegions = psArrayAlloc(num); // Subtraction regions --- required in the stacking
    308308    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator
     309    int numGood = 0;                    // Number of good frames
    309310    for (int i = 0; i < num; i++) {
    310311        psTrace("ppStack", 2, "Convolving input %d of %d to target PSF....\n", i, num);
     
    326327        psArray *regions = NULL, *kernels = NULL; // Regions and kernels used in subtraction
    327328        if (!ppStackMatch(readout, &regions, &kernels, sources, targetPSF, rng, config)) {
    328             psError(PS_ERR_UNKNOWN, false, "Unable to match image %d --- ignoring.", i);
    329             psFree(sources);
    330             psFree(targetPSF);
    331             psFree(rng);
    332             return false;
     329            psErrorStackPrint(stderr, "Unable to match image %d --- ignoring.", i);
     330            psErrorClear();
     331            continue;
    333332        }
    334333
     
    345344        cells->data[i] = psMemIncrRefCounter(readout->parent);
    346345        filesIterateUp(config);
     346        numGood++;
    347347    }
    348348    psFree(sources);
    349349    psFree(targetPSF);
    350350    psFree(rng);
     351
     352    if (numGood == 0) {
     353        psError(PS_ERR_UNKNOWN, false, "No good images to combine.");
     354        return false;
     355    }
    351356
    352357
     
    374379        for (int i = 0; i < num; i++) {
    375380            pmCell *cell = cells->data[i]; // Cell of interest
     381            if (!cell) {
     382                // Bad image
     383                continue;
     384            }
    376385            pmReadout *ro = cell->readouts->data[0]; // Readout of interest
    377386            if (!ro) {
     
    387396        psArray *weightFits = psArrayAlloc(num);
    388397        for (int i = 0; i < num; i++) {
     398            if (!readouts->data[i]) {
     399                // Bad image
     400                continue;
     401            }
    389402            // Resolved names
    390403            psString imageResolved = pmConfigConvertFilename(imageNames->data[i], config, false);
     
    412425            for (int i = 0; i < num; i++) {
    413426                pmReadout *readout = readouts->data[i];
    414                 assert(readout);
     427                if (!readout) {
     428                    // Bad image
     429                    continue;
     430                }
    415431
    416432                if (!pmReadoutReadChunk(readout, imageFits->data[i], 0, numScans, overlap) ||
     
    447463            for (int i = 0; i < num && more; i++) {
    448464                pmReadout *readout = readouts->data[i];
    449                 assert(readout);
     465                if (!readout) {
     466                    // Bad image
     467                    continue;
     468                }
    450469                more &= pmReadoutMore(readout, imageFits->data[i], 0, numScans);
    451470                more &= pmReadoutMoreMask(readout, maskFits->data[i], 0, numScans);
     
    460479        for (int i = 0; i < num; i++) {
    461480            pmReadout *ro = readouts->data[i]; // Readout of interest
     481            if (!readout) {
     482                // Bad image
     483                numRejected++;
     484                continue;
     485            }
    462486            psPixels *inspect = NULL;   // Inspection list for this readout
    463487            psMetadataIterator *iter = psMetadataIteratorAlloc(ro->analysis, PS_LIST_HEAD,
     
    575599        // Close up
    576600        for (int i = 0; i < num; i++) {
     601            if (!readouts->data[i]) {
     602                continue;
     603            }
    577604            psFitsClose(imageFits->data[i]);
    578605            psFitsClose(maskFits->data[i]);
Note: See TracChangeset for help on using the changeset viewer.