diff --git a/app.py b/app.py deleted file mode 100644 index e6de4ac..0000000 --- a/app.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -Created on Fri Apr 21 2023 -@name: app.py -@desc: Main file for the application -@auth: Djalim Simaila -@e-mail: djalim.simaila@inrae.fr -""" -import sys -from PyQt5.QtWidgets import QApplication -from utils.gui.pyqt.main_window.MainWindow import MainWindow - -if __name__ == "__main__": - app = QApplication(sys.argv) - window = MainWindow() - window.show() - app.exec() \ No newline at end of file diff --git a/main.py b/main.py index a01401a..e6de4ac 100644 --- a/main.py +++ b/main.py @@ -1,61 +1,16 @@ -from utils.data_processing.data_processing import get_discrete_data, get_raw_data -from utils.files import output -from utils.files.input import ScannedObject -from utils.math.position_manipulation import verticalise -import time +""" +Created on Fri Apr 21 2023 +@name: app.py +@desc: Main file for the application +@auth: Djalim Simaila +@e-mail: djalim.simaila@inrae.fr +""" +import sys +from PyQt5.QtWidgets import QApplication +from utils.gui.pyqt.main_window.MainWindow import MainWindow -def main(): - # Create an object from the given file - total_time = time.time() - print("Loading file...") - t = time.time() - obj = ScannedObject.from_obj_file("datasets/Barette/1 - BARETTE.obj") - print("File loaded in {} seconds".format(time.time()-t)) - t = time.time() - print("Verticalising object...") - verticalise(obj) - print("Object verticalised in {} seconds".format(time.time()-t)) - t = time.time() - print("Normalising object...") - obj.normalise() - print("Object normalised in {} seconds".format(time.time()-t)) - - # Calculate raw data and save it in a file - t = time.time() - data = get_raw_data(obj, 6,2) - print("Raw data calculated in {} seconds".format(time.time()-t)) - t = time.time() - print("Saving data...") - output.save_output_file('analyse_brute.txt', - output.format_data(data, - '\t', - ["X (en mm)", - "Y (en mm)", - "Z (en mm)", - "teta (en rad)", - "rayon (en mm)", - "Xi-Xmoy", - "Yi-Ymoy"] )) - print("Data saved in {} seconds".format(time.time()-t)) - - # Calculate discrete data and save it in a file - t = time.time() - print("Calculating discrete data...") - data = get_discrete_data(obj, 6,2) - print("Discrete data calculated in {} seconds".format(time.time()-t)) - t = time.time() - print("Saving data...") - output.save_output_file('analyse_rayon.txt', - output.format_data(data, - '\t', - ["X moy (en mm)", - "Y moy (en mm)", - "Z moy (en mm)", - "Discretisation(en mm)", - "Rayon moyen (en mm)", - "Rayon ecart type (en mm)"] )) - print("Data saved in {} seconds".format(time.time()-t)) - print("Total time : {} seconds".format(time.time()-total_time)) - -if __name__ == '__main__': - main() \ No newline at end of file +if __name__ == "__main__": + app = QApplication(sys.argv) + window = MainWindow() + window.show() + app.exec() \ No newline at end of file diff --git a/test.py b/test.py deleted file mode 100644 index 2eac71a..0000000 --- a/test.py +++ /dev/null @@ -1,38 +0,0 @@ -from utils.files.input import ScannedObject -from integration_tests import data_test - -def test_differences(): - eps = 0.000001 - obj = ScannedObject.from_xyz_file("datasets/Barette/4 - BARETTE v1.xyz", - "datasets/Barette/BARETTE_Delta 1,0_analyse rayon.txt", normalised='z') - - data_test.test_get_raw_data(obj, - "datasets/Barette/BARETTE_Delta 1,0_analyse brute.txt", - eps=eps) - - data_test.test_get_discrete_data(obj, - "datasets/Barette/BARETTE_Delta 1,0_analyse rayon.txt", - eps=eps) - - -def show_diff_two_obj(): - obj1 = ScannedObject.from_obj_file( - "datasets/Barette/3 - BARETTE v1.obj", normalised='z') - obj2 = ScannedObject.from_xyz_file( - "datasets/Barette/4 - BARETTE v1.xyz", normalised='z') - obj2verts = obj2.get_vertices(sort=True) - for count, values in enumerate(obj1.get_vertices(sort=True)): - L = [abs(values[i] - obj2verts[count][i]) for i in range(len(values))] - print(*L, sep="\t") - - -def count_elements_in_discrete_array(): - obj = ScannedObject.from_xyz_file("datasets/Barette/4 - BARETTE v1.xyz", - "datasets/Barette/BARETTE_Delta 1,0_analyse rayon.txt", normalised='z') - cpt = 0 - for i in obj.bruteforce_discretization(): - print(f"nb of element in z{cpt} to z{cpt+1}:", len(i)) - cpt += 1 - -if __name__ == "__main__": - test() \ No newline at end of file