OMC_FSR = 264.8e6;
OMC_fin = 390; %T1000276
freq9 = 9100230;
freq45 =freq9*5;

T_OMC_9 = 1/(1+(2*OMC_fin*sin(2*pi*freq9/OMC_FSR)/pi)^2);
T_OMC_45 = 1/(1+(2*OMC_fin*sin(2*pi*freq45/OMC_FSR)/pi)^2);

DCPD_A = 20e-3;
DCPD_resp = 0.858; %A/W
DCPD_pwr = DCPD_A/DCPD_resp; 

%power at AS port 48595
a = 0.194;%carrier fraction at AS port
b = 0.743;% 45 MHz fraction at AS port
c = 0.063;% 9 fraction at AS port
Pin = DCPD_pwr/a; %the power on the DCPDs is mostly carrier, assume the OMC transmission is 1, fine for our purposes
P_car = a*Pin;
P_45 = b*T_OMC_45 * Pin;
P_9 = c*T_OMC_9 * Pin;

P_contrast = 2e-3; %mW, this is verry rough

imb_45 = 1.2;
imb_9 = 50/30;
P45_upper = P_45/(1+imb_45);
P45_lower = P45_upper*imb_45;

P9_upper = P_9/(1+imb_9);
P9_lower = P9_upper*imb_9;

rms_CD_45 = sqrt(2*P_45*P_contrast/P_car^2)
rms_CD_9 = sqrt(2*P_9*P_contrast/P_car^2)
rms_imb_45 = (sqrt(P45_lower)-sqrt(P45_upper))/sqrt(2*P_car)
rms_imb_9 = (sqrt(P9_lower)-sqrt(P9_upper))/sqrt(2*P_car)

tot = sqrt(rms_CD_45^2+rms_CD_9^2+rms_imb_45^2+rms_imb_9^2)
