ABOUT
UNSIOTOOLS contains a collection of unsio based programs and depends of the Nemo package.
You have access to falcON algorithm to compute density and gravity.
Installing python wrapper
pip install python-unsiotools -U
To get some docstring help
# Help on falcON class
pydoc unsiotools.simulations.cfalcon
Usage
- In the example below, we load a RAMSES simulation, and compute density and gravity on HALO particles
import unsio.input as uns_in
import unsiotools.simulations.cfalcon as falcon
myfile="/home/jcl/output_00004"
my_in=uns_in.CUNS_IN(myfile,"halo")
if my_in.nextFrame():
status,pos=my_in.getData("halo","pos")
status,mass=my_in.getData("halo","mass")
status,timex=my_in.getData("time")
cf=falcon.CFalcon()
ok,rho,hsml=cf.getDensity(pos,mass)
print("Rho=",rho)
eps=0.05
ok,acc,phi=cf.getGravity(pos,mass,eps)
print (ok,acc,phi)
- In this more simple example, we compute density and gravity on random data. Note that data must be in float32 format
import unsiotools.simulations.cfalcon as falcon
import numpy as np
pos=np.float32(np.random.random_sample((300,)))
mass=np.float32(np.random.random_sample((100,)))
cf=falcon.CFalcon()
ok,rho,hsml=cf.getDensity(pos,mass)
print(f"ok={ok}\nrho={rho}")
eps=0.05
ok,acc,phi=cf.getGravity(pos,mass,eps)
print (f"ok={ok}\nacc={acc}\nphi={phi}")
Licence
UNSIOTOOLS is open source and released under the terms of the CeCILL2 Licence
Webpage
PLease visit :
Copyright
Copyright Jean-Charles LAMBERT
Jean-Charles.Lambert_at_lam.fr