Skip to content

Commit

Permalink
ktensor vis() -> viz() (#372)
Browse files Browse the repository at this point in the history
method name change to align with MATLAB
  • Loading branch information
ghbrown authored Jan 6, 2025
1 parent 0a469f5 commit 589239b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions docs/source/matlab/ktensor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,5 @@ Methods
+-----------------+----------------------+------------------------------------------------------------------------+
| ``tensor`` | ``to_tensor`` | ``X.to_tensor()`` |
+-----------------+----------------------+------------------------------------------------------------------------+

MATLAB methods not included in ``pyttb``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* ``viz``
| ``viz`` | ``viz`` | ``X.viz()`` |
+-----------------+----------------------+------------------------------------------------------------------------+
8 changes: 4 additions & 4 deletions pyttb/ktensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,7 @@ def update(self, modes: OneDArray, data: np.ndarray) -> ktensor:

return self

def vis( # noqa: PLR0912, PLR0913
def viz( # noqa: PLR0912, PLR0913
self,
plots: Optional[Union[tuple, list]] = None,
show_figure: bool = True,
Expand Down Expand Up @@ -2295,9 +2295,9 @@ def vis( # noqa: PLR0912, PLR0913
>>> np.random.seed(1)
>>> K = ttb.ktensor.from_function(np.random.random_sample, (2, 3, 10), 2)
Use plot K using default behavior K.vis()
Use plot K using default behavior K.viz()
>>> fig, axs = K.vis(show_figure=False) # doctest: +ELLIPSIS
>>> fig, axs = K.viz(show_figure=False) # doctest: +ELLIPSIS
>>> plt.close(fig)
Define a more realistic plot fuctions with x labels,
Expand All @@ -2314,7 +2314,7 @@ def vis( # noqa: PLR0912, PLR0913
... ax.semilogx(np.logspace(-2, 2, v.shape[0]), v)
... ax.set_xlabel("$E$, [kJ]")
>>> plots = [mode_1_plot, mode_2_plot, mode_3_plot]
>>> fig, axs = K.vis(
>>> fig, axs = K.viz(
... show_figure=False,
... plots=plots,
... rel_widths=[1, 2, 3],
Expand Down

0 comments on commit 589239b

Please sign in to comment.