rec[0] = ([34.27791569, 34.18452497], [37.55977339, 37.43415619], [0.60967213, 0.87370292], 0.03910226, 1.59669644, 36.68629443) p = minimize(L, rec_to_p(rec), method='Nelder-Mead', options={ 'disp': True, 'maxfev': 100000 }) rec = p_to_rec(p.x) P = np.dstack((np.identity(100), np.identity(100))) m = Model(rec['NQ'][0], rec['T'][0], [0, 0], rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['St'][0], [0, 0], P) s = Sim(rec['NQ'][0], rec['T'][0], 5, [0, 0], rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['St'][0], [0, 0], [0, 0], [1e-6, 1e-6], [1e-6, 1e-6], [0, 0]) x = np.arange(1000) / 5 fig, ((ax1, ax3), (ax2, ax4)) = plt.subplots(2, 2) ax1.plot(x[:30 * 5], np.sum(H[:, :, 0].T * np.arange(np.shape(H)[0]), axis=1)[:30 * 5], 'ko', label='Data - PMT7') ax1.plot(x[:30 * 5], np.sum(H[:, 0, 0]) * np.sum(m[:, :, 0].T * np.arange(np.shape(H)[0]), axis=1)[:30 * 5], 'r.-', label=r'$\delta+$' + ' 2 exp model',
], [1.20445654, 1.17307301, 1.21097483, 0.98557953, 1.03284394, 1.16066175], [ 0.06602095, 0.06831482, 0.10287761, 0.09569007, 0.09342742, 0.09662029 ], 1.07043855e-08, 16.1565145, 32.96391684) p = minimize(L, rec_to_p(rec), method='Nelder-Mead', options={ 'disp': True, 'maxfev': 100000 }) rec = p_to_rec(p.x) m = Model(rec['NQ'][0], rec['T'][0], rec['R'][0], rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['St'][0]) s = Sim(rec['NQ'][0], rec['T'][0], 5, rec['R'][0], rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['St'][0]) x = np.arange(1000) / 5 fig, ax = plt.subplots(2, 3) for i in range(len(pmts)): np.ravel(ax)[i].plot(x, np.sum(H[:, :, i].T * np.arange(np.shape(H)[0]), axis=1), 'ko', label='Data - PMT{}'.format(pmts[i])) np.ravel(ax)[i].plot( x, np.sum(H[:, 0, i]) * np.sum(m[:, :, i].T * np.arange(np.shape(H)[0]), axis=1), 'r.-', label='2 exp model',
rec[0] = ([ 0.20943015, 0.1609747, 0.14237847, 0.23220429, 0.23181889, 0.4519858 ], [ 42.73610057, 42.40555684, 42.4383545, 42.82072981, 42.45310635, 42.55993533 ], [1.04916959, 0.56848552, 0.90283598, 1.25384056, 0.86560551, 0.6160742 ], 0.10776426, 2.20348296, 35.26396902, 0.56295857, 0.41240389, 0.22790822) # p=minimize(L, make_ps(rec_to_p(rec))) # rec=p_to_rec(p.x) m, s_model = make_3D(t, N, rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['a'][0], rec['eta'][0], rec['Q'][0], rec['T'][0], rec['St'][0], dS, PEs, r_mash, V_mash) s, GS, GS_spectrum, Sspectra, Gtrp, Gsng, GRtrp, GRsng, Scov = Sim( N, rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['a'][0], rec['eta'][0], rec['Q'][0], rec['T'][0], rec['St'][0], PEs) fig, ax = plt.subplots(2, 3) for i in range(len(pmts)): np.ravel(ax)[i].plot( t, np.sum(H[:, :, i].T * np.arange(np.shape(H)[0]), axis=1) / np.sum(H[:, 0, i]), 'ko', label='Data - PMT{}'.format(pmts[i])) np.ravel(ax)[i].plot( t[:100], np.sum(m[:, :, i].T * np.arange(np.shape(m)[0]), axis=1), 'r.-', label='2 exp model, {}'.format(
if counter%(len(p)+1)==0: print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!') print('iteration=', int(counter/(len(p)+1)), 'fanc=',-l) print('--------------------------------') print(rec) return -l rec[0]=([36.65361232, 27.0674887 , 21.58765364, 35.26543114, 34.68101963, 56.55811891], [20318.89804123, 29398.22812292, 54050.97911597, 37386.39722335, 16245.51120957, 25676.63138817], [23.90532686, 23.97120507, 23.72761649, 23.46118973, 23.4272549 , 23.73023182], [1.25507068, 1.4145993 , 1.24708723, 0.55778022, 0.86542921, 1.21696164], 0.11440806, 4.51577519, 35.28739035) print(L(rec_to_p(rec))) # p=minimize(L, rec_to_p(rec), method='Nelder-Mead', options={'disp':True, 'maxfev':100000}) # rec=p_to_rec(p.x) m=Model(rec['NQ'][0], rec['T'][0], np.zeros(len(pmts)), rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['St'][0]) s=Sim(rec['NQ'][0], rec['T'][0], 5, np.zeros(len(pmts)), rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['St'][0]) x=np.arange(1000)/5 fig, ax=plt.subplots(2,3) for i in range(len(pmts)): np.ravel(ax)[i].plot(x, np.sum(H[:,:,i].T*np.arange(np.shape(H)[0]), axis=1), 'ko', label='Data - PMT{}'.format(pmts[i])) np.ravel(ax)[i].plot(x, np.sum(H[:,0,i])*np.sum(m[:,:,i].T*np.arange(np.shape(H)[0]), axis=1), 'r.-', label='2 exp model', linewidth=3) np.ravel(ax)[i].plot(x, np.sum(H[:,0,i])*np.sum(s[:,:,i].T*np.arange(np.shape(H)[0]), axis=1), 'g.-', label='2 exp model', linewidth=3) np.ravel(ax)[i].legend(fontsize=15) np.ravel(ax)[i].set_xlabel('Time [ns]', fontsize='15') fig.text(0.04, 0.5, r'$N_{events}\sum_n nH_{ni}$', va='center', rotation='vertical', fontsize=15) fig, ax=plt.subplots(2,3) for i in range(len(pmts)): spectra_rng=np.nonzero(np.logical_and(PEs>PEs[np.argmax(spectra[i])]-10, PEs<PEs[np.argmax(spectra[i])]+10))[0] model=rec['a_spectra'][0,i]*poisson.pmf(PEs, np.sum(m[:,:,i].T*np.arange(np.shape(H)[0])))[spectra_rng] np.ravel(ax)[i].plot(PEs, spectra[i], 'ko', label='spectrum - PMT{}'.format(pmts[i]))
2.26676081e-01, 4.19947869e-01 ], [ 4.28190829e+01, 4.28455151e+01, 4.27058445e+01, 4.23081522e+01, 4.30042587e+01, 4.26596060e+01 ], [ 1.34047633e+00, 6.54632148e-01, 6.41646582e-01, 1.02866161e+00, 1.04377416e+00, 7.57914588e-01 ], 6.15129303e+00, 3.30747763e+04, 9.06991646e-02, 1.36137465e+00, 3.58038043e+01, 5.71828126e-01, 3.66017987e-01, 3.05918824e-01) # p=minimize(L, make_ps(rec_to_p(rec))) # rec=p_to_rec(p.x) V = V_mash * np.exp(-(r_mash[:, x1] + np.sqrt( (10 / 40)**2 - r_mash[:, x2]**2 - r_mash[:, -1]**2)) / rec[0]['mu']) s, GS, GS_spectrum, Sspectra, Gtrp, Gsng, GRtrp, GRsng, Scov = Sim( rec['N'][0], rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['a'][0], rec['eta'][0], rec['Q'][0], rec['T'][0], rec['St'][0], PEs, rec[0]['mu'], x1, x2, r_mash, V / np.sum(V)) start_time = time.time() m, s_model, Mcov = make_3D(t, rec['N'][0], rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['a'][0], rec['eta'][0], rec['Q'][0], rec['T'][0], rec['St'][0], dS, PEs, r_mash, V / np.sum(V), Xcov) dT = time.time() - start_time fig, ax = plt.subplots(2, 3) for i in range(len(pmts)): np.ravel(ax)[i].plot( t, np.sum(H[:, :, i].T * np.arange(np.shape(H)[0]), axis=1) / np.sum(H[:, 0, i]), 'ko',
35.49302268, 26.17497766, 21.34892126, 34.11857516, 34.25089177, 55.35067421 ], [ 24.18066808, 24.14013932, 24.37615609, 24.31612566, 24.51001521, 24.57748248 ], [1.0884017, 0.88510012, 0.99856744, 1.05147662, 1.09080665, 1.14670428 ], [0.06125483, 0.05278206, 0.0909597, 0.09726535, 0.09490963, 0.08954461], 32.79469072) # print(L(rec_to_p(rec))) # p=minimize(L, rec_to_p(rec), method='Nelder-Mead', options={'disp':True, 'maxfev':100000}) # rec=p_to_rec(p.x) m = Model(rec['NQ'][0], rec['T'][0], rec['R'][0], 0, 1000, rec['Ts'][0], rec['St'][0]) s, GS, G_spec = Sim(rec['NQ'][0], rec['T'][0], 1e-6, rec['R'][0], 0, 1000, rec['Ts'][0], rec['St'][0]) x = np.arange(200) fig, ax = plt.subplots(2, 3) for i in range(len(pmts)): np.ravel(ax)[i].plot(x, np.sum(H[:, :, i].T * np.arange(np.shape(H)[0]), axis=1), 'ko', label='Data - PMT{}'.format(pmts[i])) np.ravel(ax)[i].plot( x, np.sum(H[:, 0, i]) * np.sum(m[:, :, i].T * np.arange(np.shape(m)[0]), axis=1), 'r.-', label='2 exp model ({:3.2f} PEs)'.format(
rec[0] = ([ 0.15031393, 0.10126694, 0.0980743, 0.15169108, 0.13757894, 0.27692865 ], [ 42.6965627, 42.79534384, 42.98685503, 42.85373486, 42.54194199, 42.92884848 ], [0.85148873, 0.82144334, 0.75498879, 0.84165176, 1.09559689, 0.82225653], 0.10919454, 1.65475904, 32.72410862, 0.51185353, 5.27711599) p = minimize(L, make_ps(rec_to_p(rec))) rec = p_to_rec(p.x) m = make_3D(t, N, rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['b'][0], rec['Q'][0], rec['T'][0], rec['St'][0]) s, GS, GS_spectrum, Gtrp, Gsng, GRtrp, GRsng = Sim(t, N, rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['b'][0], rec['Q'][0], rec['T'][0], rec['St'][0]) fig, ax = plt.subplots(2, 3) for i in range(len(pmts)): np.ravel(ax)[i].plot(t, np.sum(H[:, :, i].T * np.arange(np.shape(H)[0]), axis=1), 'ko', label='Data - PMT{}'.format(pmts[i])) np.ravel(ax)[i].plot( t[:100], np.sum(H[:, 0, i]) * np.sum(m[:, :, i].T * np.arange(np.shape(m)[0]), axis=1), 'r.-',
0.97738577], 0.04336487, 1., 39.08628834) print(L(rec_to_p(rec))) p = minimize(L, rec_to_p(rec), method='Nelder-Mead', options={ 'disp': True, 'maxfev': 100000 }) rec = p_to_rec(p.x) m = Model(rec['NQ'][0], rec['T'][0], np.zeros(len(pmts)), rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['St'][0]) # s, GS=Sim(rec['NQ'][0], rec['T'][0], 5, np.zeros(len(pmts)), rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['St'][0]) s, GS, GS_spectrum = Sim(rec['NQ'][0], rec['T'][0], 5, np.zeros(len(pmts)), rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['St'][0]) x = np.arange(200) fig, ax = plt.subplots(2, 3) for i in range(len(pmts)): np.ravel(ax)[i].plot(x, np.sum(H[:, :, i].T * np.arange(np.shape(H)[0]), axis=1), 'ko', label='Data - PMT{}'.format(pmts[i])) np.ravel(ax)[i].plot( x, np.sum(H[:, 0, i]) * np.sum(m[:, :, i].T * np.arange(np.shape(m)[0]), axis=1), 'r.-', label='2 exp model ({:3.2f} PEs)'.format(
42.43727439, 42.48680044, 42.48223214, 42.61715417, 42.97131299, 42.35603571 ], [1.14722701, 0.82496347, 0.71858647, 1.61434698, 1.48554624, 1.03053529], 2.57341188, 7920.93881033, 0.11035399, 0.94339727, 34.3602973, 0.5760872, 0.33983152, 0.36124252) t1 = time.time() L1 = L(rec_to_p(rec)) print(time.time() - t1) # p=minimize(L, make_ps(rec_to_p(rec), source)) # M,Mspectra, Mcov=make_3D(rec['N'][0], rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['a'][0], # rec['eta'][0], rec['Q'][0], rec['T'][0], rec['St'][0], PEs, rec[0]['mu'], x1, x2, Xcov) S, Sspectra, Scov, G, Gtrp, Gsng, GRtrp, GRsng, SN = Sim( rec['N'][0], rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['a'][0], rec['eta'][0], rec['Q'][0], rec['T'][0], rec['St'][0], PEs, rec[0]['mu'], x1, x2, left, right) rec[0] = ([ 2.47449081e-01, 1.73455094e-01, 1.40915994e-01, 2.23938188e-01, 2.27196744e-01, 4.03724823e-01 ], [ 4.30007358e+01, 4.27364088e+01, 4.26244721e+01, 4.27050188e+01, 4.27595651e+01, 4.27768675e+01 ], [ 1.19129338e+00, 7.06773710e-01, 6.42329986e-01, 1.02327019e+00, 8.84223879e-01, 9.07674808e-01 ], 5.53213718e-01, 7.83374741e+03, 9.86594244e-02, 8.09728899e-01, 3.18503273e+01, 5.54707755e-01, 3.85974402e-01, 2.39150776e-01) L2 = L(rec_to_p(rec)) S2, Sspectra2, Scov2, G2, Gtrp2, Gsng2, GRtrp2, GRsng2, SN2 = Sim(
return rec rec1[0] = ([34.17255625, 35.09148282], [39.65578361, 39.30607808], [0.98964095, 1.08379849], [0, 0], 0.07063164, 0.21911959, 36.64258893, 463.23111438) rec2[0] = ([34.1231953, 35.08659966], [38.19114816, 37.94501817], [0.97305945, 1.11166723], [0.0443506, 0.05271929], 0.02677325, 0.21487918, 36.61184292, 466.39540394) P = np.dstack((np.identity(100), np.identity(100))) m1 = Model(rec1['NQ'][0], rec1['T'][0], rec1['R'][0], rec1['F'][0], rec1['Tf'][0], rec1['Ts'][0], rec1['St'][0], [0, 0], P) s1 = Sim(rec1['NQ'][0], rec1['T'][0], 5, rec1['R'][0], rec1['F'][0], rec1['Tf'][0], rec1['Ts'][0], rec1['St'][0], [0, 0], [0, 0], [1e-6, 1e-6], [1e-6, 1e-6], [0, 0]) m2 = Model(rec2['NQ'][0], rec2['T'][0], rec2['R'][0], rec2['F'][0], rec2['Tf'][0], rec2['Ts'][0], rec2['St'][0], [0, 0], P) s2 = Sim(rec2['NQ'][0], rec2['T'][0], 5, rec2['R'][0], rec2['F'][0], rec2['Tf'][0], rec2['Ts'][0], rec2['St'][0], [0, 0], [0, 0], [1e-6, 1e-6], [1e-6, 1e-6], [0, 0]) x = np.arange(200) / 5 fig, ((ax1, ax3), (ax2, ax4)) = plt.subplots(2, 2, sharex=True) ax1.title.set_text('Double Exp') ax1.plot(x[:100], smd5(np.sum(H[:, :, 0].T * np.arange(np.shape(H)[0]), axis=1))[:100],
], [3.89209041e+04, 8.50216818e+03], [8.02020474e-02, 1.15605912e-01], [4.25063975e-01, 4.19293224e-01], [3.74194703e-01, 2.53987575e-01], 1.87200329e+00, 3.58456460e+01, 5.29547734e-01) # p=minimize(L, make_ps(rec_to_p(rec))) # rec=p_to_rec(p.x) for j in range(len(Datas)): PEs = np.arange(len(spectra[j][:, 0])) m = make_3D(t, rec['N'][0, j // 2], rec['F'][0, j // 2], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['a'][0, j // 2], rec['eta'][0, j // 2], rec['Q'][0], rec['T'][0], rec['St'][0]) s, GS, GS_spectrum, S_spectra, Gtrp, Gsng, GRtrp, GRsng = Sim( rec['N'][0, j // 2], rec['F'][0, j // 2], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['a'][0, j // 2], rec['eta'][0, j // 2], rec['Q'][0], rec['T'][0], rec['St'][0], PEs) fig, ax = plt.subplots(2, 3) fig.suptitle(Datas[j]) for i in range(len(pmts)): np.ravel(ax)[i].plot( t, np.sum(H[j][:, :, i].T * np.arange(np.shape(H[j])[0]), axis=1) / np.sum(H[j][:, 0, i]), 'ko', label='Data - PMT{}'.format(pmts[i])) np.ravel(ax)[i].plot( t[:100], np.sum(m[:, :, i].T * np.arange(np.shape(m)[0]), axis=1), 'r.-',
rec[0] = ([ 0.14863348, 0.10172282, 0.09822199, 0.14771265, 0.13840472, 0.27617164 ], [ 42.70392918, 42.78431987, 42.68265411, 42.59255318, 42.65187515, 42.74552068 ], [0.77700913, 0.75545816, 0.7959847, 0.83200572, 0.79253087, 0.78663904], 0.04929178, 0.97675645, 36.20895337, 0.40185231, 2.11811804) # print(L(rec_to_p(rec))) # p=minimize(L, rec_to_p(rec), method='Nelder-Mead', options={'disp':True, 'maxfev':100000}) # rec=p_to_rec(p.x) m = make_3D(t, N, rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['b'][0], rec['Q'][0], rec['T'][0], rec['St'][0]) s, GS, GS_spectrum, s_spectra = Sim(t, N, rec['F'][0], rec['Tf'][0], rec['Ts'][0], rec['R'][0], rec['b'][0], rec['Q'][0], rec['T'][0], rec['St'][0]) fig, ax = plt.subplots(2, 3) for i in range(len(pmts)): np.ravel(ax)[i].plot(t, np.sum(H[:, :, i].T * np.arange(np.shape(H)[0]), axis=1), 'ko', label='Data - PMT{}'.format(pmts[i])) np.ravel(ax)[i].plot( t[:100], np.sum(H[:, 0, i]) * np.sum(m[:, :, i].T * np.arange(np.shape(m)[0]), axis=1), 'r.-', label='2 exp model',
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!') print('iteration=', int(counter/(len(p)+1)), 'fanc=',-l) print('--------------------------------') print(rec) return -l rec[0]=([35.49302268, 26.17497766, 21.34892126, 34.11857516, 34.25089177, 55.35067421], [24.18066808, 24.14013932, 24.37615609, 24.31612566, 24.51001521, 24.57748248], [1.0884017 , 0.88510012, 0.99856744, 1.05147662, 1.09080665, 1.14670428], [0.06125483, 0.05278206, 0.0909597 , 0.09726535, 0.09490963, 0.08954461], 32.79469072) # print(L(rec_to_p(rec))) # p=minimize(L, rec_to_p(rec), method='Nelder-Mead', options={'disp':True, 'maxfev':100000}) # rec=p_to_rec(p.x) NGlob=120*15*(40/22)**2*2/5 m=Model(rec['NQ'][0], rec['T'][0], rec['R'][0], 0, 1000, rec['Ts'][0], rec['St'][0]) s, GS, GS_spectrum=Sim(NGlob, 0.3*rec['NQ'][0]/rec['NQ'][0], rec['T'][0], 1e-6, rec['R'][0], 0, 1000, rec['Ts'][0], rec['St'][0]) x=np.arange(200) fig, ax=plt.subplots(2,3) for i in range(len(pmts)): np.ravel(ax)[i].plot(x, np.sum(H[:,:,i].T*np.arange(np.shape(H)[0]), axis=1), 'ko', label='Data - PMT{}'.format(pmts[i])) np.ravel(ax)[i].plot(x, np.sum(H[:,0,i])*np.sum(m[:,:,i].T*np.arange(np.shape(m)[0]), axis=1), 'r.-', label='2 exp model ({:3.2f} PEs)'.format(np.sum(m[:,:,i].T*np.arange(np.shape(m)[0]))), linewidth=3) np.ravel(ax)[i].plot(x, np.sum(H[:,0,i])*np.sum(s[:,:,i].T*np.arange(np.shape(s)[0]), axis=1), 'g.-', label='2 exp sim ({:3.2f} PEs)'.format(np.sum(s[:,:,i].T*np.arange(np.shape(s)[0]))), linewidth=3) np.ravel(ax)[i].legend(fontsize=15) np.ravel(ax)[i].set_xlabel('Time [ns]', fontsize='15') fig.text(0.04, 0.5, r'$N_{events}\sum_n nH_{ni}$', va='center', rotation='vertical', fontsize=15) fig, ax=plt.subplots(2,3) for i in range(len(pmts)):
35.49302268, 26.17497766, 21.34892126, 34.11857516, 34.25089177, 55.35067421 ], [ 24.18066808, 24.14013932, 24.37615609, 24.31612566, 24.51001521, 24.57748248 ], [1.0884017, 0.88510012, 0.99856744, 1.05147662, 1.09080665, 1.14670428 ], [0.06125483, 0.05278206, 0.0909597, 0.09726535, 0.09490963, 0.08954461], 32.79469072) # print(L(rec_to_p(rec))) # p=minimize(L, rec_to_p(rec), method='Nelder-Mead', options={'disp':True, 'maxfev':100000}) # rec=p_to_rec(p.x) m = Model(rec['NQ'][0], rec['T'][0], rec['R'][0], 0, 1000, rec['Ts'][0], rec['St'][0]) s, GS = Sim(rec['NQ'][0], rec['T'][0], 5, rec['R'][0], 0, 1000, rec['Ts'][0], rec['St'][0]) x = np.arange(1000) / 5 fig, ax = plt.subplots(2, 3) for i in range(len(pmts)): np.ravel(ax)[i].plot(x, np.sum(H[:, :, i].T * np.arange(np.shape(H)[0]), axis=1), 'ko', label='Data - PMT{}'.format(pmts[i])) np.ravel(ax)[i].plot( x, np.sum(H[:, 0, i]) * np.sum(m[:, :, i].T * np.arange(np.shape(m)[0]), axis=1), 'r.-', label='2 exp model', linewidth=3)
[2.79037134e-12, 7.43713468e-03], [4.98611299e-05, 2.39955353e-05], [2.51283888e-03, 6.70268148e-07], [74940.7599723, 79719.34352622], [14586.17209451, 11292.02216426], [1696.51693551, 848.71451248], [85.16514545, 59.93128527], [-0.07018456, -0.00026282], [0.25880411, 0.22653098], [4.41810781e-03, 8.09144120e-26], 0.05258429, 1.09214088, 36.2361104, 408.93094263) P = make_P(rec1['a0'][0], rec1['Spad'][0], rec1['Spe'][0], rec1['m_pad'][0]) m1 = Model(rec1['NQ'][0], rec1['T'][0], [0, 0], rec1['F'][0], rec1['Tf'][0], rec1['Ts'][0], rec1['St'][0], rec1['q0'][0], P) m_area1 = model_area(areas, rec1['m_pad'][0], rec1['a_pad'][0], rec1['a_spe'][0], rec1['a_dpe'][0], rec1['a_trpe'][0], rec1['Spad'][0], rec1['Spe'][0]) s1 = Sim(rec1['NQ'][0], rec1['T'][0], 5, [0, 0], rec1['F'][0], rec1['Tf'][0], rec1['Ts'][0], rec1['St'][0], rec1['q0'][0], rec1['a0'][0], rec1['Spad'][0], rec1['Spe'][0], rec1['m_pad'][0]) P = make_P(rec2['a0'][0], rec2['Spad'][0], rec2['Spe'][0], rec2['m_pad'][0]) m2 = Model(rec2['NQ'][0], rec2['T'][0], rec2['R'][0], rec2['F'][0], rec2['Tf'][0], rec2['Ts'][0], rec2['St'][0], rec2['q0'][0], P) m_area2 = model_area(areas, rec2['m_pad'][0], rec2['a_pad'][0], rec2['a_spe'][0], rec2['a_dpe'][0], rec2['a_trpe'][0], rec2['Spad'][0], rec2['Spe'][0]) s2 = Sim(rec2['NQ'][0], rec2['T'][0], 5, rec2['R'][0], rec2['F'][0], rec2['Tf'][0], rec2['Ts'][0], rec2['St'][0], rec2['q0'][0], rec2['a0'][0], rec2['Spad'][0], rec2['Spe'][0], rec2['m_pad'][0]) x = np.arange(1000) / 5 fig, ((ax1, ax3), (ax2, ax4)) = plt.subplots(2, 2, sharex=True)