Closed peterstangl closed 4 years ago
There was a bug in the initial commits that caused the flavio.plot.contour
function to set z_min = np.min(z)
if the z_min
argument was set to 0
. This has been fixed in 12ca043.
@DavidMStraub do you have an opinion on that?
In my opinion it's always safer (as a user) to use keyword arguments when more than 3 or 4 arguments are involved. In fact, this could be enforeced, and any backwards-incompatible ambiguities avoided, by defining
def contour(x, y, z, levels, *, z_min, ...
although this would prevent calls contour(x, y, z, levels, z_min)
without keywords (but I'm not sure I see the benefit).
@DavidMStraub do you have an opinion on that?
In my opinion it's always safer (as a user) to use keyword arguments when more than 3 or 4 arguments are involved. In fact, this could be enforeced, and any backwards-incompatible ambiguities avoided, by defining
def contour(x, y, z, levels, *, z_min, ...
although this would prevent calls
contour(x, y, z, levels, z_min)
without keywords (but I'm not sure I see the benefit).
Thanks for the suggestion! I actually didn't know that one can enforce the use of keyword arguments. I think this is really a good solution to avoid backward-incompatible ambiguities. It's now implemented in ecfc66b.
This PR allows using an exact minimum determined by numerical minimization in contour plots generated by the
flavio.plots.contour
function. To this end, theflavio.plots.likelihood_contour_data
now returns itsz
-values without subtracting the lowestz
-value on the grid.Consequently, the output of
flavio.plots.likelihood_contour_data
is not backward compatible with older versions offlavio.plots.contour
. However, I don't see a reason why one should generate data with the new version but plot this data with an old version. On the other hand,flavio.plots.contour
is fully backward compatible in the sense that plot data generated by old versions offlavio.plots.likelihood_contour_data
can still be plotted with the new version offlavio.plots.contour
. Furthermore, bothflavio.plots.contour
andflavio.plots.likelihood_contour_data
are backward compatible in the sense that code written for the old versions of these functions will still work with the new versions.(The only exception is calling
flavio.plots.contour
and using the argumentinterpolation_factor
not as a keyword argument. i.e. if the function is called ascontour(x, y, z, levels, interpolation_factor)
instead ofcontour(x, y, z, levels, interpolation_factor=interpolation_factor)
, then this yields unexpected results in the new version since the 5th argument offlavio.plots.contour
now isz_min
. This could be avoided ifz_min
is made the last argument and all other arguments are kept in their previous order. However, I thought thatz_min
might be a rather frequently used argument and function calls likecontour(x, y, z, levels, z_min)
could be convenient. But I am not completely sure about this. @DavidMStraub do you have an opinion on that?)