In [1]:
from pyCHX.chx_packages import *
%matplotlib notebook
plt.rcParams.update({'figure.max_open_warning': 0})
plt.rcParams.update({ 'image.origin': 'lower' })
plt.rcParams.update({ 'image.interpolation': 'none' })
import pickle as cpk
from pyCHX.chx_xpcs_xsvs_jupyter_V1 import *
import itertools
In [2]:
%matplotlib notebook
#%matplotlib inline
In [79]:
uid = '3ef9240a' # a count data collected by Eiger4M and OAV
In [38]:
uid = uid[:8]
print('The current uid for analysis is: %s...'%uid)
In [39]:
#get_last_uids( -3)
In [40]:
sud = get_sid_filenames(db[uid])
for pa in sud[2]:
if 'master.h5' in pa:
data_fullpath = pa
print ('scan_id, full-uid, data path are: %s--%s--%s'%(sud[0], sud[1], data_fullpath ))
#start_time, stop_time = '2017-2-24 12:23:00', '2017-2-24 13:42:00'
#sids, uids, fuids = find_uids(start_time, stop_time)
In [41]:
uidstr = 'uid=%s'%uid
In [42]:
md = get_meta_data( uid )
md_blue = md.copy()
#md_blue
In [43]:
#md_blue['detectors'][0]
#if md_blue['OAV_mode'] != 'none':
# cx , cy = md_blue[md_blue['detectors'][0]+'_beam_center_x'], md_blue[md_blue['detectors'][0]+'_beam_center_x']
#else:
# cx , cy = md_blue['beam_center_x'], md_blue['beam_center_y']
#print(cx,cy)
In [50]:
detectors = sorted(get_detectors(db[uid]))
print('The detectors are:%s'%detectors)
if len(detectors) >1:
md['detector'] = detectors[1]
print( md['detector'])
In [45]:
if md['detector'] =='eiger4m_single_image' or md['detector'] == 'image':
reverse= True
rot90= False
elif md['detector'] =='eiger500K_single_image':
reverse= True
rot90=True
elif md['detector'] =='eiger1m_single_image':
reverse= True
rot90=False
print('Image reverse: %s\nImage rotate 90: %s'%(reverse, rot90))
In [46]:
md['detector']
Out[46]:
In [47]:
#%run /home/yuzhang/pyCHX_link/pyCHX/chx_generic_functions.py
In [87]:
imgs = load_data( uid, md['detector'], reverse= reverse, rot90=rot90 )
md.update( imgs.md );Nimg = len(imgs);
#md['beam_center_x'], md['beam_center_y'] = cx, cy
#if 'number of images' not in list(md.keys()):
md['number of images'] = Nimg
pixel_mask = 1- np.int_( np.array( imgs.md['pixel_mask'], dtype= bool) )
print( 'The data are: %s' %imgs )
#md['acquire period' ] = md['cam_acquire_period']
#md['exposure time'] = md['cam_acquire_time']
mdn = md.copy()
img = imgs[100]
In [80]:
h = db[uid]
In [84]:
h.fields()
Out[84]:
In [82]:
try:
#oavs = list( h.data( 'OAV_image' ) )[0]
#Or try to use oavs = db.get_images(db[uid], 'OAV_image' )
print( len(oavs),oavs[0].shape )
except:
print('oavs are not available. Please contact DAMA group for help.')
In [85]:
#db.get_images(db[uid], 'OAV_image' )
In [ ]:
In [70]:
uid = '4ecaff7e'
h = db[uid]
In [71]:
h.fields()
Out[71]:
In [95]:
imgs = db.get_images(db[uid], 'eiger4m_single_image')
img = imgs[0][0]
In [96]:
imgs
Out[96]:
In [97]:
img.shape
Out[97]:
In [98]:
#img[0]
In [99]:
#img = imgs[100]
#img = oavs[39]
In [104]:
show_img( img, vmin = .01, vmax = 100, logs= True, aspect=1, #save_format='tif',
image_name= uidstr, save=False, path=None, cmap=cmap_albula)#,center=center[::-1])
In [ ]:
In [ ]:
In [ ]:
In [ ]: