Evaluate LOS distances (#113)

* Add field_los

* fix typo

* add fix bug

* bug fixes

* Add docs

* Add more docs
This commit is contained in:
Richard Stiskalek 2024-02-27 12:40:52 +00:00 committed by GitHub
parent fc51f75e16
commit 66d9f46919
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 289 additions and 1 deletions

View file

@ -163,7 +163,7 @@ def evaluate_los(*fields, sky_pos, boxsize, rmax, dr, smooth_scales=None,
raise ValueError("`sky_pos` must be a 2D array.")
nsamples = len(sky_pos)
if rmax > 3**0.5 / 2 * boxsize:
if rmax > 0.5 * boxsize:
raise ValueError("The maximum radius must be within the box.")
# Radial positions to evaluate for each line of sight.
@ -194,6 +194,8 @@ def evaluate_los(*fields, sky_pos, boxsize, rmax, dr, smooth_scales=None,
field_interp = evaluate_cartesian(*fields, pos=pos,
smooth_scales=smooth_scales,
verbose=verbose)
if len(fields) == 1:
field_interp = [field_interp]
# Now we reshape the interpolated field to have the same shape as the
# input `sky_pos`.