IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 16, 2006, 11:48:37 PM (20 years ago)
Author:
eugene
Message:

fixed mask length, error checks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroLuminosityFunction.c

    r9731 r10787  
    6868  // exclude bins with no stars
    6969  // exclude points after the peak with N < 0.8*peak
     70  FILE *f = fopen ("psastro.dat", "w");
    7071  int n = 0;
    7172  for (int i = 0; i < nMags->n; i++) {
     
    7475    lnMag->data.F32[n] = log10 (nMags->data.F32[i]);
    7576    Mag->data.F32[n] = mMin + (i + 0.5)*dMag;
     77    fprintf (f, "%d  %f %.0f %f\n", n, Mag->data.F32[n], nMags->data.F32[i], lnMag->data.F32[n]);
    7678    n++;
    7779  }
     80  fclose (f);
    7881  lnMag->n = n;
    7982  Mag->n = n;
    8083  psLogMsg ("psastro", 4, "fitting %d points to luminosity function\n", n);
    8184
    82   psVector *mask = psVectorAlloc (nBin, PS_TYPE_MASK);
     85  psVector *mask = psVectorAlloc (Mag->n, PS_TYPE_MASK);
    8386  psVectorInit (mask, 0);
    8487
     
    8891  stats->clipIter = 3;
    8992
    90   line = psVectorClipFitPolynomial1D(line, stats, mask, 0xff, lnMag, NULL, Mag);
     93  if (!psVectorClipFitPolynomial1D(line, stats, mask, 0xff, lnMag, NULL, Mag)) {
     94      psError(PS_ERR_UNKNOWN, false, "Failed the fit the luminosity function\n");
     95      return(NULL);
     96  }
    9197
    9298  // find min and max unmasked magnitudes
Note: See TracChangeset for help on using the changeset viewer.