Skip to content

Commit

Permalink
ENH arrays again
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Oct 16, 2023
1 parent a1b5f82 commit e71e541
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/test_moffat.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,36 +136,36 @@ def test_moffat_properties():
cen = galsim.PositionD(0, 0)
np.testing.assert_equal(psf.centroid, cen)
# Check Fourier properties
np.testing.assert_almost_equal(psf.maxk, 11.634597424960159)
np.testing.assert_almost_equal(psf.stepk, 0.62831853071795873)
np.testing.assert_almost_equal(psf.kValue(cen), test_flux+0j)
np.testing.assert_almost_equal(psf.half_light_radius, 1.0)
np.testing.assert_almost_equal(psf.fwhm, fwhm_backwards_compatible)
np.testing.assert_almost_equal(psf.xValue(cen), 0.50654651638242509)
np.testing.assert_almost_equal(psf.kValue(cen), (1+0j) * test_flux)
np.testing.assert_almost_equal(psf.flux, test_flux)
np.testing.assert_almost_equal(psf.xValue(cen), psf.max_sb)
np.testing.assert_array_almost_equal(psf.maxk, 11.634597424960159)
np.testing.assert_array_almost_equal(psf.stepk, 0.62831853071795873)
np.testing.assert_array_almost_equal(psf.kValue(cen), test_flux+0j)
np.testing.assert_array_almost_equal(psf.half_light_radius, 1.0)
np.testing.assert_array_almost_equal(psf.fwhm, fwhm_backwards_compatible)
np.testing.assert_array_almost_equal(psf.xValue(cen), 0.50654651638242509)
np.testing.assert_array_almost_equal(psf.kValue(cen), (1+0j) * test_flux)
np.testing.assert_array_almost_equal(psf.flux, test_flux)
np.testing.assert_array_almost_equal(psf.xValue(cen), psf.max_sb)

# Now create the same profile using the half_light_radius:
psf = galsim.Moffat(beta=2.0, half_light_radius=1.,
trunc=2*fwhm_backwards_compatible, flux=test_flux)
np.testing.assert_equal(psf.centroid, cen)
np.testing.assert_almost_equal(psf.maxk, 11.634597426100862)
np.testing.assert_almost_equal(psf.stepk, 0.62831853071795862)
np.testing.assert_almost_equal(psf.kValue(cen), test_flux+0j)
np.testing.assert_almost_equal(psf.half_light_radius, 1.0)
np.testing.assert_almost_equal(psf.fwhm, fwhm_backwards_compatible)
np.testing.assert_almost_equal(psf.xValue(cen), 0.50654651638242509)
np.testing.assert_almost_equal(psf.kValue(cen), (1+0j) * test_flux)
np.testing.assert_almost_equal(psf.flux, test_flux)
np.testing.assert_almost_equal(psf.xValue(cen), psf.max_sb)
np.testing.assert_array_almost_equal(psf.maxk, 11.634597426100862)
np.testing.assert_array_almost_equal(psf.stepk, 0.62831853071795862)
np.testing.assert_array_almost_equal(psf.kValue(cen), test_flux+0j)
np.testing.assert_array_almost_equal(psf.half_light_radius, 1.0)
np.testing.assert_array_almost_equal(psf.fwhm, fwhm_backwards_compatible)
np.testing.assert_array_almost_equal(psf.xValue(cen), 0.50654651638242509)
np.testing.assert_array_almost_equal(psf.kValue(cen), (1+0j) * test_flux)
np.testing.assert_array_almost_equal(psf.flux, test_flux)
np.testing.assert_array_almost_equal(psf.xValue(cen), psf.max_sb)

# Check input flux vs output flux
for inFlux in np.logspace(-2, 2, 10):
psfFlux = galsim.Moffat(2.0, fwhm=fwhm_backwards_compatible,
trunc=2*fwhm_backwards_compatible, flux=inFlux)
outFlux = psfFlux.flux
np.testing.assert_almost_equal(outFlux, inFlux)
np.testing.assert_array_almost_equal(outFlux, inFlux)

@timer
def test_moffat_maxk():
Expand Down

0 comments on commit e71e541

Please sign in to comment.