From 3ada720db934f7f1c6f96bbd49894a122ad4712a Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Fri, 26 Apr 2024 03:05:17 +0200 Subject: [PATCH] Add execution results, plot of locations and distance analysis --- datasets/raise/flat-field_pointer.py | 55 +++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/datasets/raise/flat-field_pointer.py b/datasets/raise/flat-field_pointer.py index 76f0581..a645e66 100644 --- a/datasets/raise/flat-field_pointer.py +++ b/datasets/raise/flat-field_pointer.py @@ -9,7 +9,7 @@ from tqdm import tqdm os.chdir('flat-field/TIF') -fileNames = os.listdir()[:3] +fileNames = sorted(os.listdir())[41:] fileNameIndex = 0 xys = [] progressBar = tqdm(total = len(fileNames)) @@ -34,11 +34,56 @@ def displayImage(): def onClick(event): global xys - if event.button is MouseButton.RIGHT: - xy = [event.x, event.y] + button = event.button + if button is MouseButton.RIGHT: + xy = [event.xdata, event.ydata] xys += [xy] + if button is MouseButton.MIDDLE or button is MouseButton.RIGHT: + if button is MouseButton.MIDDLE: + print(f'Skipped {fileName}') plt.close() displayImage() - progressBar.update(1) + progressBar.update(1) -displayImage() \ No newline at end of file +displayImage() + +## + +xys = [[3061.83568617998, 842.2814890347822], [3048.9553647053262, 891.7951806771933], [3109.6923734795832, 878.8472318972372], [3095.1992301129835, 859.646383417094], [3044.950680354029, 830.531447782855], [3034.039239345914, 775.7097977790371], [3034.0562409262707, 753.1780473232427], [2991.7499740162116, 742.1417475753151], [3021.5541233968024, 737.7119154247914], [3022.412107608028, 703.0028101114289], [3094.4565209481857, 680.7339885543926], [3101.840188177543, 692.6886985125186], [3150.09819940581, 686.3913997808281], [3148.4955568040136, 694.3747788064451], [3165.156239230552, 703.9346483213995], [3158.7235775979357, 710.9522942666542], [3156.5302112965014, 697.5993396871294], [3106.8119050930513, 698.4561327048264], [3151.4728367372877, 694.3380683877142], [3137.283014559081, 662.9543422436452], [3008.1987322850605, 692.0180565561739], [3036.647953172549, 705.1188029786949], [2988.9166660643627, 684.0851408200217], [3001.5070402052334, 684.1944057536488], [2967.282534077184, 680.6072888791263], [2983.5140619626286, 693.469904886339], [2979.972210442175, 702.9033995969894], [2974.7535915953795, 709.6086279669086], [2972.55952140686, 700.4689248964266], [2967.1769510144627, 703.4861098128929], [2968.4714535085923, 708.5924315970815], [2978.725084963369, 725.0064286729727], [2992.7472737250696, 718.9682686788141], [2999.106406229902, 713.0463041988097], [2981.5746364633296, 692.5739107725338], [3014.22885383495, 675.1638989177214], [3004.351989366563, 635.6738446427469], [2964.9109157636794, 580.2416938434527], [2976.672441933737, 599.3922555819147], [2972.9623072548534, 578.6218471929612], [2694.5865522760287, 972.5526873692775], [2924.1211630176217, 1115.9816839025543], [2910.2861978522596, 1095.5172128924614], [2917.4530137143342, 1067.9680470058072], [2919.3469031337613, 1068.44539073963], [2959.4757277956496, 1105.6227950624348], [2936.370033263817, 1157.9142039933472], [2965.3568614486203, 1145.3186319170795], [2951.1991473505136, 1070.8989245366433], [2946.108094501549, 1045.891549058405], [2947.19213475732, 1074.4303801863052], [2943.690837961984, 1071.4536958497956], [3021.083385372544, 1116.881810271317], [3051.7205580454297, 1103.0992679894152], [3107.0873956690143, 972.8919609441568], [2861.932349690137, 1131.4847600231471], [2789.583044951935, 964.6512841164608]] + +x, y = [[xy[dimensionIndex] for xy in xys] for dimensionIndex in range(2)] + +plt.title('Center wall marker locations') + +plt.scatter(x, y, c = range(len(x))) +for xyIndex, xy in enumerate(xys): + plt.text(xy[0], xy[1] + 10, str(xyIndex), horizontalalignment = 'center') + +plt.show() + +## + +greatestDistances = [] + +#for xy in xys: +for xy, otherXy in zip(xys, xys[1:]): + greatestDistance = None + #for otherXy in xys: + if xy != otherXy: + distance = sum([(xy[dimensionIndex] - otherXy[dimensionIndex]) ** 2 for dimensionIndex in range(2)]) ** 0.5 + if greatestDistance is None or distance > greatestDistance: + greatestDistance = distance + greatestDistances += [greatestDistance] + + +plt.title('Distance between a wall marker location and the next one') +plt.boxplot(greatestDistances) + +for percentile in [25, 50, 75]: + y = np.percentile(greatestDistances, percentile) + plt.axhline(y = y) + +#plt.yticks() + +plt.xticks([], []) +plt.show() \ No newline at end of file