Skip to content

Commit

Permalink
Add docstrings
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Maier <[email protected]>
  • Loading branch information
maierbn committed Oct 10, 2023
1 parent c501da0 commit 900ecc2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pylife/materiallaws/notch_approximation_law.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,15 +454,14 @@ class Binned:
"""

def __init__(self, notch_approximation_law, maximum_absolute_load, number_of_bins=100):

self._notch_approximation_law = notch_approximation_law
self._maximum_absolute_load = maximum_absolute_load
self._number_of_bins = number_of_bins
self._create_bins()

def _create_bins(self):

"""Initialize the lookup tables by precomputing the notch approximation law values.
"""
# for multiple assessment points at once use a DataFrame with MultiIndex
if isinstance(self._maximum_absolute_load, pd.DataFrame):
assert self._maximum_absolute_load.index.name == "node_id"
Expand All @@ -475,6 +474,8 @@ def _create_bins(self):


def _create_bins_single_assessment_point(self):
"""Initialize the lookup tables by precomputing the notch approximation law values,
for the case of scalar variables, i.e., only a single assessment point."""

# create look-up table (lut) for the primary branch values, named PFAD in FKM nonlinear
self._lut_primary_branch = pd.DataFrame(0,
Expand Down Expand Up @@ -509,6 +510,8 @@ def _create_bins_single_assessment_point(self):
self._lut_secondary_branch.delta_stress, self._lut_secondary_branch.delta_load)

def _create_bins_multiple_assessment_points(self):
"""Initialize the lookup tables by precomputing the notch approximation law values,
for the case of vector-valued variables caused by an assessment on multiple points at once."""

# name column "max_abs_load"
self._maximum_absolute_load.rename(columns={self._maximum_absolute_load.columns[0]: "max_abs_load"}, inplace=True)
Expand Down

0 comments on commit 900ecc2

Please sign in to comment.