work on the scripting part of mupp. Preparing for the step of parameter transformation.
This commit is contained in:
parent
fe537efa6e
commit
dbefdc69a4
@ -256,7 +256,7 @@ PmuppGui::PmuppGui( QStringList fln, QWidget *parent, Qt::WindowFlags f )
|
|||||||
|
|
||||||
// setup widgets
|
// setup widgets
|
||||||
fBoxLayout_Main = new QBoxLayout(QBoxLayout::TopToBottom);
|
fBoxLayout_Main = new QBoxLayout(QBoxLayout::TopToBottom);
|
||||||
fBoxLayout_Main->setGeometry(QRect(10, 40, 600, 400));
|
fBoxLayout_Main->setGeometry(QRect(10, 40, 600, 500));
|
||||||
|
|
||||||
fBoxLayout_Top = new QBoxLayout(QBoxLayout::LeftToRight);
|
fBoxLayout_Top = new QBoxLayout(QBoxLayout::LeftToRight);
|
||||||
fGridLayout_Left = new QGridLayout();
|
fGridLayout_Left = new QGridLayout();
|
||||||
@ -329,23 +329,39 @@ PmuppGui::PmuppGui( QStringList fln, QWidget *parent, Qt::WindowFlags f )
|
|||||||
fBoxLayout_Top->addLayout(fGridLayout_Left);
|
fBoxLayout_Top->addLayout(fGridLayout_Left);
|
||||||
fBoxLayout_Top->addLayout(fGridLayout_Right);
|
fBoxLayout_Top->addLayout(fGridLayout_Right);
|
||||||
|
|
||||||
|
fCmdLineHistory = new QPlainTextEdit(this);
|
||||||
|
fCmdLineHistory->setReadOnly(true);
|
||||||
|
fCmdLineHistory->setMaximumBlockCount(50);
|
||||||
|
// fill cmd history
|
||||||
|
for (int i=0; i<fCmdHistory.size(); i++)
|
||||||
|
fCmdLineHistory->insertPlainText(QString("%1\n").arg(fCmdHistory[i]));
|
||||||
fCmdLine = new QLineEdit(this);
|
fCmdLine = new QLineEdit(this);
|
||||||
fCmdLine->installEventFilter(this);
|
fCmdLine->installEventFilter(this);
|
||||||
fCmdLine->setText("$ ");
|
fCmdLine->setText("$ ");
|
||||||
fCmdLine->setFocus(); // sets the keyboard focus
|
fCmdLine->setFocus(); // sets the keyboard focus
|
||||||
fExitButton = new QPushButton("E&xit", this);
|
fExitButton = new QPushButton("E&xit", this);
|
||||||
|
|
||||||
|
QVBoxLayout *cmdLayout = new QVBoxLayout;
|
||||||
|
QLabel *cmdLabel = new QLabel("History:");
|
||||||
|
cmdLayout->addWidget(cmdLabel);
|
||||||
|
cmdLayout->addWidget(fCmdLineHistory);
|
||||||
|
cmdLayout->addWidget(fCmdLine);
|
||||||
|
|
||||||
fBoxLayout_Cmd = new QBoxLayout(QBoxLayout::LeftToRight);
|
fBoxLayout_Cmd = new QBoxLayout(QBoxLayout::LeftToRight);
|
||||||
fBoxLayout_Cmd->addWidget(fCmdLine);
|
fBoxLayout_Cmd->addLayout(cmdLayout);
|
||||||
fBoxLayout_Cmd->addWidget(fExitButton);
|
fBoxLayout_Cmd->addWidget(fExitButton);
|
||||||
|
fBoxLayout_Cmd->setAlignment(fCmdLine, Qt::AlignBottom);
|
||||||
|
fBoxLayout_Cmd->setAlignment(fExitButton, Qt::AlignBottom);
|
||||||
|
|
||||||
QFrame* hline = new QFrame();
|
fCmdSplitter = new QSplitter(Qt::Vertical, this);
|
||||||
hline->setFrameShape(QFrame::HLine);
|
QWidget *topWidget = new QWidget(this); // only needed since splitter needs a QWidget
|
||||||
hline->setFrameShadow(QFrame::Sunken);
|
topWidget->setLayout(fBoxLayout_Top);
|
||||||
|
QWidget *cmdWidget = new QWidget(this); // only needed since splitter needs a QWidget
|
||||||
|
cmdWidget->setLayout(fBoxLayout_Cmd);
|
||||||
|
fCmdSplitter->addWidget(topWidget);
|
||||||
|
fCmdSplitter->addWidget(cmdWidget);
|
||||||
|
|
||||||
fBoxLayout_Main->addLayout(fBoxLayout_Top);
|
fBoxLayout_Main->addWidget(fCmdSplitter);
|
||||||
fBoxLayout_Main->addWidget(hline);
|
|
||||||
fBoxLayout_Main->addLayout(fBoxLayout_Cmd);
|
|
||||||
|
|
||||||
// establish all the necessary signal/slots
|
// establish all the necessary signal/slots
|
||||||
connect(fRefreshCollection, SIGNAL( pressed() ), this, SLOT( refresh() ));
|
connect(fRefreshCollection, SIGNAL( pressed() ), this, SLOT( refresh() ));
|
||||||
@ -718,16 +734,19 @@ void PmuppGui::normVal()
|
|||||||
void PmuppGui::helpCmds()
|
void PmuppGui::helpCmds()
|
||||||
{
|
{
|
||||||
QMessageBox::information(this, "cmd help", "<b>help:</b> this help.<br>"\
|
QMessageBox::information(this, "cmd help", "<b>help:</b> this help.<br>"\
|
||||||
"<b>exit/quit:</b> close mupp.<br>"\
|
"<b>ditto</b>: addX/Y for the new selection as for the previous ones.<br>"\
|
||||||
"<b>load:</b> calls the open file dialog.<br>"\
|
|
||||||
"<b>dump collections:</b> dumps all currently loaded collections.<br>"\
|
"<b>dump collections:</b> dumps all currently loaded collections.<br>"\
|
||||||
"<b>dump XY:</b> dumps X/Y tree.<br>"\
|
"<b>dump XY:</b> dumps X/Y tree.<br>"\
|
||||||
"<b>refresh:</b> refresh the currently selected collection.<br>"\
|
"<b>exit/quit:</b> close mupp.<br>"\
|
||||||
"<b>plot:</b> plot the X/Y data.<br>"\
|
"<b>load:</b> calls the open file dialog.<br>"\
|
||||||
|
"<b>norm <flag>:</b> normalize plots to maximum if <flag> is true<br>"\
|
||||||
"<b>macro <fln>:</b> saves the X/Y data as a ROOT macro (*.C).<br>"\
|
"<b>macro <fln>:</b> saves the X/Y data as a ROOT macro (*.C).<br>"\
|
||||||
"<b>path <macroPath>:</b> sets the path to the place where the macros will be saved.<br>"\
|
"<b>path <macroPath>:</b> sets the path to the place where the macros will be saved.<br>"\
|
||||||
"<b>select collection <nn>:</b> select collection in GUI.<br>"\
|
"<b>plot:</b> plot the X/Y data.<br>"\
|
||||||
|
"<b>refresh:</b> refresh the currently selected collection.<br>"\
|
||||||
|
"<b>select <nn>:</b> select collection in GUI.<br>"\
|
||||||
" <nn> is either the collection name or the row number.<br>"\
|
" <nn> is either the collection name or the row number.<br>"\
|
||||||
|
"<b>x <param_name> / y <param_name>:</b> add the parameter to the select axis.<br>"\
|
||||||
"<b>flush:</b> flush the history buffer.");
|
"<b>flush:</b> flush the history buffer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,6 +806,7 @@ bool PmuppGui::eventFilter(QObject *o, QEvent *e)
|
|||||||
if (fCmdHistory.size() >= 50)
|
if (fCmdHistory.size() >= 50)
|
||||||
fCmdHistory.removeFirst();
|
fCmdHistory.removeFirst();
|
||||||
fCmdHistory.push_back(cmd);
|
fCmdHistory.push_back(cmd);
|
||||||
|
fCmdLineHistory->insertPlainText(QString("%1\n").arg(cmd));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -866,9 +886,6 @@ void PmuppGui::readCmdHistory()
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void PmuppGui::writeCmdHistory()
|
void PmuppGui::writeCmdHistory()
|
||||||
{
|
{
|
||||||
if (fCmdHistory.size() == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment procEnv = QProcessEnvironment::systemEnvironment();
|
||||||
QString home = procEnv.value("HOME", "");
|
QString home = procEnv.value("HOME", "");
|
||||||
if (home.isEmpty())
|
if (home.isEmpty())
|
||||||
@ -877,7 +894,7 @@ void PmuppGui::writeCmdHistory()
|
|||||||
QString pathName = home + "/.musrfit/mupp/";
|
QString pathName = home + "/.musrfit/mupp/";
|
||||||
QDir dir(pathName);
|
QDir dir(pathName);
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
// directory $HOME/.musrfit/musredit does not exist hence create it
|
// directory $HOME/.musrfit/mupp does not exist hence create it
|
||||||
dir.mkpath(pathName);
|
dir.mkpath(pathName);
|
||||||
}
|
}
|
||||||
pathName += "mupp_history.txt";
|
pathName += "mupp_history.txt";
|
||||||
@ -1014,13 +1031,23 @@ void PmuppGui::remove()
|
|||||||
/**
|
/**
|
||||||
* @brief PmuppGui::addX
|
* @brief PmuppGui::addX
|
||||||
*/
|
*/
|
||||||
void PmuppGui::addX()
|
void PmuppGui::addX(QString param)
|
||||||
{
|
{
|
||||||
// get the parameter name from the parameter list widget
|
QString paramName("");
|
||||||
QListWidgetItem *item = fParamList->currentItem();
|
if (!param.isEmpty()) {
|
||||||
if (item == 0)
|
// check that param exists
|
||||||
return;
|
if (fParamList->findItems(param, Qt::MatchFixedString).empty()) {
|
||||||
QString paramName = item->text();
|
QMessageBox::critical(this, "**ERROR**", QString("Parameter X '%1' not found").arg(param));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
paramName = param;
|
||||||
|
} else {
|
||||||
|
// get the parameter name from the parameter list widget
|
||||||
|
QListWidgetItem *item = fParamList->currentItem();
|
||||||
|
if (item == 0)
|
||||||
|
return;
|
||||||
|
paramName = item->text();
|
||||||
|
}
|
||||||
int idx = fColList->currentRow();
|
int idx = fColList->currentRow();
|
||||||
QString xLabel = QString("%1 (-%2-)").arg(paramName).arg(idx);
|
QString xLabel = QString("%1 (-%2-)").arg(paramName).arg(idx);
|
||||||
|
|
||||||
@ -1046,13 +1073,23 @@ void PmuppGui::addX()
|
|||||||
/**
|
/**
|
||||||
* @brief PmuppGui::addY
|
* @brief PmuppGui::addY
|
||||||
*/
|
*/
|
||||||
void PmuppGui::addY()
|
void PmuppGui::addY(QString param)
|
||||||
{
|
{
|
||||||
// get the parameter name from the parameter list widget
|
QString paramName("");
|
||||||
QListWidgetItem *item = fParamList->currentItem();
|
if (!param.isEmpty()) {
|
||||||
if (item == 0)
|
// check that param exists
|
||||||
return;
|
if (fParamList->findItems(param, Qt::MatchFixedString).empty()) {
|
||||||
QString paramName = item->text();
|
QMessageBox::critical(this, "**ERROR**", QString("Parameter Y '%1' not found").arg(param));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
paramName = param;
|
||||||
|
} else {
|
||||||
|
// get the parameter name from the parameter list widget
|
||||||
|
QListWidgetItem *item = fParamList->currentItem();
|
||||||
|
if (item == 0)
|
||||||
|
return;
|
||||||
|
paramName = item->text();
|
||||||
|
}
|
||||||
int idx = fColList->currentRow();
|
int idx = fColList->currentRow();
|
||||||
QString yLabel = QString("%1 (-%2-)").arg(paramName).arg(idx);
|
QString yLabel = QString("%1 (-%2-)").arg(paramName).arg(idx);
|
||||||
|
|
||||||
@ -1900,13 +1937,39 @@ void PmuppGui::handleCmds()
|
|||||||
}
|
}
|
||||||
fMacroPath.replace(envVar.prepend("$"), fullPath);
|
fMacroPath.replace(envVar.prepend("$"), fullPath);
|
||||||
}
|
}
|
||||||
} else if (cmd.startsWith("select collection") || cmd.startsWith("sc")) {
|
} else if (cmd.startsWith("select") || cmd.startsWith("sc")) {
|
||||||
selectCollection(cmd);
|
selectCollection(cmd);
|
||||||
|
} else if (cmd.startsWith("x")) {
|
||||||
|
QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
|
||||||
|
addX(tok[1]);
|
||||||
|
} else if (cmd.startsWith("y")) {
|
||||||
|
QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
|
||||||
|
addY(tok[1]);
|
||||||
|
} else if (cmd.startsWith("ditto")) {
|
||||||
|
addDitto();
|
||||||
|
} else if (cmd.startsWith("norm")) {
|
||||||
|
QStringList tok = cmd.split(" ", QString::SkipEmptyParts);
|
||||||
|
if (tok.size() != 2) {
|
||||||
|
QMessageBox::critical(this, "**ERROR**", "found wrong norm cmd, will ignore it.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!tok[1].trimmed().compare("true", Qt::CaseInsensitive)) {
|
||||||
|
fNormalizeAction->setChecked(true);
|
||||||
|
} else if (!tok[1].trimmed().compare("false", Qt::CaseInsensitive)) {
|
||||||
|
fNormalizeAction->setChecked(false);
|
||||||
|
} else {
|
||||||
|
QMessageBox::critical(this, "**ERROR**", "found wrong norm cmd, will ignore it.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else if (cmd.startsWith("flush")) {
|
} else if (cmd.startsWith("flush")) {
|
||||||
fCmdHistory.clear();
|
fCmdHistory.clear();
|
||||||
fCmdLine->setText("$ ");
|
fCmdLine->setText("$ ");
|
||||||
|
fCmdLineHistory->clear();
|
||||||
|
fCmdLineHistory->insertPlainText("$");
|
||||||
} else if (cmd.startsWith("help")) {
|
} else if (cmd.startsWith("help")) {
|
||||||
helpCmds();
|
helpCmds();
|
||||||
|
} else {
|
||||||
|
helpCmds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2148,8 +2211,8 @@ void PmuppGui::selectCollection(QString cmd)
|
|||||||
bool ok;
|
bool ok;
|
||||||
int ival, pos=-1;
|
int ival, pos=-1;
|
||||||
QString str = cmd;
|
QString str = cmd;
|
||||||
if (cmd.contains("select collection")) {
|
if (cmd.contains("select")) {
|
||||||
str.remove("select collection");
|
str.remove("select");
|
||||||
str = str.trimmed();
|
str = str.trimmed();
|
||||||
} else if (cmd.contains("sc")) {
|
} else if (cmd.contains("sc")) {
|
||||||
pos = cmd.indexOf("sc");
|
pos = cmd.indexOf("sc");
|
||||||
@ -2163,6 +2226,9 @@ void PmuppGui::selectCollection(QString cmd)
|
|||||||
if (ok) { // it is a number
|
if (ok) { // it is a number
|
||||||
if (ival < fColList->count())
|
if (ival < fColList->count())
|
||||||
fColList->setCurrentRow(ival);
|
fColList->setCurrentRow(ival);
|
||||||
|
else
|
||||||
|
QMessageBox::critical(this, "**ERROR**",
|
||||||
|
QString("Found Row Selection %1 which is > #Selections=%2").arg(ival).arg(fColList->count()));
|
||||||
} else { // assume it is a collection name
|
} else { // assume it is a collection name
|
||||||
for (int i=0; i<fColList->count(); i++) {
|
for (int i=0; i<fColList->count(); i++) {
|
||||||
if (fColList->item(i)->text() == str) {
|
if (fColList->item(i)->text() == str) {
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
@ -170,6 +171,8 @@ private:
|
|||||||
QPushButton *fRemoveX;
|
QPushButton *fRemoveX;
|
||||||
QPushButton *fRemoveY;
|
QPushButton *fRemoveY;
|
||||||
QPushButton *fPlot;
|
QPushButton *fPlot;
|
||||||
|
QSplitter *fCmdSplitter;
|
||||||
|
QPlainTextEdit *fCmdLineHistory;
|
||||||
QLineEdit *fCmdLine;
|
QLineEdit *fCmdLine;
|
||||||
QPushButton *fExitButton;
|
QPushButton *fExitButton;
|
||||||
|
|
||||||
@ -198,8 +201,8 @@ private:
|
|||||||
private slots:
|
private slots:
|
||||||
void refresh();
|
void refresh();
|
||||||
void remove();
|
void remove();
|
||||||
void addX();
|
void addX(QString param="");
|
||||||
void addY();
|
void addY(QString param="");
|
||||||
void removeX();
|
void removeX();
|
||||||
void removeY();
|
void removeY();
|
||||||
void addDitto();
|
void addDitto();
|
||||||
|
@ -51,6 +51,7 @@ PmuppScript::PmuppScript(QStringList script) :
|
|||||||
fLoadPath = QString("./");
|
fLoadPath = QString("./");
|
||||||
fSavePath = QString("./");
|
fSavePath = QString("./");
|
||||||
fSelected = -2; // nothing selected
|
fSelected = -2; // nothing selected
|
||||||
|
fNorm = false;
|
||||||
|
|
||||||
fAdmin = new PmuppAdmin();
|
fAdmin = new PmuppAdmin();
|
||||||
}
|
}
|
||||||
@ -98,10 +99,12 @@ int PmuppScript::executeScript()
|
|||||||
status = selectAll();
|
status = selectAll();
|
||||||
} else if (cmd.startsWith("select ")) {
|
} else if (cmd.startsWith("select ")) {
|
||||||
status = select(cmd);
|
status = select(cmd);
|
||||||
} else if (cmd.startsWith("addX")) {
|
} else if (cmd.startsWith("x")) {
|
||||||
status = addX(cmd);
|
status = addX(cmd);
|
||||||
} else if (cmd.startsWith("addY")) {
|
} else if (cmd.startsWith("y")) {
|
||||||
status = addY(cmd);
|
status = addY(cmd);
|
||||||
|
} else if (cmd.startsWith("norm")) {
|
||||||
|
fNorm = true;
|
||||||
} else if (cmd.startsWith("plot")) {
|
} else if (cmd.startsWith("plot")) {
|
||||||
status = plot(cmd);
|
status = plot(cmd);
|
||||||
} else if (cmd.startsWith("macro")) {
|
} else if (cmd.startsWith("macro")) {
|
||||||
@ -504,6 +507,7 @@ int PmuppScript::macro(const QString str, const QString plotFln)
|
|||||||
QString collName;
|
QString collName;
|
||||||
int count=0;
|
int count=0;
|
||||||
double x_min=0.0, x_max=0.0, x_min_new=0.0, x_max_new=0.0, y_min=0.0, y_max=0.0, y_min_new=0.0, y_max_new=0.0;
|
double x_min=0.0, x_max=0.0, x_min_new=0.0, x_max_new=0.0, y_min=0.0, y_max=0.0, y_min_new=0.0, y_max_new=0.0;
|
||||||
|
double dval, y_min_norm=1.0e10;
|
||||||
for (int i=0; i<fPlotInfo.size(); i++) {
|
for (int i=0; i<fPlotInfo.size(); i++) {
|
||||||
// get collection name
|
// get collection name
|
||||||
collName = fParamDataHandler->GetCollectionName(i);
|
collName = fParamDataHandler->GetCollectionName(i);
|
||||||
@ -547,15 +551,27 @@ int PmuppScript::macro(const QString str, const QString plotFln)
|
|||||||
}
|
}
|
||||||
fout << " // y-values" << endl;
|
fout << " // y-values" << endl;
|
||||||
for (int k=0; k<yy.size(); k++) {
|
for (int k=0; k<yy.size(); k++) {
|
||||||
fout << " yy[" << k << "]=" << yy[k] << ";" << endl;
|
dval = yy[k];
|
||||||
|
if (fNorm) {
|
||||||
|
dval /= y_max;
|
||||||
|
if (dval < y_min_norm)
|
||||||
|
y_min_norm = dval;
|
||||||
|
}
|
||||||
|
fout << " yy[" << k << "]=" << dval << ";" << endl;
|
||||||
}
|
}
|
||||||
fout << " // yyNegErr-values" << endl;
|
fout << " // yyNegErr-values" << endl;
|
||||||
for (int k=0; k<yyNegErr.size(); k++) {
|
for (int k=0; k<yyNegErr.size(); k++) {
|
||||||
fout << " yyNegErr[" << k << "]=" << fabs(yyNegErr[k]) << ";" << endl;
|
dval = fabs(yyNegErr[k]);
|
||||||
|
if (fNorm)
|
||||||
|
dval /= fabs(y_max);
|
||||||
|
fout << " yyNegErr[" << k << "]=" << dval << ";" << endl;
|
||||||
}
|
}
|
||||||
fout << " // yyPosErr-values" << endl;
|
fout << " // yyPosErr-values" << endl;
|
||||||
for (int k=0; k<yyPosErr.size(); k++) {
|
for (int k=0; k<yyPosErr.size(); k++) {
|
||||||
fout << " yyPosErr[" << k << "]=" << yyPosErr[k] << ";" << endl;
|
dval = fabs(yyPosErr[k]);
|
||||||
|
if (fNorm)
|
||||||
|
dval /= fabs(y_max);
|
||||||
|
fout << " yyPosErr[" << k << "]=" << dval << ";" << endl;
|
||||||
}
|
}
|
||||||
fout << endl;
|
fout << endl;
|
||||||
fout << " TGraphAsymmErrors *g_" << i << "_" << j << " = new TGraphAsymmErrors(nn, xx, yy, null, null, yyNegErr, yyPosErr);" << endl;
|
fout << " TGraphAsymmErrors *g_" << i << "_" << j << " = new TGraphAsymmErrors(nn, xx, yy, null, null, yyNegErr, yyPosErr);" << endl;
|
||||||
@ -570,10 +586,15 @@ int PmuppScript::macro(const QString str, const QString plotFln)
|
|||||||
else
|
else
|
||||||
x_min = x_min_new;
|
x_min = x_min_new;
|
||||||
diff = x_max-x_min;
|
diff = x_max-x_min;
|
||||||
x_max = x_max_new + 0.05*diff;
|
x_max = x_max_new + 0.05*diff;
|
||||||
diff = y_max_new - y_min_new;
|
diff = y_max_new - y_min_new;
|
||||||
y_min = y_min_new - 0.05 * diff;
|
y_min = y_min_new - 0.05 * diff;
|
||||||
y_max = y_max_new + 0.05 * diff;
|
y_max = y_max_new + 0.05 * diff;
|
||||||
|
if (fNorm) {
|
||||||
|
diff = 1.0 - y_min_norm;
|
||||||
|
y_min = y_min_norm - 0.05 * diff;
|
||||||
|
y_max = 1.0 + 0.05 * diff;
|
||||||
|
}
|
||||||
|
|
||||||
// plotting
|
// plotting
|
||||||
fout << " //**********" << endl;
|
fout << " //**********" << endl;
|
||||||
@ -686,22 +707,42 @@ QString PmuppScript::getNicerLabel(const QString label)
|
|||||||
{
|
{
|
||||||
QString nice = label;
|
QString nice = label;
|
||||||
|
|
||||||
if (label == "dataE")
|
if (label == "dataE") {
|
||||||
nice = "E (keV)";
|
nice = "E (keV)";
|
||||||
else if (label == "dataT")
|
} else if (label == "dataT") {
|
||||||
nice = "T (K)";
|
nice = "T (K)";
|
||||||
else if (label == "dataB")
|
} else if (label == "dataB") {
|
||||||
nice = "B (G)";
|
nice = "B (G)";
|
||||||
else if (!label.compare("sigma", Qt::CaseInsensitive))
|
} else if (!label.compare("sigma", Qt::CaseInsensitive)) {
|
||||||
nice = "#sigma (1/#mus)";
|
if (fNorm)
|
||||||
else if (!label.compare("lambda", Qt::CaseInsensitive))
|
nice = "#sigma/max(#sigma)";
|
||||||
nice = "#lambda (1/#mus)";
|
else
|
||||||
else if (!label.compare("rate", Qt::CaseInsensitive))
|
nice = "#sigma (1/#mus)";
|
||||||
nice = "Rate (1/#mus)";
|
} else if (!label.compare("lambda", Qt::CaseInsensitive)) {
|
||||||
else if (!label.compare("alpha_LR", Qt::CaseInsensitive))
|
if (fNorm)
|
||||||
nice = "#alpha_{LR}";
|
nice = "#lambda/max(#lambda)";
|
||||||
else if (!label.compare("alpha_TB", Qt::CaseInsensitive))
|
else
|
||||||
nice = "#alpha_{TB}";
|
nice = "#lambda (1/#mus)";
|
||||||
|
} else if (!label.compare("rate", Qt::CaseInsensitive)) {
|
||||||
|
if (fNorm)
|
||||||
|
nice = "Rate/max(Rate)";
|
||||||
|
else
|
||||||
|
nice = "Rate (1/#mus)";
|
||||||
|
} else if (!label.compare("alpha_LR", Qt::CaseInsensitive)) {
|
||||||
|
if (fNorm)
|
||||||
|
nice = "#alpha_{LR}/max(#alpha_{LR})";
|
||||||
|
else
|
||||||
|
nice = "#alpha_{LR}";
|
||||||
|
} else if (!label.compare("alpha_TB", Qt::CaseInsensitive)) {
|
||||||
|
if (fNorm)
|
||||||
|
nice = "#alpha_{TB}/max(#alpha_{TB})";
|
||||||
|
else
|
||||||
|
nice = "#alpha_{TB}";
|
||||||
|
} else {
|
||||||
|
if (fNorm) {
|
||||||
|
nice = label + "/ max(" + label + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nice;
|
return nice;
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ class PmuppScript : public QObject
|
|||||||
PmuppPlotEntry fPlotEntry;
|
PmuppPlotEntry fPlotEntry;
|
||||||
QVector<PmuppPlotEntry> fPlotInfo;
|
QVector<PmuppPlotEntry> fPlotInfo;
|
||||||
|
|
||||||
|
bool fNorm;
|
||||||
QString fLoadPath;
|
QString fLoadPath;
|
||||||
QString fSavePath;
|
QString fSavePath;
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ load YBCO-40nm-T120K-FC150mT-Escan.db
|
|||||||
|
|
||||||
selectAll
|
selectAll
|
||||||
|
|
||||||
addX dataE
|
x dataE
|
||||||
addY Field
|
y Field
|
||||||
|
|
||||||
savePath ./
|
savePath ./
|
||||||
plot FieldVsEnergy.pdf
|
plot FieldVsEnergy.pdf
|
||||||
|
19
src/musredit_qt5/mupp/examples/field-vs-temp.txt
Normal file
19
src/musredit_qt5/mupp/examples/field-vs-temp.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# This is a comment
|
||||||
|
|
||||||
|
loadPath ./
|
||||||
|
|
||||||
|
load YBCO-40nm-FC-E3p8keV-B10mT-Tscan.db
|
||||||
|
load YBCO-40nm-FC-E3p8keV-B150mT-Tscan.db
|
||||||
|
|
||||||
|
selectAll
|
||||||
|
|
||||||
|
norm
|
||||||
|
x dataT
|
||||||
|
y Field
|
||||||
|
|
||||||
|
savePath ./
|
||||||
|
plot FieldVsTemp.pdf
|
||||||
|
|
||||||
|
macro FieldVsTemp.C
|
||||||
|
|
||||||
|
# end
|
18
src/musredit_qt5/mupp/examples/sigma-vs-temp.txt
Normal file
18
src/musredit_qt5/mupp/examples/sigma-vs-temp.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# This is a comment
|
||||||
|
|
||||||
|
loadPath ./
|
||||||
|
|
||||||
|
load YBCO-40nm-FC-E3p8keV-B10mT-Tscan.db
|
||||||
|
load YBCO-40nm-FC-E3p8keV-B150mT-Tscan.db
|
||||||
|
|
||||||
|
selectAll
|
||||||
|
|
||||||
|
x dataT
|
||||||
|
y Sigma
|
||||||
|
|
||||||
|
savePath ./
|
||||||
|
plot SigmaVsTemp.pdf
|
||||||
|
|
||||||
|
macro SigmaVsTemp.C
|
||||||
|
|
||||||
|
# end
|
@ -72,8 +72,9 @@ void mupp_syntax()
|
|||||||
cout << " select <nn> : selects collection <nn>, where <nn> is either the number" << endl;
|
cout << " select <nn> : selects collection <nn>, where <nn> is either the number" << endl;
|
||||||
cout << " of the collections, or its name, e.g. " << endl;
|
cout << " of the collections, or its name, e.g. " << endl;
|
||||||
cout << " select YBCO-40nm-T5K-FC150mT-Escan.db" << endl;
|
cout << " select YBCO-40nm-T5K-FC150mT-Escan.db" << endl;
|
||||||
cout << " addX <label> : add <label> as a x-variable. Only one is allowed." << endl;
|
cout << " x <label> : add <label> as a x-variable. Only one is allowed." << endl;
|
||||||
cout << " addY <label(s)>: add <label(s)> as y-variable. Multiple labls are possible." << endl;
|
cout << " y <label(s)> : add <label(s)> as y-variable. Multiple labls are possible." << endl;
|
||||||
|
cout << " norm : normalize data to maximum." << endl;
|
||||||
cout << " savePath <dir> : set the save path to <dir>. The place where the macros," << endl;
|
cout << " savePath <dir> : set the save path to <dir>. The place where the macros," << endl;
|
||||||
cout << " and/or the plot output will be saved." << endl;
|
cout << " and/or the plot output will be saved." << endl;
|
||||||
cout << " plot <fln> : where <fln> is the file name with extension under which" << endl;
|
cout << " plot <fln> : where <fln> is the file name with extension under which" << endl;
|
||||||
@ -195,7 +196,7 @@ int mupp_script_syntax_check(QStringList &list)
|
|||||||
cerr << "****************" << endl;
|
cerr << "****************" << endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (str.startsWith("addX")) {
|
} else if (str.startsWith("x")) {
|
||||||
tok = str.split(' ', QString::SkipEmptyParts);
|
tok = str.split(' ', QString::SkipEmptyParts);
|
||||||
if (tok.size() != 2) {
|
if (tok.size() != 2) {
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
@ -204,7 +205,7 @@ int mupp_script_syntax_check(QStringList &list)
|
|||||||
cerr << "****************" << endl;
|
cerr << "****************" << endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (str.startsWith("addY")) {
|
} else if (str.startsWith("y")) {
|
||||||
tok = str.split(' ', QString::SkipEmptyParts);
|
tok = str.split(' ', QString::SkipEmptyParts);
|
||||||
if (tok.size() < 2) {
|
if (tok.size() < 2) {
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
@ -283,21 +284,23 @@ int mupp_script_syntax_check(QStringList &list)
|
|||||||
cerr << "****************" << endl;
|
cerr << "****************" << endl;
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
} else if (str.startsWith("norm")) {
|
||||||
|
// nothing-to-be-done
|
||||||
} else {
|
} else {
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
cerr << "*********" << endl;
|
cerr << "*********" << endl;
|
||||||
cerr << "**ERROR** found unrecognized script command: '" << str.toLatin1().constData() << "'." << endl;
|
cerr << "**ERROR** found unrecognized script command: '" << str.toLatin1().constData() << "'." << endl;
|
||||||
cerr << "*********" << endl;
|
cerr << "*********" << endl;
|
||||||
cerr << " Currently supported:" << endl;
|
cerr << " Currently supported:" << endl;
|
||||||
cerr << " load <coll(s)>, where <coll(s)> is a file-name-list of collections (*.db, *.dat)" << endl;
|
cerr << " load <coll(s)> : where <coll(s)> is a file-name-list of collections (*.db, *.dat)" << endl;
|
||||||
cerr << " loadPath <path>, where <path> is the load path accepting bash variables like $HOME, etc." << endl;
|
cerr << " loadPath <path> : where <path> is the load path accepting bash variables like $HOME, etc." << endl;
|
||||||
cerr << " addX <var-name>, where <var-name> is a data tag of the db/dat-file." << endl;
|
cerr << " x <var-name> : where <var-name> is a data tag of the db/dat-file." << endl;
|
||||||
cerr << " addY <var-name>, where <var-name> is a data tag of the db/dat-file." << endl;
|
cerr << " y <var-name> : where <var-name> is a data tag of the db/dat-file." << endl;
|
||||||
cerr << " select <nn>, where <nn> is the row-number or collection name of the collection to be selected." << endl;
|
cerr << " select <nn> : where <nn> is the row-number or collection name of the collection to be selected." << endl;
|
||||||
cerr << " selectAll, i.e. already set addX, addY will apply to ALL collections present." << endl;
|
cerr << " selectAll : i.e. already set addX, addY will apply to ALL collections present." << endl;
|
||||||
cerr << " savePath <path>, where <path> is the save path accepting bash variables like $HOME, etc." << endl;
|
cerr << " savePath <path> : where <path> is the save path accepting bash variables like $HOME, etc." << endl;
|
||||||
cerr << " plot <fln>, where <fln> is the file name with extension under which the plot should be saved." << endl;
|
cerr << " plot <fln> : where <fln> is the file name with extension under which the plot should be saved." << endl;
|
||||||
cerr << " macro <fln>, where <fln> is the file name under which the root macro should be saved." << endl;
|
cerr << " macro <fln> : where <fln> is the file name under which the root macro should be saved." << endl;
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user