def __call__(self, reflections): """Predict for all reflections at the current model geometry""" if self._force_stills: predictors = [st(e, spherical_relp=self._spherical_relp) \ for e in self._experiments] else: predictors = [ sc(e) if e.goniometer else st(e, spherical_relp=self._spherical_relp) for e in self._experiments ] self._UBs = [ e.crystal.get_U() * e.crystal.get_B() for e in self._experiments ] for iexp, e in enumerate(self._experiments): # select the reflections for this experiment only sel = reflections['id'] == iexp refs = reflections.select(sel) # stills if not e.goniometer or self._force_stills: predictor = st(e, spherical_relp=self._spherical_relp) UB = e.crystal.get_A() predictor.for_reflection_table(refs, UB) # scan-varying elif 'ub_matrix' in refs: predictor = sv(e) UB = refs['ub_matrix'] s0 = refs['s0_vector'] dmat = refs['d_matrix'] predictor.for_reflection_table(refs, UB, s0, dmat) # scan static else: predictor = sc(e) UB = e.crystal.get_A() predictor.for_reflection_table(refs, UB) # write predictions back to overall reflections reflections.set_selected(sel, refs) return reflections
def __call__(self, reflections): """Predict for all reflections at the current model geometry""" if self._force_stills: predictors = [st(e, spherical_relp=self._spherical_relp) \ for e in self._experiments] else: predictors = [sc(e) if e.goniometer else st(e, spherical_relp=self._spherical_relp) for e in self._experiments] self._UBs = [e.crystal.get_U() * e.crystal.get_B() for e in self._experiments] for iexp, e in enumerate(self._experiments): # select the reflections for this experiment only sel = reflections['id'] == iexp refs = reflections.select(sel) # stills if not e.goniometer or self._force_stills: predictor = st(e, spherical_relp=self._spherical_relp) UB = e.crystal.get_A() predictor.for_reflection_table(refs, UB) # scan-varying elif 'ub_matrix' in refs: predictor = sv(e) UB = refs['ub_matrix'] s0 = refs['s0_vector'] dmat = refs['d_matrix'] predictor.for_reflection_table(refs, UB, s0, dmat) # scan static else: predictor = sc(e) UB = e.crystal.get_A() predictor.for_reflection_table(refs, UB) # write predictions back to overall reflections reflections.set_selected(sel, refs) return reflections
def _predict_one_experiment(self, experiment, reflections): # scan-varying if "ub_matrix" in reflections: predictor = sv(experiment) UB = reflections["ub_matrix"] s0 = reflections["s0_vector"] dmat = reflections["d_matrix"] Smat = reflections["S_matrix"] predictor.for_reflection_table(reflections, UB, s0, dmat, Smat) # scan static else: predictor = sc(experiment) UB = experiment.crystal.get_A() predictor.for_reflection_table(reflections, UB)