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)
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)
def _profiles_overplot(profiles): for model, group in profiles.items(): name = model.name absorbing = any((L[2] != 1e-4).any() for L in group) magnetic = (len(group[0]) > 3) # Note: Use 3 colours per dataset for consistency _draw_overplot(group, 1, name + ' rho') if absorbing: _draw_overplot(group, 2, name + ' irho') else: next_color() if magnetic: _draw_overplot(group, 3, name + ' rhoM') else: next_color() _profile_labels()
def _residuals_contour(Q, residuals, contours=CONTOURS): import matplotlib.pyplot as plt shift = 0 for m, r in residuals.items(): color = next_color() plot_quantiles(Q[m], shift + r.T, contours, color) plt.plot(Q[m], shift + r[:, 0], '.', label=m.name, markersize=1, color=dark(color)) # Use 3 colours from cycle so reflectivity matches rho for each dataset next_color() next_color() shift += 5 _residuals_labels()
def _draw_contours(group, index, label, zp, contours): import matplotlib.pyplot as plt color = next_color() # Interpolate on common z fp = np.vstack([np.interp(zp, L[0], L[index]) for L in group]) # Plot the quantiles plot_quantiles(zp, fp, contours, color) # Plot the best plt.plot(zp, fp[0], '-', label=label, color=dark(color))
def _draw_overplot(group, index, label): import matplotlib.pyplot as plt alpha = 0.1 color = next_color() for L in group[1:]: plt.plot(L[0], L[index], '-', color=color, alpha=alpha) # Plot best L = group[0] plt.plot(L[0], L[index], '-', label=label, color=dark(color))
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()
def _profiles_contour(profiles, contours=CONTOURS, npoints=200): for model, group in profiles.items(): name = model.name absorbing = any((L[2] > 1e-4).any() for L in group) magnetic = (len(group[0]) > 3) # Find limits of all profiles z = np.hstack([line[0] for line in group]) zp = np.linspace(np.min(z), np.max(z), npoints) # Note: Use 3 colours per dataset for consistency _draw_contours(group, 1, name + ' rho', zp, contours) if absorbing: _draw_contours(group, 2, name + ' irho', zp, contours) else: next_color() if magnetic: _draw_contours(group, 3, name + ' rhoM', zp, contours) else: next_color() _profile_labels()
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()
def _residuals_overplot(Q, residuals): import matplotlib.pyplot as plt alpha = 0.4 shift = 0 for m, r in residuals.items(): color = next_color() plt.plot(Q[m], shift + r[:, 1:], '.', markersize=1, color=color, alpha=alpha) plt.plot(Q[m], shift + r[:, 0], '.', label=m.name, markersize=1, color=dark(color)) # Use 3 colours from cycle so reflectivity matches rho for each dataset next_color() next_color() shift += 5 _residuals_labels()