fenestration.calculate.scaling#

fenestration.calculate.scaling(n_windows: float, min_ecc: float = 0.5, max_ecc: float = 15, std_dev: float | None = None) → float#

Calculate and return the scaling value, as reported in the paper.

Scaling is the ratio of the eccentricity window’s radial full-width at half-maximum to eccentricity. For eccentricity, we use the window’s “central eccentricity”, the one where the input to the window function (\(x\) in equation 9 in the online methods) is 0.

Parameters:
  • n_windows – The number of log-eccentricity windows we create.

  • min_ecc – The minimum eccentricity, the eccentricity below which we do not compute pooling windows (in degrees). Parameter \(e_0\) in equation 11 of the online methods.

  • max_ecc – The maximum eccentricity, the outer radius of the image (in degrees). Parameter \(e_r\) in equation 11 of the online methods.

  • std_dev – The standard deviation of the Gaussian window. If this is set, we compute the scaling value for the Gaussian windows instead of for the cosine ones.

Returns:

scaling – The ratio of the eccentricity window’s radial full-width at half-maximum to eccentricity

Notes

No equation for the scaling, \(s\), was included in the paper [1], so we derived this ourselves. To start, we note that the window function equation (equation 9) reaches its half-max (.5) at \(x=\pm .5\), and that, as above, we treat \(x=0\) as the central eccentricity of the window. Then we must solve for the window’s radial full-width as half-maximum and the central eccentricity, using the values given within the parentheses in equation 11 as the value for \(x\), and take their ratios.

In the following equations, we’ll use \(x_h\) as the value at which the window reaches its half-max. For the cosine windows, this is always \(\pm .5\), but for the Gaussian windows, it’s \(x_h=\sigma\sqrt{2\log 2}\).

It turns out that this holds for all permissible values of transition_region_width (\(t\) in the equations) (try playing around with some plots if you don’t believe me).

Full-width half-maximum, \(W\), the difference between the two values of \(e_h\):

\[\begin{split}\pm x_h &= \frac{\log(e_h) - (log(e_0)+w_e(n+1))}{w_e} \\ e_h &= e_0 \cdot \exp(w_e(\pm x_h+n+1)) \\ W &= e_0 (\exp(w_e(n+1+x_h)) - \exp(w_e(n+1-x_h))\end{split}\]

To calculate the window’s central eccentricity, \(e_c\), we set \(x_h=0\):

\[e_c = e_0 \cdot \exp(w_e(n+1))\]

Then the scaling, \(s\) is the ratio \(\frac{W}{e_c}\):

\[\begin{split}s &= \frac{e_0 (\exp(w_e(n+1+x_h)) - exp(w_e(n+1-x_h)))}{e_0 \cdot \exp(w_e(n+1))} \\ s &= \frac{\exp(w_e(n+1+x_h))}{\exp(w_e(n+1))} - \frac{\exp(w_e(n+1-x_h))}{\exp(w_e(n+1))} \\ s &= \exp(w_e(n+1+x_h-n-1)) - \exp(w_e(n+1-x_h-n-1)) \\ s &= \exp(x_h\cdot w_e) - \exp(-x_h\cdot w_e)\end{split}\]

Note that we don’t actually use the value for \(e_c\); we simplify it away in the calculation above.

References