Skip to content

Commit 0f961bf

Browse files
Merge pull request #361 from RocketPy-Team/enh/snake-case
ENH: Snake Case
2 parents ce77bab + f0f2696 commit 0f961bf

File tree

75 files changed

+155692
-152860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+155692
-152860
lines changed

README.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,14 @@ help(Environment)
184184
A sample code is:
185185

186186
```python
187-
Env = Environment(
187+
env = Environment(
188188
latitude=32.990254,
189189
longitude=-106.974998,
190190
elevation=1400,
191191
date=(2020, 3, 4, 12) # Tomorrow's date in year, month, day, hour UTC format
192192
)
193193

194-
Env.setAtmosphericModel(type='Forecast', file='GFS')
194+
env.set_atmospheric_model(type='Forecast', file='GFS')
195195
```
196196

197197
This can be followed up by starting a Solid Motor object. To get help on it, just use:
@@ -204,18 +204,18 @@ A sample Motor object can be created by the following code:
204204

205205
```python
206206
Pro75M1670 = SolidMotor(
207-
thrustSource="../data/motors/Cesaroni_M1670.eng",
207+
thrust_source="../data/motors/Cesaroni_M1670.eng",
208208
burn_time=3.9,
209-
grainNumber=5,
210-
grainSeparation=5/1000,
211-
grainDensity=1815,
212-
grainOuterRadius=33/1000,
213-
grainInitialInnerRadius=15/1000,
214-
grainInitialHeight=120/1000,
215-
grainsCenterOfMassPosition=-0.85704,
216-
nozzleRadius=33/1000,
217-
throatRadius=11/1000,
218-
interpolationMethod='linear'
209+
grain_number=5,
210+
grain_separation=5/1000,
211+
grain_density=1815,
212+
grain_outer_radius=33/1000,
213+
grain_initial_inner_radius=15/1000,
214+
grain_initial_height=120/1000,
215+
grains_center_of_mass_position=-0.85704,
216+
nozzle_radius=33/1000,
217+
throat_radius=11/1000,
218+
interpolation_method='linear'
219219
)
220220
```
221221

@@ -228,64 +228,64 @@ help(Rocket)
228228
A sample code to create a Rocket is:
229229

230230
```python
231-
Calisto = Rocket(
231+
calisto = Rocket(
232232
radius=127 / 2000,
233233
mass=19.197 - 2.956,
234-
inertiaI=6.60,
235-
inertiaZ=0.0351,
236-
powerOffDrag="../../data/calisto/powerOffDragCurve.csv",
237-
powerOnDrag="../../data/calisto/powerOnDragCurve.csv",
238-
centerOfDryMassPosition=0,
239-
coordinateSystemOrientation="tailToNose"
234+
inertia_i=6.60,
235+
inertia_z=0.0351,
236+
power_off_drag="../../data/calisto/powerOffDragCurve.csv",
237+
power_on_drag="../../data/calisto/powerOnDragCurve.csv",
238+
center_of_dry_mass_position=0,
239+
coordinate_system_orientation="tail_to_nose"
240240
)
241-
Calisto.setRailButtons(0.2, -0.5)
242-
Calisto.addMotor(Pro75M1670, position=-1.255)
243-
Calisto.addNose(length=0.55829, kind="vonKarman", position=1.278)
244-
Calisto.addTrapezoidalFins(
241+
calisto.set_rail_buttons(0.2, -0.5)
242+
calisto.add_motor(Pro75M1670, position=-1.255)
243+
calisto.add_nose(length=0.55829, kind="vonKarman", position=1.278)
244+
calisto.add_trapezoidal_fins(
245245
n=4,
246-
rootChord=0.120,
247-
tipChord=0.040,
246+
root_chord=0.120,
247+
tip_chord=0.040,
248248
span=0.100,
249249
position=-1.04956,
250-
cantAngle=0,
250+
cant_angle=0,
251251
radius=None,
252252
airfoil=None
253253
)
254-
Calisto.addTail(
255-
topRadius=0.0635, bottomRadius=0.0435, length=0.060, position=-1.194656
254+
calisto.add_tail(
255+
top_radius=0.0635, bottom_radius=0.0435, length=0.060, position=-1.194656
256256
)
257257
```
258258

259259
You may want to add parachutes to your rocket as well:
260260

261261
```python
262-
def drogueTrigger(p, h, y):
262+
def drogue_trigger(p, h, y):
263263
# p = pressure considering parachute noise signal
264264
# h = height above ground level considering parachute noise signal
265265
# y = [x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]
266266

267267
# activate drogue when vz < 0 m/s.
268268
return True if y[5] < 0 else False
269269

270-
def mainTrigger(p, h, y):
270+
def main_trigger(p, h, y):
271271
# p = pressure considering parachute noise signal
272272
# h = height above ground level considering parachute noise signal
273273
# y = [x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]
274274

275275
# activate main when vz < 0 m/s and z < 800 m
276276
return True if y[5] < 0 and h < 800 else False
277277

278-
Calisto.addParachute('Main',
279-
CdS=10.0,
280-
trigger=mainTrigger,
281-
samplingRate=105,
278+
calisto.add_parachute('Main',
279+
cd_s=10.0,
280+
trigger=main_trigger,
281+
sampling_rate=105,
282282
lag=1.5,
283283
noise=(0, 8.3, 0.5))
284284

285-
Calisto.addParachute('Drogue',
286-
CdS=1.0,
287-
trigger=drogueTrigger,
288-
samplingRate=105,
285+
calisto.add_parachute('Drogue',
286+
cd_s=1.0,
287+
trigger=drogue_trigger,
288+
sampling_rate=105,
289289
lag=1.5,
290290
noise=(0, 8.3, 0.5))
291291
```
@@ -299,19 +299,19 @@ help(Flight)
299299
To actually create a Flight object, use:
300300

301301
```python
302-
TestFlight = Flight(rocket=Calisto, environment=Env, railLength=5.2, inclination=85, heading=0)
302+
test_flight = Flight(rocket=calisto, environment=env, rail_length=5.2, inclination=85, heading=0)
303303
```
304304

305305
Once the Flight object is created, your simulation is done! Use the following code to get a summary of the results:
306306

307307
```python
308-
TestFlight.info()
308+
test_flight.info()
309309
```
310310

311311
To see all available results, use:
312312

313313
```python
314-
TestFlight.allInfo()
314+
test_flight.all_info()
315315
```
316316

317317
Here is just a quick taste of what RocketPy is able to calculate. There are hundreds of plots and data points computed by RocketPy to enhance your analyses.

docs/development/rocketpy_as_developer.rst

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ It contains information about the local pressure profile, temperature, speed of
9292

9393
.. code-block:: python
9494
95-
Env = Environment(latitude=32.990254, longitude=-106.974998, elevation=1400)
95+
env = Environment(latitude=32.990254, longitude=-106.974998, elevation=1400)
9696
9797
RocketPy can use local files via the Ensemble method or meteorological forecasts through OpenDAP protocol.
9898
To work with environment files, it will be very important ensuring tha that you have the netCDF4 library installed.
@@ -102,17 +102,17 @@ Assuming we are using forecast, first we set the simulated data with:
102102
103103
import datetime
104104
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
105-
Env.setDate((tomorrow.year, tomorrow.month, tomorrow.day, 12)) # Hour given in UTC time
105+
env.set_date((tomorrow.year, tomorrow.month, tomorrow.day, 12)) # Hour given in UTC time
106106
107107
Then we set the atmospheric model, in this case, GFS forecast:
108108

109109
.. code-block:: python
110110
111-
Env.setAtmosphericModel(type="Forecast", file="GFS")
111+
env.set_atmospheric_model(type="Forecast", file="GFS")
112112
113113
Weather forecast data can be visualized through two info methods.
114114

115-
``Env.info()`` or ``Env.allInfo()``
115+
``env.info()`` or ``env.all_info()``
116116

117117
Creating the motor that boosts the rocket
118118
-----------------------------------------
@@ -124,22 +124,22 @@ The motor class contains information about the thrust curve and uses some geomet
124124
.. code-block:: python
125125
126126
Pro75M1670 = SolidMotor(
127-
thrustSource="../data/motors/Cesaroni_M1670.eng", #copy here the path to the thrust source file
127+
thrust_source="../data/motors/Cesaroni_M1670.eng", #copy here the path to the thrust source file
128128
burn_time=3.9,
129-
grainNumber=5,
130-
grainSeparation=5 / 1000,
131-
grainDensity=1815,
132-
grainOuterRadius=33 / 1000,
133-
grainInitialInnerRadius=15 / 1000,
134-
grainInitialHeight=120 / 1000,
135-
nozzleRadius=33 / 1000,
136-
throatRadius=11 / 1000,
137-
interpolationMethod="linear",
129+
grain_number=5,
130+
grain_separation=5 / 1000,
131+
grain_density=1815,
132+
grain_outer_radius=33 / 1000,
133+
grain_initial_inner_radius=15 / 1000,
134+
grain_initial_height=120 / 1000,
135+
nozzle_radius=33 / 1000,
136+
throat_radius=11 / 1000,
137+
interpolation_method="linear",
138138
)
139139
140140
Motor data can be visualized through the following methods:
141141

142-
``Pro75M1670.info()`` or ``Pro75M1670.allInfo()``
142+
``Pro75M1670.info()`` or ``Pro75M1670.all_info()``
143143

144144

145145
Creating the rocket
@@ -150,46 +150,46 @@ The first step is to initialize the class with the vital data:
150150

151151
.. code-block:: python
152152
153-
Calisto = Rocket(
153+
calisto = Rocket(
154154
radius=127 / 2000,
155155
mass=19.197 - 2.956,
156-
inertiaI=6.60,
157-
inertiaZ=0.0351,
158-
powerOffDrag="../../data/calisto/powerOffDragCurve.csv",
159-
powerOnDrag="../../data/calisto/powerOnDragCurve.csv",
160-
centerOfDryMassPosition=0,
161-
coordinateSystemOrientation="tailToNose",
156+
inertia_i=6.60,
157+
inertia_z=0.0351,
158+
power_off_drag="../../data/calisto/powerOffDragCurve.csv",
159+
power_on_drag="../../data/calisto/powerOnDragCurve.csv",
160+
center_of_dry_mass_position=0,
161+
coordinate_system_orientation="tail_to_nose",
162162
)
163163
164-
Calisto.addMotor(Pro75M1670, position=-1.255)
164+
calisto.add_motor(Pro75M1670, position=-1.255)
165165
166166
Then the rail buttons must be set:
167167

168168
.. code-block:: python
169169
170-
Calisto.setRailButtons(0.2, -0.5)
170+
calisto.set_rail_buttons(0.2, -0.5)
171171
172172
In sequence, the aerodynamic surfaces must be set.
173173
If a lift curve for the fin set is not specified, it is assumed that they behave according to a linearized model with a coefficient calculated with Barrowman's theory.
174174
In the example, a nosecone, one fin set and one tail were added, but each case can be designed differently.
175175

176176
.. code-block:: python
177177
178-
NoseCone = Calisto.addNose(length=0.55829, kind="vonKarman", position=0.71971 + 0.55829)
178+
nosecone = calisto.add_nose(length=0.55829, kind="vonKarman", position=0.71971 + 0.55829)
179179
180-
FinSet = Calisto.addTrapezoidalFins(
180+
fin_set = calisto.add_trapezoidal_fins(
181181
n=4,
182-
rootChord=0.120,
183-
tipChord=0.040,
182+
root_chord=0.120,
183+
tip_chord=0.040,
184184
span=0.100,
185185
position=-1.04956,
186-
cantAngle=0,
186+
cant_angle=0,
187187
radius=None,
188188
airfoil=None,
189189
)
190190
191-
Tail = Calisto.addTail(
192-
topRadius=0.0635, bottomRadius=0.0435, length=0.060, position=-1.194656
191+
tail = calisto.add_tail(
192+
top_radius=0.0635, bottom_radius=0.0435, length=0.060, position=-1.194656
193193
)
194194
195195
If you are considering the parachutes in the simulation, they also have to be added to the rocket object.
@@ -200,7 +200,7 @@ For example:
200200

201201
.. code-block:: python
202202
203-
def drogueTrigger(p, h, y):
203+
def drogue_trigger(p, h, y):
204204
# p = pressure considering parachute noise signal
205205
# h = height above ground level considering parachute noise signal
206206
# y = [x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]
@@ -209,7 +209,7 @@ For example:
209209
return True if y[5] < 0 else False
210210
211211
212-
def mainTrigger(p, h, y):
212+
def main_trigger(p, h, y):
213213
# p = pressure considering parachute noise signal
214214
# h = height above ground level considering parachute noise signal
215215
# y = [x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]
@@ -221,20 +221,20 @@ After having the trigger functions defined, the parachute must be added to the r
221221

222222
.. code-block:: python
223223
224-
Main = Calisto.addParachute(
224+
Main = calisto.add_parachute(
225225
"Main",
226-
CdS=10.0,
227-
trigger=mainTrigger,
228-
samplingRate=105,
226+
cd_s=10.0,
227+
trigger=main_trigger,
228+
sampling_rate=105,
229229
lag=1.5,
230230
noise=(0, 8.3, 0.5),
231231
)
232232
233-
Drogue = Calisto.addParachute(
233+
Drogue = calisto.add_parachute(
234234
"Drogue",
235-
CdS=1.0,
236-
trigger=drogueTrigger,
237-
samplingRate=105,
235+
cd_s=1.0,
236+
trigger=drogue_trigger,
237+
sampling_rate=105,
238238
lag=1.5,
239239
noise=(0, 8.3, 0.5),
240240
)
@@ -247,14 +247,14 @@ The rocket and environment classes are supplied as inputs, as well as the rail l
247247

248248
.. code-block:: python
249249
250-
TestFlight = Flight(rocket=Calisto, environment=Env, railLength=5.2, inclination=85, heading=0)
250+
test_flight = Flight(rocket=calisto, environment=env, rail_length=5.2, inclination=85, heading=0)
251251
252252
Flight data can be retrieved through:
253253

254-
``TestFlight.info()`` or ``TestFlight.allInfo()``
254+
``test_flight.info()`` or ``test_flight.all_info()``
255255

256-
This function plots a comprehensive amount of flight data and graphs but, if you want to access one specific variable, for example Z position, this may be achieved by `TestFlight.z`.
257-
If you insert `TestFlight.z()` the graph of the function will be plotted.
256+
This function plots a comprehensive amount of flight data and graphs but, if you want to access one specific variable, for example Z position, this may be achieved by `test_flight.z`.
257+
If you insert `test_flight.z()` the graph of the function will be plotted.
258258
This and other features can be found in the documentation of the `Function` class, which allows data to be treated in an easier way.
259259
The documentation of each variable used in the class can be found on `Flight.py` file.
260260

0 commit comments

Comments
 (0)