From 5a7c2338f38747b02b9325af0941ca7ac48afcb3 Mon Sep 17 00:00:00 2001 From: Pim Nelissen Date: Tue, 27 Jan 2026 21:09:13 +0100 Subject: [PATCH] rename units to scale for the size of the world --- src/pg_rad/landscape.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/pg_rad/landscape.py b/src/pg_rad/landscape.py index 601b360..3644cba 100644 --- a/src/pg_rad/landscape.py +++ b/src/pg_rad/landscape.py @@ -6,7 +6,12 @@ from pg_rad.path import Path from pg_rad.objects import Source class Landscape: - def __init__(self, size: int | tuple[int, int, int] = 500, unit = 'meters'): + def __init__( + self, + size: int | tuple[int, int, int] = 500, + scale = 'meters', + ): + if isinstance(size, int): self.world = np.zeros((size, size, size)) elif isinstance(size, tuple) and len(size) == 3: @@ -14,7 +19,7 @@ class Landscape: else: raise TypeError("size must be an integer or a tuple of 3 integers.") - self.unit = unit + self.scale = scale self.path: Path = None self.sources: list[Source] = [] @@ -33,8 +38,8 @@ class Landscape: fig, ax = plt.subplots() ax.set_xlim(right=x_lim) ax.set_ylim(top=y_lim) - ax.set_xlabel(f"X [{self.unit}]") - ax.set_ylabel(f"Y [{self.unit}]") + ax.set_xlabel(f"X [{self.scale}]") + ax.set_ylabel(f"Y [{self.scale}]") if not self.path == None: ax.plot(self.path.x_list, self.path.y_list, 'bo-')