Mercurial > repos > bimib > marea_2
changeset 288:31c5c6815a31 draft
Uploaded
author | luca_milaz |
---|---|
date | Sun, 04 Aug 2024 19:17:58 +0000 |
parents | e4d02f9b41a1 |
children | 77025f4b9e6d |
files | marea_2/flux_to_map.py |
diffstat | 1 files changed, 0 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/marea_2/flux_to_map.py Sun Aug 04 19:12:43 2024 +0000 +++ b/marea_2/flux_to_map.py Sun Aug 04 19:17:58 2024 +0000 @@ -852,26 +852,7 @@ rgb = (rgb * 255).astype(int) return '#{:02x}{:02x}{:02x}'.format(rgb[0], rgb[1], rgb[2]) -def jet_colormap(value): - """ - Generate an RGB color based on a single numeric value using a colormap similar to MATLAB's 'jet'. - Args: - value (float): A numeric value to be mapped to a color. - - Returns: - tuple: An (R, G, B) tuple with color components in the range [0, 255]. - """ - # Normalize value to range [0, 1] - value = np.clip(value, 0, 1) - - # Define the red, green, and blue color components - red = np.clip(1.5 - np.abs(4 * (value - 0.75)), 0, 1) - green = np.clip(1.5 - np.abs(4 * (value - 0.5)), 0, 1) - blue = np.clip(1.5 - np.abs(4 * (value - 0.25)), 0, 1) - - # Convert to 0-255 range - return int(red * 255), int(green * 255), int(blue * 255) def save_colormap_image(min_value:float, max_value:float, path:str): """