Skip to content

Commit

Permalink
Refs #7179. Add code for displaying non-timeseries log values.
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Jan 30, 2014
1 parent 9edded2 commit b3f41a6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
Expand Up @@ -110,6 +110,9 @@ private slots:
QMap<QString, Qt::CheckState> m_savedLogsState;

QList<QString> m_unselectedFittings;

/// Names of the non-timeseries logs we should display
QStringList m_nonTimeseriesLogs;
};

}
Expand Down
Expand Up @@ -67,6 +67,11 @@ MuonAnalysisResultTableTab::MuonAnalysisResultTableTab(Ui::MuonAnalysis& uiForm)
this, SLOT( populateTables() ));
connect(m_uiForm.fitLabelCombo, SIGNAL( activated(int) ),
this, SLOT( populateTables() ));

// Populate list of non-timeseries properties
m_nonTimeseriesLogs.push_back("run_number");
m_nonTimeseriesLogs.push_back("sample_temp");
m_nonTimeseriesLogs.push_back("sample_magn_field");
}


Expand Down Expand Up @@ -390,9 +395,6 @@ void MuonAnalysisResultTableTab::populateLogsAndValues(const QStringList& fitted
{
// A set of all the logs we've met in the workspaces
QSet<QString> allLogs;

// Add run number explicitly as it is the only non-timeseries log value we are using
allLogs.insert(RUN_NO_TITLE.c_str());

for (int i=0; i<fittedWsList.size(); i++)
{
Expand All @@ -406,13 +408,6 @@ void MuonAnalysisResultTableTab::populateLogsAndValues(const QStringList& fitted
throw std::runtime_error("Wrong type of Workspace");
}

// Try to get a run number for the workspace
if (ws->run().hasProperty(RUN_NO_LOG))
{
// Set run number as a string, as we don't want it to be formatted like double.
wsLogValues[RUN_NO_TITLE.c_str()] = QString(ws->run().getLogData(RUN_NO_LOG)->value().c_str());
}

Mantid::Kernel::DateAndTime start = ws->run().startTime();
Mantid::Kernel::DateAndTime end = ws->run().endTime();

Expand Down Expand Up @@ -452,13 +447,36 @@ void MuonAnalysisResultTableTab::populateLogsAndValues(const QStringList& fitted
wsLogValues[logFile] = value / count;
}
}
else // Should be a non-timeseries one
{
QString logName = QString::fromStdString( (**pItr).name() );

// Check if we should display it
if ( m_nonTimeseriesLogs.contains(logName) )
{
QVariant value;

// Add to the list of known logs
allLogs.insert(logFile);
if ( auto stringProp = dynamic_cast<PropertyWithValue<std::string>*>(*pItr) )
{
value = QString::fromStdString( (*stringProp)() );
}
else if ( auto doubleProp = dynamic_cast<PropertyWithValue<double>*>(*pItr) )
{
value = (*doubleProp)();
}
else
{
throw std::runtime_error("Unsupported non-timeseries log type");
}

wsLogValues[logName] = value;
}
}
}

// Append log names found in the workspace to the list of all known log names
allLogs += wsLogValues.keys().toSet();

// Add all data collected from one workspace to another map. Will be used when creating table.
m_logValues[fittedWsList[i]] = wsLogValues;

Expand Down

0 comments on commit b3f41a6

Please sign in to comment.