Skip to content

Commit

Permalink
Update the docstrings in Arithmetic.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MBartkowiakSTFC committed Dec 17, 2024
1 parent b0ba6aa commit 8bd7909
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions MDANSE/Src/MDANSE/Mathematics/Arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@


def get_weights(props: Dict[str, float], contents: Dict[str, int], dim: int):
"""Calculates the scaling factor to be applied to output datasets
of an analysis.
"""Calculates the scaling factors to be applied to output datasets
of an analysis. Returns an dictionary of scaling factors, where the
chemical elements identifying each dataset are the keys.
Parameters
----------
Expand Down Expand Up @@ -72,7 +73,8 @@ def assign_weights(
key: str,
symmetric: bool = True,
):
"""_summary_
"""Updates the scaling factors of partial datasets, without
modifying the data.
Parameters
----------
Expand All @@ -92,7 +94,6 @@ def assign_weights(
np.ndarray
total sum of all the component arrays scaled by their weights
"""
weightedSum = None
matches = dict([(key % k, k) for k in list(weights.keys()) if k not in ["sum"]])
dim = key.count("%s")

Expand All @@ -108,16 +109,16 @@ def assign_weights(

values[k].scaling_factor *= w

return weightedSum


def weighted_sum(
values: Dict[str, np.ndarray],
weights: Dict[str, float],
key: str,
update_partials: bool = False,
):
"""_summary_
"""Sums up partial datasets multiplied by their scaling factors.
The scaling factors have to be set before, typically by calling
the assign_weights function.
Parameters
----------
Expand Down

0 comments on commit 8bd7909

Please sign in to comment.