From 1ca9499edd334c19fe1e7aac71d3940a80a1ec95 Mon Sep 17 00:00:00 2001 From: wakonig_k Date: Tue, 27 Aug 2024 12:49:53 +0200 Subject: [PATCH] fix(cmaps): unified all defaults to magma cmap --- bec_widgets/cli/client.py | 6 ++-- bec_widgets/widgets/figure/figure.py | 2 +- .../widgets/figure/plots/waveform/waveform.py | 6 ++-- .../figure/plots/waveform/waveform_curve.py | 2 +- .../curve_dialog/curve_dialog.py | 4 +-- .../widgets/waveform/waveform_widget.py | 2 +- .../test_configs/config_device.yaml | 2 +- .../test_configs/config_device_no_entry.yaml | 2 +- .../unit_tests/test_configs/config_scan.yaml | 2 +- tests/unit_tests/test_crosshair.py | 4 +-- tests/unit_tests/test_waveform1d.py | 28 +++++++++---------- tests/unit_tests/test_waveform_widget.py | 4 +-- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/bec_widgets/cli/client.py b/bec_widgets/cli/client.py index 477468b7..d41cb1d3 100644 --- a/bec_widgets/cli/client.py +++ b/bec_widgets/cli/client.py @@ -483,7 +483,7 @@ class BECFigure(RPCBase): y_entry: "str | None" = None, z_entry: "str | None" = None, color: "str | None" = None, - color_map_z: "str | None" = "plasma", + color_map_z: "str | None" = "magma", label: "str | None" = None, validate: "bool" = True, new: "bool" = False, @@ -1728,7 +1728,7 @@ class BECWaveform(RPCBase): y_entry: "str | None" = None, z_entry: "str | None" = None, color: "str | None" = None, - color_map_z: "str | None" = "plasma", + color_map_z: "str | None" = "magma", label: "str | None" = None, validate: "bool" = True, dap: "str | None" = None, @@ -2042,7 +2042,7 @@ class BECWaveformWidget(RPCBase): y_entry: "str | None" = None, z_entry: "str | None" = None, color: "str | None" = None, - color_map_z: "str | None" = "plasma", + color_map_z: "str | None" = "magma", label: "str | None" = None, validate: "bool" = True, dap: "str | None" = None, diff --git a/bec_widgets/widgets/figure/figure.py b/bec_widgets/widgets/figure/figure.py index 6389b61d..2bc089ce 100644 --- a/bec_widgets/widgets/figure/figure.py +++ b/bec_widgets/widgets/figure/figure.py @@ -252,7 +252,7 @@ class BECFigure(BECWidget, pg.GraphicsLayoutWidget): y_entry: str | None = None, z_entry: str | None = None, color: str | None = None, - color_map_z: str | None = "plasma", + color_map_z: str | None = "magma", label: str | None = None, validate: bool = True, new: bool = False, diff --git a/bec_widgets/widgets/figure/plots/waveform/waveform.py b/bec_widgets/widgets/figure/plots/waveform/waveform.py index 2abfd30d..6825ad74 100644 --- a/bec_widgets/widgets/figure/plots/waveform/waveform.py +++ b/bec_widgets/widgets/figure/plots/waveform/waveform.py @@ -26,7 +26,7 @@ from bec_widgets.widgets.figure.plots.waveform.waveform_curve import ( class Waveform1DConfig(SubplotConfig): color_palette: Optional[str] = Field( - "plasma", description="The color palette of the figure widget.", validate_default=True + "magma", description="The color palette of the figure widget.", validate_default=True ) curves: dict[str, CurveConfig] = Field( {}, description="The list of curves to be added to the 1D waveform widget." @@ -269,7 +269,7 @@ class BECWaveform(BECPlotBase): y_entry: str | None = None, z_entry: str | None = None, color: str | None = None, - color_map_z: str | None = "plasma", + color_map_z: str | None = "magma", label: str | None = None, validate: bool = True, dap: str | None = None, # TODO add dap custom curve wrapper @@ -481,7 +481,7 @@ class BECWaveform(BECPlotBase): y_entry: str | None = None, z_entry: str | None = None, color: str | None = None, - color_map_z: str | None = "plasma", + color_map_z: str | None = "magma", label: str | None = None, validate_bec: bool = True, dap: str | None = None, diff --git a/bec_widgets/widgets/figure/plots/waveform/waveform_curve.py b/bec_widgets/widgets/figure/plots/waveform/waveform_curve.py index fc9f451b..89c8569b 100644 --- a/bec_widgets/widgets/figure/plots/waveform/waveform_curve.py +++ b/bec_widgets/widgets/figure/plots/waveform/waveform_curve.py @@ -52,7 +52,7 @@ class CurveConfig(ConnectionConfig): source: Optional[str] = Field(None, description="The source of the curve.") signals: Optional[Signal] = Field(None, description="The signal of the curve.") color_map_z: Optional[str] = Field( - "plasma", description="The colormap of the curves z gradient.", validate_default=True + "magma", description="The colormap of the curves z gradient.", validate_default=True ) model_config: dict = {"validate_assignment": True} diff --git a/bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py b/bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py index 2de57a0e..186ee2b5 100644 --- a/bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py +++ b/bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py @@ -281,7 +281,7 @@ class DialogRow(QObject): self.symbol_size.setValue(self.config.symbol_size) else: default_colors = Colors.golden_angle_color( - colormap="plasma", num=max(10, self.row + 1), format="HEX" + colormap="magma", num=max(10, self.row + 1), format="HEX" ) default_color = default_colors[self.row] self.color_button.setColor(default_color) @@ -305,7 +305,7 @@ class DialogRow(QObject): self.symbol_size.setValue(self.config.symbol_size) else: default_colors = Colors.golden_angle_color( - colormap="plasma", num=max(10, self.row + 1), format="HEX" + colormap="magma", num=max(10, self.row + 1), format="HEX" ) default_color = default_colors[self.row] self.color_button.setColor(default_color) diff --git a/bec_widgets/widgets/waveform/waveform_widget.py b/bec_widgets/widgets/waveform/waveform_widget.py index 65c8a39f..05ecccfa 100644 --- a/bec_widgets/widgets/waveform/waveform_widget.py +++ b/bec_widgets/widgets/waveform/waveform_widget.py @@ -284,7 +284,7 @@ class BECWaveformWidget(BECWidget, QWidget): y_entry: str | None = None, z_entry: str | None = None, color: str | None = None, - color_map_z: str | None = "plasma", + color_map_z: str | None = "magma", label: str | None = None, validate: bool = True, dap: str | None = None, # TODO add dap custom curve wrapper diff --git a/tests/unit_tests/test_configs/config_device.yaml b/tests/unit_tests/test_configs/config_device.yaml index 577ab6fc..3a563ea0 100644 --- a/tests/unit_tests/test_configs/config_device.yaml +++ b/tests/unit_tests/test_configs/config_device.yaml @@ -1,7 +1,7 @@ plot_settings: background_color: "black" num_columns: 1 - colormap: "plasma" + colormap: "magma" scan_types: false plot_data: - plot_name: "BPM4i plots vs samx" diff --git a/tests/unit_tests/test_configs/config_device_no_entry.yaml b/tests/unit_tests/test_configs/config_device_no_entry.yaml index 3716e6a6..c3ced7ba 100644 --- a/tests/unit_tests/test_configs/config_device_no_entry.yaml +++ b/tests/unit_tests/test_configs/config_device_no_entry.yaml @@ -1,7 +1,7 @@ plot_settings: background_color: "black" num_columns: 1 - colormap: "plasma" + colormap: "magma" scan_types: false plot_data: - plot_name: "BPM4i plots vs samx" diff --git a/tests/unit_tests/test_configs/config_scan.yaml b/tests/unit_tests/test_configs/config_scan.yaml index f73f1ed3..c6fe7e96 100644 --- a/tests/unit_tests/test_configs/config_scan.yaml +++ b/tests/unit_tests/test_configs/config_scan.yaml @@ -1,7 +1,7 @@ plot_settings: background_color: "white" num_columns: 3 - colormap: "plasma" + colormap: "magma" scan_types: true plot_data: grid_scan: diff --git a/tests/unit_tests/test_crosshair.py b/tests/unit_tests/test_crosshair.py index e30ff483..ccf74ec6 100644 --- a/tests/unit_tests/test_crosshair.py +++ b/tests/unit_tests/test_crosshair.py @@ -49,8 +49,8 @@ def test_mouse_moved_lines(plot_widget_with_crosshair): crosshair.mouse_moved(event_mock) # Assert the expected behavior - assert crosshair.v_line.pos().x() == 2 - assert crosshair.h_line.pos().y() == 5 + assert np.isclose(crosshair.v_line.pos().x(), 2) + assert np.isclose(crosshair.h_line.pos().y(), 5) def test_mouse_moved_signals(plot_widget_with_crosshair): diff --git a/tests/unit_tests/test_waveform1d.py b/tests/unit_tests/test_waveform1d.py index 6de954d1..1da60aa1 100644 --- a/tests/unit_tests/test_waveform1d.py +++ b/tests/unit_tests/test_waveform1d.py @@ -73,7 +73,7 @@ def test_create_waveform1D_by_config(qtbot, mocked_client): "x_grid": False, "y_grid": False, }, - "color_palette": "plasma", + "color_palette": "magma", "curves": { "bpm4i-bpm4i": { "widget_class": "BECCurve", @@ -81,11 +81,11 @@ def test_create_waveform1D_by_config(qtbot, mocked_client): "parent_id": "widget_1", "label": "bpm4i-bpm4i", "color": "#cc4778", - "color_map_z": "plasma", + "color_map_z": "magma", "symbol": "o", "symbol_color": None, - "symbol_size": 5, - "pen_width": 2, + "symbol_size": 7, + "pen_width": 4, "pen_style": "dash", "source": "scan_segment", "signals": { @@ -114,11 +114,11 @@ def test_create_waveform1D_by_config(qtbot, mocked_client): "parent_id": "widget_1", "label": "curve-custom", "color": "blue", - "color_map_z": "plasma", + "color_map_z": "magma", "symbol": "o", "symbol_color": None, - "symbol_size": 5, - "pen_width": 2, + "symbol_size": 7, + "pen_width": 5, "pen_style": "dashdot", "source": "custom", "signals": None, @@ -155,11 +155,11 @@ def test_getting_curve(qtbot, mocked_client): gui_id="test_curve", parent_id=w1.gui_id, label="bpm4i-bpm4i", - color="#cc4778", + color="#b73779", symbol="o", symbol_color=None, - symbol_size=5, - pen_width=2, + symbol_size=7, + pen_width=4, pen_style="solid", source="scan_segment", signals=Signal( @@ -398,11 +398,11 @@ def test_curve_add_by_config(qtbot, mocked_client): "parent_id": "widget_1", "label": "bpm4i-bpm4i", "color": "#cc4778", - "color_map_z": "plasma", + "color_map_z": "magma", "symbol": "o", "symbol_color": None, - "symbol_size": 5, - "pen_width": 2, + "symbol_size": 7, + "pen_width": 4, "pen_style": "dash", "source": "scan_segment", "signals": { @@ -522,7 +522,7 @@ def test_scatter_2d_update(qtbot, mocked_client): data = c1.get_data() expected_x_y_data = ([1, 2, 3], [1, 2, 3]) - expected_z_colors = w1._make_z_gradient([1, 3, 2], "plasma") + expected_z_colors = w1._make_z_gradient([1, 3, 2], "magma") scatter_points = c1.scatter.points() colors = [point.brush().color() for point in scatter_points] diff --git a/tests/unit_tests/test_waveform_widget.py b/tests/unit_tests/test_waveform_widget.py index 2fb41d66..19a71849 100644 --- a/tests/unit_tests/test_waveform_widget.py +++ b/tests/unit_tests/test_waveform_widget.py @@ -66,7 +66,7 @@ def test_waveform_plot_data(waveform_widget, mock_waveform): y_entry=None, z_entry=None, color=None, - color_map_z="plasma", + color_map_z="magma", label=None, validate=True, dap=None, @@ -86,7 +86,7 @@ def test_waveform_plot_scan_curves(waveform_widget, mock_waveform): y_entry=None, z_entry=None, color=None, - color_map_z="plasma", + color_map_z="magma", label=None, validate=True, dap="GaussianModel",