34 for (
int i = 0; i < datasets_.size(); ++i)
35 if (key == datasets_.at(i)->name())
return datasets_.at(i);
36 throw invalid_argument(
"Dataset " 38 +
" does not exist!");
50 const QString &results_key)
const 53 if (
GetDataset(dataset_key)->AnalysisResultsKeys().contains(results_key))
54 return GetDataset(dataset_key)->GetAnalysisResult(results_key);
56 throw invalid_argument(
"Dataset " 57 + dataset_key.toStdString()
58 +
" does not have analysis result " 59 + results_key.toStdString());
62 throw invalid_argument(
"Dataset " 63 + dataset_key.toStdString()
64 +
" does not exist!");
71 throw invalid_argument(
"Wrong number of keys provided");
82 const QString &map_key)
const 85 if (
GetDataset(dataset_key)->MapKeys().contains(map_key))
86 return GetDataset(dataset_key)->GetMapData(map_key);
88 throw invalid_argument(
"Dataset " 89 + dataset_key.toStdString()
90 +
" does not have map " 91 + map_key.toStdString());
94 throw invalid_argument(
"Dataset " 95 + dataset_key.toStdString()
96 +
" does not exist!");
102 if (keys.size() != 2)
throw invalid_argument(
"Wrong number of keys provided");
103 return GetMap(keys[0], keys[1]);
108 QList<QSharedPointer<MapData> > maps_using_range;
109 for (
auto dataset: datasets_){
110 for (
auto key: dataset->MapKeys()){
111 QSharedPointer<MapData> map = dataset->GetMapData(key);
112 if (map->global_gradient_key() == range_key)
113 maps_using_range << map;
116 return maps_using_range;
120 const QString &results_key,
121 const QString &matrix_key)
const 124 if (
GetDataset(dataset_key)->AnalysisResultsKeys().contains(results_key)){
125 if (
GetDataset(dataset_key)->GetAnalysisResult(results_key)->KeyList().contains(matrix_key))
126 return GetDataset(dataset_key)->GetAnalysisResultMatrix(results_key, matrix_key);
128 throw invalid_argument(
"Analysis Result" 129 + results_key.toStdString()
130 +
" does not have matrix" 131 + matrix_key.toStdString());
135 throw invalid_argument(
"Dataset " 136 + dataset_key.toStdString()
137 +
" does not have result " 138 + results_key.toStdString());
142 throw invalid_argument(
"Dataset " 143 + dataset_key.toStdString()
144 +
" does not exist!");
150 if (keys.size() != 3)
throw invalid_argument(
"Wrong number of keys provided");
163 if (matrix_key ==
"Spectra" || matrix_key ==
"Spectral Abscissa" 164 || matrix_key ==
"x" || matrix_key ==
"y")
165 return GetDataset(dataset_key)->GetCoreMatrix(matrix_key);
167 throw invalid_argument(
"Dataset " 168 + dataset_key.toStdString()
169 +
" does not have core matrix " 170 + matrix_key.toStdString());
173 throw invalid_argument(
"Dataset " 174 + dataset_key.toStdString()
175 +
" does not exist!");
181 if (keys.size() != 2)
throw invalid_argument(
"Wrong number of keys provided");
192 const QString &matrix_key)
const 195 if (
GetDataset(dataset_key)->AuxiliaryMatrixKeys().contains(matrix_key))
196 return GetDataset(dataset_key)->GetAuxiliaryMatrix(matrix_key);
198 throw invalid_argument(
"Dataset " 199 + dataset_key.toStdString()
200 +
" does not have auxiliary matrix " 201 + matrix_key.toStdString());
204 throw invalid_argument(
"Dataset " + dataset_key.toStdString()
205 +
" does not exist!");
211 if (keys.size() != 2)
throw invalid_argument(
"Wrong number of keys provided");
218 if (
GetDataset(dataset_key)->CoreMatrixKeys().contains(matrix_key))
219 return GetDataset(dataset_key)->GetCoreMatrix(matrix_key);
220 else if (
GetDataset(dataset_key)->AuxiliaryMatrixKeys().contains(matrix_key))
221 return GetDataset(dataset_key)->GetAuxiliaryMatrix(matrix_key);
223 throw invalid_argument(
"Dataset " 224 + dataset_key.toStdString()
225 +
" does not have matrix " 226 + matrix_key.toStdString());
229 throw invalid_argument(
"Dataset " 230 + dataset_key.toStdString()
231 +
"does not exist!");
237 if (keys.size() == 2)
return GetMatrix(keys[0], keys[1]);
239 throw invalid_argument(
"too few keys provided");
246 uword spatial_rows =
GetDataset(keys[0])->x_ptr()->n_rows;
247 uword data_rows =
GetMatrix(keys).n_rows;
248 mappable = (data_rows == spatial_rows);
257 uword abscissa_rows =
GetDataset(keys[0])->abscissa_ptr()->n_rows;
258 uword data_rows =
GetMatrix(keys).n_rows;
259 return (data_rows == abscissa_rows);
268 QStringList dataset_names;
269 for (
auto dataset: datasets_)
270 dataset_names << dataset->name();
271 return dataset_names;
282 return GetDataset(dataset_key)->AnalysisResultsKeys();
284 throw invalid_argument(
"Dataset " 285 + dataset_key.toStdString()
286 +
"does not exist!");
297 return GetDataset(dataset_key)->AuxiliaryMatrixKeys();
299 throw invalid_argument(
"Dataset " 300 + dataset_key.toStdString()
301 +
"does not exist!");
307 return GetDataset(dataset_key)->CoreMatrixKeys();
309 throw invalid_argument(
"Dataset " 310 + dataset_key.toStdString()
311 +
"does not exist!");
323 QString name = dataset->name();
325 dataset->SetName(name +
"(" + QString::number(i++) +
")");
326 datasets_.append(dataset);
335 for (
int i = 0; i < datasets_.size(); ++i)
336 if (datasets_.at(i)->name() == name) datasets_.removeAt(i);
341 return empty_matrix_;
346 for (
int i = 0; i < datasets_.size(); ++i)
347 if (datasets_.at(i)->name() == key)
return true;
355 QSharedPointer<VespucciDataset> dataset =
GetDataset(keys.first());
357 if (keys.size() == 2)
358 return dataset->AuxiliaryMatrixKeys().contains(keys.last());
360 if (keys.size() == 3 && dataset->AnalysisResultsKeys().contains(keys[1]))
361 return dataset->GetAnalysisResult(keys[1])->HasMatrix(keys[2]);
const mat & EmptyMatrix() const
QStringList CoreMatrixNames(const QString &dataset_key)
QSharedPointer< MapData > GetMap(const QString &dataset_key, const QString &map_key) const
DataModel::GetMap Get the MapData object named map_key from dataset named dataset_key.
QStringList DatasetNames() const
DataModel::DatasetNames.
const mat & GetAuxiliaryMatrix(const QString &dataset_key, const QString &matrix_key) const
DataModel::GetAuxiliaryMatrix.
bool Plottable(const QStringList &keys) const
void AddDataset(QSharedPointer< VespucciDataset > dataset)
DataModel::AddDataset.
QSharedPointer< AnalysisResults > GetResults(const QString &dataset_key, const QString &results_key) const
DataModel::GetResults Get the AnalysisResults object named results_key from the dataset named dataset...
QSharedPointer< VespucciDataset > GetDataset(const QString &key) const
DataModel::GetDataset Get the VespucciDataset named key.
bool HasMatrix(const QStringList &keys) const
const mat & GetCoreMatrix(const QString &dataset_key, const QString &matrix_key) const
DataModel::GetCoreMatrix.
QStringList AuxiliaryMatrixNames(const QString &dataset_key) const
DataModel::AuxiliaryMatrixNames.
void RemoveDataset(const QString &name)
DataModel::RemoveDataset.
bool Mappable(const QStringList &keys) const
bool HasDataset(const QString &key) const
QStringList AnalysisResultsNames(const QString &dataset_key) const
DataModel::AnalysisResultsNames.
const mat & GetMatrix(const QString &dataset_key, const QString &matrix_key) const
QList< QSharedPointer< MapData > > GetMapsUsingColorRange(const QString &range_key)
const mat & GetResultsMatrix(const QString &dataset_key, const QString &results_key, const QString &matrix_key) const