|
17 | 17 | # Orchestrates data preparation and figure generation for plate layouts. |
18 | 18 | # |
19 | 19 | # Authors: Ramiz GINDULLIN (ramiz.gindullin@it.uu.se) |
20 | | -# Version: 1.3.4 |
21 | | -# Last Revision: March 2026 |
| 20 | +# Version: 1.3.5 |
| 21 | +# Last Revision: April 2026 |
22 | 22 | # |
23 | 23 |
|
24 | 24 | import logging |
|
32 | 32 | from core.io_utils import read_csv_file |
33 | 33 | from core.layout_utils import find_all_plates_concentrations |
34 | 34 | from core.layout_utils import transform_concentrations_to_alphas |
35 | | -from models.constants import Visualization, Performance, FigureProperties |
| 35 | +from models.constants import PlateDefaults, Visualization, Performance, FigureProperties |
36 | 36 |
|
37 | 37 | logger = logging.getLogger(__name__) |
38 | 38 |
|
@@ -228,9 +228,9 @@ def plot_plate_wells(self, ax, plate_data: List, viz_state: VisualizationState) |
228 | 228 |
|
229 | 229 | for well in materials[material]: |
230 | 230 | if is_switched: |
231 | | - [y_coord, x_coord] = transform_coordinate(well[0]) |
| 231 | + y_coord, x_coord = transform_coordinate(well[0]) |
232 | 232 | else: |
233 | | - [x_coord, y_coord] = transform_coordinate(well[0]) |
| 233 | + x_coord, y_coord = transform_coordinate(well[0]) |
234 | 234 |
|
235 | 235 | x_coords.append(x_coord + Visualization.WELL_COORDINATE_OFFSET) |
236 | 236 | y_coords.append(y_coord + Visualization.WELL_COORDINATE_OFFSET) |
@@ -361,10 +361,11 @@ def _concentration_to_size( |
361 | 361 | """ |
362 | 362 | from core.layout_utils import to_number_if_possible |
363 | 363 |
|
364 | | - # if the plate differs from 16x24 then we need to readjust the size ranges |
| 364 | + # if the plate differs from 24x16 then we need to readjust the size ranges |
365 | 365 | # We do not increase more than 1 / 0.7 to keep the marker size reasonable |
| 366 | + # NOTE: we use the reoriented grid, thus PlateDefaults.COLS and PlateDefaults.ROWS are swapped |
366 | 367 | plate_num_rows, plate_num_cols, _ = self._resolve_orientation(plate_num_rows, plate_num_cols) |
367 | | - ratio = max(0.7, plate_num_rows / 24, plate_num_cols / 16) |
| 368 | + ratio = max(0.7, plate_num_rows / int(PlateDefaults.COLS), plate_num_cols / int(PlateDefaults.ROWS)) |
368 | 369 |
|
369 | 370 | # Get size range from constants |
370 | 371 | size_min = math.floor(Visualization.CONCENTRATION_SIZE_MIN / ratio) |
@@ -451,7 +452,7 @@ def _generate_colors(self, concentrations_list: Dict[str, List[Any]]) -> Dict[st |
451 | 452 | return material_colors |
452 | 453 |
|
453 | 454 | def _resolve_orientation(self, num_rows: int, num_cols: int) -> Tuple[int, int, bool]: |
454 | | - """Return (effective_rows, effective_cols, is_switched). |
| 455 | + """Return (num_rows, num_cols, is_switched). |
455 | 456 | |
456 | 457 | MPLACE convention: wider dimension is always horizontal (x-axis). |
457 | 458 | If num_cols > num_rows the axes are swapped for display. |
|
0 commit comments