Skip to main content

Python wrapper to unsiotools

Project description

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  # unsio reading module
import unsiotools.simulations.cfalcon as falcon

myfile="/home/jcl/output_00004" # input RAMSES simulation
# we instantiate a CUNS_IN object
my_in=uns_in.CUNS_IN(myfile,"halo") # We select components HALO
#
# Reading
#
if my_in.nextFrame(): # load snapshot
  # read halo positions
  status,pos=my_in.getData("halo","pos")
  # read halo mass
  status,mass=my_in.getData("halo","mass")
  # read time simulation
  status,timex=my_in.getData("time")

# compute density
cf=falcon.CFalcon()
ok,rho,hsml=cf.getDensity(pos,mass)
print("Rho=",rho)

# compute gravity
eps=0.05 # softening
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()
# density
ok,rho,hsml=cf.getDensity(pos,mass)
print(f"ok={ok}\nrho={rho}")
# gravity
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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-unsiotools-1.0.1rc2.tar.gz (81.9 kB view hashes)

Uploaded Source

Built Distributions

python_unsiotools-1.0.1rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

python_unsiotools-1.0.1rc2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

python_unsiotools-1.0.1rc2-cp310-cp310-macosx_10_9_x86_64.whl (6.0 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

python_unsiotools-1.0.1rc2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

python_unsiotools-1.0.1rc2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (8.9 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

python_unsiotools-1.0.1rc2-cp39-cp39-macosx_10_9_x86_64.whl (6.0 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

python_unsiotools-1.0.1rc2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

python_unsiotools-1.0.1rc2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (8.9 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

python_unsiotools-1.0.1rc2-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

python_unsiotools-1.0.1rc2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

python_unsiotools-1.0.1rc2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (8.8 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

python_unsiotools-1.0.1rc2-cp37-cp37m-macosx_10_9_x86_64.whl (4.7 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

python_unsiotools-1.0.1rc2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

python_unsiotools-1.0.1rc2-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (8.8 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

python_unsiotools-1.0.1rc2-cp36-cp36m-macosx_10_9_x86_64.whl (4.7 MB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page