AEUPH commited on
Commit
9230f20
·
verified ·
1 Parent(s): 6dd52c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -24,11 +24,30 @@ print("Dataset loaded successfully.")
24
  from scipy.spatial import KDTree
25
 
26
  import time
27
- # Assuming positions_array is already defined
28
- # Extract 'final_positions' from each item in the dataset and compile them into a NumPy array
29
- final_positions = [position for item in dataset['data']['final_positions'] for position in item]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  positions_array = np.array([[p['x'], p['y'], p['z']] for p in final_positions])
31
 
 
 
32
  def estimate_time_and_build_kdtree(data):
33
  start_time = time.time()
34
  print("Estimating time based on dataset size...")
 
24
  from scipy.spatial import KDTree
25
 
26
  import time
27
+
28
+ # Initialize an empty list to store positions
29
+ final_positions = []
30
+
31
+ # Initialize a counter for progress tracking
32
+ counter = 0
33
+
34
+ # Total positions count (assuming each item['data']['final_positions'] is a list of positions)
35
+ total_positions = sum(len(item['data']['final_positions']) for item in dataset)
36
+
37
+ for item in dataset:
38
+ for position in item['data']['final_positions']:
39
+ final_positions.append(position)
40
+ counter += 1
41
+
42
+ # Print progress every 100 steps
43
+ if counter % 100 == 0 or counter == total_positions:
44
+ print(f"Processed {counter} / {total_positions} positions...")
45
+
46
+ # Convert the list of positions to a NumPy array
47
  positions_array = np.array([[p['x'], p['y'], p['z']] for p in final_positions])
48
 
49
+ print("Completed processing positions into an array.")
50
+
51
  def estimate_time_and_build_kdtree(data):
52
  start_time = time.time()
53
  print("Estimating time based on dataset size...")