29 settings_(settings_file, QSettings::IniFormat)
31 settings_.setIniCodec(
"UTF-8");
32 dataset_loading_count_ = 0;
33 directory_ = QDir::homePath();
85 cout <<
"Workspace destructor\n";
103 dataset_tree_model_ = tree_model;
117 ++dataset_loading_count_;
155 QStringList keys = item->
keys();
163 QString dataset_key = item->
keys()[0];
177 return dataset_loading_count_;
214 double abscissa_max = 0;
216 abscissa_max = data_model_->
GetDataset(key)->abscissa_ptr()->max();
232 return QSharedPointer<VespucciDataset>(data_model_->
GetDataset(key));
243 return data_model_->
GetResults(dataset_key, results_key);
248 return data_model_->
GetMap(dataset_key, map_key);
253 return data_model_->
GetMap(map_keys);
278 double abscissa_min = 0;
280 abscissa_min = data_model_->
GetDataset(key)->abscissa_ptr()->min();
306 if (global_gradients_.contains(name)) global_gradients_.remove(name);
311 return global_gradients_.keys();
316 return global_gradients_;
321 if (key ==
"ColorBrewer Cluster"){
333 if (gradients_.contains(key))
334 return gradients_.value(key);
341 return global_gradients_.value(key);
346 QStringList keys = gradients_.keys();
348 keys.insert(0,
"ColorBrewer Cluster");
359 return &global_data_range_;
368 return &global_color_gradient_;
383 global_gradients_[name] = gradient;
388 if (global_gradients_.contains(name)){
389 QList<QSharedPointer<MapData> > maps =
391 if (maps.isEmpty())
return;
392 vec mins(maps.size());
393 vec maxes(maps.size());
394 for (uword i = 0; i < mins.n_elem; ++i){
395 mins(i) = maps[i]->min();
396 maxes(i) = maps[i]->max();
398 double new_min = mins.min();
399 double new_max = maxes.max();
404 for (
auto map: maps){
405 map->SetGlobalGradient(name);
423 return ++dataset_loading_count_;
438 #if defined Q_OS_WIN32 439 r_path =
"C:/Program Files/R/R-3.1.3";
440 #elif defined Q_OS_MAC 441 r_path =
"/Library/Frameworks/R.framework/Resources";
443 r_path =
"/usr/lib/R";
445 settings_.beginGroup(
"environment");
446 settings_.setValue(
"R_HOME", r_path);
447 settings_.endGroup();
449 settings_.beginGroup(
"specdata");
450 settings_.setValue(
"absLabel",
"Raman Shift");
451 settings_.setValue(
"absUnits",
"cm⁻¹");
452 settings_.setValue(
"ordLabel",
"Intensity");
453 settings_.setValue(
"ordUnits",
"a.u.");
454 settings_.endGroup();
459 QString r_path, r_home;
460 #if defined Q_OS_WIN32 461 r_path =
"C:/Program Files/R/R-3.1.3";
462 #elif defined Q_OS_MAC 463 r_path =
"/Library/Frameworks/R.framework/Resources";
465 r_path =
"/usr/lib/R";
468 if (!settings_.childGroups().contains(
"environment")){
469 settings_.beginGroup(
"environment");
470 settings_.setValue(
"R_HOME", r_path);
471 settings_.endGroup();
474 settings_.beginGroup(
"environment");
475 if (settings_.allKeys().contains(
"R_HOME")){
476 r_home = settings_.value(
"R_HOME").toString();
480 settings_.setValue(
"R_HOME", r_path);
482 settings_.endGroup();
485 if (!settings_.childGroups().contains(
"specdata")){
486 settings_.beginGroup(
"specdata");
487 settings_.setValue(
"absLabel",
"Raman Shift");
488 settings_.setValue(
"absUnits",
"cm⁻¹");
489 settings_.setValue(
"ordLabel",
"Intensity");
490 settings_.setValue(
"ordUnits",
"a.u.");
491 settings_.endGroup();
494 settings_.beginGroup(
"specdata");
495 if (!settings_.allKeys().contains(
"absLabel"))
496 settings_.setValue(
"absLabel",
"Raman Shift");
497 if (!settings_.allKeys().contains(
"absUnits"))
498 settings_.setValue(
"absUnits",
"cm⁻¹");
499 if (!settings_.allKeys().contains(
"ordLabel"))
500 settings_.setValue(
"ordLabel",
"Intensity");
501 if (!settings_.allKeys().contains(
"ordUnits"))
502 settings_.setValue(
"ordUnits",
"a.u.");
503 settings_.endGroup();
524 if (keys.size() < 2)
return data_model_->
EmptyMatrix();
554 void VespucciWorkspace::UpdateTreeModel()
void RemoveDatasetAt(const QModelIndex &parent)
VespucciWorkspace::RemoveDatasetAt.
bool Plottable(const QStringList &keys) const
const mat & EmptyMatrix() const
void set_directory(QString directory)
VespucciWorkspace::set_directory.
QSharedPointer< VespucciDataset > GetDataset(const QString &key) const
VespucciWorkspace::GetDataset.
QStringList dataset_names() const
void ClearDatasets()
VespucciWorkspace::ClearDatasets Clears the internal container for datasets in the list model...
unsigned int UpdateCount()
VespucciWorkspace::UpdateCount.
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.
Colors suitable for thermal imaging, ranging from dark blue over purple to orange, yellow and white.
void AddDataset(QSharedPointer< VespucciDataset > dataset)
VespucciWorkspace::AddDataset.
void DisplayExceptionWarning(std::exception e)
MainWindow::DisplayExceptionWarning.
QCPColorGradient gradient
const mat & GetAuxiliaryMatrix(const QString &dataset_key, const QString &matrix_key) const
DataModel::GetAuxiliaryMatrix.
Vespucci::GlobalGradient GetGlobalGradient(QString key)
bool Mappable(const QStringList &keys) const
const mat & GetCoreMatrix(const QString &dataset_key, const QString &matrix_key) const
Hue variation similar to a spectrum, often used in numerical visualization (creates banding illusion ...
void UpdateData(const DataModel *data_model)
Continuous lightness from black over icey colors to white (suited for non-biased data representation)...
const mat & GetMatrix(const QStringList &keys) const
VespucciWorkspace::GetMatrix.
An approximation of the visible light spectrum (creates banding illusion but allows more precise magn...
bool Plottable(const QStringList &keys) const
void AddDataset(QSharedPointer< VespucciDataset > dataset)
DataModel::AddDataset.
MainWindow * main_window()
VespucciWorkspace::main_window.
QSharedPointer< VespucciDataset > DatasetAt(const QModelIndex &parent)
Half hue spectrum from black over purple to blue and finally green (creates banding illusion but allo...
void RemoveDataset(QString name)
VespucciWorkspace::RemoveDataset.
Continuous lightness from black over firey colors to white (suited for non-biased data representation...
QStringList GlobalGradientKeys()
QString * directory_ptr()
VespucciWorkspace::directory_ptr.
Continuous lightness from black to white (suited for non-biased data representation) ...
QCPRange * global_data_range()
VespucciWorkspace::global_data_range.
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.
QMap< QString, Vespucci::GlobalGradient > global_gradients()
bool HasMatrix(const QStringList &keys) const
TreeItem * getItem(const QModelIndex &index) const
int dataset_loading_count() const
VespucciWorkspace::dataset_loading_count.
QStringList GradientNames(bool include_cluster=false)
DatasetTreeModel * dataset_tree_model()
void SetPointers(MainWindow *main_window, DatasetTreeModel *tree_model)
VespucciWorkspace::SetPointers.
void AddGlobalGradient(QString name, QString gradient_key, double lower, double upper)
VespucciWorkspace::AddGlobalGradient.
const mat & GetCoreMatrix(const QString &dataset_key, const QString &matrix_key) const
DataModel::GetCoreMatrix.
const mat & GetResultsMatrix(const QString &dataset_key, const QString &results_key, const QString &matrix_key) const
double GetWavelengthMax(const QString &key) const
VespucciWorkspace::GetWavelengthMax.
void RemoveColorRange(QString name)
VespucciWorkspace::RemoveColorRange.
Colors suitable to emphasize polarity around the center, with blue for negative, black in the middle ...
QSharedPointer< AnalysisResults > GetAnalysisResults(const QString &dataset_key, const QString &results_key) const
VespucciWorkspace::GetAnalysisResults.
Continuous lightness from black over weak blueish colors to white (suited for non-biased data represe...
QCPColorGradient * global_gradient()
VespucciWorkspace::global_gradient.
double GetWavelengthMin(const QString &key) const
VespucciWorkspace::GetWavelengthMin.
void RemoveDataset(const QString &name)
DataModel::RemoveDataset.
bool HasMatrix(const QStringList &keys) const
VespucciWorkspace(QString settings_file)
VespucciWorkspace::VespucciWorkspace Constructor.
QCPColorGradient GetGradient(QString key, int count=0)
bool Mappable(const QStringList &keys) const
QSharedPointer< MapData > GetMap(const QString &dataset_key, const QString &map_key) const
void UpdateModel()
VespucciWorkspace::UpdateModel Call when a VespucciDataset adds or removes a new object.
Defines a color gradient for use with e.g. QCPColorMap.
QString directory() const
VespucciWorkspace::directory.
Represents the range an axis is encompassing.
The MainWindow class The main window of the program, this is where the user performs most operations...
~VespucciWorkspace()
VespucciWorkspace::~VespucciWorkspace Destructor.
Full hue cycle, with highest and lowest color red (suitable for periodic data, such as angles and pha...
const mat & GetMatrix(const QString &dataset_key, const QString &matrix_key) const
void RefreshTreeModel(const DataModel *data_model)
MainWindow::RefreshTreeModel.
void RecalculateGlobalGradient(QString name)
QList< QSharedPointer< MapData > > GetMapsUsingColorRange(const QString &range_key)
DatasetTreeModel * dataset_tree_model() const
dataset_list_model
const mat & GetAuxiliaryMatrix(const QString &dataset_key, const QString &matrix_key) const
const mat & GetResultsMatrix(const QString &dataset_key, const QString &results_key, const QString &matrix_key) const