[yt-users] Clumps, contours, n_contours

Matthew Turk matthewturk at gmail.com
Tue May 21 08:53:37 PDT 2013


Hi Dave,

Yes, please -- I think that is the right solution.  Thank you!

-MAtt

On Tue, May 21, 2013 at 11:43 AM, David Collins
<dcollins at physics.ucsd.edu> wrote:
> Hi, Matt-
>
> That's a good idea.  I tried
> np.unique(buff)
> and it fixed the problem.  Should I make a PR with this change?
>
> d.
>
>
> On Tue, May 21, 2013 at 7:16 AM, Matthew Turk <matthewturk at gmail.com> wrote:
>>
>> Hi Dave,
>>
>> I think the way contours works is that it sets N contours.  What might
>> work better, since we're contouring images, would be to explicitly
>> specify the contours.  Can you test if something like range(N+1) works
>> better, rather than len(contours)?
>>
>> -Matt
>>
>> On Mon, May 20, 2013 at 7:04 PM, David Collins <dcollins4096 at gmail.com>
>> wrote:
>> > Hi, Nathan--
>> >
>> > I thought about the colorbar thing, so I made the image grayscale and it
>> > still doesnt' show up.  I also set the zlim so that the data was either
>> > all
>> > white or black, and it shows up in neither.
>> >
>> > I've attached two representative images.  By construction all of these
>> > contours are disjoint.  The missing clump is pretty obvious, as it takes
>> > up
>> > most of the image where it exists.
>> >
>> > The two attached plots are two tweaks to
>> > plot_modifications.py/ClumpContourCallback, at line ~700
>> > the "plus_3" plot uses
>> > self.rv = plot._axes.contour(buff,  len(self.clumps)+3,
>> >                                      extent=extent,**self.plot_args)
>> > the "plus_5" plot uses
>> >
>> > self.rv = plot._axes.contour(buff,  len(self.clumps)+5,
>> >                                      extent=extent,**self.plot_args)
>> >
>> > The code to reproduce the plot is pretty benign, and is below for
>> > generality.  the list clumps_to_use comes from a set of pickled clumps
>> > for
>> > this dataset.  I'll see if I can reproduce it with something more
>> > universally accessible.  I'm quite sure that it doesn't have anything to
>> > do
>> > with the clump itself, as I've seen this behavior with other calls to
>> > 'contour'.  I'm working on a simpler thing that demonstrates this-- I've
>> > seen it with code that uses no piece of yt, so I'm 97.2% sure that it's
>> > contour and not yt.  (Might be something else dumb I'm doing, that's
>> > pretty
>> > common, but I haven't been able to sort out what it is.)
>> >
>> > <code>
>> >     field='Density'
>> >     center = [0.5]*3
>> >     proj = pf.h.proj(ax,field,center=center)
>> >     plot = proj.to_pw(origin='domain')
>> >     plot.set_cmap('Density','gray')
>> >     subset = 'black_map_fixed'
>> >     plot.set_zlim('Density',1e6,1e7)
>> >     if clumps_to_use is not None:
>> >         plot.annotate_clumps(clumps_to_use)
>> >     print plot.save('%s_n%04d_%s'%(name,frame,subset))
>> > </code>
>> >
>> >
>> >
>> >
>> > On Mon, May 20, 2013 at 4:21 PM, Nathan Goldbaum <nathan12343 at gmail.com>
>> > wrote:
>> >>
>> >> Hi Dave,
>> >>
>> >> I haven't seen this.  Could this be due to the colorbar?  I believe it
>> >> picks the contour colors based on a colorbar.  If the colors it picks
>> >> are
>> >> invisible on your plot, you won't see the contours.
>> >>
>> >> It would help to figure out what's going on if you could come up with a
>> >> sample script that illustrates the issue.  Bonus points if you use one
>> >> of
>> >> the datasets on yt-project.org/data.
>> >>
>> >> -Nathan
>> >>
>> >>
>> >> On Mon, May 20, 2013 at 3:17 PM, david collins <dcollins4096 at gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi, all--
>> >>>
>> >>> I'm seeing a glitch in the matplotlib countor function, as employed by
>> >>> annotate_clumps.  As is, I'm seeing some clumps that are not plotted
>> >>> by the
>> >>> countour plotter unless I bump the number of contours-- I get all the
>> >>> plots
>> >>> if I change the contour line to:
>> >>>
>> >>> self.rv = plot._axes.contour(buff, len(self.clumps)+5,
>> >>>                                      extent=extent,**self.plot_args)
>> >>>
>> >>> instead of
>> >>>
>> >>> self.rv = plot._axes.contour(buff, len(self.clumps)+1,
>> >>>                                      extent=extent,**self.plot_args)
>> >>>
>> >>>
>> >>> Is this a glitch that anyone is aware of?  Is there a more general
>> >>> fix?
>> >>> The clump contour is not the only time I've run into this glitch. It
>> >>> seems
>> >>> to happen on large contours, for what that's worth.
>> >>>
>> >>> Thanks!
>> >>> d.
>> >>>
>> >>> _______________________________________________
>> >>> 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
>> >>
>> >
>> >
>> > _______________________________________________
>> > 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
>
>
>
>
> --
> Sent from my computer.
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list