예제 #1
0
#! /usr/bin/python2.7

import ccgpack as ccg
import numpy as np
#import matplotlib.pylab as plt

from scipy import misc
m = misc.imread('../images/einstein.jpg')

cm = ccg.curvelet(m,4)

#plt.subplot(1,2,1)
#plt.imshow(m)
#plt.subplot(1,2,2)
#plt.imshow(cm)
#plt.show()

예제 #2
0
        mapp = np.load('../data/ffp10_p/' + str(i_map * 12 + i_patch) + '.npy')
        srgp = np.load('../data/string_p/' + str(i_srg * 12 + i_stch) + '.npy')

        #nsp = np.random.normal(0,gstd/s2n,mapp.shape)
        ptch = mapp + gmu * srgp  #+nsp
        t0 = time()
        ptch = blocker(ptch, 512, 512)
        btime.append(time() - t0)
        npp = len(ptch)

        for i in range(npp):
            mp = ptch[i]
            for rs in range(4, 8):
                keyn = 'ip{}_ipp{}_c{}_'.format(i_patch, i, rs)
                t0 = time()
                mc = ccg.curvelet(mp, r_scale=rs)
                ctime.append(time() - t0)

                t0 = time()
                m1 = ccg.filters(mc, edd_method='sob')
                m2 = ccg.filters(mc, edd_method='sch')
                ftime.append(time() - t0)
                res[keyn + 'sob'] = np.std(m1)
                res[keyn + 'sch'] = np.std(m2)

    ccg.save(fname, res)

dtt = time() - t00
print(np.mean(btime), np.mean(ctime), np.mean(ftime))
print(100. * np.sum(btime) / dtt, 100. * np.sum(ctime) / dtt,
      100. * np.sum(ftime) / dtt)
예제 #3
0
ngmu = len(gmulist)

tadd = '../data/test_set/healpix_p/'
sim_name = tadd.split('/')[3]
res_add = '../classic/'+sim_name+'/'
ccg.ch_mkdir(res_add)

print('Buiding classical method results:')
for j,gmu in enumerate(gmulist):
    dir_name = '{:3.2e}'.format(gmu)
    add = tadd+dir_name+'/'
    stds = []
    for i in range(480):
        ccg.pop_percent(j*480+i,480*ngmu)
        m = np.load(add+str(i)+'.npy')
        m = ccg.curvelet(m,r_scale = 7)
        m = ccg.filters(m, edd_method = 'sch')
        std = np.std(m)
        stds.append(std)
    np.save(res_add+dir_name,stds)

lst1 = []
for gmu in gmulist:
    file_name = '{:3.2e}'.format(gmu)
    var_file = res_add+file_name+'.npy'
    lst1.append(np.load(var_file))
lst1 = np.array(lst1)    

result = p_value(lst1)
np.save(res_add[:-1],np.array([gmulist,result]))