Skip to content
Snippets Groups Projects
Commit ccd396c4 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

fixes to data update

parent 699bec83
No related branches found
No related tags found
No related merge requests found
......@@ -7,4 +7,4 @@ Bar chart showing how the intensity decreases along the optical path
export TANGO_HOST=srv-tango-padres-01:20000
./bin/i0mapmon_topo pfe_f01/diagnostics/fel_iom_pfe_f01.01
./bin/i0mapmon_topo pfe_f01/diagnostics/fel_iom_pfe_f01.01 padres/felmapmon/values
......@@ -42,7 +42,7 @@ I0mapmon_topo::I0mapmon_topo(CumbiaPool *cumbia_pool, QWidget *parent) :
#ifdef QUMBIA_TANGO_CONTROLS_VERSION
mode = CuTReader::Manual;
#endif
m_multiread_plu_i->init(cu_pool, m_ctrl_factory_pool, mode); // 0 sync mode
m_multiread_plu_i->init(cu_pool, m_ctrl_factory_pool, QuMultiReaderPluginInterface::SequentialReads);
connect(m_multiread_plu_i->get_qobject(), SIGNAL(onSeqReadComplete(const QList<CuData> &)),
ui->chart, SLOT(update(const QList<CuData> &)));
......@@ -121,10 +121,10 @@ void I0mapmon_topo::m_onWlenSelectionChanged(QString wlen, bool on) {
// update the model for the lambda selection combo box if the lambdas change
//
void I0mapmon_topo::m_onLambdaChanged(const QVector<double> &la) {
qDebug() << __PRETTY_FUNCTION__ << la;
QVector<double> current_l;
for(int i = 0; m_cb_model != nullptr && i < m_cb_model->rowCount(); i++)
current_l << m_cb_model->item(i)->text().toDouble();
qDebug() << __PRETTY_FUNCTION__ << la << "current_l" << current_l;
if(current_l != la) {
QStringList wlens;
QVector<int> wlens_idx;
......
......@@ -7,6 +7,7 @@
#include <qwt_scale_engine.h>
#include <qwt_text.h>
#include <qwt_plot_textlabel.h>
#include <qustring.h>
double LogTransform::bounded(double v) const {
return qBound(0.01, v, LogMax);
......@@ -83,26 +84,33 @@ void I0MMTopoBarChart::update(const QList<CuData> &dl) {
QVector< QVector<double> > series;
for(int i = 0; i < dl.size(); i++) {
const CuData& d = dl[i];
if(d["err"].toBool()) {
if(d["err"].toBool() ) {
error += d["msg"].toString();
}
else if(d["quality"].toInt() == 1)
error += (QuString(d, "src").section('/', -1) + ":\ninvalid data quality\n").toStdString();
else {
printf("\e[1;33m%s --> %s\e[0m\n", vtoc2(d, "src"), datos(d));
const std::vector<double>& v = d["value"].toDoubleVector();
// select lambdas
qDebug() << __PRETTY_FUNCTION__ << "v size " << v.size() << m_cur_lambdas;
for(size_t i = 0; i < v.size(); i++) {
if(m_cur_lambdas.contains(i)) {
qDebug() << __PRETTY_FUNCTION__ << "- " << i << v[i];
valuemap[i] = v[i];
}
}
series += valuemap.values().toVector();
}
}
qDebug() << __PRETTY_FUNCTION__ << "setSamples on barchart : " << series;
m_barchart->setSamples(series);
const QVector<int> &lambdas = valuemap.keys().toVector();
qDebug() << __PRETTY_FUNCTION__ << "size of data: " << dl.size() << "lambdas " << lambdas << " cur lambdas " << m_cur_lambdas;
if(m_cur_lambdas != lambdas)
if(lambdas.size() && m_cur_lambdas != lambdas) // if lambdas is empty it means error or update called from
m_update_bars(lambdas);
}
else
......@@ -150,6 +158,7 @@ void I0MMTopoBarChart::enableLogScale(bool en) {
}
void I0MMTopoBarChart::setLambdas(const QVector<int> lidxs) {
qDebug() << __PRETTY_FUNCTION__ << lidxs;
m_update_bars(lidxs);
if(m_cur_data.size() > 0)
update(m_cur_data);
......@@ -161,6 +170,7 @@ void I0MMTopoBarChart::m_onBarsModeChanged(int mode) {
void I0MMTopoBarChart::m_update_bars(const QVector<int> &lambdas)
{
qDebug() << __PRETTY_FUNCTION__ << lambdas;
int idx = 0;
m_barchart->resetSymbolMap();
QList<QwtText> titles;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment