[yt-dev] Boolean data objects in yt-3

Matthew Turk matthewturk at gmail.com
Fri Jul 1 11:53:52 PDT 2016


This is now mostly implemented in
https://bitbucket.org/yt_analysis/yt/pull-requests/2257 .  (Automated)
tests and documentation are still in progress, and this cannot go in
before 3.3 is released.

-Matt

On Mon, Jun 13, 2016 at 12:41 PM, Matthew Turk <matthewturk at gmail.com> wrote:
> Hi,
>
> 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
>
> -Matt
>
> On Fri, Jun 10, 2016 at 9:11 AM, Brian O'Shea <bwoshea at gmail.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
>> yt-dev at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>>


More information about the yt-dev mailing list