We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d31ddb8 commit ea66b4eCopy full SHA for ea66b4e
src/egg-gennoise.cpp
@@ -112,18 +112,13 @@ int phypp_main(int argc, char* argv[]) {
112
113
// Compute PSF FWHM
114
double fwhm; {
115
- vec1u idok = where(psf > 0.2*max(psf));
116
vec2d r2 = generate_img(psf.dims, [&](double ix, double iy) {
117
return sqr(ix - hsize) + sqr(iy - hsize);
118
});
119
120
- auto res = linfit(log(psf[idok]/max(psf)), 1, r2[idok]);
121
- if (res.params[0] >= 0) {
122
- error("could not estimate FWHM of the PSF");
123
- return 1;
124
- }
125
-
126
- fwhm = 2*sqrt(-log(2)/res.params[0]);
+ vec1u idok = where(psf > 0.2*max(psf) && r2 > 0);
+ double res = mean(log(psf[idok]/max(psf))/r2[idok]);
+ fwhm = 2*sqrt(-log(2)/res);
127
128
if (verbose) note("FWHM=", fwhm, " pixels");
129
}
0 commit comments