def call_process(f, date): # print("File is",f) runF = open(f, "r") #runF=open("p_spec_runs.txt","r") #r_in=runF.readlines() r_in = runF.read().splitlines() rn = [] for line in r_in: rn.append(line) par_array = read_par_file.make_par_array(date) step_size = read_par_file.read_header(date) f0 = [] # lists to fill p_uns = [] f_uns = [] f0_uns = [] fs_uns = [] del_uns = [] var_uns = [] wf = [] wp = [] n_ss = 160 #Call functions to process data and fill lists for i in range(0, n_ss): print("Processing", rn[i]) ls = process( rn[i], date, [float(par_array[i][1]), float(par_array[i][2]), step_size]) p_uns.append(ls[5]) f0_uns.append(ls[2]) f_uns.append(ls[0]) fs_uns.append(ls[3]) del_uns.append(ls[7]) var_uns.append(ls[8]) #print(len(ls[1])) del ls f_start = [item[0] for item in f_uns] s_ind = np.argsort(f_start) f = sort_from_indexes(s_ind, f_uns) f = np.around(f, decimals=7) p = sort_from_indexes(s_ind, p_uns) f0 = sort_from_indexes(s_ind, f0_uns) fs = sort_from_indexes(s_ind, fs_uns) del_s = sort_from_indexes(s_ind, del_uns) var_s = sort_from_indexes(s_ind, var_uns) return [f, p, f0, fs, del_s, var_s]
def call_process(f,date): # print("File is",f) runF=open(f,"r") #runF=open("p_spec_runs.txt","r") #r_in=runF.readlines() r_in=runF.read().splitlines() rn=[] for line in r_in: rn.append(line) par_array=read_par_file.make_par_array(date) step_size=read_par_file.read_header(date) f0=[] # lists to fill p_uns=[] f_uns=[] f0_uns=[] fs_uns=[] del_uns=[] var_uns=[] wf=[] wp=[] n_ss=160 #Call functions to process data and fill lists for i in range (0,n_ss): print("Processing",rn[i]) ls=process(rn[i],date,[float(par_array[i][1]),float(par_array[i][2]),step_size]) p_uns.append(ls[5]) f0_uns.append(ls[2]) f_uns.append(ls[0]) fs_uns.append(ls[3]) del_uns.append(ls[7]) var_uns.append(ls[8]) #print(len(ls[1])) del ls f_start=[item[0] for item in f_uns ] s_ind=np.argsort(f_start) f=sort_from_indexes(s_ind,f_uns) f=np.around(f,decimals=7) p=sort_from_indexes(s_ind,p_uns) f0=sort_from_indexes(s_ind,f0_uns) fs=sort_from_indexes(s_ind,fs_uns) del_s=sort_from_indexes(s_ind,del_uns) var_s=sort_from_indexes(s_ind,var_uns) return [f,p,f0,fs,del_s,var_s]
def call_process(f): runF=open(f,"r") #runF=open("p_spec_runs.txt","r") r_in=runF.readlines() rn=list(map(int,r_in)) f0=[] # lists to fill p_uns=[] f_uns=[] f0_uns=[] fs_uns=[] del_uns=[] var_uns=[] wf=[] wp=[] n_ss=len(rn) #n_ss=25 #Call functions to process data and fill lists for i in range (0,n_ss): print("Processing",rn[i]) ls=process(rn[i]) p_uns.append(ls[5]) f0_uns.append(ls[2]) f_uns.append(ls[0]) fs_uns.append(ls[3]) del_uns.append(ls[7]) var_uns.append(ls[8]) #print(len(ls[1])) del ls f_start=[item[0] for item in f_uns ] s_ind=np.argsort(f_start) f=sort_from_indexes(s_ind,f_uns) f=np.around(f,decimals=7) p=sort_from_indexes(s_ind,p_uns) f0=sort_from_indexes(s_ind,f0_uns) fs=sort_from_indexes(s_ind,fs_uns) del_s=sort_from_indexes(s_ind,del_uns) var_s=sort_from_indexes(s_ind,var_uns) return [f,p,f0,fs,del_s,var_s]
f0=[] # lists to fill p_uns=[] f_uns=[] f0_uns=[] fs_uns=[] del_uns=[] var_uns=[] wf=[] wp=[] n_ss=len(rn) #n_ss=25 #Call functions to process data and fill lists for i in range (0,n_ss): print("Processing",rn[i]) ls=process(rn[i]) p_uns.append(ls[5]) f0_uns.append(ls[2]) f_uns.append(ls[0]) fs_uns.append(ls[3]) del_uns.append(ls[7]) var_uns.append(ls[8]) #print(len(ls[1])) del ls f_start=[item[0] for item in f_uns ] s_ind=np.argsort(f_start) f=sort_from_indexes(s_ind,f_uns) f=np.around(f,decimals=7) p=sort_from_indexes(s_ind,p_uns) f0=sort_from_indexes(s_ind,f0_uns) fs=sort_from_indexes(s_ind,fs_uns)
import numpy as np import matplotlib.pyplot as plt from process_spectra import process rn = [ 201507310008, 201507310016, 201507310023, 201507310030, 201507310037, 201507310044, 201507310051, 201507310059, 201507310066 ] f0 = [] # lists to fill p = [] f = [] wf = [] wp = [] n_ss = len(rn) #n_ss=7 #fill frequncy list with sequential steps #fill power with random gaussian noise or artificial peak at 5.723968... GHz for i in range(0, n_ss): ls = process(rn[i]) f0.append(ls[2]) del ls x = np.linspace(0, len(f0), len(f0)) plt.plot(x, f0, 'ro') plt.show()