pynbody / pynbody

N-body and hydro analysis tools for Python 3. (Older versions support Python 2.)
http://pynbody.github.io/pynbody/index.html
161 stars 76 forks source link

Geometric filters use periodic BCs even if the snapshot is rotated #799

Open apontzen opened 4 months ago

apontzen commented 4 months ago

Geometric filters wrap particles around the box using simple logic here:

https://github.com/pynbody/pynbody/blob/master/pynbody/filt/geometry_selection.hpp#L11

However, if the snapshot has been rotated so that the box axes don’t align with the coordinate axes, this will give wrong results.

In the same way that the KDTree now disables periodicity on a rotated box, so too should these filters.

A unified approach to this would be best, setting/unsetting a flag that tracks when a simulation is in its original orientation.