Open RicardaBeckmann opened 5 years ago
I think this might be hard to implement in general, since the cut_region
is a special case in a number of ways.
The first place to look would be to see how the data access works at a low level. In principle it should be using the CutRegionSelector
to do the underlying geometric selection but it's possible that we've special cased things for the cut region in a way that avoids this code path, since the CutRegionSelector
did not exist when we first implemented cut regions.
Also note that the CutRegionSelector
has weird issues associated with it because it's sensitive to floating point round-off issues (see e.g. https://github.com/yt-project/yt/issues/1646).
I think this will be hard to fix in time for yt 3.5 so I've marked the milestone as 4.0.
Bug report
Bug summary When using a cut_region object as a data_source for a (larger) geometric object, the number of particles in the final object is larger than the number of particles in the original cut_region.
For example, if I define a cut_region that only contains 50 stars, and entirely encompass it in a ds.box object, the new box will suddenly contain 138 stars. If I make a sphere that only contains 50 stars, and encompass it in a larger box, the larger box will still only contain 50 stars.
The example code below demonstrates this in an extreme case. Using my full simulation, the number of particles I get for the "cut region in box" situation isn't necessarily equal to the total number of particles, as in the example here. Instead, it is always larger but not by a consistent factor and not by an integer either. I've seen 27.2 times the original number of particles, and 98.33 times. The new number of particles is consistent for a given set of input parameters.
Code for reproduction
Output
Expected outcome
I would expect the number of particles contained in an object to be determined by the smallest or most restrictive object used to build it. I.e. when a data_source is used to define a new object, I would expect the number of particles in the new object to be equal or smaller than the number of particles in the original object, but never bigger.
For the code-snippet, this means that the code should have reported 0 particles in the last printed line.
Version Information