plot_scalar_field
[source]
plot_scalar_field
(problem
:dl4to.problem.Problem
,scalar_field
:Tensor
,data
:Tensor
=None
,title
:str
=None
,file_path
:str
=None
,threshold
:float
=0.5
,display
:bool
=True
,camera_position
:Union
[tuple
,list
]=(0, 0.1, 0.12)
,show_design_space
:bool
=False
,show_colorbar
:bool
=True
,colorscale
:str
=None
,show_axislabels
:bool
=False
,show_ticklabels
:bool
=False
,export_png
:bool
=False
, **kwargs
)
Plots a three-dimensional scalar field visualization. Returns a plotly.graph_objs.FigureWidget
object.
Type | Default | Details | |
---|---|---|---|
problem |
dl4to.problem.Problem |
The problem that is referred to for plotting. | |
scalar_field |
Tensor |
The scalar field that determines the presence or absence of voxels. | |
data |
Tensor |
None |
The data that should be represented in color on the voxels. |
title |
str |
None |
The name of the plot. |
file_path |
str |
None |
Path where the figure is saved. |
threshold |
float |
0.5 |
The threshold below which voxels are not displayed, i.e., represented as void. |
display |
bool |
True |
Whether the figure is displayed. |
camera_position |
typing.Union[tuple, list] |
(0, 0.1, 0.12) |
x, y, and z coordinates of the camera position. |
show_design_space |
bool |
False |
Whether to highlight the voxels that have a design space information of -1 assigned to them. |
show_colorbar |
bool |
True |
Determines whether a reference colorbar is displayed for the plotted voxel color values. |
colorscale |
str |
None |
The name of the colorscale that is used for plotting. |
show_axislabels |
bool |
False |
Whether the 3d axes are labelled with their dimensions. |
show_ticklabels |
bool |
False |
Whether the 3d axes ticks are displayed and labeled. |
export_png |
bool |
False |
Whether the figure is exported and saved as a png file, in addition to the standard html format. |
kwargs |
No Content |
pyvista_plot_scalar_field
[source]
pyvista_plot_scalar_field
(problem
:dl4to.problem.Problem
,scalar_field
:Tensor
,data
:Tensor
=None
,title
:str
=None
,threshold
:float
=0.5
,display
:bool
=True
,camera_position
:Union
[tuple
,list
]=(0, 0.1, 0.12)
,show_design_space
:bool
=False
,window_size
:Union
[tuple
,list
]=(800, 800)
,smooth_iters
:int
=0
,taubin_smoothing
:bool
=True
,taubin_pass_band
:float
=0.1
,show_edges
:bool
=True
)
Plots a three-dimensional scalar field visualization using pyvista. Returns a pyvista.plotting.plotting.Plotter
object.
Pyvista plotting leads to better looking visualizations than the standard plotly interface. This is mainly due to the fact, that pyvista integrates Taubin smoothing [1].
However, the pyvista interface also has its downsides: In our experiments we found that only the backend 'pythreejs' worked for us.
This backend unfortunately currently does not support several basic functionalities. This includes for instance the display of color bars and plot titles as well as the option to save generated plots.
Therefore, the plots need to be saved via manual screenshots. We still decided to leave this class a part of the DL4TO library, since the visualizations
are much better looking for publications than the default plotly interface. it is possible that the missing features will be added in the future, if pyvista adds them to their
pythreejs backend or we somehow manage to make a different backend work.
Type | Default | Details | |
---|---|---|---|
problem |
dl4to.problem.Problem |
The problem that is referred to for plotting. | |
scalar_field |
Tensor |
The scalar field that determines the presence or absence of voxels. | |
data |
Tensor |
None |
The data that should be represented in color on the voxels. |
title |
str |
None |
The name of the plot. |
threshold |
float |
0.5 |
The threshold below which voxels are not displayed, i.e., represented as void. |
display |
bool |
True |
Whether the figure is displayed. |
camera_position |
typing.Union[tuple, list] |
(0, 0.1, 0.12) |
x, y, and z coordinates of the camera position. |
show_design_space |
bool |
False |
Whether to highlight the voxels that have a design space information of -1 assigned to them. |
window_size |
typing.Union[tuple, list] |
(800, 800) |
The size of the window that displays the plot |
smooth_iters |
int |
0 |
The number of smoothing iterations for better looking visualizations. Note that the number of smoothing iterations can be reduced if Taubin smoothing is used. This is because it is more efficient than Laplacian smoothing. |
taubin_smoothing |
bool |
True |
Whether to use Taubin smoothing. If False , then Laplacian smoothing is used. Taubin smoothing has the advantage that it is volume preserving, i.e., a higher number of smoothing iterations does not lead to thiner structures. Only has an effect if smooth_iters > 0 . |
taubin_pass_band |
float |
0.1 |
The passband value for the windowed sinc filter. This should be between 0 and 2, where lower values cause more smoothing. |
show_edges |
bool |
True |
Whether to display the edges of the underlying grid. |
plot_vector_field
[source]
plot_vector_field
(problem
:dl4to.problem.Problem
,vector_field
:Tensor
,title
:str
=None
,file_path
:str
=None
,display
:bool
=True
,camera_position
:Union
[tuple
,list
]=(0, 0.1, 0.12)
,show_colorbar
:bool
=True
,colorscale
:str
='Blues'
,show_axislabels
:bool
=False
,show_ticklabels
:bool
=False
,export_png
:bool
=False
)
Plots a three-dimensional vector field visualization. Returns a plotly.graph_objs.FigureWidget
object.
Type | Default | Details | |
---|---|---|---|
problem |
dl4to.problem.Problem |
The problem that is referred to for plotting. | |
vector_field |
Tensor |
The vector field that should be displayed with 3d arrows. | |
title |
str |
None |
The name of the plot. |
file_path |
str |
None |
Path where the figure is saved. |
display |
bool |
True |
Whether the figure is displayed. |
camera_position |
typing.Union[tuple, list] |
(0, 0.1, 0.12) |
x, y, and z coordinates of the camera position. |
show_colorbar |
bool |
True |
Determines whether a reference colorbar is displayed for the plotted voxel color values. |
colorscale |
str |
Blues |
The name of the colorscale that is used for plotting. |
show_axislabels |
bool |
False |
Whether the 3d axes are labelled with their dimensions. |
show_ticklabels |
bool |
False |
Whether the 3d axes ticks are displayed and labeled. |
export_png |
bool |
False |
Whether the figure is exported and saved as a png file, in addition to the standard html format. |
[1] Taubin, Gabriel. "Curve and surface smoothing without shrinkage." Proceedings of IEEE international conference on computer vision. IEEE, 1995.