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. - density -> solar mass per cubed kpc.
Any other conversions are currently not implemented. Note that the array Any other conversions are currently not implemented. Note that the array
is passed by reference and directly modified, even though it is also 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 Parameters
---------- ----------
@ -288,7 +289,7 @@ def convert_from_boxunits(data, names, boxunits):
Columns to be converted. Columns to be converted.
boxunits : `BoxUnits` boxunits : `BoxUnits`
Box units class of the simulation and snapshot. Box units class of the simulation and snapshot.
Returns Returns
------- -------
data : structured array data : structured array
@ -323,4 +324,8 @@ def convert_from_boxunits(data, names, boxunits):
raise NotImplementedError( raise NotImplementedError(
"Conversion of `{}` is not defined.".format(name)) "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 return data