So this isn't really a bug (or a problem at all) - matplotlib is just warning that the image yt is passing to matplotlib's imshow command contains NaN values.

This was actually done on purpose in yt, you can see what the code looks like here:

https://github.com/yt-project/yt/blob/master/yt/visualization/fixed_resolution.py#L613

That was added in this commit:

https://github.com/yt-project/yt/commit/6f378028f7a1eedd553f7641be719762f0c121b2

And you can see a test script that explains why we did this change in this PR:

https://bitbucket.org/yt_analysis/yt/pull-requests/2565/remove-values-in-no-particle-region-for/diff

(I can't remember why that was declined, I think it was manually merged in right around when we we moved to GitHub)

I guess in principle we could suppress that warning on the yt side, although that might be a case of using a cudgel when all we need is a hammer. We could also think about ways to mask out images without relying on NaN in matplotlib. One could also argue that passing NaN to matplotlib as a mask is a common enough thing that matplotlib itself should be doing special handing at the line raising the warning to avoid generating it.

It's not really a problem that matplotlib is generating the warning. You can safely ignore it.



On Wed, May 16, 2018 at 10:49 AM, Nick Gnedin <ngnedin@gmail.com> wrote:

Nathan,

Done (I tared 4 files together):

/data/gnedin/REI/TMP >tar cvf gnedin_hop.tar hop.*
hop.0.h5
hop.1.h5
hop.2.h5
hop.3.h5
/data/gnedin/REI/TMP >yt upload gnedin_hop.tar
Stream body handler: received 9687040 bytes
http://use.yt/upload/318d837f

The files are available on BlueWaters at:
/mnt/c/scratch/sciteam/ngnedin/PERM/B40/A.DMO/a=1.0008/hop/hop.*.h5

Thanks a lot.

Nick



On 05/16/2018 09:38 AM, Nathan Goldbaum wrote:
Hi,

Is there any chance you can share the hdf5 file? I'm not able to reproduce this warning using a test dataset I have so it might have something to do with the data.

You can share a dataset with "yt upload path/to/data.h5". That will upload to a server at NCSA and then print a link out to share here once its done.

If the data cannot be shared publicly you can send me an e-mail off-list with e.g. a dropbox link.

-Nathan

On Wed, May 16, 2018 at 10:32 AM, Nick Gnedin <ngnedin@gmail.com <mailto:ngnedin@gmail.com>> wrote:


    I am trying to make a plot of all halos found by HOP. I copied your
    example from http://yt-project.org/doc/cookbook/simple_plots.html
    <http://yt-project.org/doc/cookbook/simple_plots.html>

    If I just plot partile positions:

    --------------------- script -------------------
    import yt
    import numpy as np

    # load the dataset
    ds = yt.load('../B40/A.DMO/a=1.0008/hop/hop.0.h5')

    # create our plot
    p = yt.ParticlePlot(ds, 'particle_position_x', 'particle_position_y')

    m = ds.all_data()[('all', 'particle_mass')]
    print(np.amin(m),np.amax(m))

    # pick some appropriate units
    p.set_axes_unit('Mpc')
    p.set_unit('particle_mass', 'Msun')

    #save result
    p.save()
    -----------------------------------------------

    then everything works fine. However, if I use mass weighting:

      p = yt.ParticlePlot(ds, 'particle_position_x',
    'particle_position_y', 'particle_mass')

    I get the following error:

    ...
    yt : [INFO     ] 2018-05-16 09:27:39,004 Allocating for 1.997e+05
    particles (index particle type 'all')
    yt : [INFO     ] 2018-05-16 09:27:39,381 Identified 5.972e+04 octs
    yt : [INFO     ] 2018-05-16 09:27:40,021 xlim = 0.000000
    199229564535610884216586240.000000
    yt : [INFO     ] 2018-05-16 09:27:40,021 ylim = 0.000000
    199229564535610884216586240.000000
    yt : [INFO     ] 2018-05-16 09:27:40,023 xlim = 0.000000
    199229564535610884216586240.000000
    yt : [INFO     ] 2018-05-16 09:27:40,023 ylim = 0.000000
    199229564535610884216586240.000000
    yt : [INFO     ] 2018-05-16 09:27:40,042 Splatting (('all',
    'particle_mass')) onto a 800 by 800 mesh
    4.1036023233207635e+41 g 1.921697915571756e+47 g
    yt : [INFO     ] 2018-05-16 09:27:44,084 Saving plot
    hop.0.h5_Particle_z_particle_mass.png
    /u/sciteam/ngnedin/.local/lib/python3.5/site-packages/matplotlib/colors.py:1020:
    RuntimeWarning: invalid value encountered in less_equal
       mask |= resdat <= 0

    Notice, that there are no nonpositive masses in the catalog
    print(np.amin(m),np.amax(m)):
             4.1036023233207635e+41 g 1.921697915571756e+47 g




    _______________________________________________
    yt-users mailing list -- yt-users@python.org
    <mailto:yt-users@python.org>
    To unsubscribe send an email to yt-users-leave@python.org
    <mailto:yt-users-leave@python.org>