Changeset 10787
- Timestamp:
- Dec 16, 2006, 11:48:37 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroLuminosityFunction.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroLuminosityFunction.c
r9731 r10787 68 68 // exclude bins with no stars 69 69 // exclude points after the peak with N < 0.8*peak 70 FILE *f = fopen ("psastro.dat", "w"); 70 71 int n = 0; 71 72 for (int i = 0; i < nMags->n; i++) { … … 74 75 lnMag->data.F32[n] = log10 (nMags->data.F32[i]); 75 76 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]); 76 78 n++; 77 79 } 80 fclose (f); 78 81 lnMag->n = n; 79 82 Mag->n = n; 80 83 psLogMsg ("psastro", 4, "fitting %d points to luminosity function\n", n); 81 84 82 psVector *mask = psVectorAlloc ( nBin, PS_TYPE_MASK);85 psVector *mask = psVectorAlloc (Mag->n, PS_TYPE_MASK); 83 86 psVectorInit (mask, 0); 84 87 … … 88 91 stats->clipIter = 3; 89 92 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 } 91 97 92 98 // find min and max unmasked magnitudes
Note:
See TracChangeset
for help on using the changeset viewer.
