# test for centering centering = xl.center(h, k, l, center_type) if centering == False: continue Qpeak = xl.huq(h, k, l, UB_rotated) # units of 1/d if Qpeak[0] > 0.0: continue # x pointing downstream # if Qpeak[1] > 0.0: continue # only detectors on -y side lenQpeak = math.sqrt(numpy.dot(Qpeak, Qpeak)) # magnitude or length of Qpeak dsp = 1.0 / lenQpeak if dsp < dmin: continue # ISAW uses IPNS coordinate system for SNS data peak_params = xl.calc_2th_wl_IPNS(Qpeak) # ISAW uses IPNS coordinate system for SNS data two_theta = (peak_params[0] / 180.0) * math.pi wl = peak_params[1] if wl < wlmin: continue if wl > wlmax: continue # Create neutron vectorin Q space in SNS coordinates. # This is the scattered vector with the origin on the crystal. nvector = numpy.array([Qpeak[1], Qpeak[2], Qpeak[0]+1.0/wl]) # create neutron vector in Q space with SNS coordinates nvecQ = numpy.zeros(3) nvecQ = numpy.array([Qpeak[1], Qpeak[2], Qpeak[0]+1.0/wl]) # Determine which detector, if any, the peak hits for i in range(dc.nod):
# R centering for sapphire sumhkl = -h + k + l if sumhkl%3 != 0: continue Qpeak = xl.huq(h, k, l, UB_IPNS) # units of 1/d if Qpeak[0] > 0.0: continue # x pointing downstream if Qpeak[1] > 0.0: continue # only detectors on -y side lenQpeak = math.sqrt(np.dot(Qpeak, Qpeak)) # magnitude or length of Qpeak dsp = 1.0 / lenQpeak if dsp < dmin: continue # ISAW uses IPNS coordinate system for SNS data peak_params = xl.calc_2th_wl_IPNS(Qpeak) two_theta = (peak_params[0] / 180.0) * math.pi wl = peak_params[1] if wl < wlmin: continue if wl > wlmax: continue # Create neutron vectorin Q space in SNS coordinates. # This is the scattered vector with the origin on the crystal. nvector = np.array([Qpeak[1], Qpeak[2], Qpeak[0]+1.0/wl]) # create neutron vector in Q space with SNS coordinates nvecQ = np.zeros(3) nvecQ = np.array([Qpeak[1], Qpeak[2], Qpeak[0]+1.0/wl]) # Determine which detector, if any, the peak hits for i in range(dc.nod):