1 # This Python script will be executed from within the main lidar_correction_ghk.py |
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, |
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. |
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 |
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. |
5 # three letters mixed small and capital. |
6 # To be used with lidar_correction_ghk.py ver. 0.9.5 and larger |
6 # Error calculation? |
7 |
7 # False: only calculate the GHK-parameters. True: calculate also errors. Can take a long time. |
8 # Do you want to calculate the errors? If not, just the GHK-parameters are determined. |
|
9 Error_Calc = True |
8 Error_Calc = True |
10 |
9 |
11 # Header to identify the lidar system |
10 # Header to identify the lidar system |
12 # |
11 # |
13 EID = "xx" # Earlinet station ID |
12 EID = "xx" # Earlinet station ID |
14 LID = "example lidar" # Additional lidar ID (short descriptive text) |
13 LID = "example lidar" # Additional lidar ID (short descriptive text) |
15 print(" Lidar system :", EID, ", ", LID) |
14 print(" Lidar system :", EID, ", ", LID) |
16 |
15 |
17 # +++ IL Laser and +-Uncertainty |
16 # +++ IL Laser beam polarisation and +-Uncertainty |
18 DOLP, dDOLP, nDOLP = 0.995, 0.005, 1 #degree of linear polarization; default 1 |
17 DOLP, dDOLP, nDOLP = 0.995, 0.005, 1 #degree of linear polarization; default 1 |
19 RotL, dRotL, nRotL = 0., 2., 1 #alpha; rotation of laser polarization in degrees; default 0 |
18 RotL, dRotL, nRotL = 0., 2., 1 #alpha; rotation of laser polarization in degrees; default 0 |
20 |
19 |
21 # +++ ME Emitter optics and +-Uncertainty; default = no emitter optics |
20 # +++ ME Emitter optics and +-Uncertainty; default = no emitter optics |
22 DiE, dDiE, nDiE = 0.0, 0.1, 0 # Diattenuation |
21 DiE, dDiE, nDiE = 0.0, 0.1, 0 # Diattenuation; default 0 |
23 TiE = 1.0 # Unpolarized transmittance |
22 TiE = 1.0 # Unpolarized transmittance; default 1 |
24 RetE, dRetE, nRetE = 0., 180., 0 # Retardance in degrees |
23 RetE, dRetE, nRetE = 0., 180., 0 # Retardance in degrees; default 0 |
25 RotE, dRotE, nRotE = 0., 1.0, 0 # beta: Rotation of optical element in degrees |
24 RotE, dRotE, nRotE = 0., 1., 0 # beta: Rotation of optical element in degrees; default 0 |
26 |
25 |
27 # +++ MO Receiver optics including telescope |
26 # +++ MO Receiver optics including telescope |
28 DiO, dDiO, nDiO = 0.0, 0.1, 1 # Diattenuation |
27 DiO, dDiO, nDiO = 0.0, 0.2, 1 # Diattenuation; default 0 |
29 TiO = 1.0 # Unpolarized transmittance |
28 TiO = 1.0 # Unpolarized transmittance; default 1 |
30 RetO, dRetO, nRetO = 0., 180., 0 # Retardance in degrees |
29 RetO, dRetO, nRetO = 0., 180., 0 # Retardance in degrees; default 0 |
31 RotO, dRotO, nRotO = 0., 0.5, 0 #gamma: Rotation of the optical element in degrees |
30 RotO, dRotO, nRotO = 0., 0.1, 0 #gamma: Rotation of the optical element in degrees; default 0 |
32 |
31 |
33 # +++++ PBS MT Transmitting path defined with TS, TP, PolFilter extinction ratio ERaT, and +-Uncertainty |
32 # +++++ PBS MT Transmitting path defined with TS, TP, PolFilter extinction ratio ERaT, and +-Uncertainty |
34 # --- Polarizing beam splitter transmitting path |
33 # --- Polarizing beam splitter transmitting path |
35 TP, dTP, nTP = 0.95, 0.01, 1 # transmittance of the PBS for parallel polarized light |
34 TP, dTP, nTP = 0.95, 0.01, 1 # transmittance of the PBS for parallel polarized light |
36 TS, dTS, nTS = 0.02, 0.01, 1 # transmittance of the PBS for cross polarized light |
35 TS, dTS, nTS = 0.005, 0.001, 1 # transmittance of the PBS for cross polarized light |
37 RetT, dRetT, nRetT = 0.0, 180., 0 # Retardance in degrees |
36 RetT, dRetT, nRetT = 0.0, 180., 0 # Retardance in degrees |
38 # --- Pol.Filter behind transmitted path of PBS |
37 # --- Pol.Filter behind transmitted path of PBS |
39 ERaT, dERaT, nERaT = 0.001, 0.001, 1 # Extinction ratio |
38 ERaT, dERaT, nERaT = 0.001, 0.001, 0 # Extinction ratio |
40 RotaT, dRotaT, nRotaT = 0., 1., 1 # Rotation of the Pol.-filter in degrees; usually close to 0° because TP >> TS, but for PollyXTs it can also be close to 90° |
39 RotaT, dRotaT, nRotaT = 0., 1., 0 # Rotation of the Pol.-filter in degrees; usually close to 0° because TP >> TS, but for PollyXTs it can also be close to 90° |
41 # -- |
40 # -- |
42 TiT = 0.5 * (TP + TS) |
41 TiT = 0.5 * (TP + TS) # do not change this |
43 DiT = (TP-TS)/(TP+TS) |
42 DiT = (TP-TS)/(TP+TS) # do not change this |
44 DaT = (1-ERaT)/(1+ERaT) |
43 DaT = (1-ERaT)/(1+ERaT) # do not change this |
45 TaT = 0.5*(1+ERaT) |
44 TaT = 0.5*(1+ERaT) # do not change this |
46 |
45 |
47 # +++++ PBS MR Reflecting path defined with RS, RP, PolFilter extinction ratio ERaR and +-Uncertainty |
46 # +++++ PBS MR Reflecting path defined with RS, RP, and cleaning PolFilter extinction ratio ERaR and +-Uncertainty |
48 # ---- 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. |
47 # ---- 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. |
49 RS_RP_depend_on_TS_TP = False |
48 RS_RP_depend_on_TS_TP = True |
50 # --- Polarizing beam splitter reflecting path |
49 # --- Polarizing beam splitter reflecting path |
51 if(RS_RP_depend_on_TS_TP): |
50 if(RS_RP_depend_on_TS_TP): |
52 RP, dRP, nRP = 1-TP, 0.00, 0 # do not change this |
51 RP, dRP, nRP = 1-TP, 0.00, 0 # do not change this |
53 RS, dRS, nRS = 1-TS, 0.00, 0 # do not change this |
52 RS, dRS, nRS = 1-TS, 0.00, 0 # do not change this |
54 else: |
53 else: |
57 RetR, dRetR, nRetR = 0.0, 180., 0 # Retardance in degrees |
56 RetR, dRetR, nRetR = 0.0, 180., 0 # Retardance in degrees |
58 # --- Pol.Filter behind reflected path of PBS |
57 # --- Pol.Filter behind reflected path of PBS |
59 ERaR, dERaR, nERaR = 0.001, 0.001, 1 # Extinction ratio |
58 ERaR, dERaR, nERaR = 0.001, 0.001, 1 # Extinction ratio |
60 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° |
59 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° |
61 # -- |
60 # -- |
62 TiR = 0.5 * (RP + RS) |
61 TiR = 0.5 * (RP + RS) # do not change this |
63 DiR = (RP-RS)/(RP+RS) |
62 DiR = (RP-RS)/(RP+RS) # do not change this |
64 DaR = (1-ERaR)/(1+ERaR) |
63 DaR = (1-ERaR)/(1+ERaR) # do not change this |
65 TaR = 0.5*(1+ERaR) |
64 TaR = 0.5*(1+ERaR) # do not change this |
|
65 # NEW --- Additional ND filter transmission (attenuation) during the calibration |
|
66 TCalT, dTCalT, nTCalT = 1, 0.01, 0 # transmitting path, default 1, 0, 0 |
|
67 TCalR, dTCalR, nTCalR = 0.1, 0.001, 1 # reflecting path, default 1, 0, 0 |
66 |
68 |
67 # +++ Orientation of the PBS with respect to the reference plane (see Polarisation-orientation.png and Polarisation-orientation-2.png in /system_settings) |
69 # +++ Orientation of the PBS with respect to the reference plane (see Improvements_of_lidar_correction_ghk_ver.0.9.8_190124.pdf) |
68 # Y = +1: polarisation in reference plane is transmitted, |
70 # Y = +1: polarisation in reference plane is finally transmitted, |
69 # Y = -1: polarisation in reference plane is reflected. |
71 # Y = -1: polarisation in reference plane is finally reflected. |
70 Y = +1. |
72 Y = +1. |
71 |
73 |
72 # +++ Calibrator Location |
74 # +++ Calibrator |
73 LocC = 3 #location of calibrator: 1 = behind laser; 2 = behind emitter; 3 = before receiver; 4 = before PBS |
75 |
74 # --- Calibrator Type used; defined by matrix values below |
76 # --- Calibrator Type used; defined by matrix values below |
75 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° |
77 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° |
|
78 |
|
79 # --- Calibrator Location |
|
80 LocC = 3 #location of calibrator: 1 = behind laser; 2 = behind emitter; 3 = before receiver; 4 = before PBS |
76 # --- MC Calibrator parameters |
81 # --- MC Calibrator parameters |
77 if TypeC == 1: #mechanical rotator |
82 if TypeC == 1: #mechanical rotator |
78 DiC, dDiC, nDiC = 0., 0., 0 # Diattenuation |
83 DiC, dDiC, nDiC = 0., 0., 0 # Diattenuation |
79 TiC = 1. |
84 TiC = 1. |
80 RetC, dRetC, nRetC = 0., 0., 0 # Retardance in degrees |
85 RetC, dRetC, nRetC = 0., 0., 0 # Retardance in degrees |
81 RotC, dRotC, nRotC = 0., 0.1, 1 #constant calibrator rotation offset epsilon |
86 RotC, dRotC, nRotC = 0., 0.1, 1 #constant calibrator rotation offset epsilon |
82 # Rotation error without calibrator: if False, then epsilon = 0 for normal measurements |
87 # Rotation error without calibrator: if False, then epsilon = 0 for normal measurements |
83 RotationErrorEpsilonForNormalMeasurements = True # is in general True for TypeC == 1 calibrator |
88 RotationErrorEpsilonForNormalMeasurements = True # is in general True for TypeC == 1 calibrator |
84 elif TypeC == 2: # HWP rotator without retardance! |
89 elif TypeC == 2: # HWP simulated by rotator without retardance! |
85 DiC, dDiC, nDiC = 0., 0., 0 # Diattenuation; ideal 0.0 |
90 DiC, dDiC, nDiC = 0., 0., 0 # Diattenuation; ideal 0.0 |
86 TiC = 1. |
91 TiC = 1. |
87 RetC, dRetC, nRetC = 180., 0., 0 # Retardance in degrees |
92 RetC, dRetC, nRetC = 180., 0., 0 # Retardance in degrees |
88 #NOTE: use here twice the HWP-rotation-angle |
93 #NOTE: use here twice the HWP-rotation-angle |
89 RotC, dRotC, nRotC = 0.0, 0.1, 1 #constant calibrator rotation offset epsilon |
94 RotC, dRotC, nRotC = 0.0, 0.1, 1 #constant calibrator rotation offset epsilon |
90 RotationErrorEpsilonForNormalMeasurements = True # is in general True for TypeC == 2 calibrator |
95 RotationErrorEpsilonForNormalMeasurements = True # is in general True for TypeC == 2 calibrator |
91 elif TypeC == 3: # linear polarizer calibrator. Diattenuation DiC = (1-ERC)/(1+ERC); ERC = extinction ratio of calibrator |
96 elif TypeC == 3: # linear polarizer calibrator. Diattenuation DiC = (1-ERC)/(1+ERC); ERC = extinction ratio of calibrator |
92 DiC, dDiC, nDiC = 0.9998, 0.0001, 1 # Diattenuation; ideal 1.0 |
97 DiC, dDiC, nDiC = 0.9998, 0.00019, 1 # Diattenuation; ideal 1.0 |
93 TiC = 0.4 # ideal 0.5 |
98 TiC = 0.4 # ideal 0.5 |
94 RetC, dRetC, nRetC = 0., 0., 0 # Retardance in degrees |
99 RetC, dRetC, nRetC = 0., 180., 3 # Retardance in degrees |
95 RotC, dRotC, nRotC = 0.0, 0.1, 0 #constant calibrator rotation offset epsilon |
100 RotC, dRotC, nRotC = 0.0, 0.1, 0 #constant calibrator rotation offset epsilon |
96 RotationErrorEpsilonForNormalMeasurements = False # is in general False for TypeC == 3 calibrator |
101 RotationErrorEpsilonForNormalMeasurements = False # is in general False for TypeC == 3 calibrator |
97 elif TypeC == 4: # QWP calibrator |
102 elif TypeC == 4: # QWP calibrator |
98 DiC, dDiC, nDiC = 0.0, 0., 0 # Diattenuation; ideal 0.0 |
103 DiC, dDiC, nDiC = 0.0, 0., 0 # Diattenuation; ideal 0.0 |
99 TiC = 1.0 # ideal 0.5 |
104 TiC = 1.0 # ideal 0.5 |
110 else: |
115 else: |
111 print ('calibrator not implemented yet') |
116 print ('calibrator not implemented yet') |
112 sys.exit() |
117 sys.exit() |
113 |
118 |
114 # --- LDRCal assumed atmospheric linear depolarization ratio during the calibration measurements in calibration range with almost clean air (first guess) |
119 # --- LDRCal assumed atmospheric linear depolarization ratio during the calibration measurements in calibration range with almost clean air (first guess) |
115 LDRCal,dLDRCal,nLDRCal= 0.009, 0.005, 1 # spans the interference filter influence |
120 LDRCal,dLDRCal,nLDRCal= 0.2, 0.15, 1 # spans most of the atmospheric depolarisation variability |
|
121 # LDRCal,dLDRCal,nLDRCal= 0.009, 0.005, 1 # spans the interference filter influence |
116 |
122 |
117 # ==================================================== |
123 # ==================================================== |
118 # NOTE: there is no need to change anything below. |
124 # NOTE: there is no need to change anything below. |
|
125 # ==================================================== |
|
126 # !!! don't change anything in this section !!! |
|
127 # NEW *** |
|
128 bPlotEtax = False # plot error histogramms for Etax |
|
129 |
|
130 # *** Only for signal noise errors *** |
|
131 nNCal = 0 # error nNCal, calibration signals: one-sigma in steps to left and right |
|
132 nNI = 0 # error nNI, 0° signals: one-sigma in steps to left and right; NI signals are calculated from NCalT and NCalR in main programm, but noise is assumed to be independent. |
|
133 |
|
134 # --- number of photon counts in the signal summed up in the calibration range during the calibration measurements |
|
135 NCalT = 28184 # default 1e6, assumed the same in +45° and -45° signals |
|
136 NCalR = 28184 # default 1e6, assumed the same in +45° and -45° signals |
|
137 NILfac = 2 # (relative duration (laser shots) of standard (0°) measurement to calibration measurements) * (range of std. meas. smoothing / calibration range); example: 100000#/5000# * 100/1000 = 2 |
|
138 # LDRmeas below will be used to calculate IR and IT of 0° signals. |
|
139 # calculate signal counts only from parallel 0° signal assuming the same electronic amplification in both channels; overwrites above values |
|
140 CalcFrom0deg = True |
|
141 NI = 1e5 #number of photon counts in the parallel 0°-signal |
|
142 |
|
143 if(CalcFrom0deg): |
|
144 # either eFactT or eFacR is = 1 => rel. amplification |
|
145 eFacT = 1 # rel. amplification of transmitted channel, approximate values are sufficient; def. = 1 |
|
146 eFacR = 10 # rel. amplification of reflected channel, approximate values are sufficient; def. = 1 |
|
147 NILfac = 2 # (relative duration (laser shots) of standard (0°) measurement to calibration measurements) * (range of std. meas. smoothing / calibration range); example: 100000#/5000# * 100/1000 = 2 |
|
148 |
|
149 NCalT = NI / NILfac * TCalT * eFacT # photon counts in transmitted signal during calibration |
|
150 NCalR = NI / NILfac * TCalR * eFacR # photon counts in reflected signal during calibration |
|
151 # LDRmeas below will be used to calculate IR and IT of 0° signals. |
|
152 # NEW *** End of signal noise error parameters *** |
|
153 |
119 |
154 |
120 # --- LDRtrue for simulation of measurement => LDRsim |
155 # --- LDRtrue for simulation of measurement => LDRsim |
121 LDRtrue = 0.4 |
156 LDRtrue = 0.4 |
122 LDRtrue2 = 0.004 |
157 LDRtrue2 = 0.004 |
123 |
158 |