Clean up all docstrings.

This commit is contained in:
Pim Nelissen
2026-01-27 21:17:02 +01:00
parent 470bf79b69
commit f9ff50f4ef
4 changed files with 29 additions and 35 deletions

View File

@ -8,9 +8,9 @@ class Isotope:
"""_Represents the essential information of an isotope._ """_Represents the essential information of an isotope._
Args: Args:
name (str): _Full name (e.g. Caesium-137)._ name (str): Full name (e.g. Caesium-137).
E (float): _Energy of the primary gamma in keV._ E (float): Energy of the primary gamma in keV.
b (float): _Branching ratio for the gamma at energy E._ b (float): Branching ratio for the gamma at energy E.
""" """
if E <= 0: if E <= 0:

View File

@ -15,12 +15,9 @@ class Landscape:
"""_A generic Landscape that can contain a Path and sources._ """_A generic Landscape that can contain a Path and sources._
Args: Args:
air_density (float, optional): _Air density in kg / m^3_. Defaults to 1.243. 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. 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'. scale (str, optional): The scale of the size argument passed. Defaults to 'meters'.
Raises:
TypeError: _description_
""" """
if isinstance(size, int): if isinstance(size, int):
@ -103,11 +100,11 @@ def create_landscape_from_path(path: Path, max_z = 500):
the size of the Landscape._ the size of the Landscape._
Args: Args:
path (Path): _A Path object describing the trajectory._ path (Path): A Path object describing the trajectory.
max_z (int, optional): _Height of the world_. Defaults to 500 meters. max_z (int, optional): Height of the world. Defaults to 500 meters.
Returns: 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_x = np.ceil(max(path.x_list))
max_y = np.ceil(max(path.y_list)) max_y = np.ceil(max(path.y_list))

View File

@ -38,15 +38,15 @@ class Source(Object):
"""_A point source._ """_A point source._
Args: Args:
x (float): _X coordinate._ x (float): X coordinate.
y (float): _Y coordinate._ y (float): Y coordinate.
z (float): _Z coordinate._ z (float): Z coordinate.
activity (int): _Activity A in MBq._ activity (int): Activity A in MBq.
isotope (Isotope): _The isotope._ isotope (Isotope): The isotope.
name (str | None, optional): _Can give the source a unique name_. name (str | None, optional): Can give the source a unique name.
Defaults to None, making the name sequential Defaults to None, making the name sequential.
(Source-1, Source-2, etc.). (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 self.id = Source._id_counter
Source._id_counter += 1 Source._id_counter += 1

View File

@ -45,14 +45,11 @@ class Path:
z: float = 0, z: float = 0,
simplify_path = False 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: Args:
coord_list (Sequence[tuple[float, float]]): _description_ coord_list (Sequence[tuple[float, float]]): List of x,y coordinates.
z (float, optional): _description_. Defaults to 0. z (float, optional): Height of the path. Defaults to 0.
Raises:
ValueError: _description_
""" """
if len(coord_list) < 2: if len(coord_list) < 2:
@ -114,12 +111,12 @@ def piecewise_regression_on_path(
order to find better global optima." order to find better global optima."
Args: Args:
x (Sequence[float]): _Full list of x coordinates._ x (Sequence[float]): Full list of x coordinates.
y (Sequence[float]): _Full list of y coordinates._ y (Sequence[float]): Full list of y coordinates.
keep_endpoints_equal (bool, optional): _Whether or not to force start 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 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._ approximation at the beginning and end of path. Defaults to False.
n_breakpoints (int, optional): _Number of breakpoints. Defaults to 3._ n_breakpoints (int, optional): Number of breakpoints. Defaults to 3.
Returns: Returns:
x (Sequence[float]): _Reduced list of x coordinates._ 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._ """_Construct a path from East and North formatted coordinates (RT90) in a Pandas DataFrame._
Args: Args:
df (pd.DataFrame): _DataFrame containing at least the two columns noted in the cols argument._ 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._ east_col (str): The column name for the East coordinates.
north_col (str): _The column name for the North coordinates._ north_col (str): The column name for the North coordinates.
Returns: 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]) east_arr = np.array(df[east_col]) - min(df[east_col])