Describes the virtual world, in which the acoustic propagation occurs.
Holds a description of things like:
Environment properties, like wave velocity, temperature, e.t.c.
- Note, over time i might extend this with pressure and temperature
The list of samplers (objects that describe how to sample the acoustic field)
The transmitter array (object that describes the Tx Array)
The propagator (object that holds the propagation engine, and compute resources)
Replace all “if print feedback” with a logging module. Time to grow up. See this tutorial
World(frequency=40000, sound_velocity=343, use_device=0, use_platform=0)¶
Root descriptor of the simulated universe
Contains what is needed to quickly serve typical use cases for HandyBeam.
world=handybeam.world.World() world.tx_array = handybeam.tx_array_library.rectilinear(parent = world) rectilinear_sampler = world.add_sampler(handybeam.samplers.rectilinear_sampler.RectilinearSampler(parent=world))
Note that OpenCL kernels are compiled with sound velocity and frequency as constants. This is for performance purposes.
Sound velocity. Set only via creating a new world.
fundamental frequency of operation for the transmitter array. Set only via creating a new world.
computed wavelength for this world. constant.
computed wavenumber for this world. constant.
the object that holds the OpenCL code for calculating (propagating) the acoustic field.
__init__(frequency=40000, sound_velocity=343, use_device=0, use_platform=0)¶
Upon creation, add an example array, initialize the propagator, and have no samplers.
the user must add a field sampler.
At one point, I tried to make it to auto-give itself a default sampler, but that resulted in circular references. Possibly I can find a workaround to that later on.
links back to __str__()
returns a short info about this world.
Helper function for
Returns: raises an error if the object’s data is not found
builds a html version of the repr. Displays some basic properties about this world instance.
Returns: Jupyter/IPython uses this
Adds a new field sampler to the world
rectilinear_sampler = world.add_sampler(handybeam.samplers.rectilinear_sampler.RectilinearSampler(parent=world))
Parameters: sampler (handybeam.samplers.*) – the sampler instance to add Returns: handle to the new sampler instance
helper method of
Returns: prints the debug data
Shortcut: Ask all the field samplers to execute it’s propagator
sampler.propagate(...)of each sampler in the samplers list
Parameters: print_performance_feedback – if set to True, will print feedback to console Returns: Nothing
Shortcut: Ask all the field samplers to execute it’s visualizer
sampler.visualize(...)for all samplers in the samplers list
Parameters: color_scale – if set, use that color scale. Usefull if you want all the plots to use a common color scale.
the tau constant. It really should get implemented into numpy.
Back to Welcome
Licence (documentation): Creative Commons CC BY-NC-SA 4.0
Licence (source code): Apache 2.0
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 737087.
This project has received funding from Ultrahaptics.