Skip to content
Snippets Groups Projects
Unverified Commit daece20e authored by Gagik Vardanyan's avatar Gagik Vardanyan Committed by GitHub
Browse files

Merge pull request #28570 from mantidproject/28551_make_polaris_pdf_lorch_filter_optional

Make Lorch Filter on Polaris PDF use of PDFFourierTransform optional
parents d301d29d fc4edfbf
No related branches found
No related tags found
No related merge requests found
......@@ -263,8 +263,26 @@ class TotalScatteringFilterTest(systemtesting.MantidSystemTest):
self.assertAlmostEqual(self.pdf_output.dataY(0)[37], 0.6068334, places=3)
class TotalScatteringLorchFilterTest(systemtesting.MantidSystemTest):
pdf_output = None
def runTest(self):
setup_mantid_paths()
# Load Focused ws
mantid.LoadNexus(Filename=total_scattering_input_file, OutputWorkspace='98533-Results-TOF-Grp')
q_lims = np.array([2.5, 3, 4, 6, 7, 3.5, 5, 7, 11, 40]).reshape((2, 5))
self.pdf_output = run_total_scattering('98533', True, q_lims=q_lims, lorch_filter=False)
def validate(self):
# Whilst total scattering is in development, the validation will avoid using reference files as they will have
# to be updated very frequently. In the meantime, the expected peak in the PDF at ~3.9 Angstrom will be checked.
# After rebin this is at X index 37
self.assertAlmostEqual(self.pdf_output.dataY(0)[37], 3.1153917, places=3)
def run_total_scattering(run_number, merge_banks, q_lims=None, delta_q=None, delta_r=None, pdf_type="G(r)",
freq_params=None):
freq_params=None, lorch_filter=True):
pdf_inst_obj = setup_inst_object(mode="PDF")
return pdf_inst_obj.create_total_scattering_pdf(run_number=run_number,
merge_banks=merge_banks,
......@@ -272,6 +290,7 @@ def run_total_scattering(run_number, merge_banks, q_lims=None, delta_q=None, del
delta_q=delta_q,
delta_r=delta_r,
pdf_type=pdf_type,
lorch_filter=lorch_filter,
freq_params=freq_params)
......
......@@ -18,6 +18,7 @@ Powder Diffraction
- Polaris.create_total_scattering_pdf fourier filter can be performed using the butterworth filter by calling with `bw_order`.
- SampleDetails.set_materials now differentiates between sample density and crystal density for converting between pdf types.
- :ref:`LoadWAND <algm-LoadWAND>` now adds `duration` log to the workspace
- Polaris.create_total_scattering_pdf now no longer calculates the PDF with the Lorch filter enabled by default and must be enabled.
Engineering Diffraction
-----------------------
......
......@@ -192,6 +192,7 @@ The output PDF can be customized with the following parameters:
a PDF will be generated for each bank within the focused_workspace.
- By calling with `delta_q` which will calculate the PDF after rebinning the Q workspace to have bin width `delta_r`.
- By calling with `delta_r` which will calculate the PDF with bin width of `delta_q`.
- By calling with `lorch_filter` will calculate the PDF with a Lorth Filter if set to `True`
- By calling with `freq_params` a fourier filter will be performed on the focused signal removing any
components from atomic distances outside of the parameters. The parameters must be given as list:
[lower], or [lower, upper]. By default this produces a sharp cut off that can produce artifacts in
......
......@@ -66,6 +66,7 @@ class Polaris(AbstractInst):
delta_r=self._inst_settings.delta_r,
delta_q=self._inst_settings.delta_q,
pdf_type=self._inst_settings.pdf_type,
lorch_filter=self._inst_settings.lorch_filter,
freq_params=self._inst_settings.freq_params,
bw_order=self._inst_settings.bw_order)
return pdf_output
......
......@@ -81,7 +81,8 @@ def save_unsplined_vanadium(vanadium_ws, output_path):
def generate_ts_pdf(run_number, focus_file_path, merge_banks=False, q_lims=None, cal_file_name=None,
sample_details=None, delta_r=None, delta_q=None, pdf_type="G(r)", freq_params=None, bw_order=None):
sample_details=None, delta_r=None, delta_q=None, pdf_type="G(r)", lorch_filter=None,
freq_params=None, bw_order=None):
focused_ws = _obtain_focused_run(run_number, focus_file_path)
focused_ws = mantid.ConvertUnits(InputWorkspace=focused_ws, Target="MomentumTransfer", EMode='Elastic')
......@@ -111,13 +112,13 @@ def generate_ts_pdf(run_number, focus_file_path, merge_banks=False, q_lims=None,
CalculateScale=False)
fast_fourier_filter(merged_ws, freq_params=freq_params, bw_order=bw_order)
pdf_output = mantid.PDFFourierTransform(Inputworkspace="merged_ws", InputSofQType="S(Q)-1", PDFType=pdf_type,
Filter=True, DeltaR=delta_r,
Filter=lorch_filter, DeltaR=delta_r,
rho0=sample_details.material_object.crystal_density)
else:
for ws in focused_ws:
fast_fourier_filter(ws, freq_params=freq_params, bw_order=bw_order)
pdf_output = mantid.PDFFourierTransform(Inputworkspace='focused_ws', InputSofQType="S(Q)-1", PDFType=pdf_type,
Filter=True, DeltaR=delta_r,
Filter=lorch_filter, DeltaR=delta_r,
rho0=sample_details.material_object.crystal_density)
pdf_output = mantid.RebinToWorkspace(WorkspaceToRebin=pdf_output, WorkspaceToMatch=pdf_output[4],
PreserveEvents=True)
......
......@@ -26,6 +26,7 @@ attr_mapping = [
ParamMapEntry(ext_name="freq_params", int_name="freq_params", optional=True),
ParamMapEntry(ext_name="grouping_file_name", int_name="grouping_file_name"),
ParamMapEntry(ext_name="input_mode", int_name="input_mode", enum_class=INPUT_BATCHING),
ParamMapEntry(ext_name="lorch_filter", int_name="lorch_filter", optional=True),
ParamMapEntry(ext_name="merge_banks", int_name="merge_banks", optional=True),
ParamMapEntry(ext_name="mode", int_name="mode", enum_class=POLARIS_CHOPPER_MODES,
optional=True),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment