示例#1
0
    print "parallel execution\n"
    
    # find the data directory    
    filename = inspect.getframeinfo(inspect.currentframe()).filename
    current_dir = os.path.dirname(os.path.abspath(filename))
    
    local_path="data" # this folder should containt the files in file_list
    
    
    for fname in file_list:
        fullfile=os.path.join(current_dir,local_path,fname)
        
        T=import_data(fullfile) # get astro-data from file

        t0=time.time() # benchmark performance
        O_period,p_period,m_opt,S,w,w_peak,w_mean,w_conf=compute_GL(T,parallel=px) # run GL,  parallel execution
        t1=time.time()
        print "total time used = %f with parallel execution\n" % (t1-t0)
    
        n=compute_bin(T,m=m_opt,w=w_peak,p=0) # compute resulting bin histogram
        print ('File:%s - Likelihood of periodic process =%3.2f %% most likely frequency %e mean frequency %e 95 %% confidence interval = [%e %e]\n') % (fname,p_period*100,w_peak,w_mean,w_conf[0],w_conf[1])
            
    
    
    
    # serial execution
    print "serial execution\n"
    px=False
    
    
    for fname in file_list:
示例#2
0
 width = 0.35 # the width of the bars
 
 # constant rate process
 fig, ax = plt.subplots()
 rects1 = ax.bar(ind, n1, width, color='b')
 ax.set_ylabel('bin count')
 ax.set_title('phase bin histogramm for constant rate process')
 
 # periodic process
 fig, ax = plt.subplots()
 rects2 = ax.bar(ind, n2, width, color='b')
 ax.set_ylabel('bin count')
 ax.set_title('phase bin histogramm for periodic rate process')
 
 # test GL algorithm for constant rate process
 O_period1,p_period1,m_opt1,S1,w1,w_peak1,w_mean1,w_conf1=compute_GL(T1,parallel=psx)
 
 fig, ax = plt.subplots()
 ax.plot(w1,S1)
 ax.set_ylabel('probability')
 ax.set_xlabel('f [rad/s]')
 ax.set_title('spectrum for constant rate process')
 
 print ('Likelihood of periodic process =%3.2f %% most likely frequency %e mean frequency %e 95 %% confidence interval = [%e  %e]\n') % (p_period1*100,w_peak1,w_mean1,w_conf1[0],w_conf1[1])
 
 
 
 O_period2,p_period2,m_opt2,S2,w2,w_peak2,w_mean2,w_conf2=compute_GL(T2,parallel=psx)
 
 fig, ax = plt.subplots()
 ax.plot(w2,S2)