IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26125


Ignore:
Timestamp:
Nov 13, 2009, 4:54:24 AM (16 years ago)
Author:
eugene
Message:

better adjustement of order as a function of number of sources

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091113/psphot/src/psphotApResid.c

    r25755 r26125  
    217217    }
    218218
    219     // XXX set the min number of needed source more carefully
    220     if ((Npsf < 15) && (APTREND_ORDER_MAX >= 4)) APTREND_ORDER_MAX = 3;
    221     if ((Npsf < 11) && (APTREND_ORDER_MAX >= 3)) APTREND_ORDER_MAX = 2;
    222     if ((Npsf <  8) && (APTREND_ORDER_MAX >= 2)) APTREND_ORDER_MAX = 1;
     219    // this is a bit tricky, because we have two cases (MAP vs POLY), and they have a different
     220    // definition for 'order' (order_MAP = order_POLY + 1).  in addition, we have a
     221    // user-specified MAX order, which we should respect, regardless of the mode
     222
     223    // set the max order (0 = constant) which the number of psf stars can support:
     224    // rule of thumb: require 3 stars per 'cell' (order+1)^2
     225    int MaxOrderForStars = 0;
     226    if (Npsf >= 12) MaxOrderForStars = 1; // 4 cells
     227    if (Npsf >= 27) MaxOrderForStars = 2; // 9 cells
     228    if (Npsf >= 48) MaxOrderForStars = 3; // 16 cells
     229    if (Npsf >  75) MaxOrderForStars = 4; // 25 cells
     230
     231    pmTrend2DMode mode = PM_TREND_MAP;
     232    if (mode == PM_TREND_MAP) {
     233        MaxOrderForStars ++;
     234    }
     235    APTREND_ORDER_MAX = PS_MIN (APTREND_ORDER_MAX, MaxOrderForStars);
    223236
    224237    psFree (psf->ApTrend);
Note: See TracChangeset for help on using the changeset viewer.