From 7c9656f8f2106b212293451f5b5e05209bee0ea5 Mon Sep 17 00:00:00 2001
From: Maciej Wielgosz <maciej.wielgosz@nibio.no>
Date: Thu, 13 Jul 2023 15:38:17 +0200
Subject: [PATCH] show parameters of a point cloud in txt format

---
 utils/cloud_txt_param.py | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 utils/cloud_txt_param.py

diff --git a/utils/cloud_txt_param.py b/utils/cloud_txt_param.py
new file mode 100644
index 0000000..abbd286
--- /dev/null
+++ b/utils/cloud_txt_param.py
@@ -0,0 +1,34 @@
+import pandas as pd
+import argparse
+
+# Define the command-line arguments
+parser = argparse.ArgumentParser(description='Read a CSV file into a pandas DataFrame and find the max values.')
+parser.add_argument('file_path', help='The path to the CSV file')
+
+# Parse the command-line arguments
+args = parser.parse_args()
+
+# Read the CSV file into a pandas DataFrame
+df = pd.read_csv(args.file_path)
+
+# print the max value for each column
+print('Max value for each column:')
+print(df.max())
+
+# print the min value for each column
+print('Min value for each column:')
+print(df.min())
+
+# find the box dimensions only for x, y, and z
+print('Box dimensions:')
+print(df[['x', 'y', 'z']].max() - df[['x', 'y', 'z']].min())
+
+# compute a middle point for the box
+print('Middle point:')
+print(df[['x', 'y', 'z']].mean())
+
+# round the x, y, and z values to two decimal places and save the contents to a new CSV file
+df[['x', 'y', 'z']] = df[['x', 'y', 'z']].round(2)
+df.to_csv('rounded.csv', index=False)
+
+
-- 
GitLab