|
11 | 11 | ModelDefinitionError) |
12 | 12 | from .parameters import Parameter, InputParameterError |
13 | 13 | from .utils import ellipse_extent |
14 | | -from ..stats.funcs import gaussian_sigma_to_fwhm |
15 | 14 | from .. import units as u |
16 | 15 | from ..units import Quantity, UnitsError |
17 | 16 |
|
|
25 | 24 | TWOPI = 2 * np.pi |
26 | 25 | FLOAT_EPSILON = float(np.finfo(np.float32).tiny) |
27 | 26 |
|
| 27 | +# Note that we define this here rather than using the value defined in |
| 28 | +# astropy.stats to avoid importing astropy.stats every time astropy.modeling |
| 29 | +# is loaded. |
| 30 | +GAUSSIAN_SIGMA_TO_FWHM = 2.0 * np.sqrt(2.0 * np.log(2.0)) |
| 31 | + |
28 | 32 |
|
29 | 33 | class Gaussian1D(Fittable1DModel): |
30 | 34 | """ |
@@ -150,7 +154,7 @@ def bounding_box(self, factor=5.5): |
150 | 154 | @property |
151 | 155 | def fwhm(self): |
152 | 156 | """Gaussian full width at half maximum.""" |
153 | | - return self.stddev * gaussian_sigma_to_fwhm |
| 157 | + return self.stddev * GAUSSIAN_SIGMA_TO_FWHM |
154 | 158 |
|
155 | 159 | @staticmethod |
156 | 160 | def evaluate(x, amplitude, mean, stddev): |
@@ -314,12 +318,12 @@ def __init__(self, amplitude=amplitude.default, x_mean=x_mean.default, |
314 | 318 | @property |
315 | 319 | def x_fwhm(self): |
316 | 320 | """Gaussian full width at half maximum in X.""" |
317 | | - return self.x_stddev * gaussian_sigma_to_fwhm |
| 321 | + return self.x_stddev * GAUSSIAN_SIGMA_TO_FWHM |
318 | 322 |
|
319 | 323 | @property |
320 | 324 | def y_fwhm(self): |
321 | 325 | """Gaussian full width at half maximum in Y.""" |
322 | | - return self.y_stddev * gaussian_sigma_to_fwhm |
| 326 | + return self.y_stddev * GAUSSIAN_SIGMA_TO_FWHM |
323 | 327 |
|
324 | 328 | def bounding_box(self, factor=5.5): |
325 | 329 | """ |
|
0 commit comments