# -*- coding: utf-8 -*-
"""
Created on Sun Dec 3 16:49:54 2017
@author: luowei
"""
import matplotlib.pyplot as plt
import Structf as sf
import numpy as np
# input card :
# ============================================
# monochromator : reflect, tth
# sample cif file
# scattering plane
# powder ring : cif file
# ============================================
# ------------------------------------------------------------------------------------------------
# set plot fig
fig = plt.figure(facecolor = 'snow')
ax = fig.add_subplot(111)
# s1s2limit : qrange
s2ring = sf.limit_range(reflect = [0,0,4],tth = 82)
qrange = [ 0.9*2*np.pi/s2ring.q1, 1.1*2*np.pi/s2ring.q0]
# calculate struct factor
df = sf.StructFactor('CsCo2Se2.cif',qrange = qrange).data
# select scattering plane (hhl)
df_select = df[df['h']==df['k']].copy().reset_index(drop = True)
# calculate unit vector length at x/y direction
df_select['qx'] = np.sqrt(df_select['qh']**2 + df_select['qk']**2)*np.sign(df_select['qh'])
df_select['qy'] = df_select['ql']
# select unit number from :
tick_x = 'h'
tick_y = 'l'
# plot sf
sf.plot_sf(plt,ax,df_select,tick_x,tick_y,xtitle = 'hh',ytitle = 'l',radius_amplify=1.5,title = 'CsCo2Se2(h,h,l)',label = [1,1])
# plot powder ring
al = sf.Powder_ring('Al.cif',qrange = qrange)
al.plot(ax,nring = 4,color = 'red')
sample = sf.Powder_ring('CsCo2Se2.cif',qrange = qrange)
sample.plot(ax,color = 'blue',nring=4)
# plot limit area
s2ring.plot(ax)
# show
plt.savefig('h0l.jpeg')
plt.show()
show.jpeg
- 黄色圆环区域由S2限位角度决定;
- 黄色扇形角度由S1限位角度决定:
- 有色圆环代表不同的powder ring,颜色越深,宽度越大代表散射强度越大
- xy长度已经scaled
网友评论