From 5fe273b0a69720be091850cce24902c385ba0cbc Mon Sep 17 00:00:00 2001 From: Prithwish Mukherjee Date: Fri, 21 Jun 2024 12:29:22 +0530 Subject: [PATCH 1/3] build: Bump version to v0.11.dev0 --- pyproject.toml | 5 ++--- tests/test_metadata.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fa072a17..7cee3c2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] # Check https://python-poetry.org/docs/pyproject/ for all available sections name = "ansys-fluent-visualization" -version = "0.10.dev0" +version = "0.11.dev0" description = "A python wrapper for ansys Fluent visualization" license = "MIT" authors = ["ANSYS, Inc. "] @@ -25,11 +25,10 @@ packages = [ [tool.poetry.dependencies] python = ">=3.9,<4.0" importlib-metadata = {version = "^4.0", python = "<3.9"} -ansys-fluent-core = "~=0.21.dev1" +ansys-fluent-core = "~=0.22.dev0" vtk = ">=9.3.0.rc0" pyvista = ">=0.39.0" pyvistaqt = ">=0.7.0" -pyside6 = ">=6.2.3" matplotlib = ">=3.5.1" requests = "==2.31.0" diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 4aea85c9..239d8b47 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -2,4 +2,4 @@ def test_pkg_version(): - assert __version__ == "0.10.dev0" + assert __version__ == "0.11.dev0" From c6c741a9bb9ea31272e915f70ed46ac21a3a3de6 Mon Sep 17 00:00:00 2001 From: Prithwish Mukherjee Date: Wed, 24 Jul 2024 13:58:22 +0530 Subject: [PATCH 2/3] fix: Plotter issues. --- .../visualization/matplotlib/plotter_defns.py | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/ansys/fluent/visualization/matplotlib/plotter_defns.py b/src/ansys/fluent/visualization/matplotlib/plotter_defns.py index 5ab05f6c..fab7a429 100644 --- a/src/ansys/fluent/visualization/matplotlib/plotter_defns.py +++ b/src/ansys/fluent/visualization/matplotlib/plotter_defns.py @@ -52,9 +52,8 @@ def __init__( self._data = {} self._closed = False self._visible = False - if not remote_process: - self.fig = plt.figure(num=self._window_id) - self.ax = self.fig.add_subplot(111) + self._remote_process = remote_process + self.fig = None def plot(self, data: dict) -> None: """Draw plot in window. @@ -79,11 +78,12 @@ def plot(self, data: dict) -> None: self._min_x = min(self._min_x, min_x_value) if self._min_x else min_x_value self._max_x = max(self._max_x, max_x_value) if self._max_x else max_x_value - curve_lines = self.ax.lines - for curve, curve_line in zip(self._curves, curve_lines): - curve_line.set_data( - self._data[curve]["xvalues"], self._data[curve]["yvalues"] - ) + if not self._remote_process: + self.fig = plt.figure(num=self._window_id) + self.ax = self.fig.add_subplot(111) + for curve in self._curves: + self.ax.plot(self._data[curve]["xvalues"], self._data[curve]["yvalues"]) + if self._max_x > self._min_x: self.ax.set_xlim(self._min_x, self._max_x) y_range = self._max_y - self._min_y @@ -142,14 +142,17 @@ def __call__(self): # private methods def _reset(self): + for curve_name in self._curves: + self._data[curve_name] = {} + self._data[curve_name]["xvalues"] = [] + self._data[curve_name]["yvalues"] = [] + if not self.fig: + return plt.figure(self.fig.number) self.ax.cla() if self._yscale: self.ax.set_yscale(self._yscale) for curve_name in self._curves: - self._data[curve_name] = {} - self._data[curve_name]["xvalues"] = [] - self._data[curve_name]["yvalues"] = [] self.ax.plot([], [], label=curve_name) self.fig.canvas.manager.set_window_title("PyFluent [" + self._window_id + "]") plt.title(self._title) From 50db7fe72a60ff464c5d5f2bbec1d120e7fb2077 Mon Sep 17 00:00:00 2001 From: Prithwish Mukherjee Date: Thu, 25 Jul 2024 10:35:23 +0530 Subject: [PATCH 3/3] Fix legends and labels. --- .../visualization/matplotlib/plotter_defns.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ansys/fluent/visualization/matplotlib/plotter_defns.py b/src/ansys/fluent/visualization/matplotlib/plotter_defns.py index fab7a429..f5194a0f 100644 --- a/src/ansys/fluent/visualization/matplotlib/plotter_defns.py +++ b/src/ansys/fluent/visualization/matplotlib/plotter_defns.py @@ -81,8 +81,15 @@ def plot(self, data: dict) -> None: if not self._remote_process: self.fig = plt.figure(num=self._window_id) self.ax = self.fig.add_subplot(111) + if self._yscale: + self.ax.set_yscale(self._yscale) + self.fig.canvas.manager.set_window_title("PyFluent [" + self._window_id + "]") + plt.title(self._title) + plt.xlabel(self._xlabel) + plt.ylabel(self._ylabel) for curve in self._curves: self.ax.plot(self._data[curve]["xvalues"], self._data[curve]["yvalues"]) + plt.legend(labels=self._curves, loc="upper right") if self._max_x > self._min_x: self.ax.set_xlim(self._min_x, self._max_x) @@ -150,15 +157,8 @@ def _reset(self): return plt.figure(self.fig.number) self.ax.cla() - if self._yscale: - self.ax.set_yscale(self._yscale) for curve_name in self._curves: self.ax.plot([], [], label=curve_name) - self.fig.canvas.manager.set_window_title("PyFluent [" + self._window_id + "]") - plt.title(self._title) - plt.xlabel(self._xlabel) - plt.ylabel(self._ylabel) - plt.legend(labels=self._curves, loc="upper right") class ProcessPlotter(Plotter):