-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbragg_CDI.py
55 lines (40 loc) · 1.66 KB
/
bragg_CDI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 6 11:19:26 2017
@author: Susanna Hammarberg
"""
#from IPython import get_ipython
#get_ipython().magic('reset -sf')
#
import numpy as np
import h5py
import matplotlib.pyplot as plt
# Path for raw data from detector lambda
data_path = 'F:\\run48_Wallentin\data\detectors\lambda\\'
sample = 'JWMK16_NW1_cdi1'
nbr_scans = 958# 958
# create matrix to hold diffraction patterns
diffSet=np.zeros((nbr_scans, 516, 1556), dtype=np.int32)
# read data from hdf5-files
for scan_nbr in range(0,nbr_scans):
scanCDI = h5py.File(data_path + sample + '\\' + sample + '_' + str('{0:05}'.format(scan_nbr)) + '.nxs','r') # read-only
data = scanCDI.get('/entry/instrument/detector/data')
np_data = np.array(data)
# rotate and remove 3D thing
#np_data33 = (np_data33[0])
# scan33 = h5py.File('scan33/pilatus_scan_33_' + str('{0:04}'.format(scan_nbr)) + '.hdf5','r') # read-only
# data_scan33 = scan33.get('/entry_0000/measurement/Pilatus/data' )
# np_data33 = np.array(data_scan33) #Varför har den tre dimensioner?
diffSet[scan_nbr] = np_data
#description = scanCDI.get(' /entry/instrument/detector/geometry/description')
#np_description = np.array(description)
#del
#diffSet = misc.imread('P.png',flatten=True)
# Experment parameters
xDet = 0.5849 # Object-detector distance, m; 0.4357 ; 0.5849 ; 0.8919 ; 1.4804
pixel = 0.055E-3 # Pixel ctr to ctr distance (w)
energy = 13.8 # keV
wavelength = 1.23984E-9/energy
kLength = 2*np.pi/wavelength # 1/m needed?
plt.figure()
plt.imshow(np.log10(sum(diffSet)))