예제 #1
0
파일: grid.py 프로젝트: samcunliffe/sam
def data_job_retention(nSelected,nRunOver):
    """Calculate the retention for a data job"""
    from uncertainties import ufloat as u
    from math import sqrt as s
    nsel  = u((nSelected,s(nSelected)))
    nrun  = u((nRunOver,s(nRunOver)))
    out   = nsel/nrun
    print "(", 100*out, ") %"
    return out
예제 #2
0
파일: grid.py 프로젝트: samcunliffe/sam
def mc_job_selection_efficiency(DecProdEff,DecProdEffErr,nSelected,nRunOver):
    """Calculate the selection efficiency for a MC job"""
    from uncertainties import ufloat as u
    from math import sqrt as s
    e_dpc = u((DecProdEff,DecProdEffErr))
    nsel  = u((nSelected,s(nSelected)))
    nrun  = u((nRunOver,s(nRunOver)))
    out   = e_dpc*nsel/nrun
    print "(", 100*out, ") %"
    return out
예제 #3
0
        time_co2[i].append(array[:,1])
        
        
#%%

osc_P_ar, osc_T_ar, time_array_ar, fit_ar, fit_err_ar = get_data_fit(P_ar, time_ar)
osc_P_co2, osc_T_co2, time_array_co2, fit_co2, fit_err_co2 = get_data_fit(P_co2, time_co2)

#%%
fit_wErr = []
for i in range(len(fit_ar)):
    fit_wErr.append([])
    for j in range(len(fit_ar[i])):
        fit_wErr[i].append([])
        for k in range(len(fit_ar[i][j])):
            fit_wErr[i][j].append(u(fit_ar[i][j][k], fit_err_ar[i][j][k]))
for i in range(len(fit_co2)):
    fit_wErr.append([])
    for j in range(len(fit_co2[i])):
        fit_wErr[i+3].append([])
        for k in range(len(fit_co2[i][j])):
            fit_wErr[i+3][j].append(u(fit_co2[i][j][k], fit_err_co2[i][j][k]))
            
fit_wErr_avg = []

#P0, c, k, omega, phi
for i in range(len(fit_wErr)):
    fit_wErr_avg.append([])
    for j in range(len(fit_wErr[i])):
        param = [[], [], [], [], []]
        for k in range(5):
예제 #4
0
plt.plot(new_x[29:64], 5.177800237*(new_x[29:64]-0.029637)+0.029637, color = 'tab:red', label = 'Stripping Line')
plt.xlabel('X - Liquid Mole Fraction Ethanol')
plt.ylabel('Y - Vapor Mole Fraction Ethanol')
plt.axis('equal')
plt.xticks(np.arange(0,1.1,0.1))
plt.yticks(np.arange(0,1.1,0.1))
plt.xlim(0, 1)
plt.ylim(0, 1)
plt.grid()
plt.legend()
#plt.savefig('McCabe_Thiele_R4.png',dpi=300,bbox_inches='tight')
#%%
bottom = np.array(984.7, 990.6, 989.7, 990.4])
bottomT = [17.1, 15.7, 12.3, 11.9]

top = [u(830.4, 1), u(829.4, 1), u(821.6, 1), u(826, 1)]
topT = [u(13.9, 0.2), u(16.2, 0.2), u(20.7, 0.2), u(18.6, 0.2)]
#%%
molfrac = [[], []]
molfrac_error = [[],[]]
for i in range(4):
    molfrac[0].append(true_proof((bottomT[i]*9/5)+32, bottom[i].value)[1])
#    molfrac[1].append(true_proof((topT[i]*9/5)+32, top[i])[1])

#%%
# R = 2

R2_trays = [[0.8312, 0.8951, 0.9593, 0.976],[0.83, 0.9, 0.963, 0.9777]]
R2_temp = [[21, 18.8, 17, 15.1],[21.6, 17, 15.6, 14.2]]
R2_molfrac = [[], []]
for i in range(2):
예제 #5
0
 def num(self, *args):
     if self.calibration_uncertainties:
         return u(*args)
     else:
         return args[0]