<div dir="ltr">Hi <span style="color:rgb(0,0,0);font-size:12.8000001907349px">Suoqing, Nathan, </span><div><span style="color:rgb(0,0,0);font-size:12.8000001907349px"><br></span></div><div><span style="color:rgb(0,0,0);font-size:12.8000001907349px">The annotate_sphere works perfect here! </span></div><div><span style="color:rgb(0,0,0);font-size:12.8000001907349px">Also, thanks for pointing me to FRBs, this should be helpful when I make future yt plots.</span><div><span style="color:rgb(0,0,0);font-size:12.8000001907349px"><br></span></div><div><span style="color:rgb(0,0,0);font-size:12.8000001907349px">Doris</span></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 1, 2015 at 9:23 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Jun 1, 2015 at 9:13 PM, DORIS LEE <span dir="ltr"><<a href="mailto:dorislee@berkeley.edu" target="_blank">dorislee@berkeley.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span style="font-size:12.8000001907349px">Hi all, </span><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">I have been trying to plot a circle of a given radius around the boundary of a collapsing cloud to track its evolution. </div><div style="font-size:12.8000001907349px">Usually in matplotlib, I would just draw a circle using a xy meshgrid, but if I do this using matplotlib the circle would be on a separate figure and not overlaid on the yt plot. So I tried using a PlotWindow to separate the data and the yt plot  but I get this error:</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><div style="display:flex;color:rgb(0,0,0);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px"><div style="min-width:11ex;padding:0.4em;margin:0px;font-family:monospace;text-align:right;line-height:1.21429em;color:rgb(0,0,128);border-top-width:1px;border-top-style:solid;border-top-color:transparent">In [92]:<span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">yt</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">.</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">visualization</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">.</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">plot_window</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">.</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">PlotWindow</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">(</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">proj</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">,(</span><span style="font-family:inherit;line-height:inherit;font-size:inherit;color:rgb(170,34,255);font-weight:bold;background-color:transparent">-</span><span style="font-family:inherit;line-height:inherit;font-size:inherit;color:rgb(0,136,0);background-color:transparent">1e5</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">,</span><span style="font-family:inherit;line-height:inherit;font-size:inherit;color:rgb(0,136,0);background-color:transparent">1e5</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">,</span><span style="font-family:inherit;line-height:inherit;font-size:inherit;color:rgb(170,34,255);font-weight:bold;background-color:transparent">-</span><span style="font-family:inherit;line-height:inherit;font-size:inherit;color:rgb(0,136,0);background-color:transparent">1e5</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">,</span><span style="font-family:inherit;line-height:inherit;font-size:inherit;color:rgb(0,136,0);background-color:transparent">1e5</span><span style="font-family:inherit;line-height:inherit;color:inherit;font-size:inherit;background-color:transparent">))</span></div></div><div style="display:flex;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px"><div style="display:flex"><div style="padding:0px;display:flex"><div style="padding:0.4em 0.4em 0px;line-height:1.21429em"><pre style="white-space:pre-wrap;padding:0px;font-size:inherit;border-radius:0px;margin-top:0px;margin-bottom:0px;line-height:inherit;word-break:break-all;word-wrap:break-word;border:0px;vertical-align:baseline;background-color:transparent"><span style="color:rgb(139,0,0)">AttributeError</span><font color="#000000">: 'ProjectionPlot' object has no attribute '_key_fields'</font></pre></div></div></div></div></div></div></blockquote><div><br></div></span><div>PlotWindow is a base class for the other plot objects, and it should never be instantiated directly.  We could probably add some logic so the error here is less obscure just in case a future user gets confused and tries to do this.</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-size:12.8000001907349px"><div style="display:flex;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px"><div style="display:flex"><div style="padding:0px;display:flex"><div style="padding:0.4em 0.4em 0px;line-height:1.21429em"><pre style="white-space:pre-wrap;padding:0px;font-size:inherit;border-radius:0px;margin-top:0px;margin-bottom:0px;line-height:inherit;word-break:break-all;word-wrap:break-word;border:0px;vertical-align:baseline;background-color:transparent"><font color="#000000">
</font></pre><div style="color:rgb(0,0,0)"><br></div></div></div></div></div></div><div style="font-size:12.8000001907349px">In general, is there to get my RAMSES data loaded into yt as a numpy array with actual numbers in them then feed it into matplotlib to do this task? or alternatively, is there a simpler way to do this directly on yt using annotate_contour or some other yt function?</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Thank you.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Regards,</div><div style="font-size:12.8000001907349px">Doris</div><div style="font-size:12.8000001907349px">----</div><div style="font-size:12.8000001907349px">Code for generating the attached plot, the green boundary line is in theory what I am trying to draw.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><div>ds= yt.load("../../bin/output_00002/info_00002.txt")</div><div>proj = yt.ProjectionPlot(ds, "y", "density",window_size=10)</div><div>proj.set_cmap("density","rainbow")</div><div>proj.annotate_velocity()</div><div>proj.show()</div></div></div></blockquote><div><br></div></span><div>Have you seen the sphere callback?</div><div><br></div><div><a href="http://yt-project.org/docs/dev/visualizing/callbacks.html#overplot-a-circle-on-a-plot" target="_blank">http://yt-project.org/docs/dev/visualizing/callbacks.html#overplot-a-circle-on-a-plot</a><br></div><div><br></div><div>You can also access the matplotlib figure and axes object that the ProjectionPlot wraps:</div><div><br></div><div><a href="http://yt-project.org/docs/dev/cookbook/simple_plots.html#accessing-and-modifying-plots-directly" target="_blank">http://yt-project.org/docs/dev/cookbook/simple_plots.html#accessing-and-modifying-plots-directly</a><br></div><div><br></div><div>Additionally, if you want the raw data to create the plot yourself using matplotlib, plot objects have an "frb" attribute (short for FixedResolutionBuffer) you can use to get the raw image you can pass to matplotlib's imshow function.  In the above script, you should be able to do something like:</div><div><br></div><div>    dens = proj.frb['density']</div><div><br></div><div>    print dens.shape</div><div>    print dens.units</div><div><br></div><div>    # strip units to pass to matplotlib </div><div>    dens = np.array(dens)</div><div><br></div><div>    plt.imshow(dens)</div><div><br></div><div>You can also create a FixedReslutionBuffer without creating a plot object first:</div><div><br></div><div><a href="http://yt-project.org/docs/dev/quickstart/data_objects_and_time_series.html?highlight=frb" target="_blank">http://yt-project.org/docs/dev/quickstart/data_objects_and_time_series.html?highlight=frb</a><br></div><div><br></div><div>(this is actually how the PlotWindow class is implemented internally).</div><div> </div><div>Hope that's helpful,</div><div><br></div><div>Nathan</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></span></div><br></div></div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>