Skip to content
Snippets Groups Projects
Commit 3952c2a7 authored by Raquel Alvarez's avatar Raquel Alvarez
Browse files

Merge pull request #14114 from mantidproject/14090_ContainerSubtraction_Shift_X_Changes

ContainerSubtraction shift x changes
parents dce57694 988d1192
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,7 @@ class ApplyPaalmanPingsCorrection(PythonAlgorithm): ...@@ -46,6 +46,7 @@ class ApplyPaalmanPingsCorrection(PythonAlgorithm):
doc='The output corrections workspace.') doc='The output corrections workspace.')
def PyExec(self): def PyExec(self):
self._setup() self._setup()
...@@ -89,15 +90,17 @@ class ApplyPaalmanPingsCorrection(PythonAlgorithm): ...@@ -89,15 +90,17 @@ class ApplyPaalmanPingsCorrection(PythonAlgorithm):
self._subtract() self._subtract()
correction_type = 'can_subtraction' correction_type = 'can_subtraction'
# Add container filename to log values # Add container filename to log values
can_cut = self._can_ws_name.index('_')
can_base = self._can_ws_name[:can_cut]
AddSampleLog(Workspace=self._output_ws_name, AddSampleLog(Workspace=self._output_ws_name,
LogName='container_filename', LogName='container_filename',
LogType='String', LogType='String',
LogText=self._can_ws_name) LogText=can_base)
# Record the container scale factor # Record the container scale factor
if self._use_can and self._scale_can: if self._use_can and self._scale_can:
AddSampleLog(Workspace=self._output_ws_name, AddSampleLog(Workspace=self._output_ws_name,
LogName='apply_corr_can_scale_factor', LogName='container_scale',
LogType='Number', LogType='Number',
LogText=str(self._can_scale_factor)) LogText=str(self._can_scale_factor))
...@@ -108,10 +111,12 @@ class ApplyPaalmanPingsCorrection(PythonAlgorithm): ...@@ -108,10 +111,12 @@ class ApplyPaalmanPingsCorrection(PythonAlgorithm):
LogText=correction_type) LogText=correction_type)
# Add original sample as log entry # Add original sample as log entry
sam_cut = self._sample_ws_name.index('_')
sam_base = self._sample_ws_name[:sam_cut]
AddSampleLog(Workspace=self._output_ws_name, AddSampleLog(Workspace=self._output_ws_name,
LogName='sample_filename', LogName='sample_filename',
LogType='String', LogType='String',
LogText=self._sample_ws_name) LogText=sam_base)
self.setPropertyValue('OutputWorkspace', self._output_ws_name) self.setPropertyValue('OutputWorkspace', self._output_ws_name)
......
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
<double>-999.990000000000009</double> <double>-999.990000000000009</double>
</property> </property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>0.010000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<double>0.000000000000000</double> <double>0.000000000000000</double>
......
...@@ -94,21 +94,26 @@ void ContainerSubtraction::run() { ...@@ -94,21 +94,26 @@ void ContainerSubtraction::run() {
} }
// Check for same binning across sample and container // Check for same binning across sample and container
if (!checkWorkspaceBinningMatches(sampleWs, canCloneWs)) { if (m_uiForm.ckShiftCan->isChecked()) {
QString text = "Binning on sample and container does not match." addRebinStep(canCloneName, sampleWsName);
"Would you like to rebin the sample to match the container?"; } else {
if (!checkWorkspaceBinningMatches(sampleWs, canCloneWs)) {
int result = QMessageBox::question(NULL, tr("Rebin sample?"), tr(text), QString text =
QMessageBox::Yes, QMessageBox::No, "Binning on sample and container does not match."
QMessageBox::NoButton); "Would you like to rebin the sample to match the container?";
if (result == QMessageBox::Yes) { int result = QMessageBox::question(NULL, tr("Rebin sample?"), tr(text),
addRebinStep(canCloneName, sampleWsName); QMessageBox::Yes, QMessageBox::No,
} else { QMessageBox::NoButton);
m_batchAlgoRunner->clearQueue();
g_log.error("Cannot apply absorption corrections using a sample and " if (result == QMessageBox::Yes) {
"container with different binning."); addRebinStep(canCloneName, sampleWsName);
return; } else {
m_batchAlgoRunner->clearQueue();
g_log.error("Cannot apply absorption corrections using a sample and "
"container with different binning.");
return;
}
} }
} }
...@@ -295,6 +300,19 @@ void ContainerSubtraction::absCorComplete(bool error) { ...@@ -295,6 +300,19 @@ void ContainerSubtraction::absCorComplete(bool error) {
if (save) if (save)
addSaveWorkspaceToQueue(QString::fromStdString(m_pythonExportWsName)); addSaveWorkspaceToQueue(QString::fromStdString(m_pythonExportWsName));
if (m_uiForm.ckShiftCan->isChecked()) {
IAlgorithm_sptr shiftLog =
AlgorithmManager::Instance().create("AddSampleLog");
shiftLog->initialize();
shiftLog->setProperty("Workspace", m_pythonExportWsName);
shiftLog->setProperty("LogName", "container_shift");
shiftLog->setProperty("LogType", "Number");
shiftLog->setProperty(
"LogText", boost::lexical_cast<std::string>(m_uiForm.spShift->value()));
m_batchAlgoRunner->addAlgorithm(shiftLog);
}
// Run algorithm queue // Run algorithm queue
connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this,
SLOT(postProcessComplete(bool))); SLOT(postProcessComplete(bool)));
......
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