// print(len(candidates_indices), candidates_indices.shape)
if mean_counts_size is not None:
print("Probability weighting considered")
proba = []
for (c, p) in zip(candidates.flatten(), mean_counts_size.flatten()):
if c >= 1:
proba.append(p)
print(len(list_indices), len(proba))
list_indices_fin = np.random.choice(list_indices, n_samples,
replace=False, p=proba)
else:
print("No probability weighting needed")
list_indices_fin = list_indices
np.random.shuffle(list_indices)
for i in range(0, n_samples):
indices_to_add = candidates_indices[list_indices_fin[i]]
// print(max_coords.shape, indices_to_add)
for s in range(0, N_SPATIAL):
max_coords[i, s] = indices_to_add[s] - np.floor(
spatial_win_sizes[0]/2)[s]
// for i in range(0, N_SPATIAL):
// assert uniq_spatial_size[i] >= max_spatial_win[i], \
// "window size {} is larger than image size {}".format(
// max_spatial_win[i], uniq_spatial_size[i])
// max_coords[:, i] = np.random.randint(
// 0, max(uniq_spatial_size[i] - max_spatial_win[i], 1), n_samples)
// adjust max spatial coordinates based on each spatial window size
all_coordinates = {}
for mod in list(win_sizes):
win_size = win_sizes[mod][:N_SPATIAL]
half_win_diff = np.floor((max_spatial_win - win_size) / 2.0)
// shift starting coords of the window
// so that smaller windows are centred within the large windows
spatial_coords = np.zeros((n_samples, N_SPATIAL * 2), dtype=np.int32)
spatial_coords[:, :N_SPATIAL] = \
max_coords[:, :N_SPATIAL] + half_win_diff[:N_SPATIAL]
spatial_coords[:, N_SPATIAL:] = \