source: MML/trunk/machine/SOLEIL/common/naff/naffutils/plot_fmap_version_mat_mesure.m @ 17

Last change on this file since 17 was 17, checked in by zhangj, 10 years ago

To have a stable version on the server.

  • Property svn:executable set to *
File size: 3.4 KB
Line 
1function plot_fmap(file)
2%  PLOT_FMAP - Plots frequency map
3%  plot_fmap('fmap.out')
4%
5%  INPUTS
6%  1. file - filename for plotting frequency maps (output file from Tracy
7%  II)
8%
9%  See also naffgui, plot_fmapdp
10
11% Written by Laurent S. Nadolski, SOLEIL, 03/04
12% Modifications for R14 compatibility, June'05
13
14%% grille par defaut
15set(0,'DefaultAxesXgrid','on');
16set(0,'DefaultAxesZgrid','on');
17
18if nargin <1
19  help (mfilename)
20  file ='fmap_mesure.out';
21end
22
23try
24    [header data] = hdrload(file);
25catch
26    error('Error while opening filename %s ',file)
27end
28
29%% dimensions en mm
30x = data(:,1)*1e3;
31z = data(:,2)*1e3;
32%% courant
33dI = data(:,5);
34%% ajoute partie entiere
35fx = 18 + abs(data(:,3));
36fz = 10 + abs(data(:,4));
37
38%% cas si diffusion
39if size(data,2) == 6
40    diffusion = 1;
41    dfx = data(:,5);
42    dfz = data(:,6);
43else
44    clear data
45    diffusion = 0
46end
47
48% select stable particles
49%indx=(fx~=18.0);
50indx=(floor(fx)==18);
51%%% carte en frequence N&B
52figure(1000); hold on;
53subplot(2,1,1)
54plot(fx,fz,'ko','MarkerSize',1.8); hold on;
55xlabel('\nu_x', 'interpreter', 'Tex'); ylabel('\nu_z', 'interpreter', 'Tex')
56axis([18.19 18.22 10.30 10.33])
57
58subplot(2,1,2)
59xa = x(indx);za = z(indx);dIa = dI(indx);
60for i=1:length(xa)
61    hold on ;plot(xa(i),za(i),'ko','MarkerSize',dIa(i));% on prend en compte les pertes en courant
62end
63xlabel('x(mm)'); ylabel('z(mm)');
64
65pwd0 = pwd;
66[pathName DirName] = fileparts (pwd0);
67addlabel(0,0, DirName);
68
69% Get Matlab version
70v = ver('matlab');
71
72%% cas diffusion
73if diffusion   
74    figure;  clf
75    xgrid = [];  dfxgrid = []; fxgrid = [];
76    zgrid = [];  dfzgrid = []; fzgrid = [];
77   
78    %% calcul automayique la taille des donnees
79    nz = sum(x==x(1));
80    nx = size(x,1)/nz;
81   
82    xgrid = reshape(x,nz,nx);
83    zgrid = reshape(z,nz,nx);
84    fxgrid = reshape(fx,nz,nx);
85    fzgrid = reshape(fz,nz,nx);
86    dfxgrid = reshape(dfx,nz,nx);
87    dfzgrid = reshape(dfz,nz,nx);
88   
89    %% Diffusion computation and get rid of log of zero
90    temp = sqrt(dfxgrid.*dfxgrid+dfzgrid.*dfzgrid);
91    nonzero = (temp ~= 0);
92    diffu = NaN*ones(size(temp));
93    diffu(nonzero) = log10(temp(nonzero));
94    clear nonzero temp;
95    diffumax = -2; diffumin = -10;
96    diffu(diffu< diffumin) = diffumin; % very stable
97    diffu(diffu> diffumax) = diffumax; %chaotic
98
99    h1=subplot(2,1,1);
100    %% frequency map   
101    if strcmp(v.Release,'(R13SP1)') 
102        h=mesh(fxgrid,fzgrid,diffu,'LineStyle','.','MarkerSize',5.0,'FaceColor','none');
103    else % For Release R14 and later
104        h=mesh(fxgrid,fzgrid,diffu,'Marker','.','MarkerSize',5.0,'FaceColor','none','LineStyle','none');
105    end
106   
107    caxis([-10 -2]); % Echelle absolue
108    view(2); hold on;
109    %axis([18.195 18.27 10.26 10.32])
110    shading flat
111    xlabel('\nu_x', 'interpreter', 'Tex');  ylabel('\nu_z', 'interpreter', 'Tex');
112    %% colorbar position
113   
114    h2=subplot(2,1,2);
115    %% dynamic aperture
116    pcolor(xgrid,zgrid,diffu); hold on;
117    if xgrid(end) > 0
118        xaxis([0 25])
119    else
120        xaxis([-25 0])
121    end
122    caxis([-10 -2]); % Echelle absolue
123    shading flat;
124    xlabel('x(mm)'); ylabel('z(mm)');
125   
126   
127    %% colorbar position
128    hp=colorbar('location', 'EastOutside');
129    p1 = get(h1,'position'); p2 = get(h2,'position'); p0 = get(hp,'position');
130    set(hp,'position',[p1(1) + 1.03*p1(3) p0(2)  0.03 p1(4)*2.4]);
131    pwd0 = pwd;
132    [pathName DirName] = fileparts (pwd0);
133    addlabel(0,0, DirName);
134end
Note: See TracBrowser for help on using the repository browser.