[yt-dev] Some questions about TimeSeries

John ZuHone jzuhone at gmail.com
Wed Jul 11 08:48:26 PDT 2012


Hi Britton,

> The place to look is the eval function for TimeSeriesData.  On line 125 of yt/data_objects/time_series.py, store.result is initialized to a list and all return values are appended to that list on line 141.  This looks to me to be handling tasks called with piter that have multiple return values.  If you add something like:
> if len(store.result) == 1: store.result = store.result[0]
> just outside of the "for task in tasks" loop, it produces the behavior that we discussed.  However, now that I understand why this was done, I'm not so sure it should be changed.  Having tasks dispatched with piter send back their return values in a list is a desired feature I think, and so I think that generality should be preserved.  Perhaps there is a solution that could only affect getting parameters through params, but I think we should let Matt chime in on this, since he is the most knowledgeable about this area of the code.

However, this also seems to affect things not in params in an undesirable way. For example:

from yt.mods import *
all_files = glob.glob("*/*.hierarchy")
all_files.sort()
ts = TimeSeries.from_filenames(all_files)
sphere = ts.sphere("max", (1.0, "pc"))
L_vecs = sphere.quantities["AngularMomentumVector"]()

L_vecs gets returned as something like:

[[array([l1,l2,l3])],
 [array([l4,l5,l6])],
...
 [array([ln,lm,lo])]]

Where once again you have lists of one object, namely in this case the NumPy arrays which are the angular momentum vector. So, generically speaking you are always getting an extra list in there you don't need, it seems.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20120711/a1e6395d/attachment.html>


More information about the yt-dev mailing list