atcollab / at

Accelerator Toolbox
Apache License 2.0
50 stars 33 forks source link

atdynap question #374

Open lnadolski opened 2 years ago

lnadolski commented 2 years ago

Dear All,

Why the function dynaper as this split between positive and negative DA

for i=1:np+3 [xx(i),zz(i)]=bscan(ring,nt,clorb,... xpmaxcos(t1(i))slist,zmaxsin(t1(i))slist); end for i=np+4:2np+3 [xx(i),zz(i)]=bscan(ring,nt,clorb,... xmmaxcos(t1(i))slist,zmaxsin(t1(i))*slist); end

instead of for i=1:np+2 [xx(i),zz(i)]=bscan(ring,nt,clorb,... xpmaxcos(t1(i))slist,zmaxsin(t1(i))slist); end for i=np+3:2np+3 [xx(i),zz(i)]=bscan(ring,nt,clorb,... xmmaxcos(t1(i))slist,zmaxsin(t1(i))*slist); end

lfarv commented 2 years ago

Maybe @simoneliuzzo can answer the question?

simoneliuzzo commented 2 years ago

I am not an author of atdynap. I actually agree with @lnadolski . I never noticed! I do not use much atdynap, a part for quick tests. Below two figures.

v = load('~/beamdyn/EBSlattices/AT/S28F.mat');

NT = 100;

diary('out_atdynap.m')
tic;
[x,y]=atdynap(v.r,NT);
t=toc;
disp(t);
diary off;

diary('out_atdynap_indexing.m');
tic;
[xi,yi]=atdynap_indexing(v.r,NT);
t1=toc;
disp(t1);
diary off;

%% 
figure;
plot(x,y,'x-','DisplayName','atdynap','MarkerSize',12); hold on;
plot(xi,yi,'o:','DisplayName','indexing change','MarkerSize',12);
xlabel( 'x [m]' );
ylabel( 'y [m]' );
legend('Location','south');
Screenshot 2022-03-21 at 08 51 42 Screenshot 2022-03-21 at 08 51 50