%read CSV file filename = 'C:\Users\Karthik\Documents\Git Repos\ULE Cavity Characterisitics\TransmissionCurve_ULECavity.csv'; delimiter = ','; startRow = 1; formatSpec = '%f%f'; fileID = fopen(filename,'r'); dataset = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'EmptyValue', NaN, 'ReturnOnError', false, 'EndOfLine', '\r\n'); fclose(fileID); wavelengths = dataset{1}; transmission = dataset{2}; f_h = Helper.getFigureByTag('CavityCharacteristics'); set(groot,'CurrentFigure',f_h); a_h = get(f_h, 'CurrentAxes'); if ~isempty(get(a_h, 'Children')) clf(f_h); end f_h.Name = 'Wavelength dependence'; f_h.Units = 'pixels'; set(0,'units','pixels'); screensize = get(0,'ScreenSize'); f_h.Position = [[screensize(3)/30 screensize(4)/4] 1812 429]; clf; W = 600:1:850; T = interp1(wavelengths(51:149), transmission(51:149), W); subplot(1,3,1) plot(wavelengths,transmission,'o', 'MarkerSize', 5); hold on plot(W, T,':.'); FSR = 1.5e+9; T_626 = T(W==626) * 1e-2; R_626 = 1 - T_626; T_842 = T(W==842) * 1e-2; R_842 = 1 - T_842; F_626 = pi * sqrt(R_626) / (1 - R_626); F_842 = pi * sqrt(R_842) / (1 - R_842); L_626 = FSR / F_626; L_842 = FSR / F_842; R = 1 - (T * 1e-2); F = pi .* sqrt(R) ./ (1 - R); L = FSR ./ F; % plot(626, T_626 * 1e2, 'o', 'MarkerSize', 15, 'LineWidth', 3) % line([626 626], [0 0.06],'Color',[0.9586 0.7372 0.2537],'LineStyle','--') % line([500 1000], [T_626 T_626] * 1e2,'Color',[0.9586 0.7372 0.2537],'LineStyle','--') text(630, T_626 * 1e2 - 0.002, sprintf('R @ 626 = %.5f', R_626), 'FontSize' , 10) % text(630, T_626 * 1e2 - 0.006, sprintf('F = %.3f', F_626), 'FontSize' , 10) % annotation('arrow', [0.293 0.293], [0.11 0.3]); % plot(842, T_842 * 1e2, 'o', 'MarkerSize', 15, 'LineWidth', 3) % line([842 842], [0 0.06],'Color','red','LineStyle','--') % line([500 1000], [T_842 T_842] * 1e2,'Color','red','LineStyle','--') text(825, T_842 * 1e2 + 0.006, sprintf('R @ 842 = %.5f', R_842), 'FontSize' , 10) % text(846, T_842 * 1e2 + 0.002, sprintf('F = %.3f', F_842), 'FontSize' , 10) % annotation('arrow', [0.571 0.571], [0.11 0.2]); hold off hXLabel = xlabel('Wavelength (nm)'); hYLabel = ylabel('Mirror Transmission T(%)'); set([hXLabel, hYLabel] , ... 'FontSize' , 14 ); grid on subplot(1,3,2) plot(W, F * 1e-4) text(626, F_626 * 1e-4 + 0.2, sprintf('F @ 626 = %1.f', F_626), 'FontSize' , 10) text(750, F_842 * 1e-4 - 0.5, sprintf('F @ 842 = %1.f', F_842), 'FontSize' , 10) hXLabel = xlabel('Wavelength (nm)'); hYLabel = ylabel('Finesse (x 10^{4})'); set([hXLabel, hYLabel] , ... 'FontSize' , 14 ); grid on subplot(1,3,3) plot(W, L * 1e-3) text(626, L_626 * 1e-3 - 5, sprintf('L @ 626 = %1.f kHz', L_626* 1e-3), 'FontSize' , 10) text(750, L_842 * 1e-3 + 12, sprintf('L @ 842 = %1.f kHz', L_842* 1e-3), 'FontSize' , 10) hXLabel = xlabel('Wavelength (nm)'); hYLabel = ylabel('Linewidth (kHz)'); set([hXLabel, hYLabel] , ... 'FontSize' , 14 ); grid on hTitle = sgtitle('SLS ULE Cavity Characterisitics'); set( hTitle , ... 'FontSize' , 18 );