def test_blockav_psd(self): out = xu.blockAveragePSD(self.seq2d, self.n) self.assertAlmostEqual(out[0, 0], numpy.average(self.seq2d[0, 0:self.n])) self.assertEqual(out.shape, (self.seq2d.shape[0], numpy.ceil(self.seq2d.shape[1] / float(self.n))))
def test_blockav_psd(self): out = xu.blockAveragePSD(self.seq2d, self.n) self.assertAlmostEqual(out[0, 0], numpy.average(self.seq2d[0, 0:self.n])) self.assertEqual( out.shape, (self.seq2d.shape[0], numpy.ceil(self.seq2d.shape[1] / float(self.n))))
################################# # InP (333) reciprocal space map omalign = 43.0529 # experimental aligned values ttalign = 86.0733 [omnominal, dummy, dummy, ttnominal] = hxrd.Q2Ang(InP.Q(3, 3, 3)) # nominal values of the substrate peak # read the data from the HDF5 file (scan number:36, names of motors in # spec file: omega= sample rocking, gamma = twotheta) [om, tt], MAP = xu.io.geth5_scan(h5file, 36, 'omega', 'gamma') # normalize the intensity values (absorber and count time corrections) psdraw = normalizer_detcorr(MAP) # remove unusable detector channels/regions (no averaging of detector channels) psd = xu.blockAveragePSD(psdraw, 1, roi=roi) # determine offset of substrate peak from experimental values (optional) omalign, ttalign, p, cov = xu.analysis.fit_bragg_peak(om, tt, psd, omalign, ttalign, hxrd, plot=False) # convert angular coordinates to reciprocal space + correct for offsets [qx, qy, qz] = hxrd.Ang2Q.linear(om, tt, delta=[omalign - omnominal, ttalign - ttnominal])
################################# # InP (333) reciprocal space map omalign = 43.0529 # experimental aligned values ttalign = 86.0733 [omnominal, dummy, dummy, ttnominal] = hxrd.Q2Ang( InP.Q(3, 3, 3)) # nominal values of the substrate peak # read the data from the HDF5 file # scan number:36, names of motors in spec file: omega= sample rocking, gamma = # twotheta [om, tt], MAP = xu.io.geth5_scan(h5file, 36, 'omega', 'gamma') # normalize the intensity values (absorber and count time corrections) psdraw = normalizer_detcorr(MAP) # remove unusable detector channels/regions (no averaging of detector channels) psd = xu.blockAveragePSD(psdraw, 1, roi=roi) # convert angular coordinates to reciprocal space + correct for offsets [qx, qy, qz] = hxrd.Ang2Q.linear( om, tt, delta=[omalign - omnominal, ttalign - ttnominal]) # calculate data on a regular grid of 200x201 points gridder = xu.Gridder2D(200, 201) gridder(qy, qz, psd) # maplog function limits the shown dynamic range to 8 orders of magnitude # from the maxium INT = xu.maplog(gridder.data.T, 8., 0) # plot the intensity as contour plot using matplotlib plt.figure()