Add colormap to reduction_kafka
Unit Testing / test (3.10) (push) Successful in 56s
Unit Testing / test (3.11) (push) Successful in 56s
Unit Testing / test (3.8) (push) Successful in 52s
Unit Testing / test (3.12) (push) Successful in 54s
Unit Testing / test (3.9) (push) Successful in 52s

This commit is contained in:
2026-06-01 16:51:24 +02:00
parent 7b95769966
commit 7cb99da2f2
+16 -4
View File
@@ -82,12 +82,24 @@ class KafkaReduction:
self.serializer.end_command_thread()
return
def register_colormap(self):
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import numpy as np
cmap = plt.colormaps['turbo'](np.arange(256))
cmap[:1, :] = np.array([256/256, 255/256, 236/256, 1])
cmap = ListedColormap(cmap, name='jochen_deluxe', N=cmap.shape[0])
#cmap.set_bad((1.,1.,0.9))
plt.colormaps.register(cmap)
def plot_loop(self):
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
from matplotlib.backend_tools import ToolBase
plt.rcParams['toolbar'] = 'toolmanager'
self.register_colormap()
fig = plt.figure(1)
#axclear = fig.add_axes([0.7, 0.05, 0.1, 0.075])
@@ -102,12 +114,12 @@ class KafkaReduction:
fig.canvas.manager.toolmanager.add_tool('Clear', ClearTool)
fig.canvas.manager.toolbar.add_tool('Clear', 'foo')
self.proj_yz.plot()
self.proj_yz.plot(cmap=self.config.reduction.plot_colormap)
fig = plt.figure(2)
fig.canvas.manager.toolmanager.add_tool('Clear', ClearTool)
fig.canvas.manager.toolbar.add_tool('Clear', 'foo')
self.proj_tofz.plot()
self.proj_tofz.plot(cmap=self.config.reduction.plot_colormap)
timer = fig.canvas.new_timer(interval=1000)
timer.add_callback(self.update)
@@ -161,12 +173,12 @@ class KafkaReduction:
self.add_data()
fig1 = plt.figure(1)
fig1.clear()
self.proj_yz.plot()
self.proj_yz.plot(cmap=self.config.reduction.plot_colormap)
fig1.canvas.draw_idle()
fig2 = plt.figure(2)
fig2.clear()
self.proj_tofz.plot()
self.proj_tofz.plot(cmap=self.config.reduction.plot_colormap)
fig2.canvas.draw_idle()
def finish_count(self):