handybeam.visualize

Todo

This entire module is to be moved out of handybeam-core into a separate project.

Warning

Consider this module deprecated!

handybeam.visualise.plot_1D_pressure_vs_angle(world=None, angles=None, pressure=None, figsize=(4, 3), dpi=150, filename=None)[source]
handybeam.visualise.plot_1D_pressure_vs_angle_db_normalized(world=None, angles=None, pressure=None, figsize=(4, 3), dpi=150, filename=None)[source]
handybeam.visualise.tx_array_basic(tx_array=None, filename=None, figsize=(4, 3), dpi=150, show=True)[source]

visualize the transmitter array, with dots where elements are located.

Parameters:
  • tx_array (handybeam.tx_array.TxArray) – reference to the array descriptor to visualize.
  • filename – if set, save the figure contents to a file using plt.savefig(filename). If unset, do nothing.
  • figsize – figure size for the plt.figure(figsize=xxx) command.
  • dpi – resolution for the plt.figure(dpi=xxx) command.
  • show – if True, call plt.show(). If false, do not do that and return the handle to plt.figure() object instead. Default: True
Returns:

handle to the plt.figure object if show==False. Nothing otherwise.

handybeam.visualise.visualise_3D(world=None, sampler=None, threshold=50, colour_map='cubehelix')[source]

show a 3D volume visualisation using VisPy

:param world : handybeam.world.World
the world from which to take the data
Parameters:
  • sampler – handybeam.samplers.abstract_sampler the sampler from which to take the data
  • threshold – threshold of visibility for volume visualisation
  • colour_map – colour map for volume visualisation
Returns:

creates the figure, and shows it.

handybeam.visualise.visualise_all_in_one(world=None, sampler=None, filename=None, figsize=(16, 9), dpi=80)[source]

visualises the amplitude and phase of the pressure field and the transducers.

Parameters:
  • world (handybeam.world.World) – An instance of the handybeam.world class.
  • sampler (handybeam.sampler) – An instance of one of the handybeam sampler classes.
  • filename (string) – This string indicates the location in which the visualisation image should be stored.
  • figsize (tuple) – This tuple sets the size of the figure used to display the visualisation image.
  • dpi (int) – This int sets the resolution of the visualisation image.
handybeam.visualise.visualise_flat_tx_array(world=None, filename=None, figsize=[15, 10], dpi=150)[source]

Create a figure with plot of the location of the array’s elements.

Warning

This is Sal’s method – do not use for Jurek’s scripts, as it might be incompatible.

Warning

Depreciated. Use handybeam.visualize.tx_array_basic() instead.

Parameters:
  • world (handybeam_core.world) – An instance of the handybeam.world class.
  • filename (string) – This string indicates the location in which the visualisation image should be stored.
  • figsize (tuple) – This tuple sets the size of the figure used to display the visualisation image.
  • dpi (int) – This int sets the resolution of the visualisation image.
handybeam.visualise.visualise_sampling_grid(sampler=None, filename=None, figsize=[15, 10], dpi=150)[source]

This method visualises the location of the transducers.

Parameters:
  • world (handybeam_core.world) – An instance of the handybeam.world class.
  • sampler (handybeam.sampler) – An instance of one of the handybeam sampler classes.
  • filename (string) – This string indicates the location in which the visualisation image should be stored.
  • figsize (tuple) – This tuple sets the size of the figure used to display the visualisation image.
  • dpi (int) – This int sets the resolution of the visualisation image.
handybeam.visualise.visualise_sampling_grid_and_array(world=None, sampler=None, filename=None, figsize=(4, 3), dpi=150)[source]

visualises the location of the sampling grid points and the transducers.

Parameters:
  • world (handybeam_core.world) – An instance of the handybeam.world class.
  • sampler (handybeam.sampler) – An instance of one of the handybeam sampler classes.
  • filename (string) – This string indicates the location in which the visualisation image should be stored.
  • figsize (tuple) – This tuple sets the size of the figure used to display the visualisation image.
  • dpi (int) – This int sets the resolution of the visualisation image.
handybeam.visualise.visualise_translation(world=None, original_pressure_field=None, sampler=None, filename=None, figsize=(15, 10), dpi=150)[source]

This method visualises the effect of the (x-y) translation algorithm on the amplitude and phase of the acoustic field.

Parameters:
  • world (handybeam_core.world) – An instance of the handybeam.world class.
  • original_pressure_field (numpy array) – A numpy array containing the propagated acoustic pressure field.
  • sampler (handybeam.sampler) – An instance of one of the handybeam sampler classes.
  • filename (string) – This string indicates the location in which the visualisation image should be stored.
  • figsize (tuple) – This tuple sets the size of the figure used to display the visualisation image.
  • dpi (int) – This int sets the resolution of the visualisation image.
handybeam.visualise.visualise_translation_3D(world=None, original_pressure_field=None, sampler=None, threshold=50, colour_map='cubehelix')[source]

This method visualises the effect of the (x-y) translation algorithm on the amplitude and phase of the acoustic field.

Parameters:
  • world (handybeam_core.world) – An instance of the handybeam.world class.
  • original_pressure_field (numpy array) – A numpy array containing the propagated acoustic pressure field.
  • sampler (handybeam.sampler) – An instance of one of the handybeam sampler classes.
  • filename (string) – This string indicates the location in which the visualisation image should be stored.
  • threshold (float / int) – This sets the threshold for which sampling points are visualised in the image. It can be modified to ignore regions with pressure less than the threshold.
  • colour_map (string) – This sets the colour map to be used in the visualisation. Please see https://github.com/vispy/vispy/blob/master/vispy/color/colormap.py#L348-L441.
handybeam.visualise.visualize_3D_only(world=None, samplers=(), alpha=0.01, filename=None, figsize=(4, 3), dpi=150)[source]

visualizes location of the probe, phase on the probe, and any compatible samplers, in a single figure

Parameters:
  • world (handybeam.world.World) – An instance of the handybeam.world class.
  • samplers (world.samplers.abstract_sampler) – list of samplers to include. Note that this has to be a list. If set to None, samplers are loaded from the world.
  • filename (string) – if set, image is saved to the file named. Do not forget to add the extension, e.g. .png
  • figsize (tuple) – size of the figure in inches
  • dpi (integer) – resolution of the figure, in points per inch
handybeam.visualise.visualize_3D_only_alpha(world=None, samplers=(), filename=None, figsize=(4, 3), dpi=150, transparent_threshold=0.1, opaque_threshold=0.2, max_display_points_per_axis=80)[source]

visualizes location of the probe, phase on the probe, and any compatible samplers, in a single figure

Examples:

_images/example_visualize_3D_only_alpha_01.png _images/example_visualize_3D_only_alpha_02.png
Parameters:
  • world (handybeam.world.World) – An instance of the handybeam.world class.
  • samplers (world.samplers.abstract_sampler) – list of samplers to include. Note that this has to be a list. If set to None, samplers are loaded from the world.
  • filename (string) – if set, image is saved to the file named. Do not forget to add the extension, e.g. .png
  • figsize (tuple) – size of the figure in inches
  • dpi (integer) – resolution of the figure, in points per inch
  • transparent_threshold (float) – value of 0-1, or beyond - (after-normalization) pressure values below this threshould will be transparent. Use values less then zero to make zero-pressure somewhat opaque
  • opaque_threshold (float) – value of 0-1, or beyond - (after-normalization) pressure values above this threshould will be opaque. Values in between transparent* and opaque* are interpolated for varied alpha. Use values of more than unity to make the peak-pressure somewhat transparent

Back to Index

Licence (documentation): Creative Commons CC BY-NC-SA 4.0

Licence (source code): Apache 2.0

EU logo

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 737087.