IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 23, 2007, 2:11:02 PM (19 years ago)
Author:
magnier
Message:
  • added function pointers to pmModel to provide class-dependent functions
  • dropped pmModel*_GetFunction functions (use pmModel->func functions instead)
  • added modelParamsFromPSF functions to model classes
  • changed pmModelGroup to pmModelClass
  • added pmSourceFitSet.[ch]
  • updated pmSourceFitSet to allow variable model classes
  • added functions to add/sub and eval models & sources with an offset between image and chip
  • added function to set a pmModel flux
  • added function to instatiate a pmModel from a pmPSF at a coordinate
  • moved pmPSF I/O to chip->analysis from readout->analysis
  • changed pmPSF I/O function names from *ForPSFmodel to pmPSFmodel*
  • changed pmModel.params_NEW back to pmModel.params
  • changed pmFind*Peaks to pmPeaksIn* (* = Image,Vector)
  • dropped pmCullPeaks (deprecated)
  • changed pmModelSetType to pmModelClassGetType
  • changed pmModelGetType to pmModelClassGetName
  • fixed PGAUSS implementation of modelRadius function
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmPeaks.c

    r13034 r14652  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-04-26 01:20:29 $
     8 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-08-24 00:11:02 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535                        pmPeakType type)
    3636{
    37     psTrace(__func__, 5, "---- begin ----\n");
     37    psTrace("psModules.objects", 5, "---- begin ----\n");
    3838
    3939    if (peaks == NULL) {
     
    6767    psFree (peak);
    6868
    69     psTrace(__func__, 5, "---- end ----\n");
     69    psTrace("psModules.objects", 5, "---- end ----\n");
    7070    return(peaks);
    7171}
     
    118118*****************************************************************************/
    119119static void peakFree(pmPeak *tmp)
    120 {} // used by pmIsPeak()
     120{} // used by pmPeakTest()
    121121
    122122pmPeak *pmPeakAlloc(psS32 x,
     
    145145}
    146146
    147 bool pmIsPeak(const psPtr ptr)
     147bool pmPeakTest(const psPtr ptr)
    148148{
    149149    return (psMemGetDeallocator(ptr) == (psFreeFunc)peakFree);
     
    193193
    194194/******************************************************************************
    195 pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector
     195pmPeaksInVector(vector, threshold): Find all local peaks in the given vector
    196196above the given threshold.  Returns a vector of type PS_TYPE_U32 containing
    197197the location (x value) of all peaks.
     
    203203Depending upon actual use, this may need to be optimized.
    204204*****************************************************************************/
    205 psVector *pmFindVectorPeaks(const psVector *vector,
    206                             psF32 threshold)
     205psVector *pmPeaksInVector(const psVector *vector,
     206                        psF32 threshold)
    207207{
    208208    psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     
    295295
    296296/******************************************************************************
    297 pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage
     297pmPeaksInImage(image, threshold): Find all local peaks in the given psImage
    298298above the given threshold.  Returns a psArray containing location (x/y value)
    299299of all peaks.
     
    309309
    310310*****************************************************************************/
    311 psArray *pmFindImagePeaks(const psImage *image, psF32 threshold)
     311psArray *pmPeaksInImage(const psImage *image, psF32 threshold)
    312312{
    313313    psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     
    327327    row = 0;
    328328    tmpRow = getRowVectorFromImage((psImage *) image, row);
    329     psVector *row1 = pmFindVectorPeaks(tmpRow, threshold);
    330     // pmFindVectorPeaks returns coords in the vector, not corrected for col0
     329    psVector *row1 = pmPeaksInVector(tmpRow, threshold);
     330    // pmPeaksInVector returns coords in the vector, not corrected for col0
    331331
    332332    for (psU32 i = 0 ; i < row1->n ; i++ ) {
     
    382382    for (row = 1 ; row < (image->numRows - 1) ; row++) {
    383383        tmpRow = getRowVectorFromImage((psImage *) image, row);
    384         row1 = pmFindVectorPeaks(tmpRow, threshold);
     384        row1 = pmPeaksInVector(tmpRow, threshold);
    385385
    386386        // Step through all local peaks in this row.
     
    461461    row = image->numRows - 1;
    462462    tmpRow = getRowVectorFromImage((psImage *) image, row);
    463     row1 = pmFindVectorPeaks(tmpRow, threshold);
     463    row1 = pmPeaksInVector(tmpRow, threshold);
    464464    for (psU32 i = 0 ; i < row1->n ; i++ ) {
    465465        col = row1->data.U32[i];
     
    501501}
    502502
    503 
    504 /******************************************************************************
    505 psCullPeaks(peaks, maxValue, valid): eliminate peaks from the psArray that have
    506 a peak value above the given maximum, or fall outside the valid region.
    507  
    508 XXX: Should the sky value be used when comparing the maximum?
    509  
    510 XXX: warning message if valid is NULL?
    511  
    512 XXX: changed API to create a NEW output psArray (should change name as well)
    513  
    514 XXX: Do we free the psList elements of those culled peaks?
    515  
    516 XXX EAM : do we still need pmCullPeaks, or only pmPeaksSubset?
    517 *****************************************************************************/
    518 psList *pmCullPeaks(psList *peaks,
    519                     psF32 maxValue,
    520                     const psRegion valid)
    521 {
    522     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
    523     PS_ASSERT_PTR_NON_NULL(peaks, NULL);
    524 
    525     psListElem *tmpListElem = (psListElem *) peaks->head;
    526     psS32 indexNum = 0;
    527 
    528     //    printf("pmCullPeaks(): list size is %d\n", peaks->size);
    529     while (tmpListElem != NULL) {
    530         pmPeak *tmpPeak = (pmPeak *) tmpListElem->data;
    531         if ((tmpPeak->value > maxValue) ||
    532                 (true == isItInThisRegion(valid, tmpPeak->x, tmpPeak->y))) {
    533             psListRemoveData(peaks, (psPtr) tmpPeak);
    534         }
    535 
    536         indexNum++;
    537         tmpListElem = tmpListElem->next;
    538     }
    539 
    540     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
    541     return(peaks);
    542 }
    543 
    544 // XXX EAM: I changed this to return a new, subset array
    545 //          rather than alter the existing one
    546 // XXX: Fix the *valid pointer.
     503// return a new array of peaks which are in the valid region and below threshold
     504// XXX this function is unused and probably could be dropped
    547505psArray *pmPeaksSubset(
    548506    psArray *peaks,
     
    555513    psArray *output = psArrayAllocEmpty (200);
    556514
    557     psTrace (".pmObjects.pmCullPeaks", 3, "list size is %ld\n", peaks->n);
     515    psTrace ("psModules.objects", 3, "list size is %ld\n", peaks->n);
    558516
    559517    for (int i = 0; i < peaks->n; i++) {
Note: See TracChangeset for help on using the changeset viewer.