Skip to content

Fix bug in normalisation for POLARIS total scattering reduction #40566

@RichardWaiteSTFC

Description

@RichardWaiteSTFC

Describe the bug
S(Q) should tend to 1 at high Q if absolute units normalisation and conversion to S(Q) done correctly - but it doesn't!

Image

FYI conversion from differential cross-section to S(Q)-1 is done

# convert diff cross section to S(Q) - 1
material_builder = MaterialBuilder()
material_builder.setFormula(sample_details.material_object.chemical_formula)
sample = material_builder.setNumberDensity(1.0).build() # number density not used in calculating xs (barns/atom)
sample_total_scatter_cross_section = sample.totalScatterXSection()
sample_coh_scatter_cross_section = sample.cohScatterXSection()
focused_ws = focused_ws - sample_total_scatter_cross_section / (4 * math.pi)
focused_ws = focused_ws * 4 * math.pi / sample_coh_scatter_cross_section

Absolute units is done here

def _perform_absolute_normalization(spline, ws):

To Reproduce
Run the following script with this file s_of_q_minus_one_merged.nxs.txt

ws_sqm1 = LoadNexus(r"C:/Users/xhg73778/Documents/POLARIS/s_of_q_minus_one.nxs")
ws_sqm1 = ws_sqm1[1:] # for some reason group ws itself is first entry
ws_sqm1_merged = MatchAndMergeWorkspaces(InputWorkspaces=ws_sqm1, XMin=len(ws_sqm1)*[0.5], XMax=len(ws_sqm1)*[40], 
                                         CalculateScale=False)
                                         
ws_gr = PDFFourierTransform(InputWorkspace=ws_sqm1_merged_new, SofQType='S(Q)-1', PDFType='g(r)', 
                           DeltaR=None, RMax=20, Filter=False)  
                           
ws_sqm1_merged_bgsub = ws_sqm1_merged - ws_sqm1_merged.readY(0)[-1]
ws_gr_bgsub = PDFFourierTransform(InputWorkspace=ws_sqm1_merged_bgsub, SofQType='S(Q)-1', PDFType='g(r)', 
                                  DeltaR=None, RMax=20, Filter=False)  
                          

fig, axes = plt.subplots(dpi=156.0, edgecolor='#ffffff', num='ws_gr-1', subplot_kw={'projection': 'mantid'})
axes.plot(ws_gr, color='#1f77b4', label='ws_gr: spec 1', wkspIndex=0)
axes.plot(ws_gr_bgsub, color='#ff7f0e', label='ws_gr_bgsub: spec 1', wkspIndex=0)
axes.tick_params(axis='x', which='major', **{'gridOn': False, 'tick1On': True, 'tick2On': False, 'label1On': True, 'label2On': False, 'size': 6, 'tickdir': 'out', 'width': 1})
axes.tick_params(axis='y', which='major', **{'gridOn': False, 'tick1On': True, 'tick2On': False, 'label1On': True, 'label2On': False, 'size': 6, 'tickdir': 'out', 'width': 1})
axes.set_title('ws_gr')
axes.set_xlabel('Atomic Distance ($\\AA$)')
axes.set_ylabel('PDF')
axes.set_xlim([0.17274, 12.307])
axes.set_ylim([-2721.1, 2971.4])
legend = axes.legend(fontsize=8.0).set_draggable(True).legend
fig.show()
Image

To run the POLARIS reduction follow instructions on this PR #39973

Expected behavior
S(Q) - 1 would tend to 0 at high-Q

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIssues and pull requests that are regressions or would be considered a bug by users (e.g. crashing)DiffractionIssues and pull requests related to diffractionISIS: DiffractionIssue and pull requests relating to Diffraction at ISISPowderIssues and pull requests related to powder diffraction

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions