Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
MantidQt::MantidWidgets::MuonPeriodInfo Class Reference

A widget used in the Muon GUI's to display period information in a readable format. More...

#include <MuonPeriodInfo.h>

Inheritance diagram for MantidQt::MantidWidgets::MuonPeriodInfo:

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
 

Detailed Description

A widget used in the Muon GUI's to display period information in a readable format.

Definition at line 20 of file MuonPeriodInfo.h.

Constructor & Destructor Documentation

◆ MuonPeriodInfo()

MantidQt::MantidWidgets::MuonPeriodInfo::MuonPeriodInfo ( QWidget *  parent = nullptr)
explicit

Constructor.

Parameters
parent:: A pointer to the parent of this widget

Definition at line 92 of file MuonPeriodInfo.cpp.

References m_uiForm, setUpTable(), and setWidgetTitleRuns().

Member Function Documentation

◆ addInfo()

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.

Parameters
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().

◆ addPeriodToTable()

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.

Parameters
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().

◆ clear()

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().

◆ createNewItem()

QTableWidgetItem * MantidQt::MantidWidgets::MuonPeriodInfo::createNewItem ( const std::string &  value) const
private

Creates a new table widget item from a string to add to the table.

Parameters
value:: String value to display on the table item
Returns
:: Table widget item which stores the value provided

Definition at line 245 of file MuonPeriodInfo.cpp.

References value.

Referenced by addPeriodToTable().

◆ getDAQCount()

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.

◆ getInfo()

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.

Parameters
ws:: Workspace to read sample logs from
Returns
:: A vector containing vectors for each period info read

Definition at line 106 of file MuonPeriodInfo.cpp.

References makeCorrections(), parseSampleLog(), and readSampleLog().

Referenced by addInfo().

◆ getNumberOfSequences()

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.

◆ getNumberOfSequencesString()

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.

◆ getTable()

QTableWidget * MantidQt::MantidWidgets::MuonPeriodInfo::getTable ( ) const

Definition at line 225 of file MuonPeriodInfo.cpp.

References m_uiForm.

◆ getWidgetTitleRuns()

std::string MantidQt::MantidWidgets::MuonPeriodInfo::getWidgetTitleRuns ( ) const

Get the title of the widget.

Definition at line 186 of file MuonPeriodInfo.cpp.

◆ isEmpty()

bool MantidQt::MantidWidgets::MuonPeriodInfo::isEmpty ( ) const

Checks if the table is empty.

Returns
:: True if the table is empty, False otherwise

Definition at line 223 of file MuonPeriodInfo.cpp.

References m_uiForm.

◆ makeCorrections()

std::vector< std::vector< std::string > > MantidQt::MantidWidgets::MuonPeriodInfo::makeCorrections ( std::vector< std::vector< std::string > > &  logs)
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

Parameters
logs:: Vector of Vectors which hold the values for each period info
Returns
:: A corrected vector which contains vectors of unified length

Definition at line 70 of file MuonPeriodInfo.cpp.

Referenced by getInfo().

◆ parseSampleLog()

std::vector< std::string > MantidQt::MantidWidgets::MuonPeriodInfo::parseSampleLog ( const std::string &  log,
const std::string &  delim 
)
static

Splits a string separated by a delimeter.

Parses a string separated by a delimeter.

Parameters
log:: Sample log string to be parsed
delim:: Delimeter to be used when splitting the sample log
Returns
:: Vector of string values from the sample log string

Definition at line 56 of file MuonPeriodInfo.cpp.

Referenced by getInfo().

◆ readSampleLog()

std::string MantidQt::MantidWidgets::MuonPeriodInfo::readSampleLog ( const Mantid::API::MatrixWorkspace_sptr ws,
const std::string &  logName 
)
static

Reads the data of the sample log from the workspace.

Reads a sample log from a workspace.

Parameters
ws:: The workspace to read the sample log from
logName:: The name of the sample log to read
Returns
:: String value of the sample log, or empty string if log cannot be found

Definition at line 41 of file MuonPeriodInfo.cpp.

References Mantid::Kernel::Logger::warning().

Referenced by addInfo(), and getInfo().

◆ setNumberOfSequences()

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

Parameters
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().

Referenced by addInfo(), and clear().

◆ setUpTable()

void MantidQt::MantidWidgets::MuonPeriodInfo::setUpTable ( )
private

Set up properties of the widgets table.

Definition at line 230 of file MuonPeriodInfo.cpp.

References m_uiForm.

Referenced by MuonPeriodInfo().

◆ setWidgetTitleRuns()

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)

Parameters
title:: The new string value to add to the default title

Definition at line 179 of file MuonPeriodInfo.cpp.

Referenced by clear(), and MuonPeriodInfo().

Member Data Documentation

◆ m_DAQCount

int MantidQt::MantidWidgets::MuonPeriodInfo::m_DAQCount
private

Definition at line 61 of file MuonPeriodInfo.h.

Referenced by addInfo(), addPeriodToTable(), clear(), and getDAQCount().

◆ m_numberOfSequences

int MantidQt::MantidWidgets::MuonPeriodInfo::m_numberOfSequences
private

Definition at line 60 of file MuonPeriodInfo.h.

Referenced by getNumberOfSequences(), and setNumberOfSequences().

◆ m_uiForm

Ui::MuonPeriodInfo MantidQt::MantidWidgets::MuonPeriodInfo::m_uiForm
private

The documentation for this class was generated from the following files: