IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 22, 2010, 11:45:18 AM (16 years ago)
Author:
Paul Price
Message:

Adding scaling of kernel parameters by seeing FWHMs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/ppStack/src/ppStackMatch.c

    r26543 r26671  
    316316            int optOrder = psMetadataLookupS32(&mdok, ppsub, "OPTIMUM.ORDER"); // Order for search
    317317            float poorFrac = psMetadataLookupF32(&mdok, ppsub, "POOR.FRACTION"); // Fraction for "poor"
     318
     319            bool scale = psMetadataLookupBool(NULL, recipe, "SCALE");        // Scale kernel parameters?
     320            float scaleRef = psMetadataLookupF32(NULL, recipe, "SCALE.REF"); // Reference for scaling
     321            float scaleMin = psMetadataLookupF32(NULL, recipe, "SCALE.MIN"); // Minimum for scaling
     322            float scaleMax = psMetadataLookupF32(NULL, recipe, "SCALE.MAX"); // Maximum for scaling
     323            if (!isfinite(scaleRef) || !isfinite(scaleMin) || !isfinite(scaleMax)) {
     324                psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     325                        "Scale parameters (SCALE.REF=%f, SCALE.MIN=%f, SCALE.MAX=%f) not set in recipe.",
     326                        scaleRef, scaleMin, scaleMax);
     327                return false;
     328            }
     329
    318330
    319331            // These values are specified specifically for stacking
     
    410422                }
    411423            } else {
     424                // Scale the input parameters
     425                psVector *widthsCopy = psVectorCopy(NULL, widths, PS_TYPE_F32); // Copy of kernel widths
     426                if (scale && !pmSubtractionParamsScale(&size, &footprint, widthsCopy,
     427                                                       options->inputSeeing->data.F32[index],
     428                                                       options->targetSeeing, scaleRef, scaleMin, scaleMax)) {
     429                    psError(PS_ERR_UNKNOWN, false, "Unable to scale kernel parameters");
     430                    psFree(fake);
     431                    psFree(optWidths);
     432                    psFree(stampSources);
     433                    psFree(conv);
     434                    psFree(widthsCopy);
     435                    if (threads > 0) {
     436                        pmSubtractionThreadsFinalize(readout, fake);
     437                    }
     438                    return false;
     439                }
     440
    412441                if (!pmSubtractionMatch(NULL, conv, fake, readout, footprint, stride, regionSize, spacing,
    413                                         threshold, stampSources, stampsName, type, size, order, widths,
     442                                        threshold, stampSources, stampsName, type, size, order, widthsCopy,
    414443                                        orders, inner, ringsOrder, binning, penalty,
    415444                                        optimum, optWidths, optOrder, optThresh, iter, rej, sysError, skyErr,
     
    421450                    psFree(stampSources);
    422451                    psFree(conv);
     452                    psFree(widthsCopy);
    423453                    if (threads > 0) {
    424454                        pmSubtractionThreadsFinalize(readout, fake);
     
    426456                    return false;
    427457                }
     458                                              psFree(widthsCopy);
    428459            }
    429460
Note: See TracChangeset for help on using the changeset viewer.