Skip to content
Snippets Groups Projects
Unverified Commit 7649bd9a authored by Jose Borreguero's avatar Jose Borreguero Committed by GitHub
Browse files

Merge pull request #30932 from Kvieta1990/patch_for_hb2a

Patch for hb2a
parents 091df2d4 a76fb26f
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ from mantid.api import (PythonAlgorithm, AlgorithmFactory, PropertyMode, Workspa
from mantid.kernel import (Direction, IntArrayProperty, FloatTimeSeriesProperty,
StringListValidator, FloatBoundedValidator, EnabledWhenProperty,
PropertyCriterion, Property)
from mantid.simpleapi import (SaveGSS, SaveFocusedXYE)
from mantid.simpleapi import (SaveGSSCW, SaveFocusedXYE)
from mantid import logger
import numpy as np
import datetime
......@@ -281,18 +281,24 @@ class HB2AReduce(PythonAlgorithm):
outputdir = outputdir if outputdir != "" else f"/HFIR/HB2A/IPTS-{metadata['proposal']}/shared"
_outputfunc = {
'XYE': SaveFocusedXYE,
'GSAS': SaveGSS
'GSAS': SaveGSSCW
}[self.getProperty('OutputFormat').value]
_outputext = {
"XYE": 'dat',
"GSAS": 'gss',
}[self.getProperty('OutputFormat').value]
outputbase = os.path.join(outputdir, outputfn)
_outputfunc(
InputWorkspace=outWS,
Filename=f"{outputbase}.{_outputext}",
SplitFiles=False,
)
if self.getProperty('OutputFormat').value == "GSAS":
_outputfunc(
InputWorkspace=outWS,
OutputFilename=f"{outputbase}.{_outputext}",
)
else:
_outputfunc(
InputWorkspace=outWS,
Filename=f"{outputbase}.{_outputext}",
SplitFiles=False,
)
def get_detector_mask(self, exp, indir):
"""Returns an anode mask"""
......
......@@ -357,6 +357,7 @@ class SANSILLAutoProcess(DataProcessorAlgorithm):
self.declareProperty('SensitivityWithOffsets', False,
'Whether the sensitivity data has been measured with different horizontal offsets.')
# flake8: noqa: C901
def PyExec(self):
self.setUp()
......
......@@ -89,6 +89,7 @@ class HB2AReduceTest(unittest.TestCase):
HB2AReduce_ws.delete()
def test_saving_files(self):
# Test for saving XYE data file.
HB2AReduce_ws = HB2AReduce(
'HB2A_exp0660_scan0146.dat',
Vanadium='HB2A_exp0644_scan0018.dat',
......@@ -99,6 +100,17 @@ class HB2AReduceTest(unittest.TestCase):
self.assertTrue(HB2AReduce_ws)
self.assertTrue(
os.path.exists(os.path.join(self._default_save_directory, f"{HB2AReduce_ws}.dat")))
# Test for saving GSAS data file.
HB2AReduce_ws = HB2AReduce(
'HB2A_exp0735_scan0016.dat',
Vanadium='HB2A_exp0644_scan0018.dat',
IndividualDetectors=True,
OutputFormat='GSAS',
OutputDirectory=self._default_save_directory,
)
self.assertTrue(HB2AReduce_ws)
self.assertTrue(
os.path.exists(os.path.join(self._default_save_directory, f"{HB2AReduce_ws}.gss")))
HB2AReduce_ws.delete()
......
67a975fe7271cfd2080df244552f1e31
......@@ -28,6 +28,7 @@ Improvements
Bugfixes
########
- Fix the format inconsistency (with data saved from autoreduction workflow) issue for saving GSAS data using :ref:`HB2AReduce <algm-HB2AReduce>` - both are now using :ref:`SaveGSSCW <algm-SaveGSSCW>` for saving GSAS data.
- Fix out-of-range bug in :ref:`FitPeaks <algm-FitPeaks>` for histogram data.
- Fix bug in :ref:`FitPeaks <algm-FitPeaks>` not correctly checking right window for an individual peak
- Fix bug to actually implement intended sequential fit of DIFC, DIFA, TZERO in :ref:`PDCalibration <algm-PDCalibration>`.
......
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