Skip to content

Commit ea66b4e

Browse files
committed
... for real.
1 parent d31ddb8 commit ea66b4e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/egg-gennoise.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,13 @@ int phypp_main(int argc, char* argv[]) {
112112

113113
// Compute PSF FWHM
114114
double fwhm; {
115-
vec1u idok = where(psf > 0.2*max(psf));
116115
vec2d r2 = generate_img(psf.dims, [&](double ix, double iy) {
117116
return sqr(ix - hsize) + sqr(iy - hsize);
118117
});
119118

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]);
119+
vec1u idok = where(psf > 0.2*max(psf) && r2 > 0);
120+
double res = mean(log(psf[idok]/max(psf))/r2[idok]);
121+
fwhm = 2*sqrt(-log(2)/res);
127122

128123
if (verbose) note("FWHM=", fwhm, " pixels");
129124
}

0 commit comments

Comments
 (0)