Commit f981f077 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files
parent 2c2a0b6e
...@@ -20,7 +20,7 @@ EXAMPLE start: ...@@ -20,7 +20,7 @@ EXAMPLE start:
export TANGO_HOST=srv-tango-padres-01:20000 export TANGO_HOST=srv-tango-padres-01:20000
./bin/i0mapmon pfe_f02/diagnostics/fel_iom_pfe_f02.01 srv-tango-srf-01:20000/f/misc/beam_status_f ./bin/i0mapmon-gui pfe_f02/diagnostics/fel_iom_pfe_f02.01 padres/felmapmon/values
......
...@@ -5,7 +5,7 @@ include($${CUMBIA_ROOT}/include/quapps/quapps.pri) ...@@ -5,7 +5,7 @@ include($${CUMBIA_ROOT}/include/quapps/quapps.pri)
CONFIG += debug CONFIG += debug
DEFINES -= QT_NO_DEBUG_OUTPUT # DEFINES -= QT_NO_DEBUG_OUTPUT
# RESOURCES += # RESOURCES +=
......
...@@ -47,8 +47,14 @@ I0mapmon::I0mapmon(CumbiaPool *cumbia_pool, QWidget *parent) : ...@@ -47,8 +47,14 @@ I0mapmon::I0mapmon(CumbiaPool *cumbia_pool, QWidget *parent) :
QuWatcher *w = new QuWatcher(this, cumbia_pool, m_ctrl_factory_pool); QuWatcher *w = new QuWatcher(this, cumbia_pool, m_ctrl_factory_pool);
w->setSingleShot(true); w->setSingleShot(true);
w->setAutoDestroy(true); w->setAutoDestroy(true);
w->attach(this, SLOT(onNamesReady(QStringList))); w->attach(this, SLOT(onLabelReady(QStringList)));
w->setSource("$1/name"); w->setSource("$1/label");
QuWatcher *nw = new QuWatcher(this, cumbia_pool, m_ctrl_factory_pool);
nw->setSingleShot(true);
nw->setAutoDestroy(true);
nw->attach(&m_ynames);
nw->setSource("$1/name");
connect(ui->pbApplyWlenWei, SIGNAL(clicked()), this, SLOT(applyWavelenX())); connect(ui->pbApplyWlenWei, SIGNAL(clicked()), this, SLOT(applyWavelenX()));
connect(ui->pbApplyWlens, SIGNAL(clicked()), this, SLOT(applyWavelenX())); connect(ui->pbApplyWlens, SIGNAL(clicked()), this, SLOT(applyWavelenX()));
...@@ -83,6 +89,7 @@ I0mapmon::I0mapmon(CumbiaPool *cumbia_pool, QWidget *parent) : ...@@ -83,6 +89,7 @@ I0mapmon::I0mapmon(CumbiaPool *cumbia_pool, QWidget *parent) :
connect(ui->cbYAuto, SIGNAL(toggled(bool)), ui->leyMax, SLOT(setDisabled(bool))); connect(ui->cbYAuto, SIGNAL(toggled(bool)), ui->leyMax, SLOT(setDisabled(bool)));
connect(ui->pbApplyBounds, SIGNAL(clicked()), this, SLOT(setYMinMax())); connect(ui->pbApplyBounds, SIGNAL(clicked()), this, SLOT(setYMinMax()));
connect(ui->cbYAuto, SIGNAL(toggled(bool)), ui->plot, SLOT(setYBoundsAuto(bool))); connect(ui->cbYAuto, SIGNAL(toggled(bool)), ui->plot, SLOT(setYBoundsAuto(bool)));
connect(ui->cbLogScale, SIGNAL(toggled(bool)), ui->plot, SLOT(setYLogScale(bool)));
ui->cbYAuto->setChecked(true); // disable y bounds line edits ui->cbYAuto->setChecked(true); // disable y bounds line edits
} }
} }
...@@ -92,7 +99,7 @@ I0mapmon::~I0mapmon() ...@@ -92,7 +99,7 @@ I0mapmon::~I0mapmon()
delete ui; delete ui;
} }
void I0mapmon::onNamesReady(const QStringList &n) { void I0mapmon::onLabelReady(const QStringList &n) {
qDebug() << __PRETTY_FUNCTION__ << n; qDebug() << __PRETTY_FUNCTION__ << n;
ui->qucby->clear(); ui->qucby->clear();
ui->qucby->insertItems(0, n); ui->qucby->insertItems(0, n);
...@@ -194,5 +201,7 @@ void I0mapmon::m_plot_reconf() { ...@@ -194,5 +201,7 @@ void I0mapmon::m_plot_reconf() {
const QString& srcx = ui->qucbx->itemData(ui->qucbx->currentIndex(), Qt::UserRole + 1).toString(); const QString& srcx = ui->qucbx->itemData(ui->qucbx->currentIndex(), Qt::UserRole + 1).toString();
const QString devy = ui->quionSamples->source().remove("/" + ui->quionSamples->source().section('/',- 1)); const QString devy = ui->quionSamples->source().remove("/" + ui->quionSamples->source().section('/',- 1));
printf("\e[1;32mI0mapmon.m_plot_reconf x \"%s\" y \"%s\"\e[0m\n", qstoc(srcx), qstoc(devy)); printf("\e[1;32mI0mapmon.m_plot_reconf x \"%s\" y \"%s\"\e[0m\n", qstoc(srcx), qstoc(devy));
ui->plot->setSources(srcx, devy + '/' + ui->qucby->currentText(), m_selected_wlens(), ui->quionSamples->findChild<QuLabel *>()->text().toInt()); qDebug() << __PRETTY_FUNCTION__ << m_ynames;
if(m_ynames.size() > ui->qucby->currentIndex())
ui->plot->setSources(srcx, devy + '/' + m_ynames[ui->qucby->currentIndex()], m_selected_wlens(), ui->quionSamples->findChild<QuLabel *>()->text().toInt());
} }
...@@ -25,7 +25,7 @@ public: ...@@ -25,7 +25,7 @@ public:
~I0mapmon(); ~I0mapmon();
private slots: private slots:
void onNamesReady(const QStringList& n); void onLabelReady(const QStringList& n);
void applyWavelenX(); void applyWavelenX();
void onYChanged(const QString& y); void onYChanged(const QString& y);
void onWlensChanged(const CuData &s); void onWlensChanged(const CuData &s);
...@@ -51,6 +51,7 @@ private: ...@@ -51,6 +51,7 @@ private:
void m_setup_x_list(); void m_setup_x_list();
QMap<int, double> m_selected_wlens() const; QMap<int, double> m_selected_wlens() const;
QStringList m_ynames;
}; };
#endif // I0mapmon_H #endif // I0mapmon_H
...@@ -7,17 +7,20 @@ ...@@ -7,17 +7,20 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1184</width> <width>1184</width>
<height>563</height> <height>614</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>I0mapmon</string> <string>I0mapmon</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0" colspan="8"> <item row="5" column="0">
<widget class="Line" name="line"> <widget class="QLabel" name="label_9">
<property name="orientation"> <property name="text">
<enum>Qt::Horizontal</enum> <string>Threshold</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -43,28 +46,86 @@ ...@@ -43,28 +46,86 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="1" column="0" colspan="9">
<widget class="QLabel" name="label_4"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="I0MMonPlot" name="plot" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gbConfPlot">
<property name="title">
<string>Plot configuration</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Wavelengths:</string> <string>Y min:</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="3"> <item row="0" column="3">
<widget class="QPushButton" name="pbApplyWlens"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>APPLY</string> <string>Y max:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="0" column="4">
<widget class="QuLabel" name="qulWlens"/> <widget class="QLineEdit" name="leyMax">
<property name="text">
<string>10</string>
</property>
</widget>
</item> </item>
<item row="4" column="5"> <item row="0" column="0">
<widget class="QuLabel" name="qulWlenWei"/> <widget class="QCheckBox" name="cbYAuto">
<property name="text">
<string>Y auto scale</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pbApplyBounds">
<property name="text">
<string>APPLY BOUNDS</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="leyMin">
<property name="text">
<string>-10</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QCheckBox" name="cbLogScale">
<property name="text">
<string>Log Scale</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item> </item>
<item row="4" column="6"> <item row="4" column="6">
<widget class="QuLineEdit" name="quleWlenWei"/> <widget class="QuLineEdit" name="quleWlenWei"/>
...@@ -76,6 +137,23 @@ ...@@ -76,6 +137,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="8">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Wavelengths:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="4"> <item row="4" column="4">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
...@@ -89,13 +167,10 @@ ...@@ -89,13 +167,10 @@
<item row="4" column="2"> <item row="4" column="2">
<widget class="QuLineEdit" name="quleWlens"/> <widget class="QuLineEdit" name="quleWlens"/>
</item> </item>
<item row="4" column="8"> <item row="4" column="3">
<widget class="QPushButton" name="pbConfPlot"> <widget class="QPushButton" name="pbApplyWlens">
<property name="text"> <property name="text">
<string>Configure Plot</string> <string>APPLY</string>
</property>
<property name="checkable">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -192,82 +267,37 @@ ...@@ -192,82 +267,37 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0" colspan="9"> <item row="4" column="5">
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QuLabel" name="qulWlenWei"/>
<item> </item>
<widget class="I0MMonPlot" name="plot" native="true"> <item row="4" column="1">
<widget class="QuLabel" name="qulWlens"/>
</item>
<item row="5" column="1">
<widget class="QuInputOutput" name="quInputOutput">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>1</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
</widget> <property name="source">
</item> <string>$1/IntensityRelThreshold</string>
<item>
<widget class="QGroupBox" name="gbConfPlot">
<property name="title">
<string>Plot configuration</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="cbYAuto">
<property name="text">
<string>Y auto scale</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Y min:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="leyMin">
<property name="text">
<string>-10</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Y max:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4"> <item row="5" column="7">
<widget class="QLineEdit" name="leyMax"> <widget class="QPushButton" name="pbConfPlot">
<property name="text"> <property name="text">
<string>10</string> <string>Configure Plot</string>
</property> </property>
</widget> <property name="checkable">
</item> <bool>true</bool>
<item row="0" column="5">
<widget class="QPushButton" name="pbApplyBounds">
<property name="text">
<string>APPLY BOUNDS</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <qwt_symbol.h> #include <qwt_symbol.h>
#include <qwt_legend.h> #include <qwt_legend.h>
#include <qwt_date_scale_engine.h> #include <qwt_date_scale_engine.h>
#include <qwt_transform.h>
#include <cupluginloader.h> #include <cupluginloader.h>
#include <qumultireaderplugininterface.h> #include <qumultireaderplugininterface.h>
...@@ -18,6 +19,17 @@ ...@@ -18,6 +19,17 @@
#include <cutreader.h> #include <cutreader.h>
#endif #endif
class LogTransform : public QwtLogTransform {
public:
LogTransform() : QwtLogTransform() { printf("LOG TRANSFORM\n"); }
// QwtTransform interface
public:
double bounded(double v) const{
return qBound(0.01, v, LogMax);
}
};
I0MMonPlot::I0MMonPlot(QWidget *parent, CumbiaPool *cup, const CuControlsFactoryPool &fpoo) I0MMonPlot::I0MMonPlot(QWidget *parent, CumbiaPool *cup, const CuControlsFactoryPool &fpoo)
: QuPlotBase(parent), : QuPlotBase(parent),
m_symstyles (QList<QwtSymbol::Style> () << QwtSymbol::Ellipse m_symstyles (QList<QwtSymbol::Style> () << QwtSymbol::Ellipse
...@@ -29,6 +41,7 @@ I0MMonPlot::I0MMonPlot(QWidget *parent, CumbiaPool *cup, const CuControlsFactory ...@@ -29,6 +41,7 @@ I0MMonPlot::I0MMonPlot(QWidget *parent, CumbiaPool *cup, const CuControlsFactory
m_time_mode = m_empty = true; m_time_mode = m_empty = true;
m_numsamples = 1; m_numsamples = 1;
m_ymin = m_ymax = 0; m_ymin = m_ymax = 0;
m_log_scale = false;
CuPluginLoader plo; CuPluginLoader plo;
QObject *plugin_qob; QObject *plugin_qob;
m_multiread_plu_i = plo.get<QuMultiReaderPluginInterface>("libcumbia-multiread-plugin.so", &plugin_qob); m_multiread_plu_i = plo.get<QuMultiReaderPluginInterface>("libcumbia-multiread-plugin.so", &plugin_qob);
...@@ -44,6 +57,9 @@ I0MMonPlot::I0MMonPlot(QWidget *parent, CumbiaPool *cup, const CuControlsFactory ...@@ -44,6 +57,9 @@ I0MMonPlot::I0MMonPlot(QWidget *parent, CumbiaPool *cup, const CuControlsFactory
setXAxisAutoscaleEnabled(false); setXAxisAutoscaleEnabled(false);
setYAxisAutoscaleEnabled(false); setYAxisAutoscaleEnabled(false);
insertLegend( new QwtLegend() ); insertLegend( new QwtLegend() );
m_colormap << "#ff5555" << "#c8ff00" << "#2882ff" << "#7fffff" ;
} }
I0MMonPlot::~I0MMonPlot() { I0MMonPlot::~I0MMonPlot() {
...@@ -68,7 +84,7 @@ void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int, ...@@ -68,7 +84,7 @@ void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int,
m_lambdas = lambdamap; m_lambdas = lambdamap;
m_time_mode = (x == "time"); m_time_mode = (x == "time");
m_reset_scales(); m_reset_scales();
int la = 1; int la = 1, cc = 0;;
foreach(double l, lambdamap.values()) { foreach(double l, lambdamap.values()) {
QString cuna = QString("lambda %1").arg(l); QString cuna = QString("lambda %1").arg(l);
QuPlotCurve *crv = curve(cuna); QuPlotCurve *crv = curve(cuna);
...@@ -76,9 +92,11 @@ void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int, ...@@ -76,9 +92,11 @@ void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int,
crv = new QuPlotCurve(cuna); crv = new QuPlotCurve(cuna);
addCurve(cuna, crv); addCurve(cuna, crv);
QPen p = crv->pen(); QPen p = crv->pen();
p.setColor(m_colormap[cc % m_colormap.size()]);
p.setWidthF(2.5); p.setWidthF(2.5);
crv->setPen(p); crv->setPen(p);
crv->setTitle(QString("λ %1").arg(la++)); crv->setTitle(QString("λ %1").arg(la++));
cc++;
} }
m_curvesymap[cuna] = m_symstyles[m_curvesymap.size() % m_symstyles.size()]; m_curvesymap[cuna] = m_symstyles[m_curvesymap.size() % m_symstyles.size()];
} }
...@@ -95,6 +113,7 @@ void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int, ...@@ -95,6 +113,7 @@ void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int,
m_multiread_plu_i->insertSource(y, 1); m_multiread_plu_i->insertSource(y, 1);
} }
} }
updateLegend();
} }
void I0MMonPlot::setYBounds(double ymi, double yma) { void I0MMonPlot::setYBounds(double ymi, double yma) {
...@@ -113,6 +132,18 @@ void I0MMonPlot::setYBoundsAuto(bool a) { ...@@ -113,6 +132,18 @@ void I0MMonPlot::setYBoundsAuto(bool a) {
} }
} }
void I0MMonPlot::setYLogScale(bool a) {
m_log_scale = a;
QwtScaleEngine *se;
a ? se = new QwtLogScaleEngine : se = new QwtLinearScaleEngine;
if(a) {
se->setTransformation(new LogTransform);
setYLowerBound(yLowerBound() <=0 ? 0.01 : yLowerBound());
}
setAxisScaleEngine(QwtPlot::yLeft, se);
replot();
}
void I0MMonPlot::m_set_bounds(const QVector<double> &xv, const QVector<double> &yv) void I0MMonPlot::m_set_bounds(const QVector<double> &xv, const QVector<double> &yv)
{ {
qDebug() << __PRETTY_FUNCTION__ << "y" << m_ymin << m_ymax << "m_empty ? " << m_empty << yv; qDebug() << __PRETTY_FUNCTION__ << "y" << m_ymin << m_ymax << "m_empty ? " << m_empty << yv;
...@@ -135,7 +166,7 @@ void I0MMonPlot::m_set_bounds(const QVector<double> &xv, const QVector<double> & ...@@ -135,7 +166,7 @@ void I0MMonPlot::m_set_bounds(const QVector<double> &xv, const QVector<double> &
} }
if(ylb != yLowerBound()) if(ylb != yLowerBound())
setYLowerBound(ylb); setYLowerBound( (m_log_scale && ylb) <= 0 ? 0.01 : ylb);
if(yub != yUpperBound()) if(yub != yUpperBound())
setYUpperBound(yub); setYUpperBound(yub);
qDebug() << __PRETTY_FUNCTION__ << "y" << ylb << "->" << yub << "ym, yM" << *ym << *yM; qDebug() << __PRETTY_FUNCTION__ << "y" << ylb << "->" << yub << "ym, yM" << *ym << *yM;
......
...@@ -28,6 +28,7 @@ public slots: ...@@ -28,6 +28,7 @@ public slots:
void setSources(const QString& x, const QString& y, const QMap<int, double> lambdamap, int nsamples); void setSources(const QString& x, const QString& y, const QMap<int, double> lambdamap, int nsamples);
void setYBounds(double ymi, double yma); void setYBounds(double ymi, double yma);
void setYBoundsAuto(bool a); void setYBoundsAuto(bool a);
void setYLogScale(bool a);
private: private:
...@@ -45,9 +46,10 @@ private: ...@@ -45,9 +46,10 @@ private:
const QList<QwtSymbol::Style> m_symstyles; const QList<QwtSymbol::Style> m_symstyles;
bool m_time_mode, m_empty; bool m_time_mode, m_empty, m_log_scale;
double m_ymin, m_ymax; double m_ymin, m_ymax;
QList<QColor> m_colormap;
}; };
#endif // I0MMONPLOT_H #endif // I0MMONPLOT_H
Markdown is supported
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