From ed80f58b0416cc374d4c4bc4749c01aa64174153 Mon Sep 17 00:00:00 2001 From: Tomas Stolker Date: Tue, 24 Sep 2024 18:09:09 +0200 Subject: [PATCH 1/2] Remove labels of fixed parameters in plot_corner --- orbitize/plot.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/orbitize/plot.py b/orbitize/plot.py index a02cfc1e..7832236a 100644 --- a/orbitize/plot.py +++ b/orbitize/plot.py @@ -107,21 +107,23 @@ def plot_corner(results, param_list=None, **corner_kwargs): param_indices = [] angle_indices = [] secondary_mass_indices = [] - for i, param in enumerate(param_list): - index_num = results.param_idx[param] + fixed_indices = [] + for i, label_key in enumerate(param_list): + index_num = results.param_idx[label_key] # only plot non-fixed parameters if np.std(results.post[:, index_num]) > 0: param_indices.append(index_num) - label_key = param if ( label_key.startswith("aop") or label_key.startswith("pan") or label_key.startswith("inc") ): - angle_indices.append(i) + angle_indices.append(i-len(fixed_indices)) if label_key.startswith("m") and label_key != "m0" and label_key != "mtot": - secondary_mass_indices.append(i) + secondary_mass_indices.append(i-len(fixed_indices)) + else: + fixed_indices.append(i) samples = np.copy( results.post[:, param_indices] @@ -137,7 +139,7 @@ def plot_corner(results, param_list=None, **corner_kwargs): "labels" not in corner_kwargs ): # use default labels if user didn't already supply them reduced_labels_list = [] - for i in np.arange(len(param_indices)): + for i in param_indices: label_key = param_list[i] if label_key.startswith("m") and label_key != "m0" and label_key != "mtot": body_num = label_key[1] From c409f492d9114e4c9e7b62b2cb1ce4f147f7ecc1 Mon Sep 17 00:00:00 2001 From: Tomas Stolker Date: Tue, 24 Sep 2024 20:02:43 +0200 Subject: [PATCH 2/2] Check if standard deviation is zero with np.isclose --- orbitize/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orbitize/plot.py b/orbitize/plot.py index 7832236a..52e1f30e 100644 --- a/orbitize/plot.py +++ b/orbitize/plot.py @@ -112,7 +112,7 @@ def plot_corner(results, param_list=None, **corner_kwargs): index_num = results.param_idx[label_key] # only plot non-fixed parameters - if np.std(results.post[:, index_num]) > 0: + if not np.isclose(0.0, np.std(results.post[:, index_num])): param_indices.append(index_num) if ( label_key.startswith("aop")