fix: add self when refering to coords

Signed-off-by: Dev Singh <dev@devksingh.com>
This commit is contained in:
Dev Singh 2020-09-23 14:34:34 +00:00
parent 1628807c31
commit 11b1db19cd

View File

@ -38,7 +38,7 @@ class CircleFit:
self.ournp = np #todo: implement cupy correctly self.ournp = np #todo: implement cupy correctly
else: else:
# following block combines x and y into one array if not already done # following block combines x and y into one array if not already done
self.coords = self.ournp.vstack(([x_data.T], [y_data.T])).T self.coords = self.ournp.vstack(([x.T], [y.T])).T
def calc_R(x, y, xc, yc): def calc_R(x, y, xc, yc):
"""Returns distance between center and point""" """Returns distance between center and point"""
return self.ournp.sqrt((x-xc)**2 + (y-yc)**2) return self.ournp.sqrt((x-xc)**2 + (y-yc)**2)
@ -48,8 +48,8 @@ class CircleFit:
return Ri - Ri.mean() return Ri - Ri.mean()
def LSC(self): def LSC(self):
"""Fits given data to a circle and returns the center, radius, and variance""" """Fits given data to a circle and returns the center, radius, and variance"""
x = coords[:, 0] x = self.coords[:, 0]
y = coords[:, 1] y = self.coords[:, 1]
# guessing at a center # guessing at a center
x_m = self.ournp.mean(x) x_m = self.ournp.mean(x)
y_m = self.ournp.mean(y) y_m = self.ournp.mean(y)