Beispiel #1
0
def saveCur(cur, num_cells):
    m.imsave('tmat:n={}'.format(num_cells), cur, cmap=plt.cm.gray)
    print('determining tmat eigs')
    #eigvals, eigvecs = np.linalg.eig(cur)
    eigvals = np.linalg.eigvals(cur)
    eigvals = np.array(list(filter(lambda x: x.real < 0.9999, eigvals)))  # get rid of trivial 1+0j eigval
    
    # display scatter plot of eigenvalues
    #ax = fig.add_subplot(121)
    print('plotting tmat eigs')
    fig, ax = plt.subplots() #fig.add_subplot(111)
    ax.set_title('Eigenvalues (tmat)')
    ax.set_xlabel('Real')
    ax.set_ylabel('Imaginary')
    f = ax.scatter(
        eigvals.real,
        eigvals.imag,
        marker=',',
        facecolor='0',
        lw=0,
        s=1, # area of each plotted point
    )

    fig.savefig('tmat_eigs:n={}'.format(num_cells), bbox_inches='tight', dpi=600)
    plt.close(fig)
Beispiel #2
0
def saveFFT(cur, num_cells):
    ft = np.fft.fft2(cur)
    #global aaa
    #aaa = -1
    #def ppp(x):
    #    global aaa
    #    aaa += 1
    #    return aaa

    #ft = np.apply_along_axis(np.fft.fft, 0, cur) # just run on columns
    m.imsave('ft_real:n={}'.format(num_cells), ft.real, cmap=plt.cm.gray)
    m.imsave('ft_imag:n={}'.format(num_cells), ft.imag, cmap=plt.cm.gray)

    print('determining 2dft eigs')
    eigvals = np.linalg.eigvals(ft)
    print('plotting 2dft eigs')
    fig, ax = plt.subplots() #fig.add_subplot(111)
    ax.set_title('Eigenvalues (FT)')
    ax.set_xlabel('Real')
    ax.set_ylabel('Imaginary')
    f = ax.scatter(
        eigvals.real,
        eigvals.imag,
        marker=',',
        facecolor='0',
        lw=0,
        s=1, # area of each plotted point
    )

    fig.savefig('2dft_eigs:n={}'.format(num_cells), bbox_inches='tight', dpi=600)
    plt.close(fig)