From ebafe3cf15eed523726c2915f0b50ff069caf780 Mon Sep 17 00:00:00 2001 From: Jean Date: Mon, 14 Oct 2024 17:08:53 +0200 Subject: [PATCH] Minor changes for thesis writing needs --- topostats/default_config.yaml | 2 +- topostats/theme.py | 14 ++++++++++++++ topostats/validation.py | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/topostats/default_config.yaml b/topostats/default_config.yaml index d333098306..4adbe2d4cf 100644 --- a/topostats/default_config.yaml +++ b/topostats/default_config.yaml @@ -7,7 +7,7 @@ loading: channel: Height # Channel to pull data from in the data files. filter: run: true # Options : true, false - row_alignment_quantile: 0.5 # below values may improve flattening of larger features + row_alignment_quantile: 0.5 # Lower values may improve flattening of larger features threshold_method: std_dev # Options : otsu, std_dev, absolute otsu_threshold_multiplier: 1.0 threshold_std_dev: diff --git a/topostats/theme.py b/topostats/theme.py index 0436c31004..ded4a393cc 100644 --- a/topostats/theme.py +++ b/topostats/theme.py @@ -34,6 +34,8 @@ def set(self, name: str): self.cmap = self.gwyddion() elif name.lower() == "blu": self.cmap = self.blu() + elif name.lower() == "white": + self.cmap = self.white() else: # Get one of the matplotlib colormaps self.cmap = mpl.colormaps[name] @@ -120,3 +122,15 @@ def gwyddion(): def blu(): "RGBA colour map of just the colour blue." return ListedColormap([[32 / 256, 226 / 256, 205 / 256]], "blu", N=256) + + @staticmethod + def white(): + "RGBA colour map of just the colour white." + N = 256 # Number of values + vals = np.ones((N, 4)) # Initialise the array to be full of 1.0 + vals[0] = [0.0, 0.0, 0.0, 1] + for i in range(1, 255): + vals[i] = [32 / 256, 226 / 256, 205 / 256, 1.0] + + colormap = LinearSegmentedColormap.from_list("gwyddion", vals, N=256) + return colormap diff --git a/topostats/validation.py b/topostats/validation.py index 5ff98e3df9..86134c8d41 100644 --- a/topostats/validation.py +++ b/topostats/validation.py @@ -272,6 +272,7 @@ def validate_config(config: dict, schema: Schema, config_type: str) -> None: "afmhot", "nanoscope", "gwyddion", + "white", error="Invalid value in config for 'plotting.cmap', valid values are 'afmhot', 'nanoscope' or 'gwyddion'", ), "mask_cmap": str,