69 """Plot position estimator payload"""
70 for pair in self.position_estimator.getGridMap():
71 pixelkind = pair.first
72 grid = pair.second
73
74
75 summary_dict = {'shapes': [],
76 'corrections': [],
77 'coverage': [],
78 'sigma_u': [],
79 'sigma_v': [],
80 'corr_uv': [],
81 'thetaU': [],
82 'thetaV': [],
83 'pixelkind': [],
84 }
85
86
87 for uBin in range(1, grid.GetXaxis().GetNbins() + 1):
88 for vBin in range(1, grid.GetYaxis().GetNbins() + 1):
89
90
91 shape_classifier = self.position_estimator.getShapeClassifier(uBin, vBin, pixelkind)
92
93
94 thetaU = grid.GetXaxis().GetBinCenter(uBin)
95 thetaV = grid.GetYaxis().GetBinCenter(vBin)
96
97
98 stats = self.get_classifier_stats(shape_classifier, pixelkind)
99
100
101 summary_dict['thetaU'].append(thetaU)
102 summary_dict['thetaV'].append(thetaV)
103 summary_dict['pixelkind'].append(pixelkind)
104 summary_dict['shapes'].append(stats['shapes'])
105 summary_dict['corrections'].append(stats['corrections'])
106 summary_dict['coverage'].append(stats['coverage'])
107 summary_dict['sigma_u'].append(stats['sigma_u'] * 10000)
108 summary_dict['sigma_v'].append(stats['sigma_v'] * 10000)
109 summary_dict['corr_uv'].append(stats['corr_uv'])
110
111
112 df = pd.DataFrame(summary_dict)
113
114 pivot_table = df.pivot(index='thetaU', columns='thetaV', values='corrections')
115 fig = plt.figure(figsize=(12, 12))
116 ax = fig.add_subplot(111)
117 ax.set_xlabel('thetaU / degree', size=20)
118 ax.set_ylabel('thetaV / degree', size=20)
119 ax.set_title(f'Number of corrections kind={pixelkind:d}', size=20)
120 ax = sns.heatmap(
121 pivot_table,
122 mask=pivot_table.isnull(),
123 annot=True,
124 fmt="d",
125 linewidths=.5,
126 square=True,
127 cmap='Blues_r',
128 cbar_kws={
129 'label': '#corrections'})
130 ax.invert_yaxis()
131 fig.savefig(self.resultdir + f'/Corrections_Heatmap_kind_{pixelkind:d}.png', dpi=100)
132 fig.clf()
133 plt.close(fig)
134
135 pivot_table = df.pivot(index='thetaU', columns='thetaV', values='shapes')
136 fig = plt.figure(figsize=(12, 12))
137 ax = fig.add_subplot(111)
138 ax.set_xlabel('thetaU / degree', size=20)
139 ax.set_ylabel('thetaV / degree', size=20)
140 ax.set_title(f'Number of shapes kind={pixelkind:d}', size=20)
141 ax = sns.heatmap(
142 pivot_table,
143 mask=pivot_table.isnull(),
144 annot=True,
145 fmt="d",
146 linewidths=.5,
147 square=True,
148 cmap='Blues_r',
149 cbar_kws={
150 'label': '#shapes'})
151 ax.invert_yaxis()
152 fig.savefig(self.resultdir + f'/Shapes_Heatmap_kind_{pixelkind:d}.png', dpi=100)
153 fig.clf()
154 plt.close(fig)
155
156 pivot_table = df.pivot(index='thetaU', columns='thetaV', values='coverage')
157 fig = plt.figure(figsize=(12, 12))
158 ax = fig.add_subplot(111)
159 ax.set_xlabel('thetaU / degree', size=20)
160 ax.set_ylabel('thetaV / degree', size=20)
161 ax.set_title(f'Coverage kind={pixelkind:d}', size=20)
162 ax = sns.heatmap(
163 pivot_table,
164 mask=pivot_table.isnull(),
165 annot=True,
166 fmt=".1f",
167 linewidths=.5,
168 square=True,
169 cmap='Blues_r',
170 cbar_kws={
171 'label': 'coverage / %'})
172 ax.invert_yaxis()
173 fig.savefig(self.resultdir + f'/Coverage_Heatmap_kind_{pixelkind:d}.png', dpi=100)
174 fig.clf()
175 plt.close(fig)
176
177 pivot_table = df.pivot(index='thetaU', columns='thetaV', values='sigma_u')
178 fig = plt.figure(figsize=(12, 12))
179 ax = fig.add_subplot(111)
180 ax.set_xlabel('thetaU / degree', size=20)
181 ax.set_ylabel('thetaV / degree', size=20)
182 ax.set_title(f'Average cluster sigma u kind={pixelkind:d}', size=20)
183 ax = sns.heatmap(
184 pivot_table,
185 mask=pivot_table.isnull(),
186 annot=True,
187 fmt=".1f",
188 linewidths=.5,
189 square=True,
190 cmap='Blues_r',
191 cbar_kws={
192 'label': 'sigma u / um'})
193 ax.invert_yaxis()
194 fig.savefig(self.resultdir + f'/SigmaU_Heatmap_kind_{pixelkind:d}.png', dpi=100)
195 fig.clf()
196 plt.close(fig)
197
198 pivot_table = df.pivot(index='thetaU', columns='thetaV', values='sigma_v')
199 fig = plt.figure(figsize=(12, 12))
200 ax = fig.add_subplot(111)
201 ax.set_xlabel('thetaU / degree', size=20)
202 ax.set_ylabel('thetaV / degree', size=20)
203 ax.set_title(f'Average cluster sigma v kind={pixelkind:d}', size=20)
204 ax = sns.heatmap(
205 pivot_table,
206 mask=pivot_table.isnull(),
207 annot=True,
208 fmt=".1f",
209 linewidths=.5,
210 square=True,
211 cmap='Blues_r',
212 cbar_kws={
213 'label': 'sigma v / um'})
214 ax.invert_yaxis()
215 fig.savefig(self.resultdir + f'/SigmaV_Heatmap_kind_{pixelkind:d}.png', dpi=100)
216 fig.clf()
217 plt.close(fig)
218
219 pivot_table = df.pivot(index='thetaU', columns='thetaV', values='corr_uv')
220 fig = plt.figure(figsize=(12, 12))
221 ax = fig.add_subplot(111)
222 ax.set_xlabel('thetaU / degree', size=20)
223 ax.set_ylabel('thetaV / degree', size=20)
224 ax.set_title(f'Average uv correlation kind={pixelkind:d}', size=20)
225 ax = sns.heatmap(
226 pivot_table,
227 mask=pivot_table.isnull(),
228 annot=True,
229 fmt=".1f",
230 linewidths=.5,
231 square=True,
232 cmap='Blues_r',
233 cbar_kws={
234 'label': 'correlation'})
235 ax.invert_yaxis()
236 fig.savefig(self.resultdir + f'/CorrelationUV_Heatmap_kind_{pixelkind:d}.png', dpi=100)
237 fig.clf()
238 plt.close(fig)
239