Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test2(self):
particles=new_plummer_model(10000)
instance = Agama(type="Multipole", particles=particles)
result=instance.get_potential_at_point(
0.|generic_unit_system.length,
0.|generic_unit_system.length,
0.|generic_unit_system.length,
0.|generic_unit_system.length)
self.assertLess(abs(result/(-16./3/3.1416|
generic_unit_system.length**2/generic_unit_system.time**2) - 1), 0.04)
scaleM=1234|units.MSun
scaleR=5.6 |units.parsec
converter=nbody_system.nbody_to_si(scaleM,scaleR)
particles=new_plummer_model(20000, convert_nbody=converter)
instance = Agama(converter, type="Multipole", particles=particles)
x=3.|units.parsec
y=4.|units.parsec
def test2(self):
particles=new_plummer_model(10000)
instance = Agama(type="Multipole", particles=particles)
result=instance.get_potential_at_point(
0.|generic_unit_system.length,
0.|generic_unit_system.length,
0.|generic_unit_system.length,
0.|generic_unit_system.length)
self.assertLess(abs(result/(-16./3/3.1416|
generic_unit_system.length**2/generic_unit_system.time**2) - 1), 0.04)
scaleM=1234|units.MSun
scaleR=5.6 |units.parsec
converter=nbody_system.nbody_to_si(scaleM,scaleR)
particles=new_plummer_model(20000, convert_nbody=converter)
instance = Agama(converter, type="Multipole", particles=particles)
x=3.|units.parsec
y=4.|units.parsec
z=5.|units.parsec
r=(x*x+y*y+z*z)**0.5
result=instance.get_gravity_at_point(0|units.parsec, x, y, z)
expected=-constants.G*scaleM/(r*r+(3*3.1416/16*scaleR)**2)**1.5*x
self.assertLess(abs(result[0]/expected-1), 0.03)
self.assertLess(abs(result[2]/result[0]-z/x), 0.03)
instance.stop()