fenestration.pooling.normalize_windows#
- fenestration.pooling.normalize_windows(angle_windows: Tensor, ecc_windows: Tensor, window_eccentricity: ndarray) tuple[dict, Tensor]#
Normalize windows to have L1-norm of 1.
We calculate the L1-norm of single windows (that is, product of eccentricity and angular windows) for all angles, one middling eccentricity (third of the way thorugh), then average across angles (because of alignment with pixel grid, L1-norm will vary somewhat across angles).
L1-norm scales linearly with area, which is proportional to the width in the angular direction times the width in the radial direction. The angular width grows linearly with eccentricity, while the radial width grows with the reciprocal of the derivative of our scaling function (that’s log(ecc) for gaussian windows). so we use that product to scale it for the different windows. only eccentricity windows is normalized (don’t need to divide both).
- Parameters:
angle_windows – tensor containing the angular windows
ecc_windows – tensor containing the eccentricity windows
window_eccentricity – array containing the eccentricity for each window that defines their location relative to each other (and so can be in either pixels or degrees). this is used to determine how to scale the L1-norm. It should probably be the central eccentricity, but it should not contain any zeros.
- Returns:
ecc_windows – the normalized ecc_windows.
scale_factor – the scale_factor used to normalize eccentricity windows (as a 3d tensor, number of eccentricity windows by 1 by 1). Stored by
PoolingWindowsobject so we can undo it forprojector plotting purposes.