Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
BeamDynamics
MatlabOperation
Commits
c656a55c
Commit
c656a55c
authored
Jun 25, 2019
by
Simone Liuzzo
Browse files
synch with master
parents
36b553bc
71edd1c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
fun_tom/fittune_traj.m
View file @
c656a55c
...
...
@@ -14,6 +14,6 @@
end
orb=linepass(mach,cini,bpm);
orb=orb(1:2,1:numel(bpm))';
orb=orb(1:2
:4
,1:numel(bpm))';
whos
res=sum(std2(orb-or(1:numel(bpm),:)))
\ No newline at end of file
fun_tom/ftcheck_sr.m
View file @
c656a55c
function
[
tunes
,
cur
,
posm
]
=
ftcheck_sr
(
flagtune
,
average
,
numbpm
)
function
[
tunes
,
cur
,
posm
,
mach
]
=
ftcheck_sr
(
flagtune
,
average
,
numbpm
)
% [tunes,cur,posm]=ftcheck_sr(flagtune,average,numbpm)
%This function is making the actual measurement of the first turn
%trajectory. If asked for (FLAGTUNE==1) then it will also compute the
...
...
@@ -72,7 +72,7 @@ traj=posm;
%data recording for vetical analysis increasing CV9 averaged over AVERAGE samples
if
flagtune
==
1
...
...
@@ -134,28 +134,34 @@ traj=([posxp poszp]);
% extracts the tunes via fft
tunes
=
findtunetom2
(
traj
(:,:),
200
,
1
);
tunes
=
tunes
*
319
;
%extract the tunes via fit of model
tunes
=
tunes
*
320
;
if
flagtune
==
1
%extract the tunes via fit of model
m
=
ebs
.
model
;
mach
=
m
.
ring
;
%%%bpm=findcells(mach,'FamName','BPM');
bpm
=
m
.
get
(
0
,
'BPM'
);
x0
=
[
-
2.704
4.459
];
co4
=
[
-
0.22E-3
-
0.11E-3
-
0.45E-3
0.06E-3
];
re
=
fittune_traj
(
x0
,
bpm
(
1
:
numbpm
),
mach
,
traj
(
1
:
numbpm
,:),
co4
);
[
xr
,
res
]
=
fminsearch
(
@
(
x
)
fittune_traj
(
x
,
bpm
(
1
:
numbpm
),
mach
,
traj
(
1
:
numbpm
,:),
co4
),
x0
);
QF1
=
findcells
(
mach
,
'FamName'
,
'QF1\w*'
);
x0
=
[
0
0
0
0
-
0.6087
/
0.2277
0.7922
/
0.3119
];
%co4=[-0.22E-3 -0.11E-3 -0.45E-3 0.06E-3];
%re=fittune_traj(x0,bpm(1:numbpm),mach,traj(1:numbpm,:),co4);
%[xr,res]=fminsearch(@(x) fittune_traj(x,bpm(1:numbpm),mach,traj(1:numbpm,:),co4),x0);
re
=
fittune_traj
(
x0
,
bpm
(
1
:
numbpm
),
mach
,
traj
(
1
:
numbpm
,:));
[
xr
,
res
]
=
fminsearch
(
@
(
x
)
fittune_traj
(
x
,
bpm
(
1
:
numbpm
),
mach
,
traj
(
1
:
numbpm
,:)),
x0
);
xr
QF1
=
findcells
(
mach
,
'FamName'
,
'QF1\w*'
);
QD2
=
findcells
(
mach
,
'FamName'
,
'QD2\w*'
);
mach
=
setcellstruct
(
mach
,
'PolynomB'
,
QD2
,[
xr
(
1
)],
1
,
2
);
mach
=
setcellstruct
(
mach
,
'PolynomB'
,
QF1
,[
xr
(
2
)],
1
,
2
);
orb
=
linepass
(
mach
,[
co4
0
0
]
'
,
bpm
);
mach
=
setcellstruct
(
mach
,
'PolynomB'
,
QD2
,[
xr
(
5
)],
1
,
2
);
mach
=
setcellstruct
(
mach
,
'PolynomB'
,
QF1
,[
xr
(
6
)],
1
,
2
);
orb
=
linepass
(
mach
,[
xr
(
1
:
4
)
0
0
]
'
,
bpm
);
figure
(
3
)
plot
([
traj
(
1
:
numbpm
,:)
orb
(
1
:
2
:
3
,
1
:
numbpm
)
'
]);
grid
on
;
legend
(
'meas or h'
,
'meas or v'
,
'fit or h'
,
'fit or v'
);
figure
(
4
);
pause
(
2
)
pause
(
5
)
atplot
(
mach
);
end
...
...
fun_tom/search_obs.m
View file @
c656a55c
...
...
@@ -37,14 +37,14 @@ classdef search_obs
cd
(
curdir
);
obj
.
CUR
=
tango
.
Attribute
(
'sr/d-ct/1/current'
);
obj
.
BLM
=
1
+
mod
([
3
:
0.25
:
34.75
],
32
);
%
obj.BLM=1+mod([3:0.25:34.75],32);
%obj.BLM=tango.Device('srdiag/beam-position/all');
obj
.
ORBITH
=
tango
.
Attribute
(
'srdiag/beam-position/all/SA_HPositions'
);
obj
.
ORBITV
=
tango
.
Attribute
(
'srdiag/beam-position/all/SA_VPositions'
);
obj
.
LT
=
tango
.
Attribute
(
'srdiag/beam-position/all/SA_HPositions_Peak'
);
obj
.
RING
=
'ebs'
;
dirname
=
uigetdir
(
'/operation/
appdata/ebs/optics/settings
'
,
'optic to be loaded'
);
dirname
=
uigetdir
(
'/operation/
beamdyn/matlab/optics/ebs/
'
,
'optic to be loaded'
);
obj
.
MODEL
=
ebs
.
model
(
dirname
);
obj
.
MODEL
.
directory
=
dirname
;
obj
.
HRESP
=
load
(
fullfile
(
dirname
,
'h_resp.csv'
));
...
...
@@ -348,12 +348,15 @@ classdef search_obs
or_sv
([
~
bpmok
(:);
~
bpmok
(:)],:)
=
nan
;
or_sh
([
~
bpmok
(:);
~
bpmok
(:)],:)
=
nan
;
end
function
resp
=
resp_or_blm
(
obj
,
plane
,
strength
)
if
plane
==
1
for
i
=
1
:
32
if
plane
==
1
for
i
=
1
:
32
blmini
=
obj
.
BLM
(:);
cell
=
i
obj
.
BLM
=
obj
.
BLM
(:)
+
randn
(
numel
(
obj
.
BLM
),
1
);
obj
.
BLM
=
obj
.
BLM
(:)
+
randn
(
numel
(
obj
.
BLM
),
1
);
sti
=
obj
.
HSTRENGTH
.
read
;
stt
=
sti
;
...
...
@@ -373,7 +376,7 @@ classdef search_obs
ylabel
(
'BLM signal sumed over all orbits'
);
grid
on
end
%%
...
...
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