IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 16, 2006, 3:50:43 PM (20 years ago)
Author:
magnier
Message:

updates from day when MHPCC CVS was down

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmSubtractBias.c

    r7445 r7589  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-06-08 22:14:28 $
     13 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-06-17 01:50:43 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    106106    psImage *subImage = sub->image;     // The image to be subtracted
    107107    psImage *subMask  = sub->mask;      // The mask for the subtraction image
     108
     109    int xIpar = psMetadataLookupS32(NULL, in->parent->concepts, "CELL.XPARITY");
     110    int xSpar = psMetadataLookupS32(NULL, sub->parent->concepts, "CELL.XPARITY");
     111    if (xIpar != xSpar) {
     112        psError(PS_ERR_UNKNOWN, true, "images for subtraction do not have the same "
     113                "CELL.XPARITY (%d vs %d).\n    pmSubtractBias must be upgraded to handle this situation\n",
     114                xIpar, xSpar);
     115        return false;
     116    }
     117
     118    int yIpar = psMetadataLookupS32(NULL, in->parent->concepts, "CELL.YPARITY");
     119    int ySpar = psMetadataLookupS32(NULL, sub->parent->concepts, "CELL.YPARITY");
     120    if (yIpar != ySpar) {
     121        psError(PS_ERR_UNKNOWN, true, "images for subtraction do not have the same "
     122                "CELL.YPARITY (%d vs %d).\n    pmSubtractBias must be upgraded to handle this situation\n",
     123                xIpar, xSpar);
     124        return false;
     125    }
    108126
    109127    // Offsets of the cells
     
    293311XXX: The SDRS does not specify type support.  F32 is implemented here.
    294312 *****************************************************************************/
    295 pmReadout *pmSubtractBias(pmReadout *in, pmOverscanOptions *overscanOpts,
    296                           const pmReadout *bias, const pmReadout *dark)
     313bool pmSubtractBias(pmReadout *in, pmOverscanOptions *overscanOpts,
     314                    const pmReadout *bias, const pmReadout *dark)
    297315{
    298316    psTrace(".psModule.pmSubtracBias.pmSubtractBias", 4,
     
    319337                overscanOpts->fitType != PM_FIT_POLY_CHEBY && overscanOpts->fitType != PM_FIT_SPLINE) {
    320338            psError(PS_ERR_UNKNOWN, true, "Invalid fit type (%d).  Returning original image.\n", overscanOpts->fitType);
    321             return(in);
     339            return false;
    322340        }
    323341
     
    349367            if (! p_psGetStatValue(myStats, &reduced)) {
    350368                psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine result from requested statistical operation.  Returning input image.\n");
    351                 return(in);
     369                return false;
    352370            }
    353371            (void)psBinaryOp(image, image, "-", psScalarAlloc((float)reduced, PS_TYPE_F32));
     
    391409                psFree(pixels);
    392410                if (! reduced) {
    393                     return in;
     411                    return false;
    394412                }
    395413
     
    435453                psFree(pixels);
    436454                if (! reduced) {
    437                     return in;
     455                    return false;
    438456                }
    439457
     
    452470    // Bias frame subtraction
    453471    if (bias) {
    454         SubtractFrame(in, bias, 1.0);
     472        if (!SubtractFrame(in, bias, 1.0))
     473            return false;
    455474    }
    456475
     
    459478        float inTime = psMetadataLookupF32(NULL, in->parent->concepts, "CELL.DARKTIME");
    460479        float darkTime = psMetadataLookupF32(NULL, dark->parent->concepts, "CELL.DARKTIME");
    461         SubtractFrame(in, dark, inTime/darkTime);
    462     }
    463 
    464     return in;
    465 }
    466 
    467 
     480        if (!SubtractFrame(in, dark, inTime/darkTime))
     481            return false;
     482    }
     483
     484    return true;
     485}
     486
     487
Note: See TracChangeset for help on using the changeset viewer.