From f9ff50f4ef5d606ffcbaf1bd32b09cdefe2f6fdf Mon Sep 17 00:00:00 2001 From: Pim Nelissen Date: Tue, 27 Jan 2026 21:17:02 +0100 Subject: [PATCH] Clean up all docstrings. --- src/pg_rad/isotope.py | 6 +++--- src/pg_rad/landscape.py | 15 ++++++--------- src/pg_rad/objects.py | 16 ++++++++-------- src/pg_rad/path.py | 27 ++++++++++++--------------- 4 files changed, 29 insertions(+), 35 deletions(-) diff --git a/src/pg_rad/isotope.py b/src/pg_rad/isotope.py index b9e3469..77cb60d 100644 --- a/src/pg_rad/isotope.py +++ b/src/pg_rad/isotope.py @@ -8,9 +8,9 @@ class Isotope: """_Represents the essential information of an isotope._ Args: - name (str): _Full name (e.g. Caesium-137)._ - E (float): _Energy of the primary gamma in keV._ - b (float): _Branching ratio for the gamma at energy E._ + name (str): Full name (e.g. Caesium-137). + E (float): Energy of the primary gamma in keV. + b (float): Branching ratio for the gamma at energy E. """ if E <= 0: diff --git a/src/pg_rad/landscape.py b/src/pg_rad/landscape.py index 85df544..88ac625 100644 --- a/src/pg_rad/landscape.py +++ b/src/pg_rad/landscape.py @@ -15,12 +15,9 @@ class Landscape: """_A generic Landscape that can contain a Path and sources._ Args: - air_density (float, optional): _Air density in kg / m^3_. Defaults to 1.243. - size (int | tuple[int, int, int], optional): _Size of the world_. Defaults to 500. - scale (str, optional): _The scale of the size argument passed_. Defaults to 'meters'. - - Raises: - TypeError: _description_ + air_density (float, optional): Air density in kg / m^3. Defaults to 1.243. + size (int | tuple[int, int, int], optional): Size of the world. Defaults to 500. + scale (str, optional): The scale of the size argument passed. Defaults to 'meters'. """ if isinstance(size, int): @@ -103,11 +100,11 @@ def create_landscape_from_path(path: Path, max_z = 500): the size of the Landscape._ Args: - path (Path): _A Path object describing the trajectory._ - max_z (int, optional): _Height of the world_. Defaults to 500 meters. + path (Path): A Path object describing the trajectory. + max_z (int, optional): Height of the world. Defaults to 500 meters. Returns: - _type_: _A Landscape with dimensions based on the provided Path._ + Landscape: A Landscape with dimensions based on the provided Path. """ max_x = np.ceil(max(path.x_list)) max_y = np.ceil(max(path.y_list)) diff --git a/src/pg_rad/objects.py b/src/pg_rad/objects.py index f0e9c49..752c814 100644 --- a/src/pg_rad/objects.py +++ b/src/pg_rad/objects.py @@ -38,15 +38,15 @@ class Source(Object): """_A point source._ Args: - x (float): _X coordinate._ - y (float): _Y coordinate._ - z (float): _Z coordinate._ - activity (int): _Activity A in MBq._ - isotope (Isotope): _The isotope._ - name (str | None, optional): _Can give the source a unique name_. - Defaults to None, making the name sequential + x (float): X coordinate. + y (float): Y coordinate. + z (float): Z coordinate. + activity (int): Activity A in MBq. + isotope (Isotope): The isotope. + name (str | None, optional): Can give the source a unique name. + Defaults to None, making the name sequential. (Source-1, Source-2, etc.). - color (str, optional): _Matplotlib compatible color string_. Defaults to "red". + color (str, optional): Matplotlib compatible color string. Defaults to "red". """ self.id = Source._id_counter Source._id_counter += 1 diff --git a/src/pg_rad/path.py b/src/pg_rad/path.py index 2f4f873..62122cc 100644 --- a/src/pg_rad/path.py +++ b/src/pg_rad/path.py @@ -45,14 +45,11 @@ class Path: z: float = 0, simplify_path = False ): - """Construct a path of sequences based on a list of coordinates. + """_Construct a path of sequences based on a list of coordinates._ Args: - coord_list (Sequence[tuple[float, float]]): _description_ - z (float, optional): _description_. Defaults to 0. - - Raises: - ValueError: _description_ + coord_list (Sequence[tuple[float, float]]): List of x,y coordinates. + z (float, optional): Height of the path. Defaults to 0. """ if len(coord_list) < 2: @@ -114,12 +111,12 @@ def piecewise_regression_on_path( order to find better global optima." Args: - x (Sequence[float]): _Full list of x coordinates._ - y (Sequence[float]): _Full list of y coordinates._ - keep_endpoints_equal (bool, optional): _Whether or not to force start + x (Sequence[float]): Full list of x coordinates. + y (Sequence[float]): Full list of y coordinates. + keep_endpoints_equal (bool, optional): Whether or not to force start and end to be exactly equal to the original. This will worsen the linear - approximation at the beginning and end of path. Defaults to False._ - n_breakpoints (int, optional): _Number of breakpoints. Defaults to 3._ + approximation at the beginning and end of path. Defaults to False. + n_breakpoints (int, optional): Number of breakpoints. Defaults to 3. Returns: x (Sequence[float]): _Reduced list of x coordinates._ @@ -170,12 +167,12 @@ def path_from_RT90( """_Construct a path from East and North formatted coordinates (RT90) in a Pandas DataFrame._ Args: - df (pd.DataFrame): _DataFrame containing at least the two columns noted in the cols argument._ - east_col (str): _The column name for the East coordinates._ - north_col (str): _The column name for the North coordinates._ + df (pd.DataFrame): DataFrame containing at least the two columns noted in the cols argument. + east_col (str): The column name for the East coordinates. + north_col (str): The column name for the North coordinates. Returns: - Path: _A Path object built from the aquisition coordinates in the DataFrame._ + Path: A Path object built from the aquisition coordinates in the DataFrame. """ east_arr = np.array(df[east_col]) - min(df[east_col])