Skip to content
1 change: 1 addition & 0 deletions rocketpy/stochastic/stochastic_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,6 @@ def create_object(self):
# get original attribute value and multiply by factor
attribute_name = f"_{key.replace('_factor', '')}"
value = getattr(self, attribute_name) * value
key = f"{key.replace('_factor', '')}"
setattr(self.obj, key, value)
return self.obj
19 changes: 14 additions & 5 deletions rocketpy/stochastic/stochastic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,20 @@
)
elif isinstance(value, tuple):
nominal_value, std_dev, dist_func = value
return (
f"\t{attr.ljust(max_str_length)} "
f"{nominal_value:.5f} ± "
f"{std_dev:.5f} ({dist_func.__name__})"
)
if callable(dist_func) and dist_func.__name__ == "uniform":
mean = (std_dev + nominal_value) / 2
half_range = (std_dev - nominal_value) / 2
return (

Check warning on line 520 in rocketpy/stochastic/stochastic_model.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/stochastic/stochastic_model.py#L518-L520

Added lines #L518 - L520 were not covered by tests
f"\t{attr.ljust(max_str_length)} "
f"{mean:.5f} ± "
f"{half_range:.5f} ({dist_func.__name__})"
)
else:
return (
f"\t{attr.ljust(max_str_length)} "
f"{nominal_value:.5f} ± "
f"{std_dev:.5f} ({dist_func.__name__})"
)
return None

attributes = {k: v for k, v in self.__dict__.items() if not k.startswith("_")}
Expand Down