Commit 148c602d authored by TOUZE Francois's avatar TOUZE Francois
Browse files

add plot options

parent 0c2db90c
......@@ -215,7 +215,7 @@ std::vector<smap> computingBlock::tunesAMLInput( UAPNode* up )
std::vector<smap> computingBlock::twissAMLInput( UAPNode* nde )
{
// cout << "computingBlock::twissAMLInput()\n";
if(debug > 0) cout << "computingBlock::twissAMLInput()\n";
UAPAttribute *att= nde->getAttribute("option");
int iopt;
......@@ -225,29 +225,14 @@ std::vector<smap> computingBlock::twissAMLInput( UAPNode* nde )
if(iopt == 1) amap["twiss_option"].push_back( "option 1" );
if(iopt == 2) amap["twiss_option"].push_back( "option 2" );
if(iopt == 3) amap["twiss_option"].push_back( "option 3" );
std::vector<smap> v;
v.push_back( amap );
if( !amap.empty() ) amap.clear();
/**
if(iopt == 2) {
UAPNode* twiss= nde->getChildByName("twiss");
string op[6]= {"beta_x","beta_y","alpha_x","alpha_y","dx","dpx"};
for(unsigned k = 0; k < sizeof(op)/sizeof(std::string); ++k) {
string str;
if( AMLtools::readAMLParameterAttribut(twiss,op[k],"design",str) )
amap[ op[k] ].push_back( str );
else
amap[ op[k] ].push_back( "none" );
}
}
*/
if(iopt == 2) {
UAPNode *n2= nde->getChildByName("twiss");
string str;
if(AMLtools::readAMLParameterAttribut(n2,"beta_x","design",str))
amap[ "beta_x" ].push_back( str );
if(AMLtools::readAMLParameterAttribut(n2,"alpha_x","design",str))
......@@ -263,16 +248,18 @@ std::vector<smap> computingBlock::twissAMLInput( UAPNode* nde )
}
v.push_back( amap );
if( !amap.empty() ) amap.clear();
NodeVec out= nde->getChildrenByName("output");
for (NodeVecIter ie = out.begin(); ie != out.end(); ie++)
{
UAPNode* child= *ie;
amap[ "output" ].push_back( child->getAttributeString("ref") );
}
v.push_back( amap );
if( !amap.empty() ) amap.clear();
return v;
}
......@@ -1045,7 +1032,7 @@ void computingBlock::jtwissOutput(json& j,const vector<smap>& v)
{
string ref= it->second.at( k );
if (ref.find("chrom") != string::npos) {
j["outputFunctions"].push_back("chromnpuatic");
j["outputFunctions"].push_back("chromatic");
}
if (ref.find("sigma") != string::npos) {
j["outputFunctions"].push_back("beam");
......
......@@ -1191,7 +1191,7 @@ void softwareMadx::setBeamParameters(double ws[5],double EX,double EY,double PC)
json softwareMadx::readOpticalParameters()
{
cout << "softwareMadx::readOpticalParameters()\n";
if(debug > 0) cout << "softwareMadx::readOpticalParameters()\n";
json j;
j["software"]= "madx";
......@@ -1199,7 +1199,7 @@ json softwareMadx::readOpticalParameters()
const vector< pair< string,vector<smap> > >& commands= getComputingBlock()->actions();
j["action"]= commands.at(0).first;
cout << "readOpticalParameters:: action =>" << j["action"] << endl;
if(debug > 0) cout << "readOpticalParameters:: action =>" << j["action"] << endl;
// get the file xxx-twiss.txt back (mandatory)
TTwiss( j );
......
......@@ -44,8 +44,8 @@ pspa::pspa (string basename)
nameOfCase_ = string();
dataManager_= NULL;
string userDir= basename + "workZone";
string workingDir= basename + "pspa-web/simulate";
string userDir= basename + "workZone/";
string workingDir= basename + "pspa.git/softwares/";
cout << "pspa userDir => " << userDir << "\n";
cout << "pspa wrkDir => " << workingDir << "\n";
......@@ -86,15 +86,15 @@ string pspa::read(const char* argv)
//fileName= userDir_ + "/" + fileName;
if( typeOfFile_ == ".aml" ) {
cout << "AML format input file\n\n";
dataManager_->parseAMLFile( fileName );
status = dataManager_->parseAMLFile( fileName );
} else if( typeOfFile_ == ".madx" ) {
cout << "MAD-X format input file\n\n";
dataManager_->parseXFile( fileName );
status = dataManager_->parseXFile( fileName );
} else if( typeOfFile_ == ".json" ) {
cout << "JSON format input file\n\n";
status= dataManager_->parseJSONFile( fileName );
status = dataManager_->parseJSONFile( fileName );
} else {
cout << "Unknown file extension\n";
......
......@@ -145,7 +145,7 @@ json pspaplot::beamParameters(json j)
{
string fname= *it;
fname= userDir_ + fname + "-plot.txt";
//cout << "open fileName => " << fname << endl;
cout << "open fileName => " << fname << endl;
std::ifstream ifs( fname );
if (!ifs.good()) {
......@@ -160,7 +160,7 @@ json pspaplot::beamParameters(json j)
//cout << "softw => " << softw << endl;
string action= obj.find( "action" ).value();
cout << "action => " << action << endl;
//cout << "pspaplot::beamParameters: action => " << action << endl;
json::iterator xaxis;
if (action == "tunes")
......@@ -226,9 +226,11 @@ json pspaplot::beamParameters(json j)
}
if (item == "chromatic-functions") { // valid only for twiss
cout << "chromatic-functions\n";
menu("wx",obj,Ymaps);
menu("wy",obj,Ymaps);
menu("xetap",obj,Ymaps);
cout << "chromatic-functions.... done\n";
}
if (item == "tune-functions") { // valid only for tunes
......@@ -345,7 +347,7 @@ json pspaplot::lineplots(vector<double> Xaxis,map<string,vector<double> > Ymaps)
x["borderColor"]= "#74B9FF";
x["fill"]= false;
x["yAxisID"]= "y-axis-1";
x["pointRadius"]= 3;
x["pointRadius"]= 0;
for(unsigned int k = 0; k < Xaxis.size(); ++k)
{
json xy= {{"x",Xaxis.at(k)},{"y",it->second.at(k)}};
......@@ -353,7 +355,7 @@ json pspaplot::lineplots(vector<double> Xaxis,map<string,vector<double> > Ymaps)
}
j["data"]["datasets"].push_back( x );
x.clear();
bool addDataset= false;
if (Ymaps.find("yemit") != Ymaps.end()) {
x["label"]= "εy [π.mrad.mm]";
......@@ -398,7 +400,7 @@ json pspaplot::lineplots(vector<double> Xaxis,map<string,vector<double> > Ymaps)
x["borderColor"]= "#FF6384";
x["fill"]= false;
x["yAxisID"]= "y-axis-1";
x["pointRadius"]= 3;
x["pointRadius"]= 0;
for(unsigned int k = 0; k < Xaxis.size(); ++k)
{
json xy= {{"x",Xaxis.at(k)},{"y",it->second.at(k)}};
......@@ -418,7 +420,7 @@ json pspaplot::lineplots(vector<double> Xaxis,map<string,vector<double> > Ymaps)
}
if (Ymaps.find("xetap") != Ymaps.end()) {
x["label"]= "μ′ₓ [m]";
it= Ymaps.find("xeta");
it= Ymaps.find("xetap");
rightLabel= "μ′ₓ";
addDataset= true;
}
......@@ -447,7 +449,7 @@ json pspaplot::lineplots(vector<double> Xaxis,map<string,vector<double> > Ymaps)
x["borderColor"]= "#2CA02C";
x["fill"]= false;
x["yAxisID"]= "y-axis-2";
x["pointRadius"]= 3;
x["pointRadius"]= 0;
for(unsigned int k = 0; k < Xaxis.size(); ++k)
{
json xy= {{"x",Xaxis.at(k)},{"y",it->second.at(k)}};
......@@ -486,10 +488,11 @@ json pspaplot::lineplots(vector<double> Xaxis,map<string,vector<double> > Ymaps)
x["scaleLabel"]["labelString"]= leftLabel;
j["options"]["scales"]["yAxes"].push_back( x );
x.clear();
// yAxes (right)
// yAxes (right if addDataset= true)
x["type"]= "linear";
x["position"]= "right";
x["display"]= true;
x["display"]= addDataset; //true;
x["id"]= "y-axis-2";
x["scaleLabel"]["display"]= true;
x["scaleLabel"]["labelString"]= rightLabel;
......
......@@ -119,7 +119,7 @@ def plots():
x_bytes= str.encode( data )
ptr.settings( x_bytes )
data= os.path.join(upath,'simulator-plot.txt')
"""
......
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