<html><body>
<p>3 new commits in yt:</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/bb5f7b3d9590/">https://bitbucket.org/yt_analysis/yt/commits/bb5f7b3d9590/</a> Changeset:   bb5f7b3d9590 Branch:      yt User:        brittonsmith Date:        2016-03-26 12:59:05+00:00 Summary:     Take each field, value pair in data dict one at a time instead of doing the same thing for all of them. Affected #:  1 file</p>
<p>diff -r a776e67368c5629296b1e365dfca0b68b41ef1d5 -r bb5f7b3d9590072b02628b47c8eebebdf6571c3e yt/frontends/stream/data_structures.py --- a/yt/frontends/stream/data_structures.py +++ b/yt/frontends/stream/data_structures.py @@ -464,36 +464,46 @@</p>
<pre>        ds.stream_handler.particle_count[gi] = npart
                                        
def unitify_data(data):</pre>
<ul><li><p>if all([hasattr(val, ‘units’) for val in data.values()]):</p></li>
<li><p>new_data, field_units = {}, {}</p></li>
<li><p>for k, v in data.items():</p></li>
<li><p>field_units[k] = v.units</p></li>
<li><p>new_data[k] = v.copy().d</p></li>
<li><p>data = new_data</p></li>
<li><p>elif all([((not isinstance(val, np.ndarray)) and (len(val) == 2))</p></li>
<li><p>for val in data.values()]):</p></li>
<li><p>new_data, field_units = {}, {}</p></li>
<li><p>for field in data:</p></li></ul>
<p>+    new_data, field_units = {}, {} +    for field, val in data.items(): +        # val is a data array +        if isinstance(val, np.ndarray): +            # val is a YTArray +            if hasattr(val, "units"): +                field_units[field] = val.units +                new_data[field] = val.copy().d +            # val is a numpy array +            else: +                field_units[field] = "" +                new_data[field] = val.copy() + +        # val is a tuple of (data, units) +        elif isinstance(val, tuple) and len(val) == 2:</p>
<pre>try:
    assert isinstance(field, (string_types, tuple)), \
      "Field name is not a string!"</pre>
<ul><li><p>assert isinstance(data[field][0], np.ndarray), \</p></li></ul>
<p>+                assert isinstance(val[0], np.ndarray), \</p>
<pre>"Field data is not an ndarray!"</pre>
<ul><li><p>assert isinstance(data[field][1], string_types), \</p></li></ul>
<p>+                assert isinstance(val[1], string_types), \</p>
<pre>"Unit specification is not a string!"</pre>
<ul><li><p>field_units[field] = data[field][1]</p></li>
<li><p>new_data[field] = data[field][0]</p></li></ul>
<p>+                field_units[field] = val[1] +                new_data[field] = val[0]</p>
<pre>except AssertionError as e:</pre>
<ul><li><p>raise RuntimeError("The data dict appears to be invalid.\n" +</p></li>
<li><p>str(e))</p></li>
<li><p>data = new_data</p></li>
<li><p>elif all([iterable(val) for val in data.values()]):</p></li>
<li><p>field_units = {field:'' for field in data.keys()}</p></li>
<li><p>data = dict((field, np.asarray(val)) for field, val in iteritems(data))</p></li>
<li><p>else:</p></li>
<li><p>raise RuntimeError("The data dict appears to be invalid. "</p></li>
<li><p>"The data dictionary must map from field "</p></li>
<li><p>"names to (numpy array, unit spec) tuples. ")</p></li></ul>
<p>+                raise RuntimeError( +                    “The data dict appears to be invalid.\n” + str(e)) + +        # val is a list of data to be turned into an array +        elif iterable(val): +            field_units[field] = "" +            new_data[field] = np.asarray(val) + +        else: +            raise RuntimeError("The data dict appears to be invalid. " +                               "The data dictionary must map from field " +                               "names to (numpy array, unit spec) tuples. ") + +    data = new_data +</p>
<pre># At this point, we have arrays for all our fields
new_data = {}
for field in data:</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/76d5bf8b5d9e/">https://bitbucket.org/yt_analysis/yt/commits/76d5bf8b5d9e/</a> Changeset:   76d5bf8b5d9e Branch:      yt User:        brittonsmith Date:        2016-03-26 14:04:18+00:00 Summary:     Removing import. Affected #:  1 file</p>
<p>diff -r bb5f7b3d9590072b02628b47c8eebebdf6571c3e -r 76d5bf8b5d9efa4631c929a2b7c587cd7fafe39b yt/frontends/stream/data_structures.py --- a/yt/frontends/stream/data_structures.py +++ b/yt/frontends/stream/data_structures.py @@ -66,7 +66,7 @@</p>
<pre>from yt.data_objects.unstructured_mesh import \
    SemiStructuredMesh, \
    UnstructuredMesh</pre>
<p>-from yt.extern.six import string_types, iteritems +from yt.extern.six import string_types</p>
<pre>from .fields import \
    StreamFieldInfo
</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/2b15ed4adb92/">https://bitbucket.org/yt_analysis/yt/commits/2b15ed4adb92/</a> Changeset:   2b15ed4adb92 Branch:      yt User:        xarthisius Date:        2016-04-06 18:31:25+00:00 Summary:     Merged in brittonsmith/yt (pull request #2086)</p>
<p>Treat each field, value pair in data dict individually in load_particles (closes #1026) Affected #:  1 file</p>
<p>diff -r 112f06b287d902edabae84e430696e4fd40bcd96 -r 2b15ed4adb92292dc18d50f778b813f7e003cfc3 yt/frontends/stream/data_structures.py --- a/yt/frontends/stream/data_structures.py +++ b/yt/frontends/stream/data_structures.py @@ -66,7 +66,7 @@</p>
<pre>from yt.data_objects.unstructured_mesh import \
    SemiStructuredMesh, \
    UnstructuredMesh</pre>
<p>-from yt.extern.six import string_types, iteritems +from yt.extern.six import string_types</p>
<pre>from .fields import \
    StreamFieldInfo
</pre>
<p>@@ -464,36 +464,46 @@</p>
<pre>        ds.stream_handler.particle_count[gi] = npart
                                        
def unitify_data(data):</pre>
<ul><li><p>if all([hasattr(val, ‘units’) for val in data.values()]):</p></li>
<li><p>new_data, field_units = {}, {}</p></li>
<li><p>for k, v in data.items():</p></li>
<li><p>field_units[k] = v.units</p></li>
<li><p>new_data[k] = v.copy().d</p></li>
<li><p>data = new_data</p></li>
<li><p>elif all([((not isinstance(val, np.ndarray)) and (len(val) == 2))</p></li>
<li><p>for val in data.values()]):</p></li>
<li><p>new_data, field_units = {}, {}</p></li>
<li><p>for field in data:</p></li></ul>
<p>+    new_data, field_units = {}, {} +    for field, val in data.items(): +        # val is a data array +        if isinstance(val, np.ndarray): +            # val is a YTArray +            if hasattr(val, "units"): +                field_units[field] = val.units +                new_data[field] = val.copy().d +            # val is a numpy array +            else: +                field_units[field] = "" +                new_data[field] = val.copy() + +        # val is a tuple of (data, units) +        elif isinstance(val, tuple) and len(val) == 2:</p>
<pre>try:
    assert isinstance(field, (string_types, tuple)), \
      "Field name is not a string!"</pre>
<ul><li><p>assert isinstance(data[field][0], np.ndarray), \</p></li></ul>
<p>+                assert isinstance(val[0], np.ndarray), \</p>
<pre>"Field data is not an ndarray!"</pre>
<ul><li><p>assert isinstance(data[field][1], string_types), \</p></li></ul>
<p>+                assert isinstance(val[1], string_types), \</p>
<pre>"Unit specification is not a string!"</pre>
<ul><li><p>field_units[field] = data[field][1]</p></li>
<li><p>new_data[field] = data[field][0]</p></li></ul>
<p>+                field_units[field] = val[1] +                new_data[field] = val[0]</p>
<pre>except AssertionError as e:</pre>
<ul><li><p>raise RuntimeError("The data dict appears to be invalid.\n" +</p></li>
<li><p>str(e))</p></li>
<li><p>data = new_data</p></li>
<li><p>elif all([iterable(val) for val in data.values()]):</p></li>
<li><p>field_units = {field:'' for field in data.keys()}</p></li>
<li><p>data = dict((field, np.asarray(val)) for field, val in iteritems(data))</p></li>
<li><p>else:</p></li>
<li><p>raise RuntimeError("The data dict appears to be invalid. "</p></li>
<li><p>"The data dictionary must map from field "</p></li>
<li><p>"names to (numpy array, unit spec) tuples. ")</p></li></ul>
<p>+                raise RuntimeError( +                    “The data dict appears to be invalid.\n” + str(e)) + +        # val is a list of data to be turned into an array +        elif iterable(val): +            field_units[field] = "" +            new_data[field] = np.asarray(val) + +        else: +            raise RuntimeError("The data dict appears to be invalid. " +                               "The data dictionary must map from field " +                               "names to (numpy array, unit spec) tuples. ") + +    data = new_data +</p>
<pre># At this point, we have arrays for all our fields
new_data = {}
for field in data:</pre>
<p>Repository URL: <a href="https://bitbucket.org/yt_analysis/yt/">https://bitbucket.org/yt_analysis/yt/</a></p>
<p>—</p>
<p>This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.</p>

<img src="http://link.bitbucket.org/wf/open?upn=ll4ctv0L-2ByeRZFC1LslHcg6aJmnQ70VruLbmeLQr27CXMuCd7-2FvLkipRV1vnAgOzUH2NS-2BLKl8KyGl9HY03zRaKWgm2RFmWzeoIyZQz0N2AUurmzz8eb5cI4Mn-2FswXpEyT8OkttlRKSNU0eauyhrisYFwHZE1Df22uRDVsoHtHoSo9iNcbBdY8AL2h8MaEmY5d4KjWXgw3JxXG4bcoN2op1C04oRmk6GdlWUSl7O4Ak-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>