IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 21, 2021, 1:50:09 PM (5 years ago)
Author:
eugene
Message:

add min iterations; skip nan pixels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20211108/Ohana/src/opihi/cmd.astro/imfit.c

    r41916 r41962  
    1818    Insert = TRUE;
    1919    if (Save) { gprint (GP_ERR, "-save and -insert are mutually exclusive\n"); free (Save); return (FALSE); }
     20  }
     21
     22  int minIter = 5;
     23  if ((N = get_argument (argc, argv, "-min-iter"))) {
     24    remove_argument (N, &argc, argv);
     25    minIter = atoi (argv[N]);
     26    remove_argument (N, &argc, argv);
    2027  }
    2128
     
    131138      if (i + sx < 0) continue;
    132139      if (i + sx >= Nx) continue;
    133       if (*V > SatThreshold) goto next;
     140      if (*V > SatThreshold) goto next; // skip pixels above threshold
     141      if (!isfinite(*V)) goto next; // skip nan pixels
    134142      dz[N] = (SQ(RDnoise) + MAX(0.0, *V/Gain)); // treat negative pixels as pure read noise
    135143      if (dz[N] <= 0) goto next;
     
    154162
    155163  // keep iterating if chisq is increasing or
    156   for (Niter = 0; (Niter < 25) && ((dchisq <= 0.0) || (dchisq > 0.1*(Npts - Npar))); Niter++) {
     164  for (Niter = 0; (Niter < 25) && ((Niter < minIter) || ((dchisq <= 0.0) || (dchisq > 0.1*(Npts - Npar)))); Niter++) {
    157165    chisq = mrq2dmin (x, y, z, dz, Npts, par, Npar, fitfunc, VERBOSE);
    158166    dchisq = ochisq - chisq;
Note: See TracChangeset for help on using the changeset viewer.