def integrate(*columns): """Integrate the intensity of the peak""" _, ys = _getData(columns)[:2] ok, reason, intensity, stddev = window_integrate(list(ys)) if ok: session.log.info(' I = %f, sigma = %f', intensity, stddev) else: session.log.error('Peak integration error: %s', reason)
def acquire(self, point, preset): _scanfuncs[self.scanmode](point.target[0], subscan=True, **self._preset) subscan = self.dataset.subsets[-1].subsets[-1] index = [ i for (i, v) in enumerate(subscan.detvalueinfo) if v.name == session.instrument.center_counter ][0] vals = [x[index] for x in subscan.detvaluelists] if vals: _, _, intensity, _ = window_integrate(vals) session.experiment.data.putResults(FINAL, {'intensity': [intensity]})
def test_no_left(): profile = make_peak(40, 8) ok, reason, _, _ = window_integrate(profile) assert (not ok) assert (reason == 'No left side')
def test_no_right(): profile = make_peak(40, 33) ok, reason, _, _ = window_integrate(profile) assert (not ok) assert (reason == 'No right side')
def test_integrate(): profile = make_peak(40, 20) ok, _, intensity, stddev = window_integrate(profile) assert ok assert (abs(intensity - 482.75) < .2) assert (abs(stddev - 22.17) < .1)