Skip to content

Commit

Permalink
Merge pull request #86 from boschresearch/68-pandas-cow-compliance
Browse files Browse the repository at this point in the history
Fix most of the COW issues
  • Loading branch information
johannes-mueller authored Jul 2, 2024
2 parents 828e6ec + 6a7daf0 commit b66ab6f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pylife/materiallaws/woehlercurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def transform_to_failure_probability(self, failure_probability):

SD = np.asarray(obj.SD / 10**((native_ppf-goal_ppf)*scattering_range_to_std(obj.TS)))
ND = np.asarray(obj.ND / 10**((native_ppf-goal_ppf)*scattering_range_to_std(obj.TN)))
ND.flags.writeable = True
ND[SD != 0] *= np.power(SD[SD != 0]/obj.SD, -obj.k_1)

transformed = obj.copy()
Expand Down Expand Up @@ -265,7 +266,7 @@ def basquin_load(self, cycles, failure_probability=0.5):
transformed = self.transform_to_failure_probability(failure_probability)

cyc, wc = transformed.broadcast(cycles)
load = np.asarray(wc.SD.copy())
load = np.asarray(wc.SD).copy()

k = self._make_k(-cyc, -wc.ND, wc)
in_limit = np.isfinite(k)
Expand All @@ -276,7 +277,7 @@ def basquin_load(self, cycles, failure_probability=0.5):
return pd.Series(load, index=cyc.index)

def _make_k(self, src, ref, wc):
k = np.asarray(wc.k_1)
k = np.asarray(wc.k_1).copy()
k_2 = np.asarray(wc.k_2)

below_limit = np.asarray(src < ref)
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import pandas as pd
pd.options.mode.copy_on_write = True

0 comments on commit b66ab6f

Please sign in to comment.