|
1 # This Python script will be executed from within the main lidar_correction_ghk.py |
|
2 # Probably it will be better in the future to let the main script rather read a conguration file, |
|
3 # which might improve the portability of the code within an executable. |
|
4 # Due to problems I had with some two letter variables, most variables are now with at least |
|
5 # three letters mixed small and capital. |
|
6 |
|
7 # Header to identify the lidar system |
|
8 # Values of DO, DT, and DR etc. from fit to lamp calibrations in Leipzig (LampCalib_2_invers_c_D0=0.opj) |
|
9 EID = "xx" # Earlinet station ID |
|
10 LID = "example lidar" # Additional lidar ID (short descriptive text) |
|
11 # firet fit intern (FITLN1) => DO = 0, DT fixed -0.9998, eta and DR fitted, |
|
12 # => internal calib with LinPol before the receiver |
|
13 print(" Lidar system :", EID, ", ", LID) |
|
14 |
|
15 |
|
16 # --- IL Laser IL and +-Uncertainty |
|
17 bL = 1. #degree of linear polarization; default 1 |
|
18 RotL, dRotL, nRotL = 90, 1., 0 #alpha; rotation of laser polarization in degrees; default 0 |
|
19 # --- ME Emitter and +-Uncertainty |
|
20 DiE, dDiE, nDiE = 0., 0.1, 0 # Diattenuation |
|
21 TiE = 1. # Unpolarized transmittance |
|
22 RetE, dRetE, nRetE = 0., 180.0, 0 # Retardance in degrees |
|
23 RotE, dRotE, nRotE = 0., 1.0, 0 # beta: Rotation of optical element in degrees |
|
24 |
|
25 # --- MO Receiver Optics including telescope |
|
26 DiO, dDiO, nDiO = 0.0, 0.0022, 0 |
|
27 TiO = 1.0 |
|
28 RetO, dRetO, nRetO = 0., 180.0, 0 |
|
29 RotO, dRotO, nRotO = 0., 0.5, 0 #gamma |
|
30 |
|
31 # --- PBS MT transmitting path defined with TS, TP, PolFilter extinction ratio ERaT, and +-Uncertainty |
|
32 # --- Polarizing beam splitter |
|
33 TP, dTP, nTP = 0.512175, 0.0024, 1 |
|
34 TS, dTS, nTS = 1-TP, 0.02, 0 |
|
35 TiT = 0.5 * (TP + TS) |
|
36 DiT = (TP-TS)/(TP+TS) |
|
37 RetT, dRetT, nRetT = 0., 180., 0 # Retardance in degrees |
|
38 # --- Pol.Filter |
|
39 ERaT, dERaT, nERaT = 0.0001, 0.0001, 1 # Extinction ratio |
|
40 RotaT, dRotaT, nRotaT = 90., 2., 0 # Rotation of the pol.-filter in degrees |
|
41 DaT = (1-ERaT)/(1+ERaT) |
|
42 TaT = 0.5*(1+ERaT) |
|
43 |
|
44 # --- PBS MR reflecting path defined with RS, RP, PolFilter extinction ratio ERaR and +-Uncertainty |
|
45 # --- Polarizing beam splitter |
|
46 RP, dRP, nRP = 1-TP, 0.02, 0 |
|
47 RS, dRS, nRS = 1-TS, 0.00, 0 |
|
48 RetR, dRetR, nRetR = 0., 180., 0 |
|
49 TiR = 0.5 * (RP + RS) |
|
50 DiR = (RP-RS)/(RP+RS) |
|
51 # --- Pol.Filter |
|
52 ERaR, dERaR, nERaR = 1, 0.003, 0 |
|
53 RotaR, dRotaR, nRotaR = 0., 2., 0 |
|
54 DaR = (1-ERaR)/(1+ERaR) |
|
55 TaR = 0.5*(1+ERaR) |
|
56 |
|
57 # --- Parallel signal detected in the transmitted channel => Y = 1, or in the reflected channel => Y = -1 |
|
58 Y = -1. |
|
59 |
|
60 # --- Calibrator Location |
|
61 LocC = 3 #location of calibrator: 1 = behind laser; 2 = behind emitter; 3 = before receiver; 4 = before PBS |
|
62 # --- Calibrator Type used; defined by matrix values below |
|
63 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° |
|
64 # --- MC Calibrator |
|
65 if TypeC == 1: #mechanical rotator |
|
66 DiC, dDiC, nDiC = 0., 0., 0 |
|
67 TiC = 1. |
|
68 RetC, dRetC, nRetC = 0., 0., 0 |
|
69 RotC, dRotC, nRotC = 0., 0.1, 1 #constant calibrator offset epsilon |
|
70 # Rotation error without calibrator: if False, then epsilon = 0 for normal measurements |
|
71 RotationErrorEpsilonForNormalMeasurements = True # is in general True for TypeC == 1 calibrator |
|
72 elif TypeC == 2: # HWP rotator |
|
73 DiC, dDiC, nDiC = 0., 0., 0 |
|
74 TiC = 1. |
|
75 RetC, dRetC, nRetC = 180., 0., 0 |
|
76 #NOTE: use here twice the HWP-rotation-angle |
|
77 RotC, dRotC, nRotC = 0.0, 0.1, 1 #constant calibrator offset epsilon |
|
78 RotationErrorEpsilonForNormalMeasurements = True # is in general True for TypeC == 2 calibrator |
|
79 elif TypeC == 3: # linear polarizer calibrator |
|
80 DiC, dDiC, nDiC = 0.9998, 0.0001, 1 # ideal 1.0 |
|
81 TiC = 0.505 # ideal 0.5 |
|
82 RetC, dRetC, nRetC = 0., 0., 0 |
|
83 RotC, dRotC, nRotC = 0.0, 0.1, 1 #constant calibrator offset epsilon |
|
84 RotationErrorEpsilonForNormalMeasurements = False # is in general False for TypeC == 3 calibrator |
|
85 elif TypeC == 4: # QWP calibrator |
|
86 DiC, dDiC, nDiC = 0.0, 0., 0 # ideal 1.0 |
|
87 TiC = 1.0 # ideal 0.5 |
|
88 RetC, dRetC, nRetC = 90., 0., 0 |
|
89 RotC, dRotC, nRotC = 0.0, 0.1, 1 #constant calibrator offset epsilon |
|
90 RotationErrorEpsilonForNormalMeasurements = False # is False for TypeC == 4 calibrator |
|
91 elif TypeC == 6: # real half-wave plate calibration at +-22.5° => rotated_diattenuator_X22x5deg.odt |
|
92 DiC, dDiC, nDiC = 0., 0., 0 |
|
93 TiC = 1. |
|
94 RetC, dRetC, nRetC = 180., 0., 0 |
|
95 #Note: use real HWP angles here |
|
96 RotC, dRotC, nRotC = 0.0, 0.1, 1 #constant calibrator offset epsilon -1.15 |
|
97 RotationErrorEpsilonForNormalMeasurements = True # is in general True for TypeC == 6 calibrator |
|
98 else: |
|
99 print ('calibrator not implemented yet') |
|
100 sys.exit() |
|
101 |
|
102 # --- LDRCal assumed atmospheric linear depolarization ratio during the calibration measurements (first guess) |
|
103 LDRCal,dLDRCal,nLDRCal= 0.006, 0.02, 1 |
|
104 |
|
105 # ==================================================== |
|
106 # NOTE: there is no need to change anything below. |
|
107 |
|
108 # --- LDRtrue for simulation of measurement => LDRsim |
|
109 LDRtrue = 0.4 |
|
110 LDRtrue2 = 0.004 |
|
111 |
|
112 # --- measured LDRm will be corrected with calculated parameters GHK |
|
113 LDRmeas = 0.3 |
|
114 |
|
115 # --- this is just for correct transfer of the variables to the main file |
|
116 RotL0, dRotL, nRotL = RotL, dRotL, nRotL |
|
117 # Emitter |
|
118 DiE0, dDiE, nDiE = DiE, dDiE, nDiE |
|
119 RetE0, dRetE, nRetE = RetE, dRetE, nRetE |
|
120 RotE0, dRotE, nRotE = RotE, dRotE, nRotE |
|
121 # Receiver |
|
122 DiO0, dDiO, nDiO = DiO, dDiO, nDiO |
|
123 RetO0, dRetO, nRetO = RetO, dRetO, nRetO |
|
124 RotO0, dRotO, nRotO = RotO, dRotO, nRotO |
|
125 # Calibrator |
|
126 DiC0, dDiC, nDiC = DiC, dDiC, nDiC |
|
127 RetC0, dRetC, nRetC = RetC, dRetC, nRetC |
|
128 RotC0, dRotC, nRotC = RotC, dRotC, nRotC |
|
129 # PBS |
|
130 TP0, dTP, nTP = TP, dTP, nTP |
|
131 TS0, dTS, nTS = TS, dTS, nTS |
|
132 RetT0, dRetT, nRetT = RetT, dRetT, nRetT |
|
133 |
|
134 ERaT0, dERaT, nERaT = ERaT, dERaT, nERaT |
|
135 RotaT0,dRotaT,nRotaT= RotaT,dRotaT,nRotaT |
|
136 |
|
137 RP0, dRP, nRP = RP, dRP, nRP |
|
138 RS0, dRS, nRS = RS, dRS, nRS |
|
139 RetR0, dRetR, nRetR = RetR, dRetR, nRetR |
|
140 |
|
141 ERaR0, dERaR, nERaR = ERaR, dERaR, nERaR |
|
142 RotaR0,dRotaR,nRotaR= RotaR,dRotaR,nRotaR |
|
143 |
|
144 LDRCal0,dLDRCal,nLDRCal=LDRCal,dLDRCal,nLDRCal |