Skip to content

Commit b26650b

Browse files
author
Franz Masatoshi Yuri
committed
Merge branch 'enh/automate_dispersion' of https://github.com/RocketPy-Team/RocketPy into enh/automate_dispersion
2 parents 68ba507 + 05ff066 commit b26650b

File tree

1 file changed

+58
-2
lines changed

1 file changed

+58
-2
lines changed

rocketpy/utilities.py

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def compute_CdS_from_drop_test(
3737
3838
"""
3939

40-
return 2 * rocket_mass * g / ((terminal_velocity ** 2) * air_density)
40+
return 2 * rocket_mass * g / ((terminal_velocity**2) * air_density)
4141

4242

4343
# TODO: Needs tests
@@ -212,6 +212,7 @@ def create_dispersion_dictionary(dic):
212212
dictionary
213213
Dictionary with all rocket data used in dispersion analysis.
214214
"""
215+
<<<<<<< HEAD
215216
try:
216217
file = np.genfromtxt(dic, usecols=(1, 2, 3), delimiter=",", dtype=str)
217218
except:
@@ -223,4 +224,59 @@ def create_dispersion_dictionary(dic):
223224
analysis_parameters[list[0]] = float(list[1])
224225
else:
225226
analysis_parameters[list[0]] = (float(list[1]), float(list[2]))
226-
return analysis_parameters
227+
return analysis_parameters
228+
=======
229+
dataframe = pd.read_csv(dic, skiprows=[0, 1], header=None)
230+
231+
rocketKeys = list(dataframe[1].dropna())
232+
rocketValues = list(dataframe[2].dropna())
233+
rocketSD = list(dataframe[3])
234+
235+
motorKeys = list(dataframe[7].dropna())
236+
motorValues = list(dataframe[8].dropna())
237+
motorSD = list(dataframe[9])
238+
239+
launchKeys = list(dataframe[13].dropna())
240+
launchValues = list(dataframe[14].dropna())
241+
launchSD = list(dataframe[15])
242+
243+
parachuteKeys = list(dataframe[19].dropna())
244+
parachuteValues = list(dataframe[20].dropna())
245+
parachuteSD = list(dataframe[21])
246+
247+
allValues = []
248+
# crating the dictionary
249+
250+
for i in range(0, len(rocketKeys)):
251+
252+
if pd.isnull(rocketSD[i]):
253+
allValues.append(rocketValues[i])
254+
else:
255+
allValues.append(((rocketValues[i]), (rocketSD[i])))
256+
257+
for j in range(0, len(motorKeys)):
258+
259+
if pd.isnull(motorSD[j]):
260+
allValues.append(motorValues[j])
261+
else:
262+
allValues.append(((motorValues[j]), (motorSD[j])))
263+
264+
for k in range(0, len(parachuteKeys)):
265+
266+
if pd.isnull(parachuteSD[k]):
267+
allValues.append(parachuteValues[k])
268+
else:
269+
allValues.append(((parachuteValues[k]), (parachuteSD[k])))
270+
271+
for l in range(0, len(launchKeys)):
272+
273+
if pd.isnull(launchSD[l]):
274+
allValues.append(launchValues[l])
275+
else:
276+
allValues.append(((launchValues[l]), (launchSD[l])))
277+
278+
allKeys = rocketKeys + motorKeys + parachuteKeys + launchKeys
279+
280+
analysis_parameters = dict(zip(allKeys, allValues))
281+
return analysis_parameters
282+
>>>>>>> 05ff0662ddda29e74b6019797ab710725d91831b

0 commit comments

Comments
 (0)