glass-dev / glass

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

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

Closed ntessore closed 1 year ago

ntessore commented 1 year ago

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.