elif ql_fluxes: print "not ready for nspec>2!!!" stop else: par = Parameters() par.Read_Pars('parameters' + suffix) #scan_dims=par.pardict['scan_dims'] grid1 = np.append(grid1, par.pardict[svar1]) if os.path.isfile('omega' + suffix): print suffix frequency = np.genfromtxt('omega' + suffix) if (frequency.any() and frequency[1] != 0.0): gamma = np.append(gamma, frequency[1]) omega = np.append(omega, frequency[2]) if nspec == 1 and ql_fluxes: tn, nrg1 = get_nrg0(suffix, nspec=nspec) Q1ES = np.append(Q1ES, nrg1[-1, 6] / nrg1[-1, 0]) Q1EM = np.append(Q1EM, nrg1[-1, 7] / nrg1[-1, 0]) G1ES = np.append(G1ES, nrg1[-1, 4] / nrg1[-1, 0]) G1EM = np.append(G1EM, nrg1[-1, 5] / nrg1[-1, 0]) elif nspec == 2 and ql_fluxes: tn, nrg1, nrg2 = get_nrg0(suffix, nspec=nspec) Q1ES = np.append(Q1ES, nrg1[-1, 6] / nrg1[-1, 0]) Q1EM = np.append(Q1EM, nrg1[-1, 7] / nrg1[-1, 0]) G1ES = np.append(G1ES, nrg1[-1, 4] / nrg1[-1, 0]) G1EM = np.append(G1EM, nrg1[-1, 5] / nrg1[-1, 0]) Q2ES = np.append(Q2ES, nrg2[-1, 6] / nrg2[-1, 0]) Q2EM = np.append(Q2EM, nrg2[-1, 7] / nrg2[-1, 0]) G2ES = np.append(G2ES, nrg2[-1, 4] / nrg2[-1, 0]) G2EM = np.append(G2EM, nrg2[-1, 5] / nrg2[-1, 0]) elif nspec == 3 and ql_fluxes:
apar_cont = np.sum(np.abs(omega_complex*field.apar()[:,:,:])) print "diff",diff print "phi_cont",phi_cont print "apar_cont",apar_cont print "diff/abs",diff/(phi_cont+apar_cont) scan_info[i,11] = diff/(phi_cont+apar_cont) else: scan_info[i,6] = np.nan scan_info[i,7] = np.nan scan_info[i,8] = np.nan scan_info[i,9] = np.nan scan_info[i,11] = np.nan if os.path.isfile('nrg_'+scan_num): if nspec==1: tn,nrg1=get_nrg0('_'+scan_num,nspec=nspec) scan_info[i,10]=nrg1[-1,7]/abs(nrg1[-1,6]) elif nspec==2: tn,nrg1,nrg2=get_nrg0('_'+scan_num,nspec=nspec) scan_info[i,10]=nrg2[-1,7]/(abs(nrg2[-1,6])+abs(nrg1[-1,6])) elif nspec==3: tn,nrg1,nrg2,nrg3=get_nrg0('_'+scan_num,nspec=nspec) else: sys.exit("Not ready for nspec > 3") else: scan_info[i,10] = np.nan f=open('scan_info.dat','w') p = open('parameters','r') lines = p.read() p.close()
elif ql_fluxes: print "not ready for nspec>2!!!" stop else: par=Parameters() par.Read_Pars('parameters'+suffix) #scan_dims=par.pardict['scan_dims'] grid1=np.append(grid1,par.pardict[svar1]) if os.path.isfile('omega'+suffix): print suffix frequency=np.genfromtxt('omega'+suffix) if(frequency.any() and frequency[1] != 0.0): gamma=np.append(gamma,frequency[1]) omega=np.append(omega,frequency[2]) if nspec==1 and ql_fluxes: tn,nrg1=get_nrg0(suffix,nspec=nspec) Q1ES=np.append(Q1ES,nrg1[-1,6]/nrg1[-1,0]) Q1EM=np.append(Q1EM,nrg1[-1,7]/nrg1[-1,0]) G1ES=np.append(G1ES,nrg1[-1,4]/nrg1[-1,0]) G1EM=np.append(G1EM,nrg1[-1,5]/nrg1[-1,0]) elif nspec==2 and ql_fluxes: tn,nrg1,nrg2=get_nrg0(suffix,nspec=nspec) Q1ES=np.append(Q1ES,nrg1[-1,6]/nrg1[-1,0]) Q1EM=np.append(Q1EM,nrg1[-1,7]/nrg1[-1,0]) G1ES=np.append(G1ES,nrg1[-1,4]/nrg1[-1,0]) G1EM=np.append(G1EM,nrg1[-1,5]/nrg1[-1,0]) Q2ES=np.append(Q2ES,nrg2[-1,6]/nrg2[-1,0]) Q2EM=np.append(Q2EM,nrg2[-1,7]/nrg2[-1,0]) G2ES=np.append(G2ES,nrg2[-1,4]/nrg2[-1,0]) G2EM=np.append(G2EM,nrg2[-1,5]/nrg2[-1,0]) elif nspec==3 and ql_fluxes:
Arguments must be 1.Case name 2.Run number (e.g. .dat or _1) \n""") case_name = args[0] run_number = args[1] tmax = options.tmax #print "tmax",tmax par=Parameters() par.Read_Pars('parameters'+run_number) n_spec = int(float(par.pardict['n_spec'])) print 'n_spec',n_spec nrgcols = int(float(par.pardict['nrgcols'])) rhostar = float(par.pardict['rhostar']) time,nrgi,nrge=get_nrg0(run_number,nspec=n_spec,ncols = nrgcols) if not tmax: print "Identify end time for plots." plt.plot(time,nrgi[:,0],'x-') plt.xlabel(r'$t(L_{ref}/v_{ref})$',size=18) plt.ylabel(r'$n^2/(n_0\rho^*)^2$',size=18) plt.show() tmax = float(raw_input("Enter end time for plot:")) end_index = np.argmin(abs(time-tmax)) print "time[end_index]",time[end_index] plt.figure(figsize=(14,8))