In [1]:
from chxanalys.chx_packages import *
%matplotlib notebook
plt.rcParams.update({'figure.max_open_warning': 0})
import pandas as pds
#%reset -f #for clean up things in the memory
In [2]:
data_dir = '/XF11ID/analysis/2017_2/sutton//Results/'
In [ ]:
In [ ]:
uid='56ba9a'#(scan num: 23830) (Measurement: T3 SBA15 in cryostat xpcs -1000frames acq=0.00134s exp=0.00134s att 1 )
uid='9eebab'#(scan num: 23829) (Measurement: T3 SBA15 in cryostat xpcs -2000frames acq=0.5s exp=0.5s att .002 )
uid='c72a69'#(scan num: 23828) (Measurement: T3 SBA15 in cryostat xpcs -1000frames acq=0.00134s exp=0.00134s att 1 )
uid='4254d4'#(scan num: 23827) (Measurement: T3 SBA15 in cryostat xpcs -2000frames acq=0.5s exp=0.5s att .002 )
uid='3b1e79'#(scan num: 23826) (Measurement: T3 SBA15 in cryostat xpcs -1000frames acq=0.00134s exp=0.00134s att 1 )
uid='ce5107'#(scan num: 23825) (Measurement: T3 SBA15 in cryostat xpcs -2000frames acq=0.5s exp=0.5s att .002 )
In [7]:
suid_dict = {'m1' : '56ba9a', 'm2': '9eebab', 'm3': 'c72a69',
'm4': '4254d4', 'm5': '3b1e79', 'm6': 'ce5107'
}
In [8]:
uid_dict = {}
for u in list( suid_dict.keys() ):
uid_dict[u] = get_meta_data( suid_dict[u] )['uid']
print( uid_dict )
In [9]:
total_res = {}
In [10]:
for u in list( uid_dict.keys() ):
inDir = data_dir + suid_dict[u] + '/'
total_res[u] = extract_xpcs_results_from_h5( filename = 'uid=%s_Res.h5'%uid_dict[u], import_dir = inDir )
In [11]:
print( total_res[list( uid_dict.keys() )[0]].keys() )
In [ ]:
In [29]:
qr = np.array( [total_res['m1']['qval_dict'][k][0] for k in list(total_res['m1']['qval_dict'].keys())] )
In [30]:
qr
Out[30]:
In [ ]:
In [41]:
qinds=[0,1,3,9]
fig,ax=plt.subplots(2,2)
ax=ax.ravel()
for k in sorted( list(total_res.keys())):
#tt=np.load(filename)
taus = total_res[k]['taus']
g2 = total_res[k]['g2']
pos = 0
for qind in qinds:
ax[pos].semilogx(taus[1:],g2[1:,qind])
pos += 1
fig.suptitle("T=380K")
pos=0
for qind in qinds:
#print(qind)
ax[pos].set_title('qr=%s A-1'%qr[int(qind)])
#ax[pos].set_title('qind={:d}'.format( qind ) )
pos += 1
fig.tight_layout()
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [341]:
qth_interest = 6 #3 #the intested single qth
In [342]:
fig,ax=plt.subplots()
for u in sorted(list( uid_dict.keys() )):
print(u)
plot1D( x = total_res[u]['taus4'], y= total_res[u]['g4'][:,qth_interest],
ax=ax, legend= u, ylim=[0, 0.0001], legend_size = 8, xlabel='t (sec)', ylabel='g4',
title='four_order_time_correlation-->q=%s'%total_res[u]['qval_dict'][qth_interest][0], logx=True )
plt.savefig( data_dir +'g4_101k44pc_190_180_175_25_new_1.png' )
In [353]:
fit_g2_func = 'stretched'
for u in sorted(list( uid_dict.keys() )):
g2 = total_res[u]['g2']
taus = total_res[u]['taus']
g2_fit_result, taus_fit, g2_fit = get_g2_fit_general( g2, taus,
function = fit_g2_func, vlim=[0.95, 1.05], fit_range= None,
fit_variables={'baseline':False, 'beta':True, 'alpha':False,'relaxation_rate':True},
guess_values={'baseline':1.0,'beta':0.05,'alpha':1.0,'relaxation_rate':0.01,})
g2_fit_paras = save_g2_fit_para_tocsv(g2_fit_result, filename= u +'_g2_fit_paras.csv', path=data_dir )
#print( g2.shape)
In [361]:
fig,ax=plt.subplots()
for u in sorted(list( uid_dict.keys() )):
y= total_res[u]['g2'][1:,qth_interest]
#ym = (y-y.min())/(y.max()-y.min())
#fits = total_res[u]['g2_fit_paras'] #here load from XPCS_Single Pipeline fit results
fits = pds.read_csv( data_dir + u + '_g2_fit_paras.csv' ) #load from re-fit results
ym = ( y - fits['baseline'][qth_interest] )/ fits['beta'][qth_interest]
plot1D( x = total_res[u]['taus'][1:], y= ym,
ax=ax, legend= u, ylim=[-0.1, 1.1], legend_size = 10, xlabel='tau (sec)', ylabel='g1',
title='normalized' +'one_time_correlation-->q=%s'%total_res[u]['qval_dict'][qth_interest][0], logx=True )
plt.savefig( data_dir +'normalized'+'g__101k44pc_190_180_175_25_new_.png' )
In [362]:
fig,ax=plt.subplots()
for u in sorted(list( uid_dict.keys() )):
plot1D( x = total_res[u]['taus'], y= total_res[u]['g2'][:,qth_interest],
ax=ax, legend= u, ylim=[0.99, 1.08], legend_size = 8, xlabel='tau (sec)', ylabel='g2',
title='one_time_correlation-->q=%s'%total_res[u]['qval_dict'][qth_interest][0], logx=True )
plt.savefig( data_dir +'g2_101k44pc_190_180_175_25_new.png' )
In [333]:
qs = np.array([total_res[u]['qval_dict'][i][0] for i in range( len(list(total_res[u]['qval_dict'].keys())) ) ])
In [365]:
fig,ax=plt.subplots()
for u in sorted(list( uid_dict.keys() )):
x= qs
#y= 1/total_res[u]['g2_fit_paras']['relaxation_rate'] #here load from XPCS_Single Pipeline fit results
y = 1/ ( pds.read_csv( data_dir + u + '_g2_fit_paras.csv' )['relaxation_rate'] ) #load from re-fit results
#print(y)
plot1D( x = qs, y= y, ax=ax, ylim=[0,200], legend= u, legend_size = 8, ls = '--',
xlabel='q, (A-1)', ylabel='relaxation_time, (s)',
title='q~relaxation_time', logx=True, logy=True )
plt.savefig( data_dir +'q~relaxation_time.png' )
In [ ]:
In [ ]: