Skip to content

Commit

Permalink
ENH: use of f-string in rocket prints
Browse files Browse the repository at this point in the history
  • Loading branch information
Gui-FernandesBR committed Oct 28, 2023
1 parent 575adbe commit 8eb1a57
Showing 1 changed file with 9 additions and 27 deletions.
36 changes: 9 additions & 27 deletions rocketpy/prints/rocket_prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ def __init__(self, rocket):
"""
self.rocket = rocket

pass

def inertia_details(self):
"""Print inertia details.
Expand All @@ -32,43 +30,27 @@ def inertia_details(self):
None
"""
print("\nInertia Details\n")
print("Rocket Mass: {:.3f} kg".format(self.rocket.mass))
print("Rocket Dry Mass: {:.3f} kg (With Motor)".format(self.rocket.dry_mass))
print("Rocket Mass: {self.rocket.mass:.3f} kg")
print(f"Rocket Dry Mass: {self.rocket.dry_mass:.3f} kg (with unloaded motor)")
print(f"Rocket Mass: {self.rocket.total_mass(0):.3f} kg (With Propellant)")
print(
"Rocket Mass: {:.3f} kg (With Propellant)".format(self.rocket.total_mass(0))
f"Rocket Inertia (with unloaded motor) 11: {self.rocket.dry_I_11:.3f} kg*m2"
)
print(
"Rocket Inertia (with motor, but without propellant) 11: {:.3f} kg*m2".format(
self.rocket.dry_I_11
)
f"Rocket Inertia (with unloaded motor) 22: {self.rocket.dry_I_22:.3f} kg*m2"
)
print(
"Rocket Inertia (with motor, but without propellant) 22: {:.3f} kg*m2".format(
self.rocket.dry_I_22
)
f"Rocket Inertia (with unloaded motor) 33: {self.rocket.dry_I_33:.3f} kg*m2"
)
print(
"Rocket Inertia (with motor, but without propellant) 33: {:.3f} kg*m2".format(
self.rocket.dry_I_33
)
f"Rocket Inertia (with unloaded motor) 12: {self.rocket.dry_I_12:.3f} kg*m2"
)
print(
"Rocket Inertia (with motor, but without propellant) 12: {:.3f} kg*m2".format(
self.rocket.dry_I_12
)
f"Rocket Inertia (with unloaded motor) 13: {self.rocket.dry_I_13:.3f} kg*m2"
)
print(
"Rocket Inertia (with motor, but without propellant) 13: {:.3f} kg*m2".format(
self.rocket.dry_I_13
)
f"Rocket Inertia (with unloaded motor) 23: {self.rocket.dry_I_23:.3f} kg*m2"
)
print(
"Rocket Inertia (with motor, but without propellant) 23: {:.3f} kg*m2".format(
self.rocket.dry_I_23
)
)

return None

def rocket_geometrical_parameters(self):
"""Print rocket geometrical parameters.
Expand Down

0 comments on commit 8eb1a57

Please sign in to comment.