glass-dev / glass

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

Update `galaxies` interfaces for array inputs #82

Closed ntessore closed 1 year ago

ntessore commented 1 year ago

Following on from #77 and #80, sampling positions for multiple populations now returns lists of individual arrays. The functions in the galaxies module should be update to allow easy composition.

gal_lon, gal_lat, gal_cnt = uniform_positions(ngal_arr)
gal_z = redshifts_from_nz(gal_cnt, z, dndz)

Assuming ngal_arr is an array of shape (N,), the galaxy counts gal_cnt would be of shape (N,), and this should be broadcast against potential leading dimensions of dndz to produce a list of gal_z samples.

The existing gal_pop output, which has always been a little awkward, will then no longer be necessary.