I don't have time to do this right now, but here is how I would implement boolean objects.
* Implement a new binary operation subclass selector which always has two cdef'd selector objects as attributes. *No* unary operations; these should be implemented as binary with AlwaysSelector. * Subclass that with the necessary binary boolean operations (and, or, xor) * Implement all subclassed selection operations with wrappers around calling each individual selector's operations * Exclusively chain these operations in python using the built-in AST by implementing dunder logic operations * Do not at any time implement a DSL * If necessary, implement a union operator that accepts multiple selector objects
On Fri, Jun 10, 2016 at 9:11 AM, Brian O'Shea email@example.com wrote:
I've stumbled across across a research task that could really use yt's Boolean data object feature, and according to the documentation it is not implemented in yt-3. Have boolean data objects been replaced by something else? I know there are various filtering methods in yt, but what I really need to do is spatial filtering (i.e., data in a sphere with some chunks of the sphere excised).
This hasn't been implemented.
In principle I'd be happy to take a crack at re-implementing it, although I might need some help. Could somebody give me a sense of why it wasn't ported to yt-3 when the changeover was made?
The data selection API was completely rewritten.
How difficult might it be to re-implement the boolean data objects in the new data selection API? (I suppose the question is really "how difficult might it be for somebody who is a decent programmer but not an expert in yt's internals to do so"?)
I'm not sure, offhand. Probably very hard if you want to use the eval-style way of contrusting the data objects using a string written in Python, since data selection happens at a lower level in yt now. See selection_routines.pyx for more details about how this works.
It is possible to combine data objects by chaining data_source keyword arguments, (e.g. one can create a half-sphere data object by chaining a region that selects only half a sphere with a sphere data object). It may be possible to generalize that somehow.
OK, this is useful. I will think about it a bit. Thanks!
yt-dev mailing list firstname.lastname@example.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org