|
1 | 1 | # SPDX-FileCopyrightText: 2021-2025 EasyDiffraction Python Library contributors <https://github.com/easyscience/diffraction-lib> |
2 | 2 | # SPDX-License-Identifier: BSD-3-Clause |
3 | 3 |
|
4 | | -from easydiffraction.core.constants import DEFAULT_AXES_LABELS |
5 | 4 | from easydiffraction.plotting.plotters.plotter_ascii import AsciiPlotter |
| 5 | +from easydiffraction.plotting.plotters.plotter_base import DEFAULT_AXES_LABELS |
6 | 6 | from easydiffraction.plotting.plotters.plotter_base import DEFAULT_ENGINE |
7 | 7 | from easydiffraction.plotting.plotters.plotter_base import DEFAULT_HEIGHT |
8 | 8 | from easydiffraction.plotting.plotters.plotter_base import DEFAULT_MAX |
@@ -120,7 +120,15 @@ def show_supported_engines(self): |
120 | 120 | columns_data=columns_data, |
121 | 121 | ) |
122 | 122 |
|
123 | | - def plot_meas(self, pattern, expt_name, expt_type, x_min=None, x_max=None, d_spacing=False): |
| 123 | + def plot_meas( |
| 124 | + self, |
| 125 | + pattern, |
| 126 | + expt_name, |
| 127 | + expt_type, |
| 128 | + x_min=None, |
| 129 | + x_max=None, |
| 130 | + d_spacing=False, |
| 131 | + ): |
124 | 132 | if pattern.x is None: |
125 | 133 | error(f'No data available for experiment {expt_name}') |
126 | 134 | return |
@@ -149,9 +157,19 @@ def plot_meas(self, pattern, expt_name, expt_type, x_min=None, x_max=None, d_spa |
149 | 157 | y_labels = ['meas'] |
150 | 158 |
|
151 | 159 | if d_spacing: |
152 | | - axes_labels = DEFAULT_AXES_LABELS[expt_type.scattering_type.value]['d-spacing'] |
| 160 | + axes_labels = DEFAULT_AXES_LABELS[ |
| 161 | + ( |
| 162 | + expt_type.scattering_type.value, |
| 163 | + 'd-spacing', |
| 164 | + ) |
| 165 | + ] |
153 | 166 | else: |
154 | | - axes_labels = DEFAULT_AXES_LABELS[expt_type.scattering_type.value][expt_type.beam_mode.value] |
| 167 | + axes_labels = DEFAULT_AXES_LABELS[ |
| 168 | + ( |
| 169 | + expt_type.scattering_type.value, |
| 170 | + expt_type.beam_mode.value, |
| 171 | + ) |
| 172 | + ] |
155 | 173 |
|
156 | 174 | self._plotter.plot( |
157 | 175 | x=x, |
@@ -199,9 +217,19 @@ def plot_calc( |
199 | 217 | y_labels = ['calc'] |
200 | 218 |
|
201 | 219 | if d_spacing: |
202 | | - axes_labels = DEFAULT_AXES_LABELS[expt_type.scattering_type.value]['d-spacing'] |
| 220 | + axes_labels = DEFAULT_AXES_LABELS[ |
| 221 | + ( |
| 222 | + expt_type.scattering_type.value, |
| 223 | + 'd-spacing', |
| 224 | + ) |
| 225 | + ] |
203 | 226 | else: |
204 | | - axes_labels = DEFAULT_AXES_LABELS[expt_type.scattering_type.value][expt_type.beam_mode.value] |
| 227 | + axes_labels = DEFAULT_AXES_LABELS[ |
| 228 | + ( |
| 229 | + expt_type.scattering_type.value, |
| 230 | + expt_type.beam_mode.value, |
| 231 | + ) |
| 232 | + ] |
205 | 233 |
|
206 | 234 | self._plotter.plot( |
207 | 235 | x=x, |
@@ -259,9 +287,19 @@ def plot_meas_vs_calc( |
259 | 287 | y_labels = ['meas', 'calc'] |
260 | 288 |
|
261 | 289 | if d_spacing: |
262 | | - axes_labels = DEFAULT_AXES_LABELS[expt_type.scattering_type.value]['d-spacing'] |
| 290 | + axes_labels = DEFAULT_AXES_LABELS[ |
| 291 | + ( |
| 292 | + expt_type.scattering_type.value, |
| 293 | + 'd-spacing', |
| 294 | + ) |
| 295 | + ] |
263 | 296 | else: |
264 | | - axes_labels = DEFAULT_AXES_LABELS[expt_type.scattering_type.value][expt_type.beam_mode.value] |
| 297 | + axes_labels = DEFAULT_AXES_LABELS[ |
| 298 | + ( |
| 299 | + expt_type.scattering_type.value, |
| 300 | + expt_type.beam_mode.value, |
| 301 | + ) |
| 302 | + ] |
265 | 303 |
|
266 | 304 | if show_residual: |
267 | 305 | y_resid = y_meas - y_calc |
|
0 commit comments