Python包装器到unsiotools
python-unsiotools的Python项目详细描述
关于
UNSIOTOOLS包含一组基于unsio的程序,并依赖于Nemo包。 你可以使用falcON算法来计算密度和重力。在
安装python包装器
pip install python-unsiotools -U
获取docstring帮助
^{pr2}$使用
- 在下面的例子中,我们加载一个RAMSES模拟,并计算晕粒子的密度
importunsio.inputasuns_in# unsio reading moduleimportunsiotools.simulations.cfalconasfalconmyfile="/home/jcl/output_00004"# input RAMSES simulation# we instantiate a CUNS_IN objectmy_in=uns_in.CUNS_IN(myfile,"halo")# We select components HALO## Reading#ifmy_in.nextFrame():# load snapshot# read halo positionsstatus,pos=my_in.getData("halo","pos")# read halo massstatus,mass=my_in.getData("halo","mass")# read time simulationstatus,timex=my_in.getData("time")# we compute densitycf=falcon.CFalcon()ok,rho,hsml=cf.getDensity(pos,mass)print("Rho=",rho)
- 在这个更简单的例子中,我们计算随机数据的密度。注意,数据必须是float32格式
importunsiotools.simulations.cfalconasfalconimportnumpyasnppos=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(ok,rho)
许可证
UNSIOTOOLS是开源的,根据CeCILL2 Licence的条款发布
网页
请访问:
- UNSIO project home page
- UNSIO Python reading manual
- UNSIO Python writing manual
- UNSIO Pypi page
- NEMO home page
版权所有
版权所有Jean-Charles LAMBERT
Jean-兰伯特逖.fr
- 项目
标签: