Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

python-unsiotools

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

python-unsiotools

Python wrapper to unsiotools

  • 1.0.1
  • PyPI
  • Socket score

Maintainers
1

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 Jean-Charles LAMBERT
Jean-Charles.Lambert_at_lam.fr

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc