Skip to content
Snippets Groups Projects
Commit a016f34f authored by Luca Conterio's avatar Luca Conterio
Browse files

[AirBrakes] Added scripts for drag coeffs and trajectories

parent b5772c18
No related branches found
No related tags found
No related merge requests found
import scipy.io as sio
import sys
#filename = "coeffs.mat"
fieldname = "coeffs"
if len(sys.argv) < 2:
print("\nError, missing path to file \nUsage : python3 coeffs.py <path_to_mat_file>\n")
mat = sio.loadmat(sys.argv[1])
data = mat[fieldname][0][0]
names = data.dtype.fields.keys()
coeffs = {}
for coeff, name in zip(data, names):
coeffs[name] = coeff.item()
print(coeffs)
import scipy.io as sio
import sys
#filename = "Trajectories.mat"
fieldname = "trajectories_saving"
if len(sys.argv) < 2:
print("\nError, missing path to file \nUsage : python3 coeffs.py <path_to_mat_file>\n")
mat = sio.loadmat(sys.argv[1])
trajectories = mat[fieldname][0]
with open("Trajectories_data.h", "w") as f:
f.write("{\n")
for trajectory in trajectories:
zs, vzs, xs, vxs, ys, vys, sbar = trajectory
f.write("\t{\n")
f.write("\t\t%d, %d,\n\t\t{\n" % (len(zs), sbar))
for z, vz in zip(zs, vzs):
f.write("\t\t\t{%f, %f},\n" % (z, vz))
f.write("\t\t}\n\t},\n")
f.write("}")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment