-
-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Display more information in MonteCarlo prints and plots #760
base: develop
Are you sure you want to change the base?
Changes from 4 commits
89bd6e1
6c1c439
34d3201
e5e9e09
b0137e1
7a4a6b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,10 +173,18 @@ def all(self, keys=None): | |
) | ||
else: | ||
raise ValueError("The 'keys' argument must be a string, list, or tuple.") | ||
|
||
for key in keys: | ||
plt.figure() | ||
plt.hist(self.monte_carlo.results[key]) | ||
plt.title(f"Histogram of {key}") | ||
plt.ylabel("Number of Occurrences") | ||
fig, (ax1, ax2) = plt.subplots(2, 1, height_ratios=[1, 3], figsize=(8, 8)) | ||
|
||
# Plot boxplot | ||
ax1.boxplot(self.monte_carlo.results[key], vert=False) | ||
ax1.set_xlabel(key) | ||
ax1.set_title(f"Box Plot of {key}") | ||
|
||
# Plot histogram | ||
ax2.hist(self.monte_carlo.results[key]) | ||
ax2.set_title(f"Histogram of {key}") | ||
ax2.set_ylabel("Number of Occurrences") | ||
|
||
plt.tight_layout() | ||
plt.show() | ||
Comment on lines
176
to
190
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Lucas-Prates should we really plot the 3 plot altogether? Perhaps letting the user activate/deactivate some of them if needed? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -722,9 +722,12 @@ def set_processed_results(self): | |
try: | ||
mean = np.mean(values) | ||
stdev = np.std(values) | ||
self.processed_results[result] = (mean, stdev) | ||
pi_low = np.quantile(values, 0.025) | ||
pi_high = np.quantile(values, 0.975) | ||
median = np.median(values) | ||
self.processed_results[result] = (mean, median, stdev, pi_low, pi_high) | ||
except TypeError: | ||
self.processed_results[result] = (None, None) | ||
self.processed_results[result] = (None, None, None, None, None) | ||
|
||
# Import methods | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. try:
mean = np.mean(values)
stdev = np.std(values)
self.processed_results[result] = (mean, stdev)
pi_low = np.quantile(values, 0.025)
pi_high = np.quantile(values, 0.975)
median = np.median(values)
except TypeError:
mean = None
stdev = None
pi_low = None
pi_high = None
median = None
self.processed_results[result] = (mean, median, stdev, pi_low, pi_high) Alternatively, we could make 5 try/except blocks instead of one single. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah sorry i missed that, I have committed this suggestion I don't think 5 try/except blocks is necessary. A situation where only one of these calculations fails seems unlikely to me. ie: either they all fail or none fail so catching them all in the same makes sense. |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor, but new lines should be add to the top, not the bottom of sections. This is common confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, it's also in the wrong section. fixed now