Added shot noise limit calculation to the MATLAB script.

This commit is contained in:
Karthik 2024-09-04 18:07:22 +02:00
parent 285d2a74a3
commit 235a436436
2 changed files with 15 additions and 7 deletions

View File

@ -273,7 +273,6 @@ def plot_psd(data, Sxx, data_str, peak_find = False, peak_find_threshold = -100,
plt.legend(loc = 3, fontsize=12) plt.legend(loc = 3, fontsize=12)
plt.xlabel('Frequency [Hz]', fontsize=14) plt.xlabel('Frequency [Hz]', fontsize=14)
plt.ylabel('PSD [dB/Hz]', fontsize=14) plt.ylabel('PSD [dB/Hz]', fontsize=14)
# plt.title('SNR= %.2f dB' % (SNR_f), fontsize=14)
# Adjust layout # Adjust layout
plt.tight_layout() plt.tight_layout()
@ -325,7 +324,6 @@ def plot_psd(data, Sxx, data_str, peak_find = False, peak_find_threshold = -100,
plt.legend(loc = 3, fontsize=12) plt.legend(loc = 3, fontsize=12)
plt.xlabel('Frequency [Hz]', fontsize=14) plt.xlabel('Frequency [Hz]', fontsize=14)
plt.ylabel('PSD [dB/Hz]', fontsize=14) plt.ylabel('PSD [dB/Hz]', fontsize=14)
# plt.title('SNR= %.2f dB' % (SNR_f), fontsize=14)
# Adjust layout # Adjust layout
plt.tight_layout() plt.tight_layout()
@ -378,7 +376,6 @@ def plot_rin(data, rin, data_str, peak_find = False, peak_find_threshold = -100,
plt.legend(loc = 3, fontsize=12) plt.legend(loc = 3, fontsize=12)
plt.xlabel('Frequency [Hz]', fontsize=14) plt.xlabel('Frequency [Hz]', fontsize=14)
plt.ylabel('RIN [dB/Hz]', fontsize=14) plt.ylabel('RIN [dB/Hz]', fontsize=14)
# plt.title('SNR= %.2f dB' % (SNR_f), fontsize=14)
# Adjust layout # Adjust layout
plt.tight_layout() plt.tight_layout()
@ -421,7 +418,6 @@ def plot_rin(data, rin, data_str, peak_find = False, peak_find_threshold = -100,
plt.legend(loc = 3, fontsize=12) plt.legend(loc = 3, fontsize=12)
plt.xlabel('Frequency [Hz]', fontsize=14) plt.xlabel('Frequency [Hz]', fontsize=14)
plt.ylabel('RIN [dB/Hz]', fontsize=14) plt.ylabel('RIN [dB/Hz]', fontsize=14)
# plt.title('SNR= %.2f dB' % (SNR_f), fontsize=14)
# Adjust layout # Adjust layout
plt.tight_layout() plt.tight_layout()

View File

@ -81,19 +81,31 @@ RIN_bg_smooth = 10*log10(spsd_bg_smooth /(average_P*delta_f));
f = f_s/2 * linspace(0,1,N/2+1); f = f_s/2 * linspace(0,1,N/2+1);
f_smooth = smooth(f,span,'moving'); f_smooth = smooth(f,span,'moving');
% Calculates the shot noise limit of the used PD given the wavelength of the light source and
% incident average power
PlanckConstant = 6.62607015E-34;
SpeedOfLight = 299792458;
WavelengthOfLaserLight = 1064E-9;
FrequencyOfLaserLight = SpeedOfLight / WavelengthOfLaserLight;
QuantumEfficiencyOfPD = 1;
ShotNoiseLimit = 10*log10((2 * PlanckConstant * FrequencyOfLaserLight / QuantumEfficiencyOfPD) * average_P);
%% Plots the RIN
% Plots the RIN vs frequency % Plots the RIN vs frequency
f_ = clf; f_ = clf;
figure(f_); figure(f_);
semilogx(f_smooth,RIN_bg_smooth,'k-') semilogx(f_smooth,RIN_bg_smooth,'k-')
hold on hold on
semilogx(f_smooth,RIN_src_smooth,'r-') semilogx(f_smooth,RIN_src_smooth,'r-')
yline(ShotNoiseLimit,'--b');
xlabel('Frequency [Hz]') xlabel('Frequency [Hz]')
ylabel('RIN [dB/Hz]') ylabel('RIN [dB/Hz]')
xlim([min(f) max(f)]); xlim([10 max(f)]);
title('\bf Relative Intensity Noise of ODT Arm 1') title('\bf Relative Intensity Noise of ODT Arm 1')
legend('Background PD Box', 'Power:7 V, Mod:-3.0 V','Location','NorthEast'); legend('Detector Noise', 'Power:7 V, Mod: 100%, with PID ON', 'Shot-Noise limit','Location','NorthWest');
% text(1e5,-95,['\bf MovingAverage = ' num2str(span) ]); % text(1e5,-95,['\bf MovingAverage = ' num2str(span) ]);
grid on grid on
% optional: save the picture without editing wherever you want % optional: save the picture without editing wherever you want
%------------------------------------------% %------------------------------------------%
% saveas(f_,'FileName','png'); % % saveas(f_,'FileName','png'); %