def process_data(r0): r0 = lm.shuffle_points(r0) ### CPD registration rtemp0, n, i = lm.get_shape_with_most_points(r0) r1 = lm.register_cpd(r0, rtemp0) ### reorder points: r2 = lm.reorder_points(r1, optimum_order=True, ensure_clockwise=True) ### correspondence: rtemp1 = r2[i] r3 = lm.set_npoints(r2, n) r4 = lm.corresp_roll(r3, rtemp1) return r4, rtemp1
#(0) Load data: dirREPO = lm.get_repository_path() names = [ 'Bell', 'Comma', 'Device8', 'Face', 'Flatfish', 'Hammer', 'Heart', 'Horseshoe', 'Key' ] name = names[0] fnameCSV = os.path.join(dirREPO, 'Data', name, 'contours_sroc.csv') r = lm.read_csv(fnameCSV) i0, i1 = 1, 2 r0, r1 = r[i0], r[i1] #(1) Process: np.random.seed(0) ### shuffle: rA0, rA1 = lm.shuffle_points(r0), lm.shuffle_points(r1) ### reorder: rB0, rB1 = [ lm.reorder_points(r, optimum_order=True, ensure_clockwise=True) for r in [rA0, rA1] ] ### optimum roll correspondence: rD0 = rB0.copy() rD1 = lm.corresp_roll(rB1, rB0) ### intermediary roll: rC0 = rB0.copy() rC1 = np.roll(rB1, 75, axis=0) #(1) Plot: plt.close('all') lm.set_matplotlib_rcparams()
r3 = lm.set_npoints(r2, n) r4 = lm.corresp_roll(r3, rtemp1) return r4, rtemp1 #(0) Process data: ### load data dirREPO = lm.get_repository_path() names = [ 'Bell', 'Comma', 'Device8', 'Face', 'Flatfish', 'Hammer', 'Heart', 'Horseshoe', 'Key' ] name = names[6] fname0 = os.path.join(dirREPO, 'Data', name, 'contours.csv') r0 = lm.read_csv(fname0) r0 = lm.shuffle_points(r0) ### CPD registration rtemp0, n, i = lm.get_shape_with_most_points(r0) r1 = lm.register_cpd(r0, rtemp0) ### reorder points: r2 = lm.reorder_points(r1, optimum_order=True, ensure_clockwise=True) ### correspondence: rtemp1 = r2[i] r3 = lm.set_npoints(r2, n) r4 = lm.corresp_roll(r3, rtemp1) ### process data: np.random.seed(0) # Case 1 r1, rtemp1 = process_data(r0) np.random.seed(2) # Case 2 r2, rtemp2 = process_data(r0) ### hypothesis tests: