Skip to content

Commit e946023

Browse files
authored
Merge pull request #1224 from PyAutoLabs/feature/autofit-smoke-cleanup
Guard corner_cornerpy against samples < dims
2 parents 9dbc55c + d6dd0ed commit e946023

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

autofit/non_linear/plot/samples_plotters.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1+
import logging
2+
13
import numpy as np
24

35
from autoconf import conf
46

57
from autofit.non_linear.plot.plot_util import skip_in_test_mode, output_figure
68

9+
logger = logging.getLogger(__name__)
10+
711

812
@skip_in_test_mode
913
def corner_cornerpy(samples, path=None, filename="corner", format="show", **kwargs):
14+
data = np.asarray(samples.parameter_lists)
15+
if data.ndim < 2 or data.shape[0] <= data.shape[1]:
16+
logger.info(
17+
"corner_cornerpy: skipping corner plot, only %s sample(s) for %s parameter(s) "
18+
"(e.g. PYAUTO_TEST_MODE bypass or an early-iteration update).",
19+
data.shape[0] if data.ndim >= 1 else 0,
20+
data.shape[1] if data.ndim >= 2 else 0,
21+
)
22+
return
23+
1024
import matplotlib.pylab as pylab
1125

1226
config_dict = conf.instance["visualize"]["plots_settings"]["corner_cornerpy"]
@@ -17,7 +31,7 @@ def corner_cornerpy(samples, path=None, filename="corner", format="show", **kwar
1731
import corner
1832

1933
corner.corner(
20-
data=np.asarray(samples.parameter_lists),
34+
data=data,
2135
weight_list=samples.weight_list,
2236
labels=samples.model.parameter_labels_with_superscripts_latex,
2337
)

0 commit comments

Comments
 (0)