def guess(self, dep, *args, **kwargs): ref = guess_reference(self.rest.min, self.rest.max, *args) param_apply_limits(ref, self.rest, **kwargs) norm = guess_amplitude_at_ref(self.rest.val, dep, *args) fwhm = get_fwhm(dep, *args) c_km = 2.99792458e+5 if self.rest.val != 0: vsini = 2. * fwhm * c_km / numpy.sqrt(3.) / self.rest.val vs = {'val': vsini, 'min': vsini / _guess_ampl_scale, 'max': vsini * _guess_ampl_scale } param_apply_limits(vs, self.vsini, **kwargs) modampl = norm['val'] * numpy.pi * self.vsini.val * \ self.rest.val / 2. / c_km mod = {'val': modampl, 'min': modampl / _guess_ampl_scale, 'max': modampl * _guess_ampl_scale} param_apply_limits(mod, self.ampl, **kwargs)
def test_get_fwhm(x, y, expected): """Check the FWHM algorithm.""" ans = get_fwhm(y, x) assert ans == pytest.approx(expected)