Commit dfd2b168 authored by Leon Merten Lohse's avatar Leon Merten Lohse
Browse files

adapt scaling of x-axis in checkFresnelNumber

frequency axis is now scaled such the first minimum of the CTF is on 1
fix #3
parent 27f98c87
Pipeline #110665 passed with stage
in 1 minute and 37 seconds
...@@ -82,28 +82,28 @@ hologram = fadeoutImage(hologram); ...@@ -82,28 +82,28 @@ hologram = fadeoutImage(hologram);
hologramPSDAngularAvg = angularAverage(powerSpectralDensity(double(hologram))); hologramPSDAngularAvg = angularAverage(powerSpectralDensity(double(hologram)));
% Fourier-frequencies corresponding to the PSD-values, normalized with Fresnel number % Fourier-frequencies corresponding to the PSD-values, normalized with Fresnel number
fourierFreqs = fftfreq(size(hologram,1)); fourierFreqs = fftfreq(size(hologram,1), 2 * pi);
fourierFreqs = fourierFreqs(1:ceil(end/2)) ./ sqrt(4*pi*fresnelNumberExpected); fourierFreqs = fourierFreqs(1:ceil(end/2)) ./ (sqrt(fresnelNumberExpected));
% Restrict the frequency range to the specified number of CTF-periods % Restrict the frequency range to the specified number of CTF-periods
maxFreq = sqrt(2*pi*settings.maxNumPlottedCTFPeriods); maxFreq = sqrt(settings.maxNumPlottedCTFPeriods);
hologramPSDAngularAvg = hologramPSDAngularAvg(fourierFreqs < maxFreq);
fourierFreqs = fourierFreqs(fourierFreqs < maxFreq);
% Compute expected contrast-transfer-function CTF with fine sampling % Compute expected contrast-transfer-function CTF with fine sampling
fourierFreqsCTF = linspace(0, min(pi./sqrt(4*pi*fresnelNumberExpected), maxFreq), 10000).'; fourierFreqsCTF = linspace(0, 1.05 * maxFreq, 10000).';
ctfExpected = (sin(fourierFreqsCTF.^2) + settings.betaDeltaRatio * cos(fourierFreqsCTF.^2)).^2; ctfExpected = (sin(pi * fourierFreqsCTF.^2) + settings.betaDeltaRatio * cos(pi * fourierFreqsCTF.^2)).^2;
% Scale CTF for better visibility in joint plot with PSD % Scale CTF for better visibility in joint plot with PSD
minPSD = min(hologramPSDAngularAvg(:)); mask = (fourierFreqs < maxFreq) & (fourierFreqs > 0.25);
maxPSDHighFreq = max(hologramPSDAngularAvg(fourierFreqs > sqrt(pi/2))); minPSD = min(hologramPSDAngularAvg(mask));
maxPSDHighFreq = max(hologramPSDAngularAvg(mask));
ctfExpected = (maxPSDHighFreq./max(ctfExpected(:))) * ctfExpected; ctfExpected = (maxPSDHighFreq./max(ctfExpected(:))) * ctfExpected;
% Jointly plot computed PSD and expected CTF with logarithmic y-axis % Jointly plot computed PSD and expected CTF with logarithmic y-axis
figure; plot(fourierFreqs, hologramPSDAngularAvg, '-b', fourierFreqsCTF, ctfExpected, '--r'); figure; plot(fourierFreqs, hologramPSDAngularAvg, '-b', fourierFreqsCTF, ctfExpected, '--r');
set(gca, 'YScale', 'log'); set(gca, 'YScale', 'log');
ylim([0.8*minPSD, 1.25*maxPSDHighFreq]); ylim([0.8*minPSD, 1.25*maxPSDHighFreq]);
xlim([0, maxFreq]); xlim([0, 1.05 * maxFreq]);
xlabel('k / F^{1/2}')
legend({'PSD(hologram)', 'expected CTF'}, 'location', 'northeast'); legend({'PSD(hologram)', 'expected CTF'}, 'location', 'northeast');
title(['Check that the location of the minima in the two curves coincide. ', ... title(['Check that the location of the minima in the two curves coincide. ', ...
'If the minima differ systematically, the entered Fresnel number is probably wrong']); 'If the minima differ systematically, the entered Fresnel number is probably wrong']);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment