Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

least-squares fit of shells to galaxy distribution #121

Closed
ntessore opened this issue Aug 1, 2023 · 0 comments · Fixed by #122
Closed

least-squares fit of shells to galaxy distribution #121

ntessore opened this issue Aug 1, 2023 · 0 comments · Fixed by #122
Assignees
Milestone

Comments

@ntessore
Copy link
Collaborator

ntessore commented Aug 1, 2023

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.

@ntessore ntessore added this to the v2023.7 milestone Aug 1, 2023
@ntessore ntessore self-assigned this Aug 1, 2023
ntessore added a commit that referenced this issue Aug 1, 2023
Change the `partition()` function to return an array of weights such
that the weighted sum of window functions approximates the given input
function. This can be used to directly obtain e.g. the galaxy densities
in each shell to match a target distribution $dN/dz$:

    # the galaxy density in each shell to match dndz
    ngal = partition(z, dndz, shells)

For overlapping window functions, there are in general many ways to
combine shells to match a given function. The `partition()` function
currently implements least-squares (`method="lstsq"`) and the
restriction of the target function to the shell, followed by integration
(`method="restrict"`). The latter was previously the default procedure
for tophat windows.

Closes: #121
Changed: The `partition()` function now returns an array of weights to
  approximate the given function by the windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant