Minor modifications to labels, changed computation of spectral weight.
This commit is contained in:
parent
d4c0dc3f07
commit
88febbd045
@ -1,8 +1,8 @@
|
||||
%% Parameters
|
||||
|
||||
groupList = ["/images/MOT_3D_Camera/in_situ_absorption", "/images/ODT_1_Axis_Camera/in_situ_absorption", "/images/ODT_2_Axis_Camera/in_situ_absorption", "/images/Horizontal_Axis_Camera/in_situ_absorption", "/images/Vertical_Axis_Camera/in_situ_absorption"];
|
||||
|
||||
|
||||
groupList = ["/images/MOT_3D_Camera/in_situ_absorption", "/images/ODT_1_Axis_Camera/in_situ_absorption", ...
|
||||
"/images/ODT_2_Axis_Camera/in_situ_absorption", "/images/Horizontal_Axis_Camera/in_situ_absorption", ...
|
||||
"/images/Vertical_Axis_Camera/in_situ_absorption"];
|
||||
|
||||
folderPath = "C:/Users/Karthik/Documents/GitRepositories/Calculations/Data-Analyzer/";
|
||||
|
||||
@ -80,7 +80,7 @@ end
|
||||
%% Run Fourier analysis over images
|
||||
|
||||
fft_imgs = cell(1, nimgs);
|
||||
integrated_sf = zeros(1, nimgs);
|
||||
spectral_weight = zeros(1, nimgs);
|
||||
|
||||
% Create VideoWriter object for movie
|
||||
videoFile = VideoWriter('Single_Shot_FFT.mp4', 'MPEG-4');
|
||||
@ -127,8 +127,8 @@ for k = 1 : length(od_imgs)
|
||||
set(gca,'YDir','normal')
|
||||
set(gca, 'YTick', linspace(y_min, y_max, 5)); % Define y ticks
|
||||
set(gca, 'YTickLabel', flip(linspace(y_min, y_max, 5))); % Flip only the labels
|
||||
hXLabel = xlabel('X (pixels)', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('Y (pixels)', 'Interpreter', 'tex');
|
||||
hXLabel = xlabel('x (pixels)', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('y (pixels)', 'Interpreter', 'tex');
|
||||
hTitle = title('OD Image', 'Interpreter', 'tex');
|
||||
set([hXLabel, hYLabel, hL, hText], 'FontName', font)
|
||||
set([hXLabel, hYLabel, hL], 'FontSize', 14)
|
||||
@ -143,8 +143,8 @@ for k = 1 : length(od_imgs)
|
||||
set(gca,'YDir','normal')
|
||||
set(gca, 'YTick', linspace(y_min, y_max, 5)); % Define y ticks
|
||||
set(gca, 'YTickLabel', flip(linspace(y_min, y_max, 5))); % Flip only the labels
|
||||
hXLabel = xlabel('X (pixels)', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('Y (pixels)', 'Interpreter', 'tex');
|
||||
hXLabel = xlabel('x (pixels)', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('y (pixels)', 'Interpreter', 'tex');
|
||||
hTitle = title('Denoised - Masked - Binarized', 'Interpreter', 'tex');
|
||||
|
||||
set([hXLabel, hYLabel], 'FontName', font)
|
||||
@ -170,9 +170,9 @@ for k = 1 : length(od_imgs)
|
||||
colormap(ax3, 'jet');
|
||||
set(gca, 'FontSize', 14); % For tick labels only
|
||||
set(gca,'YDir','normal')
|
||||
hXLabel = xlabel('X (pixels)', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('Y (pixels)', 'Interpreter', 'tex');
|
||||
hTitle = title('Fourier Power Spectrum', 'Interpreter', 'tex');
|
||||
hXLabel = xlabel('k_x', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('k_y', 'Interpreter', 'tex');
|
||||
hTitle = title('Power Spectrum - |S(k_x,k_y)|^2', 'Interpreter', 'tex');
|
||||
set([hXLabel, hYLabel, hText], 'FontName', font)
|
||||
set([hXLabel, hYLabel], 'FontSize', 14)
|
||||
set(hTitle, 'FontName', font, 'FontSize', 16, 'FontWeight', 'bold'); % Set font and size for title
|
||||
@ -190,13 +190,13 @@ for k = 1 : length(od_imgs)
|
||||
%}
|
||||
% Plot the angular structure factor
|
||||
nexttile
|
||||
[theta_vals, S_theta] = computeAngularStructureFactor(zoomedIMGFFT, 10, 20, 180, 75, 2);
|
||||
integrated_sf(k) = trapz(theta_vals, S_theta);
|
||||
[theta_vals, S_theta] = computeNormalizedAngularSpectralDistribution(zoomedIMGFFT, 10, 20, 180, 75, 2);
|
||||
spectral_weight(k) = trapz(theta_vals, sqrt(S_theta));
|
||||
plot(theta_vals/pi, S_theta,'Linewidth',2);
|
||||
set(gca, 'FontSize', 14); % For tick labels only
|
||||
hXLabel = xlabel('\theta (\pi)', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('S(\theta)', 'Interpreter', 'tex');
|
||||
hTitle = title('Angular Structure Factor', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('Normalized magnitude (a.u.)', 'Interpreter', 'tex');
|
||||
hTitle = title('Angular Spectral Distribution - |S(\theta)|^2', 'Interpreter', 'tex');
|
||||
set([hXLabel, hYLabel, hText], 'FontName', font)
|
||||
set([hXLabel, hYLabel], 'FontSize', 14)
|
||||
set(hTitle, 'FontName', font, 'FontSize', 16, 'FontWeight', 'bold'); % Set font and size for title
|
||||
@ -213,9 +213,9 @@ end
|
||||
% Close the video file
|
||||
close(videoFile);
|
||||
|
||||
%% Track integrated structure factor across the transition
|
||||
%% Track spectral weight across the transition
|
||||
|
||||
% Assuming theta_values and integrated_sf are column vectors (or row vectors of same length)
|
||||
% Assuming theta_values and spectral_weight are column vectors (or row vectors of same length)
|
||||
[unique_theta, ~, idx] = unique(theta_values);
|
||||
|
||||
% Preallocate arrays
|
||||
@ -224,7 +224,7 @@ stderr_sf = zeros(size(unique_theta));
|
||||
|
||||
% Loop through each unique theta and compute mean and standard error
|
||||
for i = 1:length(unique_theta)
|
||||
group_vals = integrated_sf(idx == i);
|
||||
group_vals = spectral_weight(idx == i);
|
||||
mean_sf(i) = mean(group_vals);
|
||||
stderr_sf(i) = std(group_vals) / sqrt(length(group_vals)); % standard error = std / sqrt(N)
|
||||
end
|
||||
@ -235,7 +235,7 @@ errorbar(unique_theta, mean_sf, stderr_sf, 'o--', ...
|
||||
'LineWidth', 1.5, 'MarkerSize', 6, 'CapSize', 5);
|
||||
set(gca, 'FontSize', 14); % For tick labels only
|
||||
hXLabel = xlabel('\alpha (degrees)', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('Integrated S(\theta)', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('Spectral Weight', 'Interpreter', 'tex');
|
||||
hTitle = title('Change during rotation', 'Interpreter', 'tex');
|
||||
set([hXLabel, hYLabel], 'FontName', font)
|
||||
set([hXLabel, hYLabel], 'FontSize', 14)
|
||||
@ -293,7 +293,7 @@ for i = 1:optimalClusters
|
||||
end
|
||||
|
||||
hXLabel = xlabel('\alpha (degrees)', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('Integrated S(\theta)', 'Interpreter', 'tex');
|
||||
hYLabel = ylabel('Spectral Weight', 'Interpreter', 'tex');
|
||||
hTitle = title('Regimes identified by k-means clustering', 'Interpreter', 'tex');
|
||||
set([hXLabel, hYLabel], 'FontName', font)
|
||||
set([hXLabel, hYLabel], 'FontSize', 14)
|
||||
@ -379,7 +379,7 @@ function [IMGFFT, IMGBIN] = computeFourierTransform(I)
|
||||
|
||||
end
|
||||
|
||||
function [theta_vals, S_theta] = computeAngularStructureFactor(IMGFFT, r_min, r_max, num_bins, threshold, sigma)
|
||||
function [theta_vals, S_theta] = computeNormalizedAngularSpectralDistribution(IMGFFT, r_min, r_max, num_bins, threshold, sigma)
|
||||
% Apply threshold to isolate strong peaks
|
||||
IMGFFT(IMGFFT < threshold) = 0;
|
||||
|
||||
@ -413,7 +413,7 @@ function [theta_vals, S_theta] = computeAngularStructureFactor(IMGFFT, r_min, r_
|
||||
fft_angle = IMGFFT .* bin_mask;
|
||||
|
||||
% Integrate the Fourier components over the radius at the angle
|
||||
S_theta(i) = sum(sum(abs(fft_angle).^2)); % Compute structure factor (sum of squared magnitudes)
|
||||
S_theta(i) = sum(sum(abs(fft_angle).^2)); % sum of squared magnitudes
|
||||
end
|
||||
|
||||
% Create a 1D Gaussian kernel
|
||||
@ -426,9 +426,8 @@ function [theta_vals, S_theta] = computeAngularStructureFactor(IMGFFT, r_min, r_
|
||||
S_theta = conv([S_theta(end-half_width+1:end), S_theta, S_theta(1:half_width)], gauss_kernel, 'same');
|
||||
S_theta = S_theta(half_width+1:end-half_width); % crop back to original size
|
||||
|
||||
% Normalize to maximum value of 1
|
||||
% Normalize to 1
|
||||
S_theta = S_theta / max(S_theta);
|
||||
|
||||
end
|
||||
|
||||
function ret = getBkgOffsetFromCorners(img, x_fraction, y_fraction)
|
||||
|
Loading…
Reference in New Issue
Block a user