def getMagnification(dicdict): XYgood = np.column_stack((dicdict['X'].ravel(), dicdict['Y'].ravel())) xygood = np.column_stack((dicdict['x'].ravel(), dicdict['y'].ravel())) XYmag = np.sum(XYgood,axis=1) indexsmall, indexlarge = np.nanargmin(XYmag), np.nanargmax(XYmag) distpix = Mmath.get_dist(xygood[indexsmall,:].astype('float64'), xygood[indexlarge,:].astype('float64')) distreal = Mmath.get_dist(XYgood[indexsmall,:], XYgood[indexlarge,:]) return distreal/distpix
def distance_matrix(xy): n = np.shape(xy)[0] dist = np.zeros((n, n)) for i, acurr in enumerate(xy): for j, bcurr in enumerate(xy): dist[i, j] = Mmath.get_dist(acurr, bcurr) return dist