Commit 5d2ee6f1 authored by beamdyn's avatar beamdyn

updates done in august restart

parent 03bbbec1
......@@ -13,6 +13,7 @@ function run_by_hand_singlemagnets(MagType,Range,varargin)
[automatic,~]=getflag(varargin,'Automatic');
rips=tango.Device('sy/ps-rips/manager');
SI3=tango.Device('sr/ps-si/3');
npointscan = 7;
nacq=2;
......@@ -87,15 +88,16 @@ for is = 1:length(indmags)
% loop points for a given magnet
ii=0;
jj=0;
BeamCurrent=tango.Device('srdiag/beam-current/total');
while ii < length(mag_values)
% check rips running. if running. reset scan to start from zero
% again
magStrAttr=tango.Attribute([name '/Strength']);
if rips.State==10
if strcmp(SI3.State,'On')
disp('RIPS running set to initial values');
disp('Injection ON, set to initial values');
magStrAttr.set=K0;
pause(10);
if ~magsaved
......@@ -114,12 +116,15 @@ for is = 1:length(indmags)
else
magsaved=false;
ii=ii+1;
I0=BeamCurrent.Current.read;
magStrAttr.set=mag_values(ii);
pause(1);
for nn=1:nacq
jj=jj+1;
TL(jj)=getTotalLosses(1);
I=BeamCurrent.Current.read;
TL(jj)=getTotalLosses(1)*(I0/I)^2;
DS(jj)=mag_values(ii);
end
......@@ -144,7 +149,7 @@ for is = 1:length(indmags)
[mf,ind]=min(f);
Mf=max(f);
RelVariation=(Mf-mf)/((Mf+mf)/2);
if RelVariation>0.005 && RelVariation<0.1 && fitres.p1>0
if RelVariation>0.005 && RelVariation<0.2 && fitres.p1>0
optimal = x(ind);
else
optimal=0;
......
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