10
10
"n_contacts" : "balanced.sum" ,
11
11
"contact_freq" : "balanced.avg" ,
12
12
"smooth_suffix" : ".smoothed" ,
13
+ "n_pixels_tot" : "n_elem" ,
14
+ "n_contacts_raw" : "count.sum" ,
15
+ "contact_freq_raw" : "count.avg" ,
13
16
}
14
17
15
18
@@ -182,6 +185,8 @@ def _smooth_cvd_group(cvd, sigma_log10, window_sigma, points_per_sigma, cols=Non
182
185
{
183
186
cols ["n_pixels" ]: "sum" ,
184
187
cols ["n_contacts" ]: "sum" ,
188
+ cols ["n_pixels_tot" ]: "sum" ,
189
+ cols ["n_contacts_raw" ]: "sum" ,
185
190
}
186
191
)
187
192
.reset_index ()
@@ -198,6 +203,18 @@ def _smooth_cvd_group(cvd, sigma_log10, window_sigma, points_per_sigma, cols=Non
198
203
points_per_sigma = points_per_sigma ,
199
204
)
200
205
206
+ smoothed_raw_sum , smoothed_n_elem = log_smooth (
207
+ cvd_smoothed [cols ["dist" ]].values .astype (np .float64 ),
208
+ [
209
+ cvd_smoothed [cols ["n_contacts_raw" ]].values .astype (np .float64 ),
210
+ cvd_smoothed [cols ["n_pixels_tot" ]].values .astype (np .float64 ),
211
+ ],
212
+ sigma_log10 = sigma_log10 ,
213
+ window_sigma = window_sigma ,
214
+ points_per_sigma = points_per_sigma ,
215
+ )
216
+
217
+
201
218
# cvd_smoothed[cols["contact_freq"]] = cvd_smoothed[cols["n_contacts"]] / cvd_smoothed[cols["n_pixels"]]
202
219
203
220
cvd_smoothed [cols ["n_pixels" ] + cols ["smooth_suffix" ]] = smoothed_n_valid
@@ -207,6 +224,13 @@ def _smooth_cvd_group(cvd, sigma_log10, window_sigma, points_per_sigma, cols=Non
207
224
/ cvd_smoothed [cols ["n_pixels" ] + cols ["smooth_suffix" ]]
208
225
)
209
226
227
+ cvd_smoothed [cols ["n_pixels_tot" ] + cols ["smooth_suffix" ]] = smoothed_n_elem
228
+ cvd_smoothed [cols ["n_contacts_raw" ] + cols ["smooth_suffix" ]] = smoothed_raw_sum
229
+ cvd_smoothed [cols ["contact_freq_raw" ] + cols ["smooth_suffix" ]] = (
230
+ cvd_smoothed [cols ["n_contacts_raw" ] + cols ["smooth_suffix" ]]
231
+ / cvd_smoothed [cols ["n_pixels_tot" ] + cols ["smooth_suffix" ]]
232
+ )
233
+
210
234
return cvd_smoothed
211
235
212
236
@@ -291,7 +315,7 @@ def agg_smooth_cvd(
291
315
)
292
316
293
317
cvd_smoothed .drop (
294
- [cols ["n_pixels" ], cols ["n_contacts" ]], axis = "columns" , inplace = True
318
+ [cols ["n_pixels" ], cols ["n_contacts" ], cols [ "n_pixels_tot" ], cols [ "n_contacts_raw" ] ], axis = "columns" , inplace = True
295
319
)
296
320
297
321
# cvd = cvd.drop(cols["contact_freq"], axis='columns', errors='ignore')
0 commit comments