61 Estimates the transfer length of all cracks according to \ref methods.
62 Limits that are `None` are replaced by \f$-\infty\f$ for the left and \f$\infty\f$ right limit prior to the assignments
63 \param x Positional x values.
64 \param strain List of strain values.
65 \param crack_list \ref cracks.CrackList with \ref cracks.Crack objects, that already have assigned locations.
66 \return Returns a \ref cracks.CrackList object.
69 for crack
in crack_list:
70 crack.x_l = crack.x_l
if crack.x_l
is not None else -np.inf
71 crack.x_r = crack.x_r
if crack.x_r
is not None else np.inf
72 methods = copy.deepcopy(self.
methods)
73 reset = methods.pop(
"reset",
None)
75 for i, crack
in enumerate(crack_list):
76 if i < len(crack_list)-1
or reset ==
"all":
78 if i > 0
or reset ==
"all":
80 for method, value
in methods.items():
81 for i, crack
in enumerate(crack_list):
82 if method ==
"middle":
84 middle = (crack_list[i-1].location + crack.location)/2
85 crack.x_l = max(middle, crack.x_l)
86 crack_list[i-1].x_r = min(middle, crack_list[i-1].x_r)
89 left_peak_index = crack_list[i-1].index
90 right_peak_index = crack.index
91 left_valley = strain[left_peak_index:right_peak_index]
92 min_index = np.argmin(left_valley) + left_peak_index
93 crack.x_l = max(x[min_index], crack.x_l)
94 crack_list[i-1].x_r = min(x[min_index], crack_list[i-1].x_r)
95 elif method ==
"threshold":
96 left_peak_index = crack_list[i-1].index
if i > 1
else 0
97 right_peak_index = crack.index[i+1]
if i < len(x) - 1
else len(len(x) - 1)
98 left_valley = strain[left_peak_index:crack.index+1].reverse()
99 right_valley = strain[crack.index:right_peak_index+1]
102 if l_index
is not None:
103 crack.x_l = x[crack.index - l_index]
104 if r_index
is not None:
105 crack.x_r = x[crack.index + r_index]
106 elif method ==
"length":
107 crack.x_l = max(crack.location - value, crack.x_l)
108 crack.x_r = min(crack.location + value, crack.x_r)
110 raise ValueError(
"No such option '{}' known for `method`.".format(method))