SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
CMBTimeSeriesSet Class Reference

Collection of time series with labels and observed values. More...

#include </home/runner/work/SedSat3/SedSat3/cmbtimeseriesset.h>

Inheritance diagram for CMBTimeSeriesSet:
Inheritance graph
Collaboration diagram for CMBTimeSeriesSet:
Collaboration graph

Public Member Functions

 CMBTimeSeriesSet ()
 Default constructor - creates an empty time series set.
 
 CMBTimeSeriesSet (int n)
 Constructs a time series set with given capacity.
 
 CMBTimeSeriesSet (int n, int m)
 Constructs with specified number of series and points.
 
 CMBTimeSeriesSet (const CMBTimeSeriesSet &mp)
 Copy constructor from CMBTimeSeriesSet.
 
CMBTimeSeriesSetoperator= (const CMBTimeSeriesSet &mp)
 Assignment operator from CMBTimeSeriesSet.
 
CMBTimeSeriesSetoperator= (const TimeSeriesSet< double > &mp)
 Assignment operator from base TimeSeriesSet.
 
 CMBTimeSeriesSet (const TimeSeriesSet< double > &mp)
 Constructs from base TimeSeriesSet.
 
QJsonObject toJsonObject () const override
 Serializes time series set to JSON format.
 
bool ReadFromJsonObject (const QJsonObject &jsonobject) override
 Deserializes time series set from JSON format.
 
string ToString () const override
 Converts time series set to CSV-formatted string.
 
bool writetofile (QFile *) override
 Writes time series set to file.
 
QTableWidget * ToTable () override
 Creates a QTableWidget for displaying time series set data.
 
void AppendLastContribution (int colnumber, const string &name)
 Appends a final contribution series calculated from existing series.
 
void SetObservedValue (int i, const double &value)
 Sets observed value for comparison at specified index.
 
double ObservedValue (int i)
 Gets observed value at specified index.
 
double ObservedValue (string variable_name)
 Gets observed value for named series.
 
string Label (unsigned int i) const
 Gets label for time point (uses custom labels if set)
 
string Label (unsigned int i, unsigned int j) const
 Gets label for time point in specific series.
 
void SetLabel (unsigned int i, const string &label)
 Sets custom label for time point.
 
- Public Member Functions inherited from Interface
 Interface ()
 Default constructor.
 
 Interface (const Interface &intf)
 Copy constructor.
 
Interfaceoperator= (const Interface &intf)
 Assignment operator.
 
virtual bool Read (const QStringList &strlist)
 Parse object data from a string list.
 
string GetNotes () const
 Get the notes/annotations associated with this object.
 
void SetNotes (const string &note)
 Set the notes for this object, replacing any existing notes.
 
void AppendtoNotes (const string &note)
 Append a note to existing notes.
 
void ClearNotes ()
 Clear all notes associated with this object.
 
void SetLimit (_range lowhigh, const double &value)
 Set upper or lower limit for value highlighting.
 
void SetOption (options_key opt, bool val)
 Set a configuration option.
 
bool Option (options_key opt)
 Get the current value of a configuration option.
 
optionsGetOptions ()
 Get reference to the options structure.
 
QString XAxisLabel () const
 Get the X-axis label.
 
QString YAxisLabel () const
 Get the Y-axis label.
 
bool SetXAxisLabel (const QString &label)
 Set the X-axis label.
 
bool SetYAxisLabel (const QString &label)
 Set the Y-axis label.
 

Private Attributes

vector< double > observed_value
 Observed values for comparison with modeled series.
 
vector< stringlabels
 Custom labels for time points.
 

Additional Inherited Members

- Public Attributes inherited from Interface
double lowlimit
 Lower threshold for value highlighting (when enabled)
 
double highlimit
 Upper threshold for value highlighting (when enabled)
 
bool highlightoutsideoflimit = false
 Flag indicating whether to highlight values outside defined limits.
 

Detailed Description

Collection of time series with labels and observed values.

Extends TimeSeriesSet<double> with custom labels for time points, observed values for comparison, JSON serialization, and table generation. Used for organizing multiple time series data such as contribution time series from different sources or fitted vs observed distributions.

Definition at line 16 of file cmbtimeseriesset.h.

Constructor & Destructor Documentation

◆ CMBTimeSeriesSet() [1/5]

CMBTimeSeriesSet::CMBTimeSeriesSet ( )

Default constructor - creates an empty time series set.

Definition at line 6 of file cmbtimeseriesset.cpp.

◆ CMBTimeSeriesSet() [2/5]

CMBTimeSeriesSet::CMBTimeSeriesSet ( int  n)

Constructs a time series set with given capacity.

Parameters
nInitial number of series

Definition at line 17 of file cmbtimeseriesset.cpp.

References observed_value.

◆ CMBTimeSeriesSet() [3/5]

CMBTimeSeriesSet::CMBTimeSeriesSet ( int  n,
int  m 
)

Constructs with specified number of series and points.

Parameters
nNumber of series
mNumber of points per series

◆ CMBTimeSeriesSet() [4/5]

CMBTimeSeriesSet::CMBTimeSeriesSet ( const CMBTimeSeriesSet mp)

Copy constructor from CMBTimeSeriesSet.

Parameters
mpTime series set to copy from

Definition at line 11 of file cmbtimeseriesset.cpp.

References labels, and observed_value.

◆ CMBTimeSeriesSet() [5/5]

CMBTimeSeriesSet::CMBTimeSeriesSet ( const TimeSeriesSet< double > &  mp)

Constructs from base TimeSeriesSet.

Parameters
mpTime series set to copy from

Definition at line 36 of file cmbtimeseriesset.cpp.

References observed_value.

Member Function Documentation

◆ AppendLastContribution()

void CMBTimeSeriesSet::AppendLastContribution ( int  colnumber,
const string name 
)

Appends a final contribution series calculated from existing series.

Calculates the remaining contribution (1 - sum of first colnumber series) and inserts it at position colnumber in the set.

Parameters
colnumberNumber of existing contribution series
nameName for the final contribution series

Definition at line 137 of file cmbtimeseriesset.cpp.

References name.

◆ Label() [1/2]

string CMBTimeSeriesSet::Label ( unsigned int  i) const
inline

Gets label for time point (uses custom labels if set)

Parameters
iTime point index
Returns
Custom label if available, otherwise formatted time value

Definition at line 155 of file cmbtimeseriesset.h.

References labels.

Referenced by GeneralChart::PlotTimeSeriesSet_A(), GeneralChart::PlotTimeSeriesSet_M(), GeneralChart::PlotTimeSeriesSet_Stacked(), toJsonObject(), ToString(), and ToTable().

◆ Label() [2/2]

string CMBTimeSeriesSet::Label ( unsigned int  i,
unsigned int  j 
) const
inline

Gets label for time point in specific series.

Parameters
iTime point index
jSeries index
Returns
Custom label if available, otherwise formatted time value from series j

Definition at line 171 of file cmbtimeseriesset.h.

References labels.

◆ ObservedValue() [1/2]

double CMBTimeSeriesSet::ObservedValue ( int  i)
inline

Gets observed value at specified index.

Parameters
iSeries index
Returns
Observed value, or 0 if index out of range

Definition at line 127 of file cmbtimeseriesset.h.

References observed_value.

Referenced by GeneralChart::PlotDistribution().

◆ ObservedValue() [2/2]

double CMBTimeSeriesSet::ObservedValue ( string  variable_name)
inline

Gets observed value for named series.

Parameters
variable_nameName of the series
Returns
Observed value, or 0 if series not found

Definition at line 140 of file cmbtimeseriesset.h.

References observed_value.

◆ operator=() [1/2]

CMBTimeSeriesSet & CMBTimeSeriesSet::operator= ( const CMBTimeSeriesSet mp)

Assignment operator from CMBTimeSeriesSet.

Parameters
mpTime series set to assign from
Returns
Reference to this time series set

Definition at line 22 of file cmbtimeseriesset.cpp.

References labels, and observed_value.

◆ operator=() [2/2]

CMBTimeSeriesSet & CMBTimeSeriesSet::operator= ( const TimeSeriesSet< double > &  mp)

Assignment operator from base TimeSeriesSet.

Parameters
mpTime series set to assign from
Returns
Reference to this time series set

Definition at line 30 of file cmbtimeseriesset.cpp.

References observed_value.

◆ ReadFromJsonObject()

bool CMBTimeSeriesSet::ReadFromJsonObject ( const QJsonObject &  jsonobject)
overridevirtual

Deserializes time series set from JSON format.

Parameters
jsonobjectJSON object to read from
Returns
true if successful, false otherwise

Reimplemented from Interface.

Definition at line 71 of file cmbtimeseriesset.cpp.

References labels, and observed_value.

Referenced by Results::ReadFromJson().

◆ SetLabel()

void CMBTimeSeriesSet::SetLabel ( unsigned int  i,
const string label 
)
inline

Sets custom label for time point.

Parameters
iTime point index
labelLabel string to set

Definition at line 186 of file cmbtimeseriesset.h.

References labels.

Referenced by SourceSinkData::LM_Batch(), and SourceSinkData::VerifySource().

◆ SetObservedValue()

void CMBTimeSeriesSet::SetObservedValue ( int  i,
const double &  value 
)
inline

Sets observed value for comparison at specified index.

Parameters
iSeries index
valueObserved value

Definition at line 116 of file cmbtimeseriesset.h.

References observed_value.

Referenced by SourceSinkData::MCMC().

◆ toJsonObject()

QJsonObject CMBTimeSeriesSet::toJsonObject ( ) const
overridevirtual

Serializes time series set to JSON format.

Returns
JSON object containing all series, labels, and observed values

Reimplemented from Interface.

Definition at line 41 of file cmbtimeseriesset.cpp.

References Label(), labels, observed_value, and timeseries.

◆ ToString()

string CMBTimeSeriesSet::ToString ( ) const
overridevirtual

Converts time series set to CSV-formatted string.

Returns
String representation with all series

Reimplemented from Interface.

Definition at line 105 of file cmbtimeseriesset.cpp.

References Label().

Referenced by writetofile().

◆ ToTable()

QTableWidget * CMBTimeSeriesSet::ToTable ( )
overridevirtual

Creates a QTableWidget for displaying time series set data.

Generates either a table with separate time columns for each series, or a single time column with multiple value columns, depending on the single_column_x option.

Returns
Pointer to newly created QTableWidget (caller takes ownership)

Reimplemented from Interface.

Definition at line 167 of file cmbtimeseriesset.cpp.

References Interface::GetOptions(), Label(), Interface::Option(), single_column_x, options::X_suffix, and options::Y_suffix.

◆ writetofile()

bool CMBTimeSeriesSet::writetofile ( QFile *  file)
overridevirtual

Writes time series set to file.

Parameters
fileFile pointer to write to
Returns
true if successful

Reimplemented from Interface.

Definition at line 131 of file cmbtimeseriesset.cpp.

References ToString().

Member Data Documentation

◆ labels

vector<string> CMBTimeSeriesSet::labels
private

Custom labels for time points.

Definition at line 199 of file cmbtimeseriesset.h.

Referenced by CMBTimeSeriesSet(), Label(), Label(), operator=(), ReadFromJsonObject(), SetLabel(), and toJsonObject().

◆ observed_value

vector<double> CMBTimeSeriesSet::observed_value
private

Observed values for comparison with modeled series.

Definition at line 198 of file cmbtimeseriesset.h.

Referenced by CMBTimeSeriesSet(), CMBTimeSeriesSet(), CMBTimeSeriesSet(), ObservedValue(), ObservedValue(), operator=(), operator=(), ReadFromJsonObject(), SetObservedValue(), and toJsonObject().


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