Esempio n. 1
0
    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:
        fullfile=os.path.join(current_dir,local_path,fname)
        
        T=import_data(fullfile) # get astro-data from file
        t0=time.time() # benchmark performance
Esempio n. 2
0
import matplotlib.pyplot as plt

if __name__ == '__main__':
    psx=False # parallel execution
    
    w0=0.0004  # simulate slow frequency signal
    phase0=1.0 # with phase offset 1.0
     
    # simulate constant rate process as test of Null - hypothesis
    T1=simulate_arrival_times() 
    
    # simulate periodic rate process as positive test
    T2=simulate_arrival_times(w=w0,phase=phase0,noise_rate=0.0000)
    
    #make bin histograms
    n1=compute_bin(T1,m=7,w=w0,p=phase0)
    n2=compute_bin(T2,m=7,w=w0,p=phase0)
    
    # plot the bin histograms 
    ind=np.arange(7) # x-axis for the bin histogram
    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')