source: MML/trunk/machine/SOLEIL/common/naff/naffutils/plot_fmap.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 3.3 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.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%% ajoute partie entiere
33fx = 18 + abs(data(:,3));
34fz = 10 + abs(data(:,4));
35
36%% cas si diffusion
37if size(data,2) == 6
38    diffusion = 1;
39    dfx = data(:,5);
40    dfz = data(:,6);
41else
42    clear data
43    diffusion = 0
44end
45
46% select stable particles
47indx=(fx~=18.0);
48
49%%% carte en frequence N&B
50figure;
51subplot(2,1,1)
52plot(fx,fz,'.','MarkerSize',0.5); hold on;
53xlabel('\nu_x', 'interpreter', 'Tex'); ylabel('\nu_z', 'interpreter', 'Tex')
54%axis([18.10 18.30 10.60 10.80])
55
56subplot(2,1,2)
57plot(x(indx),z(indx),'.','MarkerSize',0.5); hold on
58xlabel('x(mm)'); ylabel('z(mm)');
59
60pwd0 = pwd;
61[pathName DirName] = fileparts (pwd0);
62addlabel(0,0, DirName);
63
64% Get Matlab version
65v = ver('matlab');
66
67%% cas diffusion
68if diffusion   
69    figure;  clf
70    xgrid = [];  dfxgrid = []; fxgrid = [];
71    zgrid = [];  dfzgrid = []; fzgrid = [];
72   
73    %% calcul automatique la taille des donnees
74    nz = sum(x==x(1));
75    nx = size(x,1)/nz;
76   
77    xgrid = reshape(x,nz,nx);
78    zgrid = reshape(z,nz,nx);
79    fxgrid = reshape(fx,nz,nx);
80    fzgrid = reshape(fz,nz,nx);
81    dfxgrid = reshape(dfx,nz,nx);
82    dfzgrid = reshape(dfz,nz,nx);
83   
84    %% Diffusion computation and get rid of log of zero
85    temp = sqrt(dfxgrid.*dfxgrid+dfzgrid.*dfzgrid);
86    nonzero = (temp ~= 0);
87    diffu = NaN*ones(size(temp));
88    diffu(nonzero) = log10(temp(nonzero));
89    clear nonzero temp;
90    diffumax = -2; diffumin = -10;
91    diffu(diffu< diffumin) = diffumin; %very stable
92    diffu(diffu> diffumax) = diffumax; %chaotic
93
94    h1=subplot(2,1,1);
95    %% frequency map   
96    if strcmp(v.Release,'(R13SP1)') 
97        h=mesh(fxgrid,fzgrid,diffu,'LineStyle','.','MarkerSize',5.0,'FaceColor','none');
98    else % For Release R14 and later
99        h=mesh(fxgrid,fzgrid,diffu,'Marker','.','MarkerSize',5.0,'FaceColor','none','LineStyle','none');
100    end
101   
102    caxis([-10 -2]); % Echelle absolue
103    view(2); hold on;
104    %axis([18.195 18.27 10.26 10.32])
105    %axis([18.195 18.22 10.28 10.32]) % modif mat oct 09 0.2 0.3
106    %axis([18.15 18.22 10.28 10.36]) % modif mat oct 09 0.202 0.317
107    shading flat
108    xlabel('\nu_x', 'interpreter', 'Tex');  ylabel('\nu_z', 'interpreter', 'Tex');
109    %% colorbar position
110   
111    h2=subplot(2,1,2);
112    %% dynamic aperture
113    pcolor(xgrid,zgrid,diffu); hold on;
114    if xgrid(end) > 0
115        xaxis([0 25])
116    else
117        xaxis([-25 0])
118    end
119    caxis([-10 -2]); % Echelle absolue
120    shading flat;
121    xlabel('x(mm)'); ylabel('z(mm)');
122   
123   
124    %% colorbar position
125    hp=colorbar('location', 'EastOutside');
126    p1 = get(h1,'position'); p2 = get(h2,'position'); p0 = get(hp,'position');
127    set(hp,'position',[p1(1) + 1.03*p1(3) p0(2)  0.03 p1(4)*2.4]);
128    pwd0 = pwd;
129    [pathName DirName] = fileparts (pwd0);
130    addlabel(0,0, DirName);
131end
Note: See TracBrowser for help on using the repository browser.