mc3 icon indicating copy to clipboard operation
mc3 copied to clipboard

contourf error

Open sarahshi opened this issue 10 months ago • 0 comments

Hi Patricio,

Hope this message finds you well. I just wanted to write to alert you of a potential error introduced in the pairwise function. It appears that contour's collections have been modified. I just got a failed pytest after pushing some updates to my code. Find the error and the snippet of code involved attached.

Best, Sarah


AC4_OL53_101220_256s_30x30_a failed. Reason: 'QuadContourSet' object has no attribute 'collections' =========================== short test summary info ============================ FAILED UnitTests/test_fittingfunc.py::test_fitting_functions::test_MCMC_exportpath - AssertionError: False is not true : No figure files found in FIGURES or its subdirectories.

` def _pairwise( hist, hist_xran, axes, ranges, estimates, palette, nlevels, absolute_dens, lmax, linewidth, theme, alpha=0.8, clear=True, ): """ Lowest-lever routine to plot pair-wise posterior distributions. (Everything happening inside the axes) """ npars = len(ranges) # Reset upper boundary to absolute maximum value if requested: if absolute_dens: lmax[:] = np.amax(lmax)

for icol in range(npars-1):
    for irow in range(icol, npars-1):
        ax = axes[irow,icol]
        if clear:
            ax.clear()
        extent = (
            hist_xran[icol,0],
            hist_xran[icol,-1],
            hist_xran[irow+1,0],
            hist_xran[irow+1,-1],
        )
        levels = np.zeros(nlevels+1)
        levels[1:] = np.linspace(1.0, lmax[irow,icol], nlevels)
        colors = palette(levels/lmax[irow,icol], alpha=alpha)
        colors[0,3] = 0.0
        colors[1,3] = 0.75*alpha
        cont = ax.contourf(
            hist[irow,icol],
            colors=colors, levels=levels,
            origin='lower', extent=extent,
        )
        edge_color = to_rgba(theme.color, alpha=0.65)
        for c in cont.collections:
            c.set_edgecolor(edge_color)
            c.set_linewidth(0.1)
        cont.collections[0].set_edgecolor((1,1,1,0))
        if estimates[icol] is not None:
            ax.axvline(
                estimates[icol],
                dashes=(9,2), lw=linewidth, color=theme.dark_color,
            )
        if estimates[irow+1] is not None:
            ax.axhline(
                estimates[irow+1],
                dashes=(9,2), lw=linewidth, color=theme.dark_color,
            )
        if ranges[icol] is not None:
            ax.set_xlim(ranges[icol])
        if ranges[irow] is not None:
            ax.set_ylim(ranges[irow+1])`

sarahshi avatar Feb 22 '25 01:02 sarahshi