def update_distances(self):
"""
Calculate the distances between the observed series and the stresses.
Returns
-------
distances: pandas.DataFrame
pandas dataframe with the distances between the oseries (index)
and the stresses (columns).
"""
# Make sure these are values, even when actually objects.
xo = pd.to_numeric(self.oseries.x)
xt = pd.to_numeric(self.stresses.x)
yo = pd.to_numeric(self.oseries.y)
yt = pd.to_numeric(self.stresses.y)
xh, xi = np.meshgrid(xt, xo)
yh, yi = np.meshgrid(yt, yo)
self.distances = pd.DataFrame(np.sqrt((xh - xi) ** 2 + (yh - yi) ** 2),
index=self.oseries.index,
columns=self.stresses.index)
评论列表
文章目录