You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
756 B
36 lines
756 B
import pandas as pd
|
|
import numpy as np
|
|
|
|
# Path to your CSV file
|
|
csv_path = "port_quadrature_export.csv"
|
|
|
|
# Load CSV
|
|
df = pd.read_csv(csv_path)
|
|
|
|
# Pick correct columns (robust to lower/upper case)
|
|
cols = []
|
|
for c in ['x', 'X']:
|
|
if c in df.columns:
|
|
cols.append(c)
|
|
for c in ['y', 'Y']:
|
|
if c in df.columns:
|
|
cols.append(c)
|
|
for c in ['z', 'Z']:
|
|
if c in df.columns:
|
|
cols.append(c)
|
|
|
|
# Extract XYZ and rename
|
|
xyz = df[cols].copy()
|
|
xyz.columns = ['X', 'Y', 'Z']
|
|
|
|
# Round to 6 digits
|
|
xyz = xyz.round(6)
|
|
|
|
# Save to .probe file
|
|
probe_path = "port_quadrature_points.probe"
|
|
with open(probe_path, "w") as f:
|
|
f.write("X,Y,Z\n")
|
|
np.savetxt(f, xyz.values, delimiter=",", fmt="%.6f")
|
|
|
|
print(f".probe file written to {probe_path}")
|
|
|
|
|