Closed jkanner closed 4 months ago
Below is also a snippet of code which prevents smoothing over the q=1 boundary for a mass_1-mass_2 2d plot:
from pesummary.utils.bounded_2d_kde import Bounded_2d_kde
from pesummary.gw.plots.bounds import default_bounds
xbounds = default_bounds["mass_1"]
ybounds = default_bounds["mass_2"]
fig, _, _, _ = samples.plot(["mass_1", "mass_2"], type="reverse_triangle", module="gw", kde_2d=Bounded_2d_kde, kde_k2d_kwargs={"xlow": xbounds.get("low", None), "xhigh": xbounds.get("high", None), "ylow": ybounds.get("low", None), "yhigh": ybounds.get("high", None)})
For the 2-d triangle plot, I made the suggested change.
I noticed a strange result when plotting GW150914 along with GW170817:
For the 1-D plots, I get an error message when I try this code. The mass_2 high bound is mass_1
. I get an error that says:
TypeError: '>' not supported between instances of 'numpy.ndarray' and 'str'
This makes me think the code is trying to compare the string mass_1
with some number, or some other bug. I'm not sure how to fix this. For now, I'll leave this change on the branch kde
.
Update: I was able to fix this by adding a try/except statement.
My preference is to not make these changes.
In some cases, the scipy.stats.gaussian_kde used in the 1d plots under the 2d plot tab smooth over physical boundaries. This is seen for parameters like chi_p and a_1. I suggest using a bounded_1d_kde/bounded_2d_kde to resolve this. You can see the different bounded KDEs implemented in pesummary here. In general I suggest a method=Transform for chi_p and a method=Reflection for a_1 etc. An example code snippet which does this is below: