@@ -97,26 +97,32 @@ def _get_plot_title(pl, title, plot_theme):
97
97
)
98
98
99
99
100
- def _get_clip_mesh (pl , obj , arg , plot_clip ):
100
+ def _get_filter_mesh (pl , obj , arg , plot_filter ):
101
101
"""
102
102
Add an object (either full view or clipped).
103
103
"""
104
104
105
105
# extract
106
- clip_plot = plot_clip ["clip_plot" ]
107
- clip_invert = plot_clip ["clip_invert" ]
108
- clip_normal = plot_clip ["clip_normal" ]
109
- clip_value = plot_clip ["clip_value" ]
106
+ clip = plot_filter ["clip" ]
107
+ slice = plot_filter ["slice" ]
108
+ invert = plot_filter ["invert" ]
109
+ normal = plot_filter ["normal" ]
110
+ value = plot_filter ["value" ]
110
111
111
112
# clip the plot
112
- if clip_plot :
113
- obj = obj .clip (normal = clip_normal , value = clip_value , invert = clip_invert )
113
+ if clip :
114
+ obj = obj .clip (normal = normal , origin = (value , value , value ), invert = invert )
115
+
116
+ # slice the plot
117
+ if slice :
118
+ obj = obj .slice (normal = normal , origin = (value , value , value ))
114
119
115
120
# add the full plot
116
- pl .add_mesh (
117
- obj ,
118
- ** arg ,
119
- )
121
+ if obj .n_cells > 0 :
122
+ pl .add_mesh (
123
+ obj ,
124
+ ** arg ,
125
+ )
120
126
121
127
122
128
def _get_scale_norm (obj , scale ):
@@ -327,7 +333,7 @@ def _get_arrow(obj, data_plot):
327
333
return obj_tmp
328
334
329
335
330
- def _plot_scalar (pl , obj , data_plot , plot_clip , plot_theme ):
336
+ def _plot_scalar (pl , obj , data_plot , plot_filter , plot_theme ):
331
337
"""
332
338
Plot a scalar variable.
333
339
"""
@@ -367,11 +373,10 @@ def _plot_scalar(pl, obj, data_plot, plot_clip, plot_theme):
367
373
scalar_bar_args = scalar_bar_args ,
368
374
render_points_as_spheres = True ,
369
375
)
370
- if obj .n_cells > 0 :
371
- _get_clip_mesh (pl , obj , arg , plot_clip )
376
+ _get_filter_mesh (pl , obj , arg , plot_filter )
372
377
373
378
374
- def _plot_arrow (pl , grid , obj , data_plot , plot_clip , plot_theme ):
379
+ def _plot_arrow (pl , grid , obj , data_plot , plot_filter , plot_theme ):
375
380
"""
376
381
Plot a vector variable with an arrow plot (quiver plot).
377
382
A scalar variable is used to determine the color of the arrows.
@@ -417,10 +422,10 @@ def _plot_arrow(pl, grid, obj, data_plot, plot_clip, plot_theme):
417
422
)
418
423
if obj .n_cells > 0 :
419
424
glyph_tmp = obj .glyph (orient = "vector" , scale = False , factor = factor )
420
- _get_clip_mesh (pl , glyph_tmp , arg , plot_clip )
425
+ _get_filter_mesh (pl , glyph_tmp , arg , plot_filter )
421
426
422
427
423
- def _plot_material (pl , voxel , data_plot , plot_clip , plot_theme ):
428
+ def _plot_material (pl , voxel , data_plot , plot_filter , plot_theme ):
424
429
"""
425
430
Plot the material and source description.
426
431
"""
@@ -455,11 +460,10 @@ def _plot_material(pl, voxel, data_plot, plot_clip, plot_theme):
455
460
scalars = "material_tag" ,
456
461
cmap = cmap ,
457
462
)
458
- if voxel_tmp .n_cells > 0 :
459
- _get_clip_mesh (pl , voxel_tmp , arg , plot_clip )
463
+ _get_filter_mesh (pl , voxel_tmp , arg , plot_filter )
460
464
461
465
462
- def _plot_geometry (pl , voxel , data_plot , plot_clip , plot_theme , var ):
466
+ def _plot_geometry (pl , voxel , data_plot , plot_filter , plot_theme , var ):
463
467
"""
464
468
Plot an integer variable on the voxel structure (material or connection).
465
469
"""
@@ -482,18 +486,19 @@ def _plot_geometry(pl, voxel, data_plot, plot_clip, plot_theme, var):
482
486
cmap = colormap ,
483
487
opacity = opacity ,
484
488
)
485
- if voxel_tmp .n_cells > 0 :
486
- _get_clip_mesh (pl , voxel_tmp , arg , plot_clip )
489
+ _get_filter_mesh (pl , voxel_tmp , arg , plot_filter )
487
490
488
491
489
- def _plot_voxelization (pl , voxel , reference , data_plot , plot_clip , plot_theme ):
492
+ def _plot_voxelization (pl , voxel , reference , data_plot , plot_filter , plot_theme ):
490
493
"""
491
494
Plot the reference and voxelized structures in order to assess the voxelization error.
492
495
"""
493
496
494
497
# extract the data
495
498
color_voxel = data_plot ["color_voxel" ]
496
499
color_reference = data_plot ["color_reference" ]
500
+ width_voxel = data_plot ["width_voxel" ]
501
+ width_reference = data_plot ["width_reference" ]
497
502
opacity_voxel = data_plot ["opacity_voxel" ]
498
503
opacity_reference = data_plot ["opacity_reference" ]
499
504
title = data_plot ["title" ]
@@ -510,18 +515,18 @@ def _plot_voxelization(pl, voxel, reference, data_plot, plot_clip, plot_theme):
510
515
show_scalar_bar = False ,
511
516
color = color_voxel ,
512
517
opacity = opacity_voxel ,
518
+ line_width = width_voxel ,
513
519
)
514
- if voxel_tmp .n_cells > 0 :
515
- _get_clip_mesh (pl , voxel_tmp , arg , plot_clip )
520
+ _get_filter_mesh (pl , voxel_tmp , arg , plot_filter )
516
521
517
522
# add the resulting plot to the plotter
518
523
arg = dict (
519
524
show_scalar_bar = False ,
520
525
color = color_reference ,
521
526
opacity = opacity_reference ,
527
+ line_width = width_reference ,
522
528
)
523
- if voxel_tmp .n_cells > 0 :
524
- _get_clip_mesh (pl , reference_tmp , arg , plot_clip )
529
+ _get_filter_mesh (pl , reference_tmp , arg , plot_filter )
525
530
526
531
527
532
def get_plot_viewer (pl , grid , voxel , point , reference , layout , data_plot , data_options ):
@@ -533,17 +538,17 @@ def get_plot_viewer(pl, grid, voxel, point, reference, layout, data_plot, data_o
533
538
"""
534
539
535
540
# extract the data
536
- plot_clip = data_options ["plot_clip " ]
541
+ plot_filter = data_options ["plot_filter " ]
537
542
plot_view = data_options ["plot_view" ]
538
543
plot_theme = data_options ["plot_theme" ]
539
544
540
545
# plot the geometry
541
546
if layout == "domain" :
542
- _plot_geometry (pl , voxel , data_plot , plot_clip , plot_theme , "domain_tag" )
547
+ _plot_geometry (pl , voxel , data_plot , plot_filter , plot_theme , "domain_tag" )
543
548
elif layout == "component" :
544
- _plot_geometry (pl , voxel , data_plot , plot_clip , plot_theme , "component_tag" )
549
+ _plot_geometry (pl , voxel , data_plot , plot_filter , plot_theme , "component_tag" )
545
550
elif layout == "voxelization" :
546
- _plot_voxelization (pl , voxel , reference , data_plot , plot_clip , plot_theme )
551
+ _plot_voxelization (pl , voxel , reference , data_plot , plot_filter , plot_theme )
547
552
else :
548
553
raise ValueError ("invalid plot layout" )
549
554
@@ -561,7 +566,7 @@ def get_plot_plotter(pl, grid, voxel, point, layout, data_plot, data_options):
561
566
"""
562
567
563
568
# extract the data
564
- plot_clip = data_options ["plot_clip " ]
569
+ plot_filter = data_options ["plot_filter " ]
565
570
plot_view = data_options ["plot_view" ]
566
571
plot_theme = data_options ["plot_theme" ]
567
572
@@ -577,16 +582,16 @@ def get_plot_plotter(pl, grid, voxel, point, layout, data_plot, data_options):
577
582
578
583
# plot the geometry
579
584
if layout == "material" :
580
- _plot_material (pl , voxel , data_plot , plot_clip , plot_theme )
585
+ _plot_material (pl , voxel , data_plot , plot_filter , plot_theme )
581
586
elif layout in ["norm_voxel" , "norm_point" ]:
582
587
obj = _get_norm (obj , data_plot )
583
- _plot_scalar (pl , obj , data_plot , plot_clip , plot_theme )
588
+ _plot_scalar (pl , obj , data_plot , plot_filter , plot_theme )
584
589
elif layout in ["phasor_voxel" , "phasor_point" ]:
585
590
obj = _get_phasor (obj , data_plot )
586
- _plot_scalar (pl , obj , data_plot , plot_clip , plot_theme )
591
+ _plot_scalar (pl , obj , data_plot , plot_filter , plot_theme )
587
592
elif layout in ["arrow_voxel" , "arrow_point" ]:
588
593
obj = _get_arrow (obj , data_plot )
589
- _plot_arrow (pl , grid , obj , data_plot , plot_clip , plot_theme )
594
+ _plot_arrow (pl , grid , obj , data_plot , plot_filter , plot_theme )
590
595
else :
591
596
raise ValueError ("invalid plot layout" )
592
597
0 commit comments