[yt-dev] Issue #1304: Boolean objects only inherit the fields present in both of their parent objects (yt_analysis/yt)

chummels issues-reply at bitbucket.org
Tue Dec 20 12:21:37 PST 2016


New issue 1304: Boolean objects only inherit the fields present in both of their parent objects
https://bitbucket.org/yt_analysis/yt/issues/1304/boolean-objects-only-inherit-the-fields

chummels:

Boolean objects are meant to combine the fields present in two data objects from the same dataset.  Normally, this means that they will have the same fields present.

However, the `ray` object creates a special field `"t"` as a parametric variable to tell you how far along the ray you are (goes from 0 to 1).  When I take an intersection of this `ray` object with a `region` object, the result lacks this `"t"` field because `"t"` is only present in a single parent in the boolean intersection.

Here is an example of this in action with a sample dataset:

import yt
import numpy as np

ds = yt.load("gizmo_cosmology_plus/snap_N128L16_151.hdf5")
ad = ds.all_data()
ad[('gas', 'temperature')]

ray_start = ds.arr(np.random.random(3), 'unitary')
ray_end = ds.arr(np.random.random(3), 'unitary')
ray1 = ds.ray(ray_start, ray_end)
ray2 = ray1 & ad
# ray1 object *has* a t field because it was created from scratch
print ray1['t']
# ray2 object *lacks* a t field because only one of its parents contains it
print ray2['t']




More information about the yt-dev mailing list