glass-dev / glass

Generator for Large Scale Structure
https://glass.readthedocs.io
MIT License
31 stars 7 forks source link

least-squares fit of shells to galaxy distribution #121

Closed ntessore closed 1 year ago

ntessore commented 1 year ago

With overlapping radial window functions (#118, #119), there is no longer a unique way to distribute galaxies among each shell to recover some given galaxy distribution $dN/dz$.

If $w_i$ are the radial window functions, $f = dN/dz$ is the target function, and $z_i$ is a redshift grid, we want a solution $x_i$ of the following overdetermined matrix equation:

\begin{pmatrix}
w_1(z_1) & w_2(z_1) & \cdots \\
w_1(z_2) & w_2(z_2) & \cdots \\
\vdots & \vdots & \ddots
\end{pmatrix} \, \begin{pmatrix}
x_1 \\ x_2 \\ \vdots
\end{pmatrix} = \begin{pmatrix}
f(z_1) \\ f(z_2) \\ \vdots
\end{pmatrix}

Linear least squares is one obvious method. A weighting $\Delta z_i$ can ensure that finer-sampled regions do not overly influence the result:

\begin{pmatrix}
w_1(z_1) \Delta z_1 & w_2(z_1) \, \Delta z_1 & \cdots \\
w_1(z_2) \Delta z_2 & w_2(z_2) \, \Delta z_2 & \cdots \\
\vdots & \vdots & \ddots
\end{pmatrix} \, \begin{pmatrix}
x_1 \\ x_2 \\ \vdots
\end{pmatrix} = \begin{pmatrix}
f(z_1) \, \Delta z_1 \\ f(z_2) \, \Delta z_2 \\ \vdots
\end{pmatrix}

The $\Delta z_i$ could be the weights of the trapezoidal rule.