Пример #1
0
kernel3 = np.ones_like(x)
kernel3[xmin:xmax, ymin:ymax] = 0.7

xc, yc = 750., 520.,
sigma = 150.
kernel4 = 1 - A * np.exp(- (0.1*(x-xc)**2+(y-yc)**2) / (2. * sigma**2))



e_mod = np.empty_like(e)
for i in range(e.shape[2]):
    print data['x'].shape
    fig, ax, cc = graph.color_plot(data['y'][..., i], data['x'][..., i], e[..., i] / kernel[i], vmin=0, vmax=1*10**4)
    ax.invert_yaxis()
    graph.add_colorbar(cc, option='scientific')
    graph.title(ax, 'z=%.3f' % data['z'][0, 0, i])
    graph.save(dir + '/mod_deltadx_%s_-30/zm%03d' % (str(deltafx).replace('.', 'p'), i), ext='png')
    plt.close('all')

    if i < 100:
        fig, ax, cc = graph.color_plot(data['y'][..., i], data['x'][..., i], e[..., i] / kernel[i] * kernel4, vmin=0,
                                       vmax=10 * 10 ** 3)
        e_mod[..., i] = e[..., i] / kernel[i] * kernel4
    else:
        fig, ax, cc = graph.color_plot(data['y'][..., i], data['x'][..., i], e[..., i] / kernel[i], vmin=0,
                                       vmax=10 * 10 ** 3)
        e_mod[..., i] = e[..., i] / kernel[i]

    ax.scatter(yc, xc)
    ax.invert_yaxis()
    graph.add_colorbar(cc, option='scientific')
Пример #2
0
    fig2, ax2, cc2 = graph.color_plot(iw_grid, disp_grid, fitdata, vmin=vmins[i], vmax=vmaxs[i], fignum=2, subplot=241+i, cmap=cmaps[i])
    plt.scatter(iws, disps, color='m', s=4)
    axes.append(ax2)
    ccs.append(cc2)

def vel_upper_limit_func(iw, npass):
    iw_ini = iw * 2**(npass-1)
    return iw_ini/2

for ax, title, cc in zip(axes, titles, ccs):
    ax.plot(np.linspace(0, 80), vel_upper_limit_func(np.linspace(0, 80), 4), linestyle='--', color='r')
    ax.set_facecolor('k')
    graph.setaxes(ax, 0, 80, 0, 80)
    graph.add_colorbar(cc, ax=ax)
    graph.labelaxes(ax, xlabel, ylabel)
    graph.title(ax, title)
graph.save(datafilename+'4')


#sort arrays first
import library.basics.formatarray as fa
iws_s, disps_s = fa.sort_two_arrays_using_order_of_first_array(iws, disps)
# Accuracy
iws_s, gauss_peaks_ux_s = fa.sort_two_arrays_using_order_of_first_array(iws, gauss_peaks_ux)
iws_s, gauss_peaks_ux_err_s = fa.sort_two_arrays_using_order_of_first_array(iws, gauss_peaks_ux_err)
iws_s, lorentz_peaks_ux_s = fa.sort_two_arrays_using_order_of_first_array(iws, lorentz_peaks_ux)
iws_s, lorentz_peaks_ux_err_s = fa.sort_two_arrays_using_order_of_first_array(iws, lorentz_peaks_ux_err)
# Precision
iws_s, sigmas_ux_s = fa.sort_two_arrays_using_order_of_first_array(iws, sigmas_ux)
iws_s, sigmas_ux_err_s = fa.sort_two_arrays_using_order_of_first_array(iws, sigmas_ux_err)
iws_s, gammas_ux_s = fa.sort_two_arrays_using_order_of_first_array(iws, gammas_ux)
        e = (ux**2 + uy**2) / 2.

        for i in range(x.shape[2]):
            print i, np.min(z[..., i]), np.max(z[..., i]), np.mean(z[..., i])
            fig, ax, cc = graph.color_plot(x[..., i],
                                           y[..., i],
                                           e[..., i],
                                           cmap='plasma',
                                           vmin=vmin,
                                           vmax=vmax)
            graph.add_colorbar(
                cc,
                label=r'$\bar{E}_{2D}=\frac{1}{2}(\bar{U_x}^2)$',
                option='scientific')
            graph.labelaxes(ax, 'X (px)', 'Y (px)')
            graph.title(ax, '<z>=%.2f px' % np.mean(z[..., i]))
            fig.tight_layout()
            filename = '/time_avg_energy_raw_%s/zm%03d' % (args.mode, i)
            graph.save(args.dir + filename,
                       ext='png',
                       close=True,
                       verbose=True)

        print x.shape, ux.shape
        xmin, xmax, ymin, ymax, zmin, zmax = np.min(x), np.max(x), np.min(
            y), np.max(y), np.min(z), np.max(z)

        points = zip(np.ravel(x), np.ravel(y),
                     np.ravel(z))  # px after piv processing
        # values = np.ravel(ux)*scale*frame_rate #mm/s