[yt-users] Streamplot error

Nathan Goldbaum nathan12343 at gmail.com
Thu Aug 18 11:10:08 PDT 2016


In your script, where you have:

plt.streamplot(X, Y, U, V, density=2,color='blue')

replace that with:

plt.streamplot(X, Y, np.array(U), np.array(V), density=2,color='blue')

U and V have units attached, but streamplot doesn't know about yt's unit
system, so you need to make sure they're plain old ndarrays (with no units)
before passing them to matplotlib.

On Thu, Aug 18, 2016 at 1:03 PM, Sushilkumar <sushil.sush19us at gmail.com>
wrote:

> Dear yt:
>
> I am getting the error as below while plotting streamplots. Could you let
> me know what is causing this problem? drive link to my code
> (yt_frb_streamplot.py) is also below.
>
> https://drive.google.com/open?id=0B4g8shg4DL7oak5PLWVVdG5UMHc
>
> Traceback (most recent call last):
>   File "yt_frb_streamplot.py", line 67, in <module>
>     plt.streamplot(X, Y, U, V, density=2,color='blue') # Here density
> adjusts the density of streamlines
>   File "/state/partition1/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py",
> line 3339, in streamplot
>     zorder=zorder)
>   File "/state/partition1/anaconda/lib/python2.7/site-packages/matplotlib/axes/_axes.py",
> line 4204, in streamplot
>     zorder=zorder)
>   File "/state/partition1/anaconda/lib/python2.7/site-packages/matplotlib/streamplot.py",
> line 74, in streamplot
>     grid = Grid(x, y)
>   File "/state/partition1/anaconda/lib/python2.7/site-packages/matplotlib/streamplot.py",
> line 261, in __init__
>     assert np.allclose(x_row, x)
>   File "/state/partition1/anaconda/lib/python2.7/site-packages/numpy/core/numeric.py",
> line 2372, in allclose
>     res = all(isclose(a, b, rtol=rtol, atol=atol, equal_nan=equal_nan))
>   File "/state/partition1/anaconda/lib/python2.7/site-packages/numpy/core/numeric.py",
> line 2453, in isclose
>     return within_tol(x, y, atol, rtol)
>   File "/state/partition1/anaconda/lib/python2.7/site-packages/numpy/core/numeric.py",
> line 2436, in within_tol
>     result = less_equal(abs(x-y), atol + rtol * abs(y))
>   File "/state/partition1/anaconda/lib/python2.7/site-packages/yt/units/yt_array.py",
> line 732, in __radd__
>     lo = sanitize_units_add(self, left_object, "addition")
>   File "/state/partition1/anaconda/lib/python2.7/site-packages/yt/units/yt_array.py",
> line 134, in sanitize_units_add
>     raise YTUnitOperationError(op_string, inp.units, dimensionless)
> yt.utilities.exceptions.YTUnitOperationError: The addition operator for
> YTArrays with units (km) and (1) is not well defined.
>
>
>
>
>
>
> On Tue, Aug 16, 2016 at 1:00 PM, <yt-users-request at lists.spacepope.org>
> wrote:
>
>> Send yt-users mailing list submissions to
>>         yt-users at lists.spacepope.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>         http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>> or, via email, send a message with subject or body 'help' to
>>         yt-users-request at lists.spacepope.org
>>
>> You can reach the person managing the list at
>>         yt-users-owner at lists.spacepope.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of yt-users digest..."
>>
>>
>> Today's Topics:
>>
>>    1. Re: conda install (John Regan)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 16 Aug 2016 15:34:48 +0100
>> From: John Regan <johnanthonyregan at gmail.com>
>> To: Discussion of the yt analysis package
>>         <yt-users at lists.spacepope.org>
>> Subject: Re: [yt-users] conda install
>> Message-ID:
>>         <CABzd+TFisnpj44UZ3NUQ4HnEHNAuS_iQR+LzM2YRU_a9DntX=Q at mail.
>> gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> perfect - thanks Nathan!
>>
>> On Mon, Aug 15, 2016 at 5:20 PM, Nathan Goldbaum <nathan12343 at gmail.com>
>> wrote:
>>
>> >
>> >
>> > On Mon, Aug 15, 2016 at 11:18 AM, John Regan <
>> johnanthonyregan at gmail.com>
>> > wrote:
>> >
>> >> Hi All,
>> >>
>> >> Quick question on the conda install system.
>> >>
>> >> I'm sure this is very easy but when I update the source folder e.g.
>> >> ~/ytfork/yt/analysis_modules/.....
>> >> how do I then get that reflected in the yt-conda installation e.g. in
>> >> ~/ytfork/doc/yt-conda/lib/.../analysis_modules?
>> >>
>> >> I could copy the "source" files directly into the "lib" directory but
>> I'm
>> >> guessing there is a better way?
>> >>
>> >
>> > $ conda uninstall yt
>> > $ pip uninstall yt
>> > $ cd ~/ytfork/
>> > $ python setup.py develop
>> >
>> > And now ~/ytfork/ will be the "active" installation.
>> >
>> >
>> >>
>> >>
>> >> John
>> >>
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> yt-users mailing list
>> >> yt-users at lists.spacepope.org
>> >> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>> >>
>> >>
>> >
>> > _______________________________________________
>> > yt-users mailing list
>> > yt-users at lists.spacepope.org
>> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>> >
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org
>> /attachments/20160816/30447b70/attachment.html>
>>
>> ------------------------------
>>
>> Subject: Digest Footer
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>> ------------------------------
>>
>> End of yt-users Digest, Vol 102, Issue 22
>> *****************************************
>>
>
>
>
> --
> *SK2*
>
> *"**Claiming that something can move faster than light is a good
> conversation-stopper in physics. People edge away from you in cocktail
> parties; friends never return phone calls. You just don’t mess with Albert
> Einstein.**"*
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160818/8f733032/attachment-0001.htm>


More information about the yt-users mailing list