volker@12: # This Python script will be executed from within the main lidar_correction_ghk.py volker@12: # Probably it will be better in the future to let the main script rather read a conguration file, volker@12: # which might improve the portability of the code within an executable. volker@12: # Due to problems I had with some two letter variables, most variables are now with at least volker@12: # three letters mixed small and capital. volker@12: volker@12: # Header to identify the lidar system volker@12: # Values of DO, DT, and DR etc. from fit to lamp calibrations in Leipzig (LampCalib_2_invers_c_D0=0.opj) volker@12: EID = "xx" # Earlinet station ID volker@12: LID = "example lidar" # Additional lidar ID (short descriptive text) volker@12: # firet fit intern (FITLN1) => DO = 0, DT fixed -0.9998, eta and DR fitted, volker@12: # => internal calib with LinPol before the receiver volker@12: print(" Lidar system :", EID, ", ", LID) volker@12: volker@13: # +++ IL Laser and +-Uncertainty volker@12: bL = 1. #degree of linear polarization; default 1 volker@13: RotL, dRotL, nRotL = 0., 1., 1 #alpha; rotation of laser polarization in degrees; default 0 volker@13: volker@13: # +++ ME Emitter optics and +-Uncertainty; default = no emitter optics volker@13: DiE, dDiE, nDiE = 0.0, 0.1, 0 # Diattenuation volker@13: TiE = 1.0 # Unpolarized transmittance volker@13: RetE, dRetE, nRetE = 0., 180., 0 # Retardance in degrees volker@12: RotE, dRotE, nRotE = 0., 1.0, 0 # beta: Rotation of optical element in degrees volker@12: volker@13: # +++ MO Receiver optics including telescope volker@13: DiO, dDiO, nDiO = 0.0, 0.01, 1 volker@12: TiO = 1.0 volker@13: RetO, dRetO, nRetO = 0., 180., 2 volker@13: RotO, dRotO, nRotO = 0., 0.5, 0 #gamma: Rotation of optical element in degrees volker@13: volker@13: # +++++ PBS MT Transmitting path defined with TS, TP, PolFilter extinction ratio ERaT, and +-Uncertainty volker@13: # --- Polarizing beam splitter transmitting path volker@13: TP, dTP, nTP = 0.95, 0.01, 1 volker@13: TS, dTS, nTS = 0.02, 0.01, 1 volker@13: RetT, dRetT, nRetT = 0.0, 180., 0 # Retardance in degrees volker@13: # --- Pol.Filter behind transmitted path of PBS volker@13: ERaT, dERaT, nERaT = 0.0001, 0.0001, 1 # Extinction ratio volker@13: RotaT, dRotaT, nRotaT = 0., 1., 1 # Rotation of the Pol.-filter in degrees; usually 0° because TP >> TS, but for PollyXTs it can also be 90° volker@13: # -- volker@12: TiT = 0.5 * (TP + TS) volker@12: DiT = (TP-TS)/(TP+TS) volker@12: DaT = (1-ERaT)/(1+ERaT) volker@13: TaT = 0.5*(1+ERaT) volker@12: volker@13: # +++++ PBS MR Reflecting path defined with RS, RP, PolFilter extinction ratio ERaR and +-Uncertainty volker@13: # ---- for PBS without absorption the change of RS and RP must depend on the change of TP and TS. Hence the values and uncertainties are not independent. volker@13: RS_RP_depend_on_TS_TP = True volker@13: # --- Polarizing beam splitter reflecting path volker@13: if(RS_RP_depend_on_TS_TP): volker@13: RP, dRP, nRP = 1-TP, 0.00, 0 # do not change this volker@13: RS, dRS, nRS = 1-TS, 0.00, 0 # do not change this volker@13: else: volker@13: RP, dRP, nRP = 0.05, 0.01, 1 # change this if RS_RP_depend_on_TS_TP = False volker@13: RS, dRS, nRS = 0.98, 0.01, 1 # change this if RS_RP_depend_on_TS_TP = False volker@13: RetR, dRetR, nRetR = 0.0, 180., 0 volker@13: # --- Pol.Filter behind reflected path of PBS volker@13: ERaR, dERaR, nERaR = 0.0001, 0.0001, 1 # Extinction ratio volker@13: RotaR, dRotaR, nRotaR = 90., 1., 1 # Rotation of the Pol.-filter in degrees; usually 90° because RS >> RP, but for PollyXTs it can also be 0° volker@13: # -- volker@12: TiR = 0.5 * (RP + RS) volker@12: DiR = (RP-RS)/(RP+RS) volker@12: DaR = (1-ERaR)/(1+ERaR) volker@13: TaR = 0.5*(1+ERaR) volker@12: volker@13: # +++ Parallel signal detected in the transmitted channel => Y = +1, or in the reflected channel => Y = -1 volker@13: Y = +1. volker@12: volker@13: # +++ Calibrator Location volker@12: LocC = 3 #location of calibrator: 1 = behind laser; 2 = behind emitter; 3 = before receiver; 4 = before PBS volker@12: # --- Calibrator Type used; defined by matrix values below volker@12: TypeC = 3 #Type of calibrator: 1 = mechanical rotator; 2 = hwp rotator (fixed retardation); 3 = linear polarizer; 4 = qwp; 5 = circular polarizer; 6 = real HWP calibration +-22.5° volker@13: # --- MC Calibrator parameters volker@12: if TypeC == 1: #mechanical rotator volker@12: DiC, dDiC, nDiC = 0., 0., 0 volker@12: TiC = 1. volker@12: RetC, dRetC, nRetC = 0., 0., 0 volker@12: RotC, dRotC, nRotC = 0., 0.1, 1 #constant calibrator offset epsilon volker@12: # Rotation error without calibrator: if False, then epsilon = 0 for normal measurements volker@12: RotationErrorEpsilonForNormalMeasurements = True # is in general True for TypeC == 1 calibrator volker@12: elif TypeC == 2: # HWP rotator volker@12: DiC, dDiC, nDiC = 0., 0., 0 volker@12: TiC = 1. volker@12: RetC, dRetC, nRetC = 180., 0., 0 volker@12: #NOTE: use here twice the HWP-rotation-angle volker@12: RotC, dRotC, nRotC = 0.0, 0.1, 1 #constant calibrator offset epsilon volker@12: RotationErrorEpsilonForNormalMeasurements = True # is in general True for TypeC == 2 calibrator volker@12: elif TypeC == 3: # linear polarizer calibrator volker@12: DiC, dDiC, nDiC = 0.9998, 0.0001, 1 # ideal 1.0 volker@12: TiC = 0.505 # ideal 0.5 volker@12: RetC, dRetC, nRetC = 0., 0., 0 volker@12: RotC, dRotC, nRotC = 0.0, 0.1, 1 #constant calibrator offset epsilon volker@12: RotationErrorEpsilonForNormalMeasurements = False # is in general False for TypeC == 3 calibrator volker@12: elif TypeC == 4: # QWP calibrator volker@12: DiC, dDiC, nDiC = 0.0, 0., 0 # ideal 1.0 volker@12: TiC = 1.0 # ideal 0.5 volker@12: RetC, dRetC, nRetC = 90., 0., 0 volker@12: RotC, dRotC, nRotC = 0.0, 0.1, 1 #constant calibrator offset epsilon volker@12: RotationErrorEpsilonForNormalMeasurements = False # is False for TypeC == 4 calibrator volker@12: elif TypeC == 6: # real half-wave plate calibration at +-22.5° => rotated_diattenuator_X22x5deg.odt volker@12: DiC, dDiC, nDiC = 0., 0., 0 volker@12: TiC = 1. volker@12: RetC, dRetC, nRetC = 180., 0., 0 volker@12: #Note: use real HWP angles here volker@12: RotC, dRotC, nRotC = 0.0, 0.1, 1 #constant calibrator offset epsilon -1.15 volker@12: RotationErrorEpsilonForNormalMeasurements = True # is in general True for TypeC == 6 calibrator volker@12: else: volker@12: print ('calibrator not implemented yet') volker@12: sys.exit() volker@12: volker@12: # --- LDRCal assumed atmospheric linear depolarization ratio during the calibration measurements (first guess) volker@13: LDRCal,dLDRCal,nLDRCal= 0.008, 0.003, 0 volker@12: volker@12: # ==================================================== volker@12: # NOTE: there is no need to change anything below. volker@12: volker@12: # --- LDRtrue for simulation of measurement => LDRsim volker@12: LDRtrue = 0.4 volker@12: LDRtrue2 = 0.004 volker@12: volker@12: # --- measured LDRm will be corrected with calculated parameters GHK volker@12: LDRmeas = 0.3 volker@12: volker@12: # --- this is just for correct transfer of the variables to the main file volker@12: RotL0, dRotL, nRotL = RotL, dRotL, nRotL volker@12: # Emitter volker@12: DiE0, dDiE, nDiE = DiE, dDiE, nDiE volker@12: RetE0, dRetE, nRetE = RetE, dRetE, nRetE volker@12: RotE0, dRotE, nRotE = RotE, dRotE, nRotE volker@12: # Receiver volker@12: DiO0, dDiO, nDiO = DiO, dDiO, nDiO volker@12: RetO0, dRetO, nRetO = RetO, dRetO, nRetO volker@12: RotO0, dRotO, nRotO = RotO, dRotO, nRotO volker@12: # Calibrator volker@12: DiC0, dDiC, nDiC = DiC, dDiC, nDiC volker@12: RetC0, dRetC, nRetC = RetC, dRetC, nRetC volker@12: RotC0, dRotC, nRotC = RotC, dRotC, nRotC volker@12: # PBS volker@12: TP0, dTP, nTP = TP, dTP, nTP volker@12: TS0, dTS, nTS = TS, dTS, nTS volker@12: RetT0, dRetT, nRetT = RetT, dRetT, nRetT volker@12: volker@12: ERaT0, dERaT, nERaT = ERaT, dERaT, nERaT volker@12: RotaT0,dRotaT,nRotaT= RotaT,dRotaT,nRotaT volker@12: volker@12: RP0, dRP, nRP = RP, dRP, nRP volker@12: RS0, dRS, nRS = RS, dRS, nRS volker@12: RetR0, dRetR, nRetR = RetR, dRetR, nRetR volker@12: volker@12: ERaR0, dERaR, nERaR = ERaR, dERaR, nERaR volker@12: RotaR0,dRotaR,nRotaR= RotaR,dRotaR,nRotaR volker@12: volker@12: LDRCal0,dLDRCal,nLDRCal=LDRCal,dLDRCal,nLDRCal