Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BeamDynamics
matutil
Commits
7b0d6db1
Commit
7b0d6db1
authored
Oct 13, 2018
by
beamdyn
Browse files
modifications by A.Franchi
parent
f6fe57bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
qem/FitLocalErrors/FitLocalErrors.m
View file @
7b0d6db1
...
...
@@ -67,6 +67,7 @@ qemres.ql(qemres.ql==0) = 1; % integrated strengths;
% hw=waitbar(0,'Fitting quadrupole strengths (analytic)...');
% dispfunc=@(i,itot) waitbar(i/itot,hw);
dispfunc
=@
(
a
,
b
)
disp
([
'Fitting quadrupole strengths (analytic): '
num2str
(
a
)
'/'
num2str
(
b
)]);
okbpm
(
1
:
224
)
=
true
;
okbpm
=
okbpm
'
;
% added by Andrea
okbpm
(
qemres
.
wrongbpms
)
=
false
;
shidx
=
qemres
.
steerhidx
(
qemres
.
hlist
);
...
...
@@ -80,6 +81,8 @@ dpp=o0(5);
dresp
=
qemderivAnalytic
(
qemb
(
2
)
.
at
,
dpp
,
@
setk
,
0.0001
,
qemres
.
qpidx
,
qemres
.
bpmidx
,
shidx
,
svidx
,
dispfunc
);
drespskew
=
semquadrespAnalytic
(
qemb
(
2
),
qemres
,
semres
);
% save -ascii pippo.txt dresp;
% return;
% load RM
wrongbpms
=
qemres
.
wrongbpms
;
% find(bpmm.All_Status.read~=0)
...
...
@@ -127,9 +130,14 @@ if ~isfield(mode,'vnorm')
mode
.
vnorm
=
vv
(
okfit
)
'
;
end
mode
.
nsets
=
4
;
mode
.
neigs
=
length
(
errorlocation
);
mode
.
tuneweight
=
0
;
mode
.
dispweight
=
0
;
kn
=
qemerrfit
(
nhst
,
nvst
,
resp
-
resp0
,
dresp
,
mode
,
okbpm
);
mode
=
struct
(
'
vnorm
'
,
sqrt
([
0.77
;
2
;
0.9
;
1.15
;
1.15
;
0.9
;
2
;
1
])
)
;
mode
.
vnorm
=
sqrt
([
0.77
;
2
;
0.9
;
1.15
;
1.15
;
0.9
;
2
;
1
]);
resps
(
isnan
(
resps
))
=
0
;
resps0
(
isnan
(
resps0
))
=
0
;
...
...
@@ -137,12 +145,14 @@ resps0(isnan(resps0))=0;
ks
=
semerrfit
(
length
(
semres
.
hlist
),
length
(
semres
.
vlist
),
resps
-
resps0
,
...
drespskew
,
mode
);
knl
=
kn
.*
Lthin
;
ksl
=
ks
.*
Lthin
;
knl
=
kn
;
ksl
=
ks
;
% display fit residual
disp
([
'residual on- diagonal blocks: '
num2str
(
std2
(
resp
-
resp0
))
'->'
...
num2str
(
std2
(
resp
-
resp0
-
dresp
*
kn
))])
rm_in
=
(
resp
-
resp0
);
rm_in
(
end
-
length
(
qemres
.
bpmidx
)
-
2
:
end
)
=
[];
dresp
(
end
-
length
(
qemres
.
bpmidx
)
-
2
:
end
)
=
[];
disp
([
'residual on- diagonal blocks: '
num2str
(
std2
(
rm_in
))
'->'
...
num2str
(
std2
(
rm_in
-
dresp
*
kn
))])
disp
([
'residual off-diagonal blocks: '
num2str
(
std2
(
resps
-
resps0
))
'->'
...
num2str
(
std2
(
resps
-
resps0
-
drespskew
*
ks
))])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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