Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Improved display of units in get_unit_system
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Nov 9, 2022
1 parent 50f6261 commit 99f8c8b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions python/swiftest/swiftest/simulation_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ def set_unit_system(self,
self.TU_name = "y"
elif TU.upper() == "DAY" or TU.upper() == "D" or TU.upper() == "JD" or TU.upper() == "DAYS":
self.param['TU2S'] = constants.JD2S
self.TU_name = "Day"
self.TU_name = "d"
elif TU.upper() == "S" or TU.upper() == "SECONDS" or TU.upper() == "SEC":
self.param['TU2S'] = 1.0
self.TU_name = "s"
Expand Down Expand Up @@ -1185,7 +1185,12 @@ def get_unit_system(self, arg_list: str | List[str] | None = None):
else:
TU_name = self.TU_name

units = {
units1 = {
"MU" : MU_name,
"DU" : DU_name,
"TU" : TU_name
}
units2 = {
"MU" : f"kg / {MU_name}",
"DU" : f"m / {DU_name}",
"TU" : f"s / {TU_name}"
Expand All @@ -1196,7 +1201,7 @@ def get_unit_system(self, arg_list: str | List[str] | None = None):
if self.verbose:
for arg in valid_arg:
key = valid_var[arg]
print(f"{arg:<32} {unit_dict[key]} {units[arg]}")
print(f"{arg}: {units1[arg]:<28} {unit_dict[key]} {units2[arg]}")

return unit_dict

Expand Down

0 comments on commit 99f8c8b

Please sign in to comment.