s2let_plot_curvelet_on_sphere - Plot curvelet coefficients on multiple spheres. This Matlab function i) compute the j-th curvelet, rotated by rho=(alpha, beta, gamma) in harmonic space and reconstruct it on the sphere. ii) generates one plot of the scaling function contribution and a grid of plots for each orientation of each scale of the curvelet contributions. Default usage : s2let_plot_curvelet_on_sphere(alpha, beta, gamma, B, L, J_min, <options>) (alpha, beta, gamma) are the Euler's angles by which we rotate the curvelet B is the wavelet dilation factor L is the angular band-limit. J_min is the first curvelet scale to be probed. Option : 'Spin' = { Spin number; Spin >= 0 (default = 0) } 'SpinLowered' = { true [Apply normalisation factors for spin-lowered wavelets and scaling function.], false [Apply the usual normalisation factors such that the wavelets fulfil the admissibility condition (default)]} 'SpinLoweredFrom' = [integer; if the SpinLowered option is used, this option indicates which spin number the wavelets should be lowered from (default = 0)] 'Reality' = { false [do not assume corresponding signal f real (default)], true [assume f real (improves performance)] } ----------------------------------------------------------- S2LET package to perform Wavelet Transform on the Sphere. Copyright (C) 2012-2016 Boris Leistedt, Jennifer Chan & Jason McEwen See LICENSE.txt for license details -----------------------------------------------------------
0001 function s2let_plot_curvelet_on_sphere(alpha, beta, gamma, B, L, J_min, varargin) 0002 % s2let_plot_curvelet_on_sphere 0003 % - Plot curvelet coefficients on multiple spheres. 0004 % 0005 % This Matlab function 0006 % i) compute the j-th curvelet, rotated by rho=(alpha, beta, gamma) in 0007 % harmonic space and reconstruct it on the sphere. 0008 % ii) generates one plot of the scaling function contribution and 0009 % a grid of plots for each orientation of each scale of the 0010 % curvelet contributions. 0011 % 0012 % Default usage : 0013 % 0014 % s2let_plot_curvelet_on_sphere(alpha, beta, gamma, B, L, J_min, <options>) 0015 % 0016 % (alpha, beta, gamma) are the Euler's angles by which we rotate the curvelet 0017 % B is the wavelet dilation factor 0018 % L is the angular band-limit. 0019 % J_min is the first curvelet scale to be probed. 0020 % 0021 % Option : 0022 % 'Spin' = { Spin number; Spin >= 0 (default = 0) } 0023 % 'SpinLowered' = { true [Apply normalisation factors for spin-lowered 0024 % wavelets and scaling function.], 0025 % false [Apply the usual normalisation factors such 0026 % that the wavelets fulfil the admissibility 0027 % condition (default)]} 0028 % 'SpinLoweredFrom' = [integer; if the SpinLowered option is used, this 0029 % option indicates which spin number the wavelets 0030 % should be lowered from (default = 0)] 0031 % 'Reality' = { false [do not assume corresponding signal f real (default)], 0032 % true [assume f real (improves performance)] } 0033 % 0034 % ----------------------------------------------------------- 0035 % S2LET package to perform Wavelet Transform on the Sphere. 0036 % Copyright (C) 2012-2016 Boris Leistedt, Jennifer Chan & Jason McEwen 0037 % See LICENSE.txt for license details 0038 % ----------------------------------------------------------- 0039 0040 % Parse arguments. 0041 p = inputParser; 0042 p.addRequired('alpha', @isnumeric); 0043 p.addRequired('beta', @isnumeric); 0044 p.addRequired('gamma', @isnumeric); 0045 p.addRequired('B', @isnumeric); 0046 p.addRequired('L', @isnumeric); 0047 p.addRequired('J_min', @isnumeric); 0048 p.addParamValue('Spin', 0, @isnumeric); 0049 p.addParamValue('SpinLowered', false, @islogical); 0050 p.addParamValue('SpinLoweredFrom', 0, @isnumeric); 0051 p.addParamValue('Reality', false, @islogical); 0052 p.addParamValue('Sampling', 'MW', @ischar); 0053 p.parse(alpha, beta, gamma, B, L, J_min, varargin{:}); 0054 args = p.Results; 0055 0056 B = args.B ; 0057 L = args. L; 0058 J_min = args.J_min; 0059 J = s2let_jmax(L, B); 0060 0061 original_spin = 0 ; % if we don't use spin-lowered wavelets (default). 0062 if (args.SpinLowered ~= 0) % For spin-lowered curvelet: 0063 original_spin= args.SpinLoweredFrom; 0064 end 0065 el_min = max(abs(args.Spin), abs(original_spin)); 0066 0067 % Precompute Wigner small-d functions for rotation 0068 % d are the Wigner small-d functions d_lmn for all el, m, n evaluated at beta. They are indexed d(el,m,n), such that 0069 % d has dimensions (L,2*L-1,2*L-1). 0070 % alpha and gamma are the other two rotation angles. 0071 d = zeros(L, 2*L-1, 2*L-1); 0072 d(1,:,:) = ssht_dl(squeeze(d(1,:,:)), L, 0, args.beta); %el_min, beta); 0073 for el = 1:L-1 %el_min:L-1 % 0074 d(el+1,:,:) = ssht_dl(squeeze(d(el,:,:)), L, el, args.beta); 0075 end 0076 0077 % Define plotting parameters 0078 zoomfactor = 1.3; 0079 plot_caxis_scale = 2; 0080 type = 'colour'; 0081 lighting = true; 0082 nx = 3; 0083 ny = 2; 0084 maxfigs = nx*ny; 0085 pltroot = '../../../figs/' ; 0086 configstr = ['Spin',int2str(args.Spin),... 0087 '_L',int2str(L),'_B',int2str(B),... 0088 '_Jmin',int2str(J_min)]; 0089 0090 % ------------ Tile curvelts and the scaling functions --------------- 0091 [cur_lm scal_l] = s2let_curvelet_tiling(B, L, J_min, ... 0092 'Spin', args.Spin, ... 0093 'SpinLowered', args.SpinLowered,... 0094 'SpinLoweredFrom', args.SpinLoweredFrom); 0095 0096 % ------------- 0097 % Plot curvelets: 0098 % ------------- 0099 figure('Position',[0 0 1000 800]) 0100 ind=0; 0101 for j = J_min:J-1 0102 %% Rotate the curvelets coefficients 0103 flm_cur_rot = ssht_rotate_flm(cur_lm{j-J_min+1}(:), d, args.alpha, args.gamma); 0104 if args.Spin == 0 0105 % Compute the function (rotated): 0106 f_cur_rot = ssht_inverse(flm_cur_rot, L, 'Method', args.Sampling, 'Spin', args.Spin, 'Reality', true); 0107 ind = ind + 1; 0108 if ind <= maxfigs 0109 h = subplot(ny, nx, ind); 0110 %% Plot the rotated function on the sphere 0111 ssht_plot_sphere(f_cur_rot, L, 'Type', type, 'Lighting', lighting); 0112 %title(h, ['Curvelet j = ',int2str(j-J_min+1)]) 0113 %locate = get(h,'title'); 0114 %pos = get(locate,'position'); 0115 %pos(1,2) = pos(1,2)+0.7; 0116 %pos(1,1) = pos(1,1)-0.7; 0117 %set(locate,'pos',pos); 0118 v = caxis; 0119 temp = max(abs(v)); 0120 caxis([-temp temp]*plot_caxis_scale); 0121 zoom(zoomfactor) 0122 end 0123 end 0124 0125 if args.Spin > 0 0126 f_cur_rot = ssht_inverse(flm_cur_rot, L, 'Method', args.Sampling,... 0127 'Spin', args.Spin,'Reality', args.Reality); 0128 ind = ind + 1; 0129 if ind <= maxfigs 0130 h = subplot(ny, nx, ind); 0131 ssht_plot_sphere(real(f_cur_rot), L, 'Type', type,'Lighting', lighting); 0132 %title(h, ['Spin Curvelet j = ',int2str(j-J_min+1), ', real part']) 0133 %locate = get(h,'title'); 0134 %pos = get(locate,'position'); 0135 %pos(1,2) = pos(1,2)+0.7; 0136 %pos(1,1) = pos(1,1)-0.7; 0137 %set(locate,'pos',pos); 0138 v = caxis; 0139 temp = max(abs(v)); 0140 caxis([-temp temp]*plot_caxis_scale) 0141 zoom(zoomfactor) 0142 end 0143 0144 ind = ind + 1; 0145 if ind <= maxfigs 0146 h = subplot(ny, nx, ind); 0147 ssht_plot_sphere(imag(f_cur_rot), L, 'Type', type, 'Lighting', lighting); 0148 %title(h, ['Spin Curvelet j = ',int2str(j-J_min+1), ', imag part']) 0149 %locate = get(h,'title'); 0150 %pos = get(locate,'position'); 0151 %pos(1,2) = pos(1,2)+0.7; 0152 %pos(1,1) = pos(1,1)-0.7; 0153 %set(locate,'pos',pos); 0154 v = caxis; 0155 temp = max(abs(v)); 0156 caxis([-temp temp]*plot_caxis_scale) 0157 zoom(zoomfactor) 0158 end 0159 0160 ind = ind + 1; 0161 if ind <= maxfigs 0162 h = subplot(ny, nx, ind); 0163 ssht_plot_sphere(abs(f_cur_rot), L, 'Type', type,'Lighting', lighting); 0164 %title(h, ['Spin Curvelet j = ',int2str(j-J_min+1), ', abs part']) 0165 %locate = get(h,'title'); 0166 %pos = get(locate,'position'); 0167 %pos(1,2) = pos(1,2)+0.7; 0168 %pos(1,1) = pos(1,1)-0.7; 0169 %set(locate,'pos',pos); 0170 v = caxis; 0171 temp = max(abs(v)); 0172 caxis([-temp temp]*plot_caxis_scale) 0173 zoom(zoomfactor) 0174 end 0175 end 0176 end 0177 % output as png file 0178 colormap(jet) 0179 fname = [pltroot,'s2let_plotfn_', configstr, '_cur_jet.png'] 0180 print('-r200', '-dpng', fname); 0181 0182 % ------------- 0183 % Plot scaling functions 0184 % ------------- 0185 figure('Position',[100 100 300 300]) 0186 h=subplot(1, 1, 1); 0187 f = ssht_inverse(scal_l, L, 'Reality', true); 0188 ssht_plot_sphere(f, L, 'Type', type, 'Lighting', lighting); 0189 % 0190 title(h,'Scaling function') 0191 locate = get(h,'title'); 0192 pos = get(locate,'position'); 0193 pos(1,2) = pos(1,2)+0.7; 0194 pos(1,1) = pos(1,1)-0.7; 0195 set(locate,'pos',pos); 0196 zoom(1.2) 0197 v = caxis; 0198 temp = max(abs(v)); 0199 caxis([-temp temp]*plot_caxis_scale) 0200 % output as png file 0201 colormap(jet) 0202 fname = [pltroot,'s2let_plotfn_', configstr, '_scal_jet.png'] 0203 print('-r200', '-dpng', fname); 0204