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