Mantid
|
A widget used in the Muon GUI's to display period information in a readable format. More...
#include <MuonPeriodInfo.h>
Public Member Functions | |
void | addInfo (const Mantid::API::Workspace_sptr &ws) |
Takes the workspace and adds it's period info to the table if any. More... | |
void | addPeriodToTable (const std::string &name, const std::string &type, const std::string &frames, const std::string &totalFrames, const std::string &counts, const std::string &tag) |
Add a period to the table on the widget. More... | |
void | clear () |
Clear the widget of all information. More... | |
int | getDAQCount () const |
Get the number of DAQ periods currently stored in the table. More... | |
std::vector< std::vector< std::string > > | getInfo (const Mantid::API::MatrixWorkspace_sptr &ws) |
Gets all sample log data related to periods. More... | |
int | getNumberOfSequences () const |
Get the number of sequences as an int. More... | |
std::string | getNumberOfSequencesString () const |
Get the number of sequences as a string. More... | |
QTableWidget * | getTable () const |
std::string | getWidgetTitleRuns () const |
Get the title of the widget. More... | |
bool | isEmpty () const |
Checks if the table is empty. More... | |
MuonPeriodInfo (QWidget *parent=nullptr) | |
Constructor. More... | |
void | setNumberOfSequences (const int numberOfSequences) |
Set the number of sequences that was gathered. More... | |
void | setWidgetTitleRuns (const std::string &title) |
Set the title of the widget. More... | |
Static Public Member Functions | |
static std::vector< std::vector< std::string > > | makeCorrections (std::vector< std::vector< std::string > > &logs) |
Unifies the length of all vectors given. More... | |
static std::vector< std::string > | parseSampleLog (const std::string &log, const std::string &delim) |
Splits a string separated by a delimeter. More... | |
static std::string | readSampleLog (const Mantid::API::MatrixWorkspace_sptr &ws, const std::string &logName) |
Reads the data of the sample log from the workspace. More... | |
Private Member Functions | |
QTableWidgetItem * | createNewItem (const std::string &value) const |
Creates a new table widget item from a string to add to the table. More... | |
void | setUpTable () |
Set up properties of the widgets table. More... | |
Private Attributes | |
int | m_DAQCount |
int | m_numberOfSequences |
Ui::MuonPeriodInfo | m_uiForm |
A widget used in the Muon GUI's to display period information in a readable format.
Definition at line 20 of file MuonPeriodInfo.h.
|
explicit |
Constructor.
parent | :: A pointer to the parent of this widget |
Definition at line 92 of file MuonPeriodInfo.cpp.
References m_uiForm, setUpTable(), and setWidgetTitleRuns().
void MantidQt::MantidWidgets::MuonPeriodInfo::addInfo | ( | const Mantid::API::Workspace_sptr & | ws | ) |
Takes the workspace and adds it's period info to the table if any.
Adds all period information from the workspace provided to the widgets table in a readable format.
ws | :: The workspace to read the period information from |
Definition at line 121 of file MuonPeriodInfo.cpp.
References addPeriodToTable(), getInfo(), m_DAQCount, readSampleLog(), setNumberOfSequences(), and Mantid::Kernel::Logger::warning().
void MantidQt::MantidWidgets::MuonPeriodInfo::addPeriodToTable | ( | const std::string & | name, |
const std::string & | type, | ||
const std::string & | frames, | ||
const std::string & | totalFrames, | ||
const std::string & | counts, | ||
const std::string & | tag | ||
) |
Add a period to the table on the widget.
Adds a new row to the table with the information provided.
name | :: Name of the period |
type | :: Whether the period is DAQ (1) or DWELL (2) |
frames | :: Frames period requested |
totalFrames | :: Total frames period requested |
counts | :: Total counts per period, only applies to DAQ periods |
tag | :: String value to convert to binary tag for the period |
Definition at line 149 of file MuonPeriodInfo.cpp.
References createNewItem(), m_DAQCount, m_uiForm, and std::to_string().
Referenced by addInfo().
void MantidQt::MantidWidgets::MuonPeriodInfo::clear | ( | ) |
Clear the widget of all information.
Clears all period information by removing all rows from the table and resetting the label.
Definition at line 212 of file MuonPeriodInfo.cpp.
References m_DAQCount, m_uiForm, setNumberOfSequences(), and setWidgetTitleRuns().
|
private |
Creates a new table widget item from a string to add to the table.
value | :: String value to display on the table item |
Definition at line 245 of file MuonPeriodInfo.cpp.
References value.
Referenced by addPeriodToTable().
int MantidQt::MantidWidgets::MuonPeriodInfo::getDAQCount | ( | ) | const |
Get the number of DAQ periods currently stored in the table.
Definition at line 207 of file MuonPeriodInfo.cpp.
References m_DAQCount.
std::vector< std::vector< std::string > > MantidQt::MantidWidgets::MuonPeriodInfo::getInfo | ( | const Mantid::API::MatrixWorkspace_sptr & | ws | ) |
Gets all sample log data related to periods.
Reads all period information from the workspace provided.
ws | :: Workspace to read sample logs from |
Definition at line 106 of file MuonPeriodInfo.cpp.
References makeCorrections(), parseSampleLog(), and readSampleLog().
Referenced by addInfo().
int MantidQt::MantidWidgets::MuonPeriodInfo::getNumberOfSequences | ( | ) | const |
Get the number of sequences as an int.
Definition at line 203 of file MuonPeriodInfo.cpp.
References m_numberOfSequences.
std::string MantidQt::MantidWidgets::MuonPeriodInfo::getNumberOfSequencesString | ( | ) | const |
Get the number of sequences as a string.
Definition at line 205 of file MuonPeriodInfo.cpp.
References m_uiForm.
QTableWidget * MantidQt::MantidWidgets::MuonPeriodInfo::getTable | ( | ) | const |
Definition at line 225 of file MuonPeriodInfo.cpp.
References m_uiForm.
std::string MantidQt::MantidWidgets::MuonPeriodInfo::getWidgetTitleRuns | ( | ) | const |
Get the title of the widget.
Definition at line 186 of file MuonPeriodInfo.cpp.
bool MantidQt::MantidWidgets::MuonPeriodInfo::isEmpty | ( | ) | const |
Checks if the table is empty.
Definition at line 223 of file MuonPeriodInfo.cpp.
References m_uiForm.
|
static |
Unifies the length of all vectors given.
Makes sure each log vector is the same length taking the longest length as the standard.
Adds in a period info not found string to pad each vector to the correct length
logs | :: Vector of Vectors which hold the values for each period info |
Definition at line 70 of file MuonPeriodInfo.cpp.
Referenced by getInfo().
|
static |
Splits a string separated by a delimeter.
Parses a string separated by a delimeter.
log | :: Sample log string to be parsed |
delim | :: Delimeter to be used when splitting the sample log |
Definition at line 56 of file MuonPeriodInfo.cpp.
Referenced by getInfo().
|
static |
Reads the data of the sample log from the workspace.
Reads a sample log from a workspace.
ws | :: The workspace to read the sample log from |
logName | :: The name of the sample log to read |
Definition at line 41 of file MuonPeriodInfo.cpp.
References Mantid::Kernel::Logger::warning().
void MantidQt::MantidWidgets::MuonPeriodInfo::setNumberOfSequences | ( | const int | numberOfSequences | ) |
Set the number of sequences that was gathered.
Sets the numberOfSequences and updates the label of the widget.
A sequence is a complete recording of all periods once, and the number of sequences is how many times this happens during a run
numberOfSequences | :: The new value for the number of sequences |
Definition at line 194 of file MuonPeriodInfo.cpp.
References m_numberOfSequences, m_uiForm, and std::to_string().
|
private |
Set up properties of the widgets table.
Definition at line 230 of file MuonPeriodInfo.cpp.
References m_uiForm.
Referenced by MuonPeriodInfo().
void MantidQt::MantidWidgets::MuonPeriodInfo::setWidgetTitleRuns | ( | const std::string & | title | ) |
Set the title of the widget.
Sets the title of the widget with the string provided (typically instrument + runs)
title | :: The new string value to add to the default title |
Definition at line 179 of file MuonPeriodInfo.cpp.
Referenced by clear(), and MuonPeriodInfo().
|
private |
Definition at line 61 of file MuonPeriodInfo.h.
Referenced by addInfo(), addPeriodToTable(), clear(), and getDAQCount().
|
private |
Definition at line 60 of file MuonPeriodInfo.h.
Referenced by getNumberOfSequences(), and setNumberOfSequences().
|
private |
Definition at line 62 of file MuonPeriodInfo.h.
Referenced by addPeriodToTable(), clear(), getNumberOfSequencesString(), getTable(), isEmpty(), MuonPeriodInfo(), setNumberOfSequences(), and setUpTable().