def calculate_phase_intensities(specimen): """ Gets phase intensities for the provided phases Returns a 2-tuple containing 2-theta values and phase intensities. """ range_stl = 2 * np.sin(specimen.range_theta) / specimen.goniometer.wavelength correction_range = get_machine_correction_range(specimen) def get_phase_intensities(phases): for phase in phases: if phase != None: correction = correction_range if phase.apply_correction else 1.0 yield get_intensity( specimen.range_theta, range_stl, specimen.goniometer.soller1, specimen.goniometer.soller2, phase ) * correction else: yield np.zeros_like(range_stl) return ( correction_range, np.array([I for I in get_phase_intensities(specimen.phases)], dtype=np.float_) )
def get_machine_correction_range(self, range_theta, sample_length, absorption): """ Calculates correction factors for the given theta range, sample length and absorption using the information about the goniometer's geometry. """ return get_machine_correction_range( range_theta, sample_length, absorption, self.data_object )