From 1e696200527a00c811f50fa18fa19e3e3735803f Mon Sep 17 00:00:00 2001 From: Jackson Burns <33505528+JacksonBurns@users.noreply.github.com> Date: Thu, 16 May 2024 13:12:51 -0400 Subject: [PATCH 1/7] fix import of get_cmap --- aimsim/tasks/cluster_data.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aimsim/tasks/cluster_data.py b/aimsim/tasks/cluster_data.py index 034f7357..b6dbbe6c 100644 --- a/aimsim/tasks/cluster_data.py +++ b/aimsim/tasks/cluster_data.py @@ -3,6 +3,7 @@ from os.path import dirname import matplotlib.pyplot as plt +from matplotlib.cm import get_cmap from matplotlib.colors import rgb2hex import yaml @@ -54,7 +55,7 @@ def _extract_configs(self): self.plot_settings = dict() self.plot_settings["cluster_plot"] = { "cluster_colors": [ - rgb2hex(plt.cm.get_cmap("tab20", self.n_clusters)(cluster_id)) + rgb2hex(get_cmap("tab20", self.n_clusters)(cluster_id)) for cluster_id in range(self.n_clusters)], "response": "Response", } From 895dfcb687dc0260677ad15c71549c281a51d5d3 Mon Sep 17 00:00:00 2001 From: Jackson Burns <33505528+JacksonBurns@users.noreply.github.com> Date: Thu, 16 May 2024 13:17:40 -0400 Subject: [PATCH 2/7] change to a module import --- aimsim/tasks/cluster_data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aimsim/tasks/cluster_data.py b/aimsim/tasks/cluster_data.py index b6dbbe6c..3c970405 100644 --- a/aimsim/tasks/cluster_data.py +++ b/aimsim/tasks/cluster_data.py @@ -3,7 +3,7 @@ from os.path import dirname import matplotlib.pyplot as plt -from matplotlib.cm import get_cmap +import matplotlib.cm as colormaps from matplotlib.colors import rgb2hex import yaml @@ -55,7 +55,7 @@ def _extract_configs(self): self.plot_settings = dict() self.plot_settings["cluster_plot"] = { "cluster_colors": [ - rgb2hex(get_cmap("tab20", self.n_clusters)(cluster_id)) + rgb2hex(colormaps.get_cmap("tab20", self.n_clusters)(cluster_id)) for cluster_id in range(self.n_clusters)], "response": "Response", } From 2f8b3d37e3468f3ac7a75e4a79a74f13f681e0f0 Mon Sep 17 00:00:00 2001 From: Jackson Burns <33505528+JacksonBurns@users.noreply.github.com> Date: Thu, 16 May 2024 13:36:49 -0400 Subject: [PATCH 3/7] moved cmap based on version --- aimsim/tasks/cluster_data.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aimsim/tasks/cluster_data.py b/aimsim/tasks/cluster_data.py index 3c970405..9141c39a 100644 --- a/aimsim/tasks/cluster_data.py +++ b/aimsim/tasks/cluster_data.py @@ -3,7 +3,10 @@ from os.path import dirname import matplotlib.pyplot as plt -import matplotlib.cm as colormaps +try: + import matplotlib.cm import get_cmap +except: + from matplotlib.pyplot import get_cmap from matplotlib.colors import rgb2hex import yaml From f8be4d5daad28f12e71f7856cea0bd2558545445 Mon Sep 17 00:00:00 2001 From: Jackson Burns <33505528+JacksonBurns@users.noreply.github.com> Date: Thu, 16 May 2024 13:38:57 -0400 Subject: [PATCH 4/7] import -> from --- aimsim/tasks/cluster_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aimsim/tasks/cluster_data.py b/aimsim/tasks/cluster_data.py index 9141c39a..b184ae30 100644 --- a/aimsim/tasks/cluster_data.py +++ b/aimsim/tasks/cluster_data.py @@ -4,7 +4,7 @@ import matplotlib.pyplot as plt try: - import matplotlib.cm import get_cmap + from matplotlib.cm import get_cmap except: from matplotlib.pyplot import get_cmap from matplotlib.colors import rgb2hex From 03442e0c1a39d49a7d58fe257944f68490e8d440 Mon Sep 17 00:00:00 2001 From: Jackson Burns <33505528+JacksonBurns@users.noreply.github.com> Date: Thu, 16 May 2024 13:47:55 -0400 Subject: [PATCH 5/7] typo --- aimsim/tasks/cluster_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aimsim/tasks/cluster_data.py b/aimsim/tasks/cluster_data.py index b184ae30..f8422c36 100644 --- a/aimsim/tasks/cluster_data.py +++ b/aimsim/tasks/cluster_data.py @@ -58,7 +58,7 @@ def _extract_configs(self): self.plot_settings = dict() self.plot_settings["cluster_plot"] = { "cluster_colors": [ - rgb2hex(colormaps.get_cmap("tab20", self.n_clusters)(cluster_id)) + rgb2hex(get_cmap("tab20", self.n_clusters)(cluster_id)) for cluster_id in range(self.n_clusters)], "response": "Response", } From c79bd3046f982150b0ab0aabe4b03119a3f6fdef Mon Sep 17 00:00:00 2001 From: Jackson Burns <33505528+JacksonBurns@users.noreply.github.com> Date: Thu, 16 May 2024 13:59:38 -0400 Subject: [PATCH 6/7] allow bare except in import --- aimsim/tasks/cluster_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aimsim/tasks/cluster_data.py b/aimsim/tasks/cluster_data.py index f8422c36..40aafb4d 100644 --- a/aimsim/tasks/cluster_data.py +++ b/aimsim/tasks/cluster_data.py @@ -5,7 +5,7 @@ import matplotlib.pyplot as plt try: from matplotlib.cm import get_cmap -except: +except: # noqa: E722 from matplotlib.pyplot import get_cmap from matplotlib.colors import rgb2hex import yaml From 305b89bd8d58f815d2881773daa395d8c24edd06 Mon Sep 17 00:00:00 2001 From: Jackson Burns <33505528+JacksonBurns@users.noreply.github.com> Date: Thu, 16 May 2024 14:45:19 -0400 Subject: [PATCH 7/7] Update __init__.py --- aimsim/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aimsim/__init__.py b/aimsim/__init__.py index e16ecd12..877e1432 100644 --- a/aimsim/__init__.py +++ b/aimsim/__init__.py @@ -7,4 +7,4 @@ except ImportError: pass # aimsim_core does not include this -__version__ = "2.2.0" +__version__ = "2.2.1"