centre coords at 0

This commit is contained in:
rstiskalek 2022-11-06 09:06:03 +00:00
parent 1cd3f10848
commit 0baa81a4f4

View file

@ -278,7 +278,8 @@ def convert_from_boxunits(data, names, boxunits):
- density -> solar mass per cubed kpc.
Any other conversions are currently not implemented. Note that the array
is passed by reference and directly modified, even though it is also
explicitly returned.
explicitly returned. Additionally centres the box coordinates on the
observer, if they are being transformed.
Parameters
----------
@ -323,4 +324,8 @@ def convert_from_boxunits(data, names, boxunits):
raise NotImplementedError(
"Conversion of `{}` is not defined.".format(name))
# Center at the observer
if name in ["peak_x", "peak_y", "peak_z"]:
data[name] -= transforms["length"](0.5)
return data