Commit eae063cb authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Save modulation vectors in IndexSatellitePeaks

Also updates documentation test to check peaks directly
for modulated structure indices.
Refs #26839
parent 01859a4c
......@@ -99,14 +99,15 @@ class IndexSatellitePeaks(PythonAlgorithm):
distance, index = peak_map.query(q, k=1)
hklm[i, 3:] = indices[index]
indexed = self.create_indexed_peaksworkspace(satellites, hklm)
indexed = self.create_indexed_peaksworkspace(satellites, qs, hklm)
self.setProperty("OutputWorkspace", indexed)
def create_indexed_peaksworkspace(self, fractional_peaks, hklm):
def create_indexed_peaksworkspace(self, fractional_peaks, qs, hklm):
"""Create a PeaksWorkspace that contains indexed peak data.
:param fractional_peaks: the peaks workspace containing peaks with
fractional HKL values.
:param qs: The set of modulation vectors determined
:param hklm: the new higher dimensional miller indices to add.
:returns: a peaks workspace with the indexed peak data
"""
......@@ -114,6 +115,14 @@ class IndexSatellitePeaks(PythonAlgorithm):
hklm = np.pad(hklm, pad_width=(0, 6 - hklm.shape[1]), mode='constant',
constant_values=0)
indexed = api.CloneWorkspace(fractional_peaks, StoreInADS=False)
# save modulation vectors. ensure qs has 3 rows
qs = np.pad(qs, pad_width=((0, 3 - qs.shape[0]), (0, 0)), mode='constant',
constant_values=0)
lattice = fractional_peaks.sample().getOrientedLattice()
lattice.setModVec1(V3D(*qs[0]))
lattice.setModVec2(V3D(*qs[1]))
lattice.setModVec3(V3D(*qs[2]))
# save indices
for row, peak in enumerate(indexed):
row_indices = hklm[row]
peak.setHKL(*row_indices[:3])
......
......@@ -73,10 +73,9 @@ Usage
nuclear_peaks = Load('WISH_peak_hkl_small.nxs')
satellite_peaks = Load("refine_satellites_fixed_q_test.nxs")
indexed_peaks = IndexSatellitePeaks(nuclear_peaks, satellite_peaks, tolerance=0.1, NumOfQs=2)
index_values = np.array(indexed_peaks.column("m1"))
for peak in indexed_peaks:
print("H: {h:>5} K: {k:>5} L: {l:>5} M1: {m1:>5}".format(**peak))
print("H: {:>5} K: {:>5} L: {:>5} M1: {:>5}".format(peak.getH(),peak.getK(),peak.getL(),peak.getIntMNP()[0]))
Output:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment