Skip to content

Commit

Permalink
Merge pull request #159 from BrainLesion/panoptica_statisics_utility
Browse files Browse the repository at this point in the history
increased panoptica statistics utility
  • Loading branch information
Hendrik-code authored Dec 12, 2024
2 parents 17e53dc + 309574a commit 7d72422
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
16 changes: 15 additions & 1 deletion panoptica/panoptica_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def make_curve_over_setups(
fig: None = None,
plot_dotsize: int | None = None,
plot_lines: bool = True,
plot_std: bool = False,
):
if groups is None:
groups = list(statistics_dict.values())[0].groupnames
Expand Down Expand Up @@ -334,14 +335,27 @@ def make_curve_over_setups(
ValueSummary(stat.get(g, metric, remove_nones=True)).avg
for stat in statistics_dict.values()
]
Ystd = [
ValueSummary(stat.get(g, metric, remove_nones=True)).std
for stat in statistics_dict.values()
]

if plot_lines:
plt.plot(
p = plt.plot(
X,
Y,
label=g if alternate_groupnames is None else alternate_groupnames[idx],
)

if plot_std:
plt.fill_between(
X,
np.subtract(Y, Ystd),
np.add(Y, Ystd),
alpha=0.25,
edgecolor=p[-1].get_color(),
)

if plot_dotsize is not None:
plt.scatter(X, Y, s=plot_dotsize)

Expand Down
4 changes: 1 addition & 3 deletions panoptica/utils/processing_pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,7 @@ def _check_array_integrity(
assert (
prediction_arr.shape == reference_arr.shape
), f"shape mismatch, got {prediction_arr.shape},{reference_arr.shape}"
assert (
prediction_arr.dtype == reference_arr.dtype
), f"dtype mismatch, got {prediction_arr.dtype},{reference_arr.dtype}"
# assert prediction_arr.dtype == reference_arr.dtype, f"dtype mismatch, got {prediction_arr.dtype},{reference_arr.dtype}"
if dtype is not None:
assert (
np.issubdtype(prediction_arr.dtype, dtype)
Expand Down

0 comments on commit 7d72422

Please sign in to comment.