88import param
99import scipy
1010from imas .ids_toplevel import IDSToplevel
11+ from panel .viewable import Viewer
1112
13+ from waveform_editor .settings import NiceSettings
1214from waveform_editor .shape_editor .nice_integration import NiceIntegration
1315from waveform_editor .shape_editor .plasma_properties import PlasmaProperties
1416from waveform_editor .shape_editor .plasma_shape import PlasmaShape
1719logger = logging .getLogger (__name__ )
1820
1921
20- class NicePlotter (param . Parameterized ):
22+ class NicePlotter (Viewer ):
2123 # Input data, use negative precedence to hide from the UI
2224 communicator = param .ClassSelector (class_ = NiceIntegration , precedence = - 1 )
2325 wall = param .ClassSelector (class_ = IDSToplevel , precedence = - 1 )
2426 pf_active = param .ClassSelector (class_ = IDSToplevel , precedence = - 1 )
2527 plasma_shape = param .ClassSelector (class_ = PlasmaShape , precedence = - 1 )
2628 plasma_properties = param .ClassSelector (class_ = PlasmaProperties , precedence = - 1 )
29+ nice_mode = param .Parameter (precedence = - 1 , allow_refs = True )
2730
2831 # Plot parameters
2932 show_contour = param .Boolean (default = True , label = "Show contour lines" )
@@ -45,12 +48,15 @@ class NicePlotter(param.Parameterized):
4548 PROFILE_WIDTH = 350
4649 PROFILE_HEIGHT = 350
4750
48- def __init__ (self , communicator , plasma_shape , plasma_properties , ** params ):
51+ def __init__ (
52+ self , communicator , plasma_shape , plasma_properties , nice_mode , ** params
53+ ):
4954 super ().__init__ (
5055 ** params ,
5156 communicator = communicator ,
5257 plasma_shape = plasma_shape ,
5358 plasma_properties = plasma_properties ,
59+ nice_mode = nice_mode ,
5460 )
5561 self .DEFAULT_OPTS = hv .opts .Overlay (
5662 xlim = (0 , 13 ),
@@ -124,9 +130,13 @@ def _plot_profiles(self):
124130 hv .opts .Overlay (title = "Plasma Profiles" ), hv .opts .Curve (framewise = True )
125131 )
126132
127- @pn .depends ("plasma_shape.shape_updated" , "show_desired_shape" )
133+ @pn .depends ("plasma_shape.shape_updated" , "show_desired_shape" , "nice_mode" )
128134 def _plot_plasma_shape (self ):
129- if not self .show_desired_shape or not self .plasma_shape .has_shape :
135+ if (
136+ self .nice_mode == NiceSettings .DIRECT_MODE
137+ or not self .show_desired_shape
138+ or not self .plasma_shape .has_shape
139+ ):
130140 return hv .Overlay ([hv .Curve ([]).opts (self .DESIRED_SHAPE_OPTS )])
131141
132142 r = self .plasma_shape .outline_r
@@ -388,3 +398,17 @@ def _plot_xo_points(self):
388398 hover_tooltips = [("" , "X-point" )],
389399 )
390400 return o_scatter * x_scatter
401+
402+ def __panel__ (self ):
403+ return (
404+ pn .Param (
405+ self .param ,
406+ show_name = False ,
407+ widgets = {
408+ "show_desired_shape" : {
409+ "visible" : self .param .nice_mode .rx ()
410+ == NiceSettings .INVERSE_MODE
411+ }
412+ },
413+ ),
414+ )
0 commit comments