Skip to content
Snippets Groups Projects
Commit 5e9cfcd6 authored by Conor Finn's avatar Conor Finn
Browse files

RE #27659 Make full calib integrate with model

parent de8053e9
No related merge requests found
......@@ -25,9 +25,6 @@ class SettingsView(QtWidgets.QDialog, Ui_settings):
self.finder_fullCalib.setLabelText("Full Calibration")
self.finder_fullCalib.isForRunFiles(False)
# TODO: Once it becomes possible to load the .csv containing the full calibration into mantid,
# this can be used. Until then, this option is hidden from the user.
self.finder_fullCalib.hide()
# ===============
# Slot Connectors
......
......@@ -14,7 +14,7 @@ import matplotlib.pyplot as plt
from mantid.api import AnalysisDataService as Ads
from mantid.kernel import logger
from mantid.simpleapi import EnggCalibrate, DeleteWorkspace, CloneWorkspace, \
CreateWorkspace, AppendSpectra, CreateEmptyTableWorkspace
CreateWorkspace, AppendSpectra, CreateEmptyTableWorkspace, LoadAscii
from mantidqt.plotting.functions import plot
from Engineering.EnggUtils import write_ENGINX_GSAS_iparam_file
from Engineering.gui.engineering_diffraction.tabs.common import vanadium_corrections
......@@ -55,7 +55,7 @@ class CalibrationModel(object):
full_calib_path = get_setting(path_handling.INTERFACES_SETTINGS_GROUP,
path_handling.ENGINEERING_PREFIX, "full_calibration")
if full_calib_path is not None and path.exists(full_calib_path):
full_calib = path_handling.load_workspace(full_calib_path)
full_calib = LoadAscii(full_calib_path, OutputWorkspace="det_pos", Separator="Tab")
output = self.run_calibration(sample_workspace,
van_integration,
van_curves,
......
......@@ -58,22 +58,24 @@ class CalibrationModelTest(unittest.TestCase):
@patch(file_path + '.get_setting')
@patch(class_path + '.update_calibration_params_table')
@patch(class_path + '.create_output_files')
@patch(file_path + '.LoadAscii')
@patch(file_path + ".path_handling.load_workspace")
@patch(class_path + '.run_calibration')
@patch(file_path + '.vanadium_corrections.fetch_correction_workspaces')
def test_having_full_calib_set_uses_file(self, van_corr, calibrate_alg, load_workspace,
def test_having_full_calib_set_uses_file(self, van_corr, calibrate_alg, load_workspace, load_ascii,
output_files, update_table, setting, path):
path.return_value = True
setting.return_value = "mocked/out/path"
van_corr.return_value = ("mocked_integration", "mocked_curves")
load_workspace.return_value = "mocked_workspace"
load_ascii.return_value = "mocked_det_pos"
self.model.create_new_calibration(VANADIUM_NUMBER, CERIUM_NUMBER, False, "ENGINX")
calibrate_alg.assert_called_with("mocked_workspace",
"mocked_integration",
"mocked_curves",
None,
None,
full_calib_ws="mocked_workspace")
full_calib_ws="mocked_det_pos")
@patch(class_path + '.update_calibration_params_table')
@patch(class_path + '.create_output_files')
......
......@@ -25,9 +25,9 @@ def get_output_path():
return location if location is not None else ""
def load_workspace(file_path):
def load_workspace(file_path, **kwargs):
try:
return Load(Filename=file_path, OutputWorkspace="engggui_calibration_sample_ws")
return Load(Filename=file_path, OutputWorkspace="engggui_calibration_sample_ws", **kwargs)
except Exception as e:
logger.error("Error while loading workspace. "
"Could not run the algorithm Load successfully for the data file "
......
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