@@ -2283,6 +2283,8 @@ def compute(
2283
2283
)
2284
2284
# if the axes are named correctly, xarray figures out the normalization correctly
2285
2285
self ._normalized = self ._binned / self ._normalization_histogram
2286
+ # Set datatype of binned data
2287
+ self ._normalized .data = self ._normalized .data .astype (self ._binned .data .dtype )
2286
2288
self ._attributes .add (
2287
2289
self ._normalization_histogram .values ,
2288
2290
name = "normalization_histogram" ,
@@ -2353,36 +2355,35 @@ def get_normalization_histogram(
2353
2355
2354
2356
if isinstance (df_partitions , int ):
2355
2357
df_partitions = list (range (0 , min (df_partitions , self ._dataframe .npartitions )))
2358
+
2356
2359
if use_time_stamps or self ._timed_dataframe is None :
2357
2360
if df_partitions is not None :
2358
- self ._normalization_histogram = normalization_histogram_from_timestamps (
2359
- self ._dataframe .partitions [df_partitions ],
2360
- axis ,
2361
- self ._binned .coords [axis ].values ,
2362
- self ._config ["dataframe" ]["columns" ]["timestamp" ],
2363
- )
2361
+ dataframe = self ._dataframe .partitions [df_partitions ]
2364
2362
else :
2365
- self ._normalization_histogram = normalization_histogram_from_timestamps (
2366
- self ._dataframe ,
2367
- axis ,
2368
- self ._binned .coords [axis ].values ,
2369
- self ._config ["dataframe" ]["columns" ]["timestamp" ],
2370
- )
2363
+ dataframe = self ._dataframe
2364
+ self ._normalization_histogram = normalization_histogram_from_timestamps (
2365
+ df = dataframe ,
2366
+ axis = axis ,
2367
+ bin_centers = self ._binned .coords [axis ].values ,
2368
+ time_stamp_column = self ._config ["dataframe" ]["columns" ]["timestamp" ],
2369
+ )
2371
2370
else :
2372
2371
if df_partitions is not None :
2373
- self ._normalization_histogram = normalization_histogram_from_timed_dataframe (
2374
- self ._timed_dataframe .partitions [df_partitions ],
2375
- axis ,
2376
- self ._binned .coords [axis ].values ,
2377
- self ._config ["dataframe" ]["timed_dataframe_unit_time" ],
2378
- )
2372
+ timed_dataframe = self ._timed_dataframe .partitions [df_partitions ]
2379
2373
else :
2380
- self ._normalization_histogram = normalization_histogram_from_timed_dataframe (
2381
- self ._timed_dataframe ,
2382
- axis ,
2383
- self ._binned .coords [axis ].values ,
2384
- self ._config ["dataframe" ]["timed_dataframe_unit_time" ],
2385
- )
2374
+ timed_dataframe = self ._timed_dataframe
2375
+ self ._normalization_histogram = normalization_histogram_from_timed_dataframe (
2376
+ df = timed_dataframe ,
2377
+ axis = axis ,
2378
+ bin_centers = self ._binned .coords [axis ].values ,
2379
+ time_unit = self ._config ["dataframe" ]["timed_dataframe_unit_time" ],
2380
+ hist_mode = self .config ["binning" ]["hist_mode" ],
2381
+ mode = self .config ["binning" ]["mode" ],
2382
+ pbar = self .config ["binning" ]["pbar" ],
2383
+ n_cores = self .config ["core" ]["num_cores" ],
2384
+ threads_per_worker = self .config ["binning" ]["threads_per_worker" ],
2385
+ threadpool_api = self .config ["binning" ]["threadpool_API" ],
2386
+ )
2386
2387
2387
2388
return self ._normalization_histogram
2388
2389
0 commit comments