def sigma(self, keV, OFFSET=0., order=1, distribution="gaussian"): """Replacement for Physics.sigma function.""" tB = self.keV2Bragg(keV, order) Q = self.mat_facs[order]*Physics.angular_factor(tB) Dtheta = self.getDelta(tB, OFFSET) if distribution=="hat": weight=Physics.hat(Dtheta, Physics.eta2fwhm(self.eta)) elif distribution=="gaussian": weight=Physics.gaussian(Dtheta, self.eta) else: return 0. return Q*weight/math.cos(tB)
def sigma(self, G=False, order=1, distribution="gaussian"): """Interface to the sigma function from Physics.""" tB = self.xtal.keV2Bragg(self.photon.e) ang_fac = Physics.angular_factor(tB) Q = self.xtal.mat_facs[order]*ang_fac if G is None: G=self.g_needed(order) Dtheta = Physics.anglebetween(G, self.xtal.g) if distribution=="hat": weight=Physics.hat(Dtheta, Physics.eta2fwhm(self.xtal.eta)) elif distribution=="gaussian": weight=Physics.gaussian(Dtheta, self.xtal.eta) else: return 0. cosine = abs(self.photon.k[2]/self.photon.knorm) return Q*weight/cosine