Exemplo n.º 1
0
    output = basename+'_fsc.dat'
else:
    output = args.output

nf = len(args.files)
fscs = []
for i in range(nf):
    fscs.append(np.loadtxt(args.files[i]))
fscs = np.array(fscs)

if nf==1:
    fsc = fscs[0]
else:
    fsc = np.mean(fscs,axis=0)

resn, x, y, resx = saxs.fsc2res(fsc, return_plot=True)
if np.min(fsc[:,1]) > 0.5:
    print("Resolution: < %.1f A (maximum possible)" % resn)
else:
    print("Resolution: %.1f A" % resn)

np.savetxt(output,fsc,delimiter=' ',fmt='%.5e',header="1/resolution, FSC")

if args.plot:
    import matplotlib.pyplot as plt
    plt.plot(fsc[:,0],fsc[:,0]*0+0.5,'k--')
    for i in range(nf):
        plt.plot(fscs[i,:,0],fscs[i,:,1],'k--',alpha=0.1)
    plt.plot(fsc[:,0],fsc[:,1],'bo-')
    #plt.plot(x,y,'k-')
    plt.plot([resx],[0.5],'ro',label='Resolution = '+str(resn)+r'$\mathrm{\AA}$')
Exemplo n.º 2
0
            rhosum = rho
        else:
            rhosum += rho
    print()
    rhos = np.array(rhos)
    average_rho = rhosum / nmaps
    saxs.write_mrc(average_rho, side, output + "_avg.mrc")
    print("%s_avg.mrc written." % output)

    #rather than compare two halves, average all fsc's to the reference
    fscs = []
    resns = []
    for calc_map in range(nmaps):
        fsc_map = saxs.calc_fsc(rhos[calc_map], average_rho, side)
        fscs.append(fsc_map)
        resn_map = saxs.fsc2res(fsc_map)
        resns.append(resn_map)

    fscs = np.array(fscs)
    resns = np.array(resns)
    fsc = np.mean(fscs, axis=0)
    resn, x, y, resx = saxs.fsc2res(fsc, return_plot=True)
    resn_sd = np.std(resns)
    if np.min(fsc[:, 1]) > 0.5:
        print("Resolution: < %.1f +- %.1f A (maximum possible)" %
              (resn, resn_sd))
    else:
        print("Resolution: %.1f +- %.1f A " % (resn, resn_sd))

    np.savetxt(output + '_fsc.dat',
               fsc,