diff --git a/dgsres/singlextal/simdata.py b/dgsres/singlextal/simdata.py index 453fc0b..a9c0b61 100644 --- a/dgsres/singlextal/simdata.py +++ b/dgsres/singlextal/simdata.py @@ -17,27 +17,30 @@ def __init__(self, parent_dir, dirname_template='E%s_hkl%s'): def path(self, hkl, E): return os.path.join(self.parent_dir, self.dirname_template % (E, '%s,%s,%s' % tuple(hkl))) - def loadData(self, hkl, E): + def loadData(self, hkl, E, dhkl_ranges=None): p = self.path(hkl, E) - return self._loadData(p) + return self._loadData(p, dhkl_ranges=dhkl_ranges) def loadPointCloud(self, hkl, E): dhs, dks, dls, dEs, probs = self.loadData(hkl, E) return PointCloud(dhs, dks, dls, dEs, probs) - def _loadData(self, outdir1): + def _loadData(self, outdir1, dhkl_ranges=None): + if dhkl_ranges is None: + dhkl_ranges = [ (-2., 2.) ] * 3 dhkls = np.load('%s/dhkls.npy' % outdir1) dEs = np.load('%s/dEs.npy' % outdir1) probs = np.load('%s/probs.npy' % outdir1) dhs,dks,dls = dhkls.T # there might be unreasonable data points with unreasonable weights - mask = (dhs> -2.)*(dhs<2.) \ - * (dks> -2.)*(dks<2.) \ - * (dls> -2.)*(dls<2.) + (dh_min, dh_max), (dk_min, dk_max), (dl_min, dl_max) = dhkl_ranges + mask = (dhs>dh_min)*(dhsdk_min)*(dksdl_min)*(dls