Skip to content

Commit

Permalink
Refs #4581. Change the settings tab and how it works.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-Whitley committed Jan 23, 2012
1 parent 800741b commit 04d75d0
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@
</property>
<item>
<property name="text">
<string>Overwrite</string>
<string>Auto-Update + Overwrite</string>
</property>
</item>
<item>
Expand All @@ -1332,7 +1332,7 @@
</item>
<item>
<property name="text">
<string>Auto-Update + Overwrite</string>
<string>Overwrite</string>
</property>
</item>
<item>
Expand Down Expand Up @@ -2080,7 +2080,15 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>instrSelector</tabstop>
<tabstop>timeZeroFront</tabstop>
<tabstop>firstGoodBinFront</tabstop>
<tabstop>loadCurrent</tabstop>
<tabstop>mwRunFiles</tabstop>
<tabstop>appendRun</tabstop>
<tabstop>previousRun</tabstop>
<tabstop>nextRun</tabstop>
<tabstop>frontGroupGroupPairComboBox</tabstop>
<tabstop>frontAlphaNumber</tabstop>
<tabstop>homePeriodBox1</tabstop>
Expand All @@ -2102,8 +2110,27 @@
<tabstop>pairTablePlotChoice</tabstop>
<tabstop>pairTablePlotButton</tabstop>
<tabstop>muonAnalysisHelpGrouping</tabstop>
<tabstop>connectPlotType</tabstop>
<tabstop>timeComboBox</tabstop>
<tabstop>timeAxisStartAtInput</tabstop>
<tabstop>timeAxisFinishAtInput</tabstop>
<tabstop>yAxisMinimumInput</tabstop>
<tabstop>yAxisMaximumInput</tabstop>
<tabstop>yAxisAutoscale</tabstop>
<tabstop>showErrorBars</tabstop>
<tabstop>rebinComboBox</tabstop>
<tabstop>optionStepSizeText</tabstop>
<tabstop>plotCreation</tabstop>
<tabstop>hideToolbars</tabstop>
<tabstop>muonAnalysisHelpPlotting</tabstop>
<tabstop>muonAnalysisHelpDataAnalysis</tabstop>
<tabstop>valueTable</tabstop>
<tabstop>selectAllLogValues</tabstop>
<tabstop>fittingResultsTable</tabstop>
<tabstop>selectAllFittingResults</tabstop>
<tabstop>tableName</tabstop>
<tabstop>createTableBtn</tabstop>
<tabstop>muonAnalysisHelpResults</tabstop>
</tabstops>
<resources/>
<connections/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ private slots:
void errorBarsChanged(bool);
///
void toolbarsChanged(bool);
///
void validateYMin();
///
void validateYMax();
};

}
Expand Down
50 changes: 24 additions & 26 deletions Code/Mantid/MantidQt/CustomInterfaces/src/MuonAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1436,9 +1436,10 @@ void MuonAnalysis::createPlotWS(const std::string& groupName, const std::string&
runPythonCode( cropStr ).trimmed();

// Copy the data and keep as raw for later
if (!(AnalysisDataService::Instance().doesExist(wsname + "_Raw") ) )
bool newRaw = (!(AnalysisDataService::Instance().doesExist(wsname + "_Raw") ) );
if (newRaw)
{
m_fitDataTab->makeRawWorkspace(wsname);
m_fitDataTab->makeRawWorkspace(wsname);
}

// rebin data if option set in Plot Options
Expand All @@ -1465,6 +1466,15 @@ void MuonAnalysis::createPlotWS(const std::string& groupName, const std::string&
+ "',OutputWorkspace='" + groupName.c_str() + "')\n";
runPythonCode( groupStr ).trimmed();
}

if(newRaw)
{
// Group the raw workspace
std::vector<std::string> groupWorkspaces;
groupWorkspaces.push_back(groupName);
groupWorkspaces.push_back(wsname + "_Raw");
m_fitDataTab->groupRawWorkspace(groupWorkspaces, groupName);
}
}


Expand Down Expand Up @@ -1652,22 +1662,16 @@ void MuonAnalysis::plotGroup(const std::string& plotType)
}
else
{
if (!rawExists)
Mantid::API::AnalysisDataService::Instance().remove(cropWS.toStdString() + "_Raw");
g_log.error("Unknown group table plot function");
m_updating = false;
return;
}

// run python script
QString pyOutput = runPythonCode( pyString ).trimmed();

// Group the raw workspace
if (!rawExists)
{
std::vector<std::string> groupWorkspaces;
groupWorkspaces.push_back(wsGroupName.toStdString());
groupWorkspaces.push_back(titleLabel.toStdString() + "_Raw");
m_fitDataTab->groupRawWorkspace(groupWorkspaces, wsGroupName.toStdString());
}

// Change the plot style of the graph so that it matches what is selected on
// the plot options tab. Default is set to line (0).
QStringList plotDetails;
Expand Down Expand Up @@ -1824,21 +1828,15 @@ void MuonAnalysis::plotPair(const std::string& plotType)
}
else
{
if (!rawExists)
Mantid::API::AnalysisDataService::Instance().remove(cropWS.toStdString() + "_Raw");
g_log.error("Unknown pair table plot function");
m_updating = false;
return;
}

QString pyOutput = runPythonCode( pyString ).trimmed();

// Group the raw workspace
if (!rawExists)
{
std::vector<std::string> groupWorkspaces;
groupWorkspaces.push_back(wsGroupName.toStdString());
groupWorkspaces.push_back(titleLabel.toStdString() + "_Raw");
m_fitDataTab->groupRawWorkspace(groupWorkspaces, wsGroupName.toStdString());
}

// Change the plot style of the graph so that it matches what is selected on
// the plot options tab. Default is set to line (0).
QStringList plotDetails;
Expand Down Expand Up @@ -2974,13 +2972,13 @@ void MuonAnalysis::groupFittedWorkspaces(QString workspaceName)
void MuonAnalysis::connectAutoUpdate()
{
// Home tab Auto Updates
connect(m_uiForm.firstGoodBinFront, SIGNAL(editingFinished ()), this, SLOT(homeTabUpdatePlot()));
connect(m_uiForm.firstGoodBinFront, SIGNAL(returnPressed ()), this, SLOT(homeTabUpdatePlot()));
connect(m_uiForm.frontGroupGroupPairComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(homeTabUpdatePlot()));
connect(m_uiForm.homePeriodBox1, SIGNAL(currentIndexChanged(int)), this, SLOT(homeTabUpdatePlot()));
connect(m_uiForm.homePeriodBoxMath, SIGNAL(currentIndexChanged(int)), this, SLOT(homeTabUpdatePlot()));
connect(m_uiForm.homePeriodBox2, SIGNAL(currentIndexChanged(int)), this, SLOT(homeTabUpdatePlot()));
connect(m_uiForm.frontPlotFuncs, SIGNAL(currentIndexChanged(int)), this, SLOT(homeTabUpdatePlot()));
connect(m_uiForm.frontAlphaNumber, SIGNAL(editingFinished ()), this, SLOT(homeTabUpdatePlot()));
connect(m_uiForm.frontAlphaNumber, SIGNAL(returnPressed ()), this, SLOT(homeTabUpdatePlot()));

// Grouping tab Auto Updates
// Group Table
Expand All @@ -2997,7 +2995,7 @@ void MuonAnalysis::connectAutoUpdate()
void MuonAnalysis::homeTabUpdatePlot()
{
int choice(m_uiForm.plotCreation->currentIndex());
if ((choice == 1 || choice == 2) && (!m_updating) && (m_tabNumber == 0) )
if ((choice == 0 || choice == 1) && (!m_updating) && (m_tabNumber == 0) )
{
if (m_loaded == true)
runFrontPlotButton();
Expand All @@ -3007,7 +3005,7 @@ void MuonAnalysis::homeTabUpdatePlot()
void MuonAnalysis::groupTabUpdateGroup()
{
int choice(m_uiForm.plotCreation->currentIndex());
if ((choice == 1 || choice == 2) && (!m_updating) && (m_tabNumber == 1) )
if ((choice == 0 || choice == 1) && (!m_updating) && (m_tabNumber == 1) )
{
if (m_loaded == true)
runGroupTablePlotButton();
Expand All @@ -3017,7 +3015,7 @@ void MuonAnalysis::groupTabUpdateGroup()
void MuonAnalysis::groupTabUpdatePair()
{
int choice(m_uiForm.plotCreation->currentIndex());
if ((choice == 1 || choice == 2) && (!m_updating) && (m_tabNumber == 1) )
if ((choice == 0 || choice == 1) && (!m_updating) && (m_tabNumber == 1) )
{
if (m_loaded == true)
runPairTablePlotButton();
Expand All @@ -3027,7 +3025,7 @@ void MuonAnalysis::groupTabUpdatePair()
void MuonAnalysis::settingsTabUpdatePlot()
{
int choice(m_uiForm.plotCreation->currentIndex());
if ((choice == 1 || choice == 2) && (!m_updating) && (m_tabNumber == 2) )
if ((choice == 0 || choice == 1) && (!m_updating) && (m_tabNumber == 2) )
{
if (m_loaded == true)
runFrontPlotButton();
Expand Down
50 changes: 39 additions & 11 deletions Code/Mantid/MantidQt/CustomInterfaces/src/MuonAnalysisOptionTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,19 @@ void MuonAnalysisOptionTab::initLayout()
////////////// Auto Update /////////////////
connect(m_uiForm.connectPlotType, SIGNAL(currentIndexChanged(int)), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.timeComboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.timeAxisStartAtInput, SIGNAL(editingFinished ()), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.timeAxisFinishAtInput, SIGNAL(editingFinished ()), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.yAxisMinimumInput, SIGNAL(editingFinished ()), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.yAxisMaximumInput, SIGNAL(editingFinished ()), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.optionStepSizeText, SIGNAL(editingFinished ()), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.timeAxisStartAtInput, SIGNAL(returnPressed ()), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.timeAxisFinishAtInput, SIGNAL(returnPressed ()), this, SIGNAL(settingsTabUpdatePlot()));

//validate
connect(m_uiForm.yAxisMinimumInput, SIGNAL(editingfinished ()), this, SLOT(runyAxisMinimumInput()));
connect(m_uiForm.yAxisMaximumInput, SIGNAL(editingfinished ()), this, SLOT(runyAxisMaximumInput()));

connect(m_uiForm.yAxisMinimumInput, SIGNAL(returnPressed ()), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.yAxisMaximumInput, SIGNAL(returnPressed ()), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.optionStepSizeText, SIGNAL(returnPressed ()), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.rebinComboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.showErrorBars, SIGNAL(clicked()), this, SIGNAL(settingsTabUpdatePlot()));
connect(m_uiForm.yAxisAutoscale, SIGNAL(clicked()), this, SIGNAL(settingsTabUpdatePlot()));
}


Expand Down Expand Up @@ -212,8 +218,8 @@ void MuonAnalysisOptionTab::runTimeAxisFinishAtInput()
}
catch (...)
{
QMessageBox::warning(this,"Mantid - MuonAnalysis", "Number not recognised in Plot Option 'Finish (ms):' input box.");
m_uiForm.timeAxisFinishAtInput->setText("");
QMessageBox::warning(this,"Mantid - MuonAnalysis", "Number not recognised in Plot Option 'Finish (ms):' input box. Reset to 0.");
m_uiForm.timeAxisFinishAtInput->setText("0");
}
}

Expand All @@ -236,8 +242,8 @@ void MuonAnalysisOptionTab::runyAxisMinimumInput()
}
catch (...)
{
QMessageBox::warning(this,"Mantid - MuonAnalysis", "Number not recognised in Plot Option 'Minimum:' input box.");
m_uiForm.yAxisMinimumInput->setText("");
QMessageBox::warning(this,"Mantid - MuonAnalysis", "Number not recognised in Plot Option 'Minimum:' input box. Reset to 0");
m_uiForm.yAxisMinimumInput->setText("0");
}
}

Expand All @@ -260,8 +266,8 @@ void MuonAnalysisOptionTab::runyAxisMaximumInput()
}
catch (...)
{
QMessageBox::warning(this,"Mantid - MuonAnalysis", "Number not recognised in Plot Option 'Maximum:' input box.");
m_uiForm.yAxisMaximumInput->setText("");
QMessageBox::warning(this,"Mantid - MuonAnalysis", "Number not recognised in Plot Option 'Maximum:' input box. Reset to 0");
m_uiForm.yAxisMaximumInput->setText("0");
}
}

Expand Down Expand Up @@ -295,6 +301,28 @@ void MuonAnalysisOptionTab::toolbarsChanged(bool state)
group.setValue("toolbars", state);
}


void MuonAnalysisOptionTab::validateYMin()
{
QString tempValue = m_uiForm.yAxisMinimumInput->text();
runyAxisMinimumInput();
if(tempValue == m_uiForm.yAxisMinimumInput->text())
{
emit settingsTabUpdatePlot();
}
}

void MuonAnalysisOptionTab::validateYMax()
{
QString tempValue = m_uiForm.yAxisMinimumInput->text();
runyAxisMinimumInput();
if(tempValue == m_uiForm.yAxisMinimumInput->text())
{
emit settingsTabUpdatePlot();
}
}


}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ void MuonAnalysisResultTableTab::populateLogsAndValues(const QVector<QString>& f
for( std::vector< Mantid::Kernel::Property * >::const_iterator pItr = logData.begin();
pItr != pEnd; ++pItr )
{

QString logFile(QFileInfo((**pItr).name().c_str()).fileName());
// Just get the num.series log values
Mantid::Kernel::TimeSeriesProperty<double> *tspd = dynamic_cast<Mantid::Kernel::TimeSeriesProperty<double> *>(*pItr);
Expand Down

0 comments on commit 04d75d0

Please sign in to comment.