Skip to content

Commit cb2c2c9

Browse files
author
Franz Masatoshi Yuri
committed
removed libraries
1 parent b4f5560 commit cb2c2c9

File tree

1 file changed

+12
-62
lines changed

1 file changed

+12
-62
lines changed

rocketpy/utilities.py

Lines changed: 12 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
__copyright__ = "Copyright 20XX, RocketPy Team"
44
__license__ = "MIT"
55

6-
import os
76
import numpy as np
8-
import pandas as pd
97
from scipy.integrate import solve_ivp
108

119
from .Environment import Environment
@@ -41,7 +39,6 @@ def compute_CdS_from_drop_test(
4139

4240
return 2 * rocket_mass * g / ((terminal_velocity ** 2) * air_density)
4341

44-
4542
# TODO: Needs tests
4643

4744

@@ -214,62 +211,15 @@ def create_dispersion_dictionary(dic):
214211
dictionary
215212
Dictionary with all rocket data used in dispersion analysis.
216213
"""
217-
218-
file = os.path.splitext(dic)
219-
if file[-1] == ".csv":
220-
dataframe = pd.read_csv(dic, skiprows=[0, 1], header=None)
221-
elif file[-1] == ".xlsx":
222-
dataframe = pd.read_excel(dic, skiprows=[0, 1], header=None)
223-
224-
225-
rocketKeys = list(dataframe[1].dropna())
226-
rocketValues = list(dataframe[2].dropna())
227-
rocketSD = list(dataframe[3])
228-
229-
motorKeys = list(dataframe[7].dropna())
230-
motorValues = list(dataframe[8].dropna())
231-
motorSD = list(dataframe[9])
232-
233-
launchKeys = list(dataframe[13].dropna())
234-
launchValues = list(dataframe[14].dropna())
235-
launchSD = list(dataframe[15])
236-
237-
parachuteKeys = list(dataframe[19].dropna())
238-
parachuteValues = list(dataframe[20].dropna())
239-
parachuteSD = list(dataframe[21])
240-
241-
allValues = []
242-
# crating the dictionary
243-
244-
for i in range(0, len(rocketKeys)):
245-
246-
if pd.isnull(rocketSD[i]):
247-
allValues.append(rocketValues[i])
248-
else:
249-
allValues.append(((rocketValues[i]), (rocketSD[i])))
250-
251-
for j in range(0, len(motorKeys)):
252-
253-
if pd.isnull(motorSD[j]):
254-
allValues.append(motorValues[j])
255-
else:
256-
allValues.append(((motorValues[j]), (motorSD[j])))
257-
258-
for k in range(0, len(parachuteKeys)):
259-
260-
if pd.isnull(parachuteSD[k]):
261-
allValues.append(parachuteValues[k])
262-
else:
263-
allValues.append(((parachuteValues[k]), (parachuteSD[k])))
264-
265-
for l in range(0, len(launchKeys)):
266-
267-
if pd.isnull(launchSD[l]):
268-
allValues.append(launchValues[l])
269-
else:
270-
allValues.append(((launchValues[l]), (launchSD[l])))
271-
272-
allKeys = rocketKeys + motorKeys + parachuteKeys + launchKeys
273-
274-
analysis_parameters = dict(zip(allKeys, allValues))
275-
return analysis_parameters
214+
try:
215+
file = np.genfromtxt(dic,usecols = (1,2,3),delimiter = ',',dtype = str)
216+
except:
217+
file = np.genfromtxt(dic,usecols = (1,2,3),delimiter = ';',dtype = str)
218+
analysis_parameters = dict()
219+
for list in file:
220+
if list[0] !="":
221+
if list[2] =="":
222+
analysis_parameters[list[0]] = float(list[1])
223+
else:
224+
analysis_parameters[list[0]] = (float(list[1]),float(list[2]))
225+
return analysis_parameters

0 commit comments

Comments
 (0)