Skip to content

Investigate/fix noisy low-r region of PDF in POLARIS reduction #38961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
RichardWaiteSTFC opened this issue Feb 24, 2025 · 1 comment · May be fixed by #39203
Open

Investigate/fix noisy low-r region of PDF in POLARIS reduction #38961

RichardWaiteSTFC opened this issue Feb 24, 2025 · 1 comment · May be fixed by #39203
Assignees
Labels
Bug Issues and pull requests that are regressions or would be considered a bug by users (e.g. crashing) Diffraction Issues and pull requests related to diffraction ISIS Team: Diffraction Issue and pull requests managed by the Diffraction subteam at ISIS Powder Issues and pull requests related to powder diffraction
Milestone

Comments

@RichardWaiteSTFC
Copy link
Contributor

Describe the bug

Comparison of PDF produced by Mantid (LEFT) and Gudrun (RIGHT)

Image

This could be due to the implementation of the fourier filter here

def fast_fourier_filter(ws, rho0, freq_params=None):

  • The output from this filter has regular bin-width (the input doesn’t) taken from smallest bin-width in data
  • If no rmax is supplied in the freq_params then it uses hard-coded rmax=200 – I’m not sure how reasonable this is?

It also affects PDF with merge_banks=False

Image

To Reproduce
(1) Ask me for files
(2) Update paths in .yaml files
(3) Run this script

from mantid.simpleapi import *
import numpy as np
from isis_powder import polaris, SampleDetails

config_file_path = r"C:\Users\xhg73778\Documents\POLARIS\PR34144Files\polaris_config_example.yaml"
polaris = polaris.Polaris(config_file=config_file_path, user_name="test")


sample_details = SampleDetails(height=4.0, radius=0.2985, center=[0, 0, 0], shape='cylinder')
sample_details.set_material(chemical_formula='Si', packing_fraction=0.6)
sample_details.set_container(radius=0.3175, chemical_formula='V')
polaris.set_sample_details(sample=sample_details)

# focus
polaris.create_vanadium(first_cycle_run_no="98532", multiple_scattering=True, mayers_mult_scat_events=1)
polaris.focus(run_number="98533", input_mode='Summed', # sample_empty="98532", # "98531"
              mode="PDF", do_absorb_corrections=True, do_van_normalisation=True,
              van_normalisation_method="Absolute",
              empty_can_subtraction_method= "PaalmanPings",
              sample_empty_scale=1.0)

# produce PDF
polaris.create_total_scattering_pdf(run_number="98533", 
                                    q_lims=[[-1, 0.5, 0.5, 0.5, 0.5],[-1, 30, 30, 30, 30]],
                                    delta_q=0.02,
                                    delta_r=0.02,
                                    pdf_type="g(r)",
                                    freq_params=[0.91],
                                    lorch_filter=True,
                                    placzek_order=2,
                                    sample_temp=300,
                                    pdf_output_name="pdf",
                                    merge_banks=True)

Expected behavior
Would produce result similar to gudrun

Screenshots

Platform/Version (please complete the following information):

  • OS: [e.g. Windows, RHEL 7, Ubuntu, macOS]
  • OS Version:
  • Mantid Version [e.g. 6.0.0]

Additional context

@RichardWaiteSTFC RichardWaiteSTFC added the Bug Issues and pull requests that are regressions or would be considered a bug by users (e.g. crashing) label Feb 24, 2025
@RichardWaiteSTFC RichardWaiteSTFC added this to the Release 6.13 milestone Feb 24, 2025
@RichardWaiteSTFC RichardWaiteSTFC added Diffraction Issues and pull requests related to diffraction Powder Issues and pull requests related to powder diffraction ISIS Team: Diffraction Issue and pull requests managed by the Diffraction subteam at ISIS labels Feb 24, 2025
@RichardWaiteSTFC RichardWaiteSTFC self-assigned this Feb 25, 2025
@RichardWaiteSTFC
Copy link
Contributor Author

RichardWaiteSTFC commented Apr 4, 2025

Compare Mantid to pystog - input is bank 5 in Q (not rebinned to have constant bin width)

Using default deltaR=pi/Qmax in PDFFourierTransform the results of mantid (with fourier filter applied) and pystog (no fourier filter) look similar

Image

If using a smaller deltaR=0.05 then pytog starts to like Mantid without fourier filter - though perhaps bin-width difference?

Image

But pystog also has a lorch filter which seems to help.

Similar results for larger than defualt deltaR

Image

deltaR seems very important at least to pystog if no lorch filter

@RichardWaiteSTFC RichardWaiteSTFC moved this from Todo to In Progress in ISIS Diffraction Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues and pull requests that are regressions or would be considered a bug by users (e.g. crashing) Diffraction Issues and pull requests related to diffraction ISIS Team: Diffraction Issue and pull requests managed by the Diffraction subteam at ISIS Powder Issues and pull requests related to powder diffraction
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

1 participant