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

API(shells): partition() to fit windows to function #122

Merged
merged 1 commit into from
Aug 1, 2023
Merged

Conversation

ntessore
Copy link
Collaborator

@ntessore ntessore commented 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.

@ntessore ntessore merged commit de77986 into main Aug 1, 2023
9 checks passed
@ntessore ntessore deleted the pr/gh-121 branch August 1, 2023 12:09
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 this pull request may close these issues.

least-squares fit of shells to galaxy distribution
1 participant