varenius / ascot

ASCOT - Analysis, Scheduling and Combination Toolbox, for VLBI
GNU General Public License v3.0
4 stars 0 forks source link

Cannot plot residuals #33

Open varenius opened 3 years ago

varenius commented 3 years ago

Cannot plot residuals with any version since putting on github. Using -r flag on ivg_indep I get e.g.

...
<LEVEL3> *** Creating Solution-Infos...
<LEVEL3> *** Solution-Infos created.
std::exception: void Plot::_plot_coastline(QFormat format) in plot.cpp: Failed to open file:  in 20NOV12VB
 =================================================================== 

Maybe due to Qt4->5 upgrade?

varenius commented 3 years ago

Aha! The problem is the file plot.cpp:

355 // ...........................................................................
 356 void Plot::_plot_coastline(protype type, QFormat format)
 357 // ...........................................................................
 358 {
 359     // create new layer where the coastline is plotted on
 360     _qcp->addLayer("pro_coastline",_qcp->layer("trash_coastline"), QCustomPlot::LayerInsertMode::limAbove );
 361 
 362     // hard implemented path to the coastlinedata (segments containing latitude and longitude)  
 363     stringstream path_ss;
 364     if(const char* env_ascot_dir = std::getenv("ASCOT_DIR"))
 365         path_ss << env_ascot_dir << "/src/qt_plot/world.gmt";
 366 
 367     string path = path_ss.str();
 368 
 369     ifstream inStream;
 370     string line;
 371 
 372     double x,y,t;
 373     QVector<double> x_vec,y_vec,t_vec;
 374 
 375     // reads the file and each segment is ploted as individual curve
 376     inStream.open(path.c_str(), ios::in);
 377     if( !inStream.is_open() )
 378             throw runtime_error( "void Plot::_plot_coastline(QFormat format) in plot.cpp: Failed to open file: "+path);

This logic requires "ASCOT_DIR" to be set, and to still have src with qt_plot/world.gmt present. This is ugly, since running the compiled software should not rely on this variable, nor on files in the SRC dir. Should be changed at some point!

varenius commented 3 years ago

But, for now, setting e.g. "export ASCOT_DIR=/opt/ascot/" seems to work.