sup3r.preprocessing.samplers.utilities.weighted_box_sampler#
- weighted_box_sampler(data_shape, sample_shape, weights)[source]#
Extracts a temporal slice from data with selection weighted based on provided weights
- Parameters:
data_shape (tuple) – (rows, cols) Size of full spatial grid available for sampling
sample_shape (tuple) – (rows, cols) Size of grid to sample from data
weights (ndarray) – Array of weights used to specify selection strategy. e.g. If weights is [0.2, 0.4, 0.1, 0.3] then the upper left quadrant of the spatial domain will be sampled 20 percent of the time, the upper right quadrant will be sampled 40 percent of the time, etc.
- Returns:
slices (list) – List of spatial slices [spatial_1, spatial_2]