Commit 1d17f451 authored by Begam, Khadiza's avatar Begam, Khadiza
Browse files

Fix import of reflection file reader

parent 475e4093
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
import h5py
import iotbx 
from iotbx.reflection_file_reader import any_reflection_file
import numpy as np
import scipy.linalg

instrument_mask = '/HFIR/CG4D/shared/instrument/data/instrument_coverage.nxs'
mtz_file = '/HFIR/CG4D/shared/instrument/data/t4-mtz-files/5VNQ.0.mtz'
instrument_mask = 'instrument_coverage.nxs'
mtz_file = '5VNQ.0.mtz'

# load instrument mapping
f = h5py.File(instrument_mask, 'r')
@@ -13,16 +13,17 @@ Qx, Qy, Qz = [data['D{}'.format(i)][()] for i in range(3)]
coverage = data['signal'][()].T
f.close()

# transform bin edges to centers and create dense mesh
# transform bin edges to centers and create dense mesh #kb 3d volume of what?

Qx, Qy, Qz = [0.5*(comp[1:]+comp[:-1]) for comp in [Qx, Qy, Qz]] # bin edges to centers
Qx, Qy, Qz = np.meshgrid(Qx, Qy, Qz, indexing='ij')

# mask only regions that are in laboratory coverage space
# mask only regions that are in laboratory coverage space #kb detector_coverage?
mask = coverage > 0
Qx, Qy, Qz = Qx[mask], Qy[mask], Qz[mask]

# read reflection file
hkl_file = iotbx.reflection_file_reader.any_reflection_file(mtz_file)
hkl_file = any_reflection_file(mtz_file)
miller = hkl_file.as_miller_arrays()
cryst_symm = miller[0].crystal_symmetry()