Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove stitle #29

Merged
merged 1 commit into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions ansys/mapdl/reader/cyclic_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def plot_nodal_thermal_strain(self, rnum,
sel_type_all : bool, optional
If node_components is specified, plots those elements
containing all nodes of the component. Default True.
containing all nodes of the component. Default ``True``.
Returns
-------
Expand All @@ -707,7 +707,7 @@ def plot_nodal_thermal_strain(self, rnum,
_, strain = self.nodal_thermal_strain(rnum, phase, False, True)
scalars = strain[:, :, idx]

kwargs.setdefault('stitle', '%s Nodal Thermal Strain' % comp)
kwargs.setdefault('scalar_bar_args', {'title': f'{comp} Nodal Thermal Strain'})
kwargs['node_components'] = node_components
kwargs['element_components'] = element_components
kwargs['show_displacement'] = show_displacement
Expand Down Expand Up @@ -825,7 +825,7 @@ def plot_nodal_elastic_strain(self, rnum,
sel_type_all : bool, optional
If node_components is specified, plots those elements
containing all nodes of the component. Default True.
containing all nodes of the component. Default ``True``.
Returns
-------
Expand All @@ -843,7 +843,7 @@ def plot_nodal_elastic_strain(self, rnum,
_, strain = self.nodal_elastic_strain(rnum, phase, False, full_rotor)
scalars = strain[:, :, idx]

kwargs.setdefault('stitle', '%s Nodal Elastic Strain' % comp.upper())
kwargs.setdefault('scalar_bar_args', {'title': f'{comp} Nodal Elastic Strain'})
kwargs['node_components'] = node_components
kwargs['element_components'] = element_components
kwargs['show_displacement'] = show_displacement
Expand Down Expand Up @@ -961,7 +961,7 @@ def plot_nodal_plastic_strain(self, rnum,
sel_type_all : bool, optional
If node_components is specified, plots those elements
containing all nodes of the component. Default True.
containing all nodes of the component. Default ``True``.
Returns
-------
Expand All @@ -979,7 +979,7 @@ def plot_nodal_plastic_strain(self, rnum,
_, strain = self.nodal_plastic_strain(rnum, phase, False, full_rotor)
scalars = strain[:, :, idx]

kwargs.setdefault('stitle', '%s Nodal Plastic Strain' % comp)
kwargs.setdefault('scalar_bar_args', {'title': f'{comp} Nodal Plastic Strain'})
kwargs['node_components'] = node_components
kwargs['element_components'] = element_components
kwargs['show_displacement'] = show_displacement
Expand Down Expand Up @@ -1106,7 +1106,7 @@ def plot_nodal_solution(self, rnum, comp='norm',
sel_type_all : bool, optional
If node_components is specified, plots those elements
containing all nodes of the component. Default True.
containing all nodes of the component. Default ``True``.
Returns
-------
Expand All @@ -1133,19 +1133,19 @@ def plot_nodal_solution(self, rnum, comp='norm',
label = 'Cyclic Rotor\nDisplacement'
if comp == 'x':
scalars = result[:, :, 0]
stitle = 'X {:s}\n'.format(label)
title = 'X {:s}\n'.format(label)
elif comp == 'y':
scalars = result[:, :, 1]
stitle = 'Y {:s}\n'.format(label)
title = 'Y {:s}\n'.format(label)
elif comp == 'z':
scalars = result[:, :, 2]
stitle = 'Z {:s}\n'.format(label)
title = 'Z {:s}\n'.format(label)
else:
# Normalize displacement
scalars = (result*result).sum(2)**0.5
stitle = 'Normalized\n%s\n' % label
kwargs.setdefault('stitle', stitle)
title = 'Normalized\n%s\n' % label

kwargs.setdefault('scalar_bar_args', {'title': title})
kwargs['node_components'] = node_components
kwargs['element_components'] = element_components
kwargs['show_displacement'] = show_displacement
Expand Down Expand Up @@ -1211,7 +1211,7 @@ def plot_nodal_stress(self, rnum,
sel_type_all : bool, optional
If node_components is specified, plots those elements
containing all nodes of the component. Default True.
containing all nodes of the component. Default ``True``.
Returns
-------
Expand All @@ -1231,7 +1231,8 @@ def plot_nodal_stress(self, rnum,
_, stress = self.nodal_stress(rnum, phase, False, full_rotor=True)
scalars = stress[:, :, idx]

kwargs.setdefault('stitle', 'Cyclic Rotor\nNodal Stress\n%s\n' % comp)
kwargs.setdefault('scalar_bar_args',
{'title': f'Cyclic Rotor\nNodal Stress\n{comp}\n'})
kwargs['node_components'] = node_components
kwargs['element_components'] = element_components
kwargs['show_displacement'] = show_displacement
Expand Down Expand Up @@ -1291,7 +1292,7 @@ def plot_principal_nodal_stress(self, rnum,
sel_type_all : bool, optional
If node_components is specified, plots those elements
containing all nodes of the component. Default True.
containing all nodes of the component. Default ``True``.
kwargs : keyword arguments
Additional keyword arguments. See ``help(pyvista.plot)``
Expand All @@ -1315,8 +1316,8 @@ def plot_principal_nodal_stress(self, rnum,
_, pstress = self.principal_nodal_stress(rnum, phase, full_rotor=True)
scalars = pstress[:, :, idx]

kwargs.setdefault('stitle',
'Cyclic Rotor\nPrincipal Nodal Stress\n%s\n' % comp)
kwargs.setdefault('scalar_bar_args',
{'title': f'Cyclic Rotor\nPrincipal Nodal Stress\n{comp}\n'})
kwargs['node_components'] = node_components
kwargs['element_components'] = element_components
kwargs['show_displacement'] = show_displacement
Expand All @@ -1330,8 +1331,7 @@ def plot_principal_nodal_stress(self, rnum,
self._plot_cyclic_point_scalars(scalars, rnum, **kwargs)

def nodal_temperature(self, rnum, full_rotor=False):
"""Retrieves the temperature for each node in the
solution.
"""Retrieves the temperature for each node in the solution.
The order of the results corresponds to the sorted node
numbering.
Expand Down Expand Up @@ -1409,7 +1409,7 @@ def plot_nodal_temperature(self, rnum,
sel_type_all : bool, optional
If node_components is specified, plots those elements
containing all nodes of the component. Default True.
containing all nodes of the component. Default ``True``.
Returns
-------
Expand Down
57 changes: 29 additions & 28 deletions ansys/mapdl/reader/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def plot_nodal_solution(self, rnum, comp=None,
else:
grid = self.grid

kwargs.setdefault('stitle', '%s\n%s\n' % (comp, label))
kwargs.setdefault('scalar_bar_args', {'title': f'{comp}\n{label}\n'})
return self._plot_point_scalars(scalars, rnum=rnum, grid=grid,
show_displacement=show_displacement,
displacement_factor=displacement_factor,
Expand Down Expand Up @@ -949,8 +949,10 @@ def animate_nodal_solution_set(self, rnums=None, comp='norm',
the top down.
>>> rsets = range(0, rst.nsets, 50)
>>> rst.animate_nodal_solution_set(rsets, stitle='Temp', lighting=False,
cpos='zx', movie_filename='example.gif')
>>> rst.animate_nodal_solution_set(rsets,
... scalar_bar_args={'title': 'My Animation'},
... lighting=False, cpos='zx',
... movie_filename='example.gif')
"""
if self.nsets == 1:
raise RuntimeError('Unable to animate. Solution contains only one '
Expand Down Expand Up @@ -2434,8 +2436,7 @@ def plot_principal_nodal_stress(self, rnum, comp=None,
'S3': 'Principal Stress 3',
'SINT': 'Stress Intensity',
'SEQV': 'von Mises Stress'}
kwargs.setdefault('stitle', stype_stitle_map[comp])

kwargs.setdefault('scalar_bar_args', {'title': stype_stitle_map[comp]})
return self._plot_point_scalars(stress, grid=grid, rnum=rnum,
show_displacement=show_displacement,
displacement_factor=displacement_factor,
Expand Down Expand Up @@ -2564,7 +2565,6 @@ def _plot_point_scalars(self, scalars, rnum=None, grid=None,
screenshot = kwargs.pop('screenshot', None)
interactive = kwargs.pop('interactive', True)
text_color = kwargs.pop('text_color', None)
use_ipyvtk = kwargs.pop('use_ipyvtk', pv.rcParams['use_ipyvtk'])

kwargs.setdefault('smooth_shading', pv.rcParams.get('smooth_shading', True))
kwargs.setdefault('color', 'w')
Expand Down Expand Up @@ -2625,8 +2625,7 @@ def _plot_point_scalars(self, scalars, rnum=None, grid=None,
plotter.show(interactive=False, auto_close=False,
window_size=window_size,
full_screen=full_screen,
interactive_update=not off_screen,
use_ipyvtk=use_ipyvtk)
interactive_update=not off_screen)

self._animating = True
def q_callback():
Expand Down Expand Up @@ -2928,10 +2927,10 @@ def plot_nodal_stress(self, rnum, comp=None,
sel_type_all : bool, optional
If node_components is specified, plots those elements
containing all nodes of the component. Default True.
containing all nodes of the component. Default ``True``.
kwargs : keyword arguments
Additional keyword arguments. See help(pyvista.plot)
Additional keyword arguments. See ``help(pyvista.plot)``
Returns
-------
Expand All @@ -2944,7 +2943,8 @@ def plot_nodal_stress(self, rnum, comp=None,
>>> rst.plot_nodal_stress(0, comp='x', show_displacement=True)
"""
kwargs['stitle'] = '%s Component Nodal Stress' % comp
kwargs.setdefault('scalar_bar_args',
{'title': f'{comp} Component Nodal Stress'})
return self._plot_nodal_result(rnum, 'ENS', comp, STRESS_TYPES,
show_displacement,
displacement_factor, node_components,
Expand Down Expand Up @@ -3422,7 +3422,7 @@ def plot_element_result(self, rnum, result_type, item_index,
in_element_coord_sys)

desc = self.available_results.description[result_type].capitalize()
kwargs.setdefault('stitle', desc)
kwargs.setdefault('scalar_bar_args', {'title': desc})
return bsurf.plot(scalars='_scalars', **kwargs)

def _extract_surface_element_result(self, rnum, result_type, item_index,
Expand Down Expand Up @@ -3646,14 +3646,14 @@ def plot_cylindrical_nodal_stress(self, rnum, comp=None, show_displacement=False
sel_type_all : bool, optional
If node_components is specified, plots those elements
containing all nodes of the component. Default True.
containing all nodes of the component. Default ``True``.
**kwargs : keyword arguments
Optional keyword arguments. See help(pyvista.plot)
Optional keyword arguments. See ``help(pyvista.plot)``
Examples
--------
Plot nodal stress in the radial direction
Plot nodal stress in the radial direction.
>>> from ansys.mapdl import reader as pymapdl_reader
>>> result = pymapdl_reader.read_binary('file.rst')
Expand All @@ -3672,7 +3672,8 @@ def plot_cylindrical_nodal_stress(self, rnum, comp=None, show_displacement=False
grid, ind = self._extract_element_components(element_components)
scalars = scalars[ind]

kwargs.setdefault('stitle', '%s Cylindrical\nNodal Stress' % comp)
kwargs.setdefault('scalar_bar_args',
{'title': f'{comp} Cylindrical\nNodal Stress'})
return self._plot_point_scalars(scalars, grid=grid, rnum=rnum,
show_displacement=show_displacement,
displacement_factor=displacement_factor,
Expand Down Expand Up @@ -3707,10 +3708,10 @@ def plot_nodal_temperature(self, rnum, show_displacement=False,
sel_type_all : bool, optional
If node_components is specified, plots those elements
containing all nodes of the component. Default True.
containing all nodes of the component. Default ``True``.
**kwargs : keyword arguments
Optional keyword arguments. See help(pyvista.plot)
Optional keyword arguments. See ``help(pyvista.plot)``
Examples
--------
Expand All @@ -3737,7 +3738,7 @@ def plot_nodal_temperature(self, rnum, show_displacement=False,
return self._plot_point_scalars(scalars, grid=grid, rnum=rnum,
show_displacement=show_displacement,
displacement_factor=displacement_factor,
stitle='Nodal Tempature',
scalar_bar_args={'title': 'Nodal Tempature'},
**kwargs)

def nodal_thermal_strain(self, rnum):
Expand Down Expand Up @@ -3767,7 +3768,7 @@ def nodal_thermal_strain(self, rnum):
Examples
--------
Load the nodal thermal strain for the first solution
Load the nodal thermal strain for the first solution.
>>> from ansys.mapdl import reader as pymapdl_reader
>>> rst = pymapdl_reader.read_binary('file.rst')
Expand All @@ -3777,7 +3778,7 @@ def nodal_thermal_strain(self, rnum):

def plot_nodal_thermal_strain(self, rnum,
comp=None,
stitle='Nodal Thermal Strain',
scalar_bar_args={'title': 'Nodal Thermal Strain'},
show_displacement=False,
displacement_factor=1,
node_components=None,
Expand Down Expand Up @@ -3841,7 +3842,7 @@ def plot_nodal_thermal_strain(self, rnum,
node_components=node_components,
element_components=element_components,
sel_type_all=sel_type_all,
stitle=stitle,
scalar_bar_args=scalar_bar_args,
**kwargs)

def nodal_elastic_strain(self, rnum):
Expand Down Expand Up @@ -3885,7 +3886,7 @@ def nodal_elastic_strain(self, rnum):
return self._nodal_result(rnum, 'EEL')

def plot_nodal_elastic_strain(self, rnum, comp,
stitle='Nodal Elastic Strain',
scalar_bar_args={'title': 'Nodal Elastic Strain'},
show_displacement=False,
displacement_factor=1,
node_components=None,
Expand Down Expand Up @@ -3940,7 +3941,7 @@ def plot_nodal_elastic_strain(self, rnum, comp,
>>> result = examples.download_pontoon()
>>> result.plot_nodal_elastic_strain(0)
"""
stitle = ' '.join([comp.upper(), stitle])
scalar_bar_args['title'] = ' '.join([comp.upper(), scalar_bar_args['title']])
return self._plot_nodal_result(rnum, 'EEL',
comp,
STRAIN_TYPES,
Expand All @@ -3949,7 +3950,7 @@ def plot_nodal_elastic_strain(self, rnum, comp,
node_components=node_components,
element_components=element_components,
sel_type_all=sel_type_all,
stitle=stitle,
scalar_bar_args=scalar_bar_args,
**kwargs)

def nodal_plastic_strain(self, rnum):
Expand Down Expand Up @@ -3985,7 +3986,7 @@ def nodal_plastic_strain(self, rnum):
return self._nodal_result(rnum, 'EPL')

def plot_nodal_plastic_strain(self, rnum, comp,
stitle='Nodal Plastic Strain',
scalar_bar_args={'title': 'Nodal Plastic Strain'},
show_displacement=False,
displacement_factor=1,
node_components=None,
Expand Down Expand Up @@ -4041,7 +4042,7 @@ def plot_nodal_plastic_strain(self, rnum, comp,
>>> result = examples.download_pontoon()
>>> result.plot_nodal_plastic_strain(0)
"""
stitle = ' '.join([comp.upper(), stitle])
scalar_bar_args['title'] = ' '.join([comp.upper(), scalar_bar_args['title']])
return self._plot_nodal_result(rnum, 'EPL',
comp,
STRAIN_TYPES,
Expand All @@ -4050,7 +4051,7 @@ def plot_nodal_plastic_strain(self, rnum, comp,
node_components=node_components,
element_components=element_components,
sel_type_all=sel_type_all,
stitle=stitle,
scalar_bar_args=scalar_bar_args,
**kwargs)

def _plot_nodal_result(self, rnum, result_type, comp, available_comps,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def compilerName():
exec(fd.read())

install_requires = ['numpy>=1.14.0',
'pyvista>=0.28.0',
'pyvista>=0.30.1',
'appdirs>=1.4.0',
'tqdm>=4.45.0']

Expand Down