Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
TOUZE Francois
PSPA
Commits
148c602d
Commit
148c602d
authored
Jul 12, 2019
by
TOUZE Francois
Browse files
add plot options
parent
0c2db90c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
37 deletions
+27
-37
backend/pspa/v0/src/Core/computingBlock.cc
backend/pspa/v0/src/Core/computingBlock.cc
+7
-20
backend/pspa/v0/src/Core/softwareMadx.cc
backend/pspa/v0/src/Core/softwareMadx.cc
+2
-2
backend/pspa/v0/src/cppcode.cpp
backend/pspa/v0/src/cppcode.cpp
+5
-5
controller/modules/settingPlots.cpp
controller/modules/settingPlots.cpp
+12
-9
controller/pspa.py
controller/pspa.py
+1
-1
No files found.
backend/pspa/v0/src/Core/computingBlock.cc
View file @
148c602d
...
...
@@ -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
(
"chrom
npu
atic"
);
j
[
"outputFunctions"
].
push_back
(
"chromatic"
);
}
if
(
ref
.
find
(
"sigma"
)
!=
string
::
npos
)
{
j
[
"outputFunctions"
].
push_back
(
"beam"
);
...
...
backend/pspa/v0/src/Core/softwareMadx.cc
View file @
148c602d
...
...
@@ -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
);
...
...
backend/pspa/v0/src/cppcode.cpp
View file @
148c602d
...
...
@@ -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
"
;
...
...
controller/modules/settingPlots.cpp
View file @
148c602d
...
...
@@ -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
(
"xeta
p
"
);
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
;
...
...
controller/pspa.py
View file @
148c602d
...
...
@@ -119,7 +119,7 @@ def plots():
x_bytes
=
str
.
encode
(
data
)
ptr
.
settings
(
x_bytes
)
data
=
os
.
path
.
join
(
upath
,
'simulator-plot.txt'
)
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment