-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread_data.py
More file actions
57 lines (48 loc) · 1.65 KB
/
read_data.py
File metadata and controls
57 lines (48 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pandas as pd
import plotly.graph_objects as go
# Read the CSV file
data_file = 'data_with_multiple_reference_points.csv'
df = pd.read_csv(data_file)
# Identify reference points
# Reference points are rows where Azimuth (rad) = 0, Elevation (rad) = 0
reference_indices = df[(df['Azimuth (rad)'] == 0) & (df['Elevation (rad)'] == 0)].index
# Initialize the 3D scatter plot
fig = go.Figure()
# Loop through each reference point and plot its data
for i in range(len(reference_indices)):
# Get the start and end indices for this reference point's group
start_idx = reference_indices[i]
end_idx = reference_indices[i + 1] if i + 1 < len(reference_indices) else len(df)
# Extract reference point and generated points
reference_point = df.iloc[start_idx]
generated_points = df.iloc[start_idx + 1:end_idx]
# Plot the reference point
fig.add_trace(go.Scatter3d(
x=[reference_point['X']],
y=[reference_point['Y']],
z=[reference_point['Z']],
mode='markers',
marker=dict(size=8, color='red'),
name=f'Reference Point {i + 1}'
))
# Plot the generated points
fig.add_trace(go.Scatter3d(
x=generated_points['X'],
y=generated_points['Y'],
z=generated_points['Z'],
mode='markers',
marker=dict(size=4),
name=f'Generated Points {i + 1}'
))
# Update layout for better interaction
fig.update_layout(
title='3D Points from CSV (Multiple Reference Points)',
scene=dict(
xaxis_title='X-axis',
yaxis_title='Y-axis',
zaxis_title='Z-axis',
aspectmode='cube' # Ensure equal scaling
)
)
# Show the plot
fig.show()