예제 #1
0
def _profiles_overplot(profiles):
    import pylab

    alpha = 0.1
    any_magnetic = False
    for p in profiles.values():
        if len(p[0]) == 3:
            rho_color = next_color()
            for z, rho, _ in p[1:]:
                pylab.plot(z, rho, '-', color=rho_color, alpha=alpha)
            # Plot best
            z, rho, _ = p[0]
            pylab.plot(z, rho, '-', color=dhsv(rho_color, dv=-0.2))
        else:
            any_magnetic = True
            rho_color = next_color()
            rhoM_color = next_color()
            for z, rho, _, rhoM, _ in p[1:]:
                pylab.plot(z, rho, '-', color=rho_color, alpha=alpha)
                pylab.plot(z, rhoM, '-', color=rhoM_color, alpha=alpha)
            # Plot best
            z, rho, _, rhoM, _ = p[0]
            pylab.plot(z, rho, '-', color=dhsv(rho_color, dv=-0.2))
            pylab.plot(z, rhoM, '-', color=dhsv(rhoM_color, dv=-0.2))
    _profiles_labels(any_magnetic)
예제 #2
0
def _profiles_contour(profiles, contours=_CONTOURS, npoints=200):
    import pylab

    any_magnetic = False
    for p in profiles.values():
        # Find limits of all profiles
        z = np.hstack([line[0] for line in p])
        zp = np.linspace(np.min(z), np.max(z), npoints)
        if len(p[0]) == 3:
            rho_color = next_color()
            # Interpolate rho on common z
            rho = np.vstack([np.interp(zp, L[0], L[1]) for L in p])
            # Plot the quantiles
            plot_quantiles(zp, rho, contours, rho_color)
            # Plot the best
            pylab.plot(zp, rho[0], '-', color=dhsv(rho_color, dv=-0.2))
        else:
            any_magnetic = True
            rho_color = next_color()
            rhoM_color = next_color()
            # Interpolate rho, rhoM on common z
            rho = np.vstack([np.interp(zp, L[0], L[1]) for L in p])
            rhoM = np.vstack([np.interp(zp, L[0], L[3]) for L in p])
            # Plot the quantiles
            plot_quantiles(zp, rho, contours, rho_color)
            plot_quantiles(zp, rhoM, contours, rhoM_color)
            # Plot the best
            pylab.plot(zp, rho[0], '-', color=dhsv(rho_color, dv=-0.2))
            pylab.plot(zp, rhoM[0], '-', color=dhsv(rhoM_color, dv=-0.2))
    _profiles_labels(any_magnetic)
예제 #3
0
def _residuals_contour(Q, residuals, contours=_CONTOURS):
    import pylab
    shift = 0
    for m, r in residuals.items():
        color = next_color()
        plot_quantiles(Q[m], shift+r.T, contours, color)
        pylab.plot(Q[m], shift+r[:, 0], '.', markersize=1,
                   color=dhsv(color, dv=-0.2)) # best
        shift += 5
    _residuals_labels()
예제 #4
0
def _residuals_overplot(Q, residuals):
    import pylab
    alpha = 0.4
    shift = 0
    for m, r in residuals.items():
        color = next_color()
        pylab.plot(Q[m], shift+r[:, 1:], '.', markersize=1,
                   color=color, alpha=alpha)
        pylab.plot(Q[m], shift+r[:, 0], '.', markersize=1,
                   color=dhsv(color, dv=-0.2)) # best
        shift += 5
    _residuals_labels()
예제 #5
0
파일: errors.py 프로젝트: ohcpaull/refl1d
def dark(color):
    return dhsv(color, dv=-0.2)