Skip to content

Commit

Permalink
Add test of IsothermalDiskPotential's amplitude for issue #400
Browse files Browse the repository at this point in the history
  • Loading branch information
jobovy committed Oct 28, 2019
1 parent 0bc185b commit bfa34da
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_potential.py
Original file line number Diff line number Diff line change
Expand Up @@ -3281,6 +3281,18 @@ def test_add_potentials_error():
3+pot
return None

# Test that the amplitude of the isothermal disk potential is set correctly (issue #400)
def test_isodisk_amplitude_issue400():
# Morgan's example
z= numpy.linspace(-0.1,0.1,10001)
pot= potential.IsothermalDiskPotential(amp=0.1,sigma=20.5/220.)
# Density at z=0 should be 0.1, no density or 2nd deriv for 1D at this
# point, so manually compute
z= numpy.linspace(-2e-4,2e-4,5)
dens_at_0= 1./(numpy.pi*4)*numpy.gradient(numpy.gradient(pot(z),z),z)[2]
assert numpy.fabs(dens_at_0-0.1) < 1e-7, 'Density at z=0 for IsothermalDiskPotential is not correct'
return None

def test_plotting():
import tempfile
#Some tests of the plotting routines, to make sure they don't fail
Expand Down

0 comments on commit bfa34da

Please sign in to comment.