Skip to content

Commit 6093de3

Browse files
author
Franz Masatoshi Yuri
committed
formating
1 parent 3e0d8e5 commit 6093de3

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

rocketpy/utilities.py

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def compute_CdS_from_drop_test(
3838
3939
"""
4040

41-
return 2 * rocket_mass * g / ((terminal_velocity**2) * air_density)
41+
return 2 * rocket_mass * g / ((terminal_velocity ** 2) * air_density)
4242

4343

4444
# TODO: Needs tests
@@ -199,9 +199,21 @@ def du(z, u):
199199

200200
return altitudeFunction, velocityFunction, final_sol
201201

202+
202203
def create_dispersion_dictionary(dic):
203-
dataframe = pd.read_csv(dic,sep = ';', skiprows=[0,1], header = None)
204+
"""creates a dictinary with the rocket data in a excel .csv file.
204205
206+
Parameters
207+
----------
208+
dic : string
209+
String with the path to the .csv file.
210+
211+
Returns
212+
-------
213+
dictionary
214+
Dictionary with all rocket data used in dispersion analysis.
215+
"""
216+
dataframe = pd.read_csv(dic, sep=";", skiprows=[0, 1], header=None)
205217

206218
rocketKeys = list(dataframe[1].dropna())
207219
rocketValues = list(dataframe[2].dropna())
@@ -214,48 +226,43 @@ def create_dispersion_dictionary(dic):
214226
launchKeys = list(dataframe[13].dropna())
215227
launchValues = list(dataframe[14].dropna())
216228
launchSD = list(dataframe[15])
217-
229+
218230
parachuteKeys = list(dataframe[19].dropna())
219231
parachuteValues = list(dataframe[20].dropna())
220232
parachuteSD = list(dataframe[21])
221-
222233

223234
allValues = []
224235
# crating the dictionary
225236

226-
for i in range(0,len(rocketKeys)):
237+
for i in range(0, len(rocketKeys)):
227238

228239
if pd.isnull(rocketSD[i]):
229240
allValues.append(rocketValues[i])
230241
else:
231-
allValues.append(((rocketValues[i]), (rocketSD[i])))
242+
allValues.append(((rocketValues[i]), (rocketSD[i])))
232243

233-
for j in range(0,len(motorKeys)):
244+
for j in range(0, len(motorKeys)):
234245

235246
if pd.isnull(motorSD[j]):
236247
allValues.append(motorValues[j])
237248
else:
238-
allValues.append(((motorValues[j]), (motorSD[j])))
249+
allValues.append(((motorValues[j]), (motorSD[j])))
239250

240-
for k in range(0,len(parachuteKeys)):
251+
for k in range(0, len(parachuteKeys)):
241252

242253
if pd.isnull(parachuteSD[k]):
243254
allValues.append(parachuteValues[k])
244255
else:
245-
allValues.append(((parachuteValues[k]), (parachuteSD[k])))
256+
allValues.append(((parachuteValues[k]), (parachuteSD[k])))
246257

247-
for l in range(0,len(launchKeys)):
258+
for l in range(0, len(launchKeys)):
248259

249260
if pd.isnull(launchSD[l]):
250261
allValues.append(launchValues[l])
251262
else:
252-
allValues.append(((launchValues[l]), (launchSD[l])))
253-
263+
allValues.append(((launchValues[l]), (launchSD[l])))
254264

255265
allKeys = rocketKeys + motorKeys + parachuteKeys + launchKeys
256266

257-
analysis_parameters = dict(zip(allKeys,allValues))
267+
analysis_parameters = dict(zip(allKeys, allValues))
258268
return analysis_parameters
259-
260-
261-

0 commit comments

Comments
 (0)