<div dir="ltr">Dear Cameron Hummels, <div><br></div><div>Your script to generate a 3x3 image is quite sufficient. But is there any attribute to 'AMRSlice' object (or any other method) to produce a color code scale on the right of each row or below to each column. </div>
<div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 7, 2013 at 3:15 AM, Cameron Hummels <span dir="ltr"><<a href="mailto:chummels@gmail.com" target="_blank">chummels@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">Hi Reju,<div><br></div><div>It looks like your for loops are in the wrong order (as you correctly surmised). Your first "for" loop (i.e. <span style="font-family:'courier new',monospace;font-size:large">for kk in L:</span>) goes through each redshift output, and it generates a new 3x3 plot collection for each one which it populates with the slice plots for that redshift.</div>
<div><br></div><div>What I think you want to do is run the two later for loops (i.e. <span style="font-family:'courier new',monospace;font-size:large">for i in range (0,3): </span><span style="font-family:'courier new',monospace;font-size:large">for j in range (0, 3):</span>) first, and then load in the individual redshift outputs to populate the plot collection. Unfortunately, and someone can correct me here if I'm wrong, but I don't think you'll be able to use the Plot Collection data structure to do this. PlotCollections are necessarily tied to a single data output, not several as you're trying to do here with the data outputs for each redshift. </div>
<div><br></div><div>What you'll likely have to do instead is just generate an array of slices, where you generate each from a different data output. There is some examples of this on the yt docs page here: </div><div>
<br></div><div><a href="http://yt-project.org/doc/cookbook/complex_plots.html#multi-plot-slice-and-projections" target="_blank">http://yt-project.org/doc/cookbook/complex_plots.html#multi-plot-slice-and-projections</a><br>
</div><div><br>
</div><div>and here:</div><div><br></div><div><a href="http://yt-project.org/doc/cookbook/complex_plots.html#advanced-multi-plot-multi-panel" target="_blank">http://yt-project.org/doc/cookbook/complex_plots.html#advanced-multi-plot-multi-panel</a><br>
</div><div><br></div><div><br></div><div>In addition, I wrote up a quick basic script to generate a 3x3 image array with slices (or projections) from a bunch of different data outputs. I think it is what you're trying to do. It's here:</div>
<div><br></div><div><a href="http://paste.yt-project.org/show/3749/" target="_blank">http://paste.yt-project.org/show/3749/</a><br></div><div><br></div><div>and it generates this image:</div><div><br></div><div><a href="http://i.imgur.com/lhUrcbI.png" target="_blank">http://i.imgur.com/lhUrcbI.png</a></div>
<div><br></div><div>I hope this helps. Let us know if you have any other questions regarding this.</div><div><br></div><div>Cameron</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">
On Tue, Aug 6, 2013 at 10:09 AM, Reju Sam John <span dir="ltr"><<a href="mailto:rejusamjohn@gmail.com" target="_blank">rejusamjohn@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Dear all,<br><div class="gmail_quote"><div dir="ltr"><div class="gmail_quote">
<div dir="ltr"><div><br></div>
<div>I am trying to create a muti plot of density's at different red-shift with the following code. </div>
<div><br></div><div><div>
<font face="courier new, monospace" size="4">from yt.mods import * </font></div>
<div><font face="courier new, monospace" size="4">import matplotlib.colorbar as cb</font></div><div><font face="courier new, monospace" size="4"><br></font></div><div><font face="courier new, monospace" size="4">fig, axes, colorbars = get_multi_plot( 3, 3, colorbar='vertical', bw = 3)</font></div>
<div><font face="courier new, monospace" size="4">file1="/app/run/csarkar/surajit/simulation_shock/simulation5/RD00"</font></div><div><font face="courier new, monospace" size="4">file2="/RedshiftOutput00"</font></div>
<div><font face="courier new, monospace" size="4"><br></font></div>
<div><font face="courier new, monospace" size="4">L = [11,15,18,20,22,25,30,35,40]</font></div><div><font face="courier new, monospace" size="4"><br></font></div><div><font face="courier new, monospace" size="4">#for i in range (0, 8):</font></div>
<div><font face="courier new, monospace" size="4">for kk in L: </font></div><div><font face="courier new, monospace" size="4"> fn_i=str(kk)</font></div><div><font face="courier new, monospace" size="4"> fn=file1+fn_i+file2+fn_i </font></div>
<div><font face="courier new, monospace" size="4"> print fn</font></div><div><font face="courier new, monospace" size="4"> pf = load(fn) </font></div><div><font face="courier new, monospace" size="4"> pc = PlotCollection(pf, center=[0.5, 0.5, 0.5])</font></div>
<div><font face="courier new, monospace" size="4"> for i in range (0,3):</font></div><div><font face="courier new, monospace" size="4"> for j in range (0, 3):</font></div><div><font face="courier new, monospace" size="4"> p = pc.add_slice("Density", 2, axes = axes[i][j],figure = fig, use_colorbar=False)</font></div>
<div><font face="courier new, monospace" size="4"> p.set_log_field(True)</font></div><div><font face="courier new, monospace" size="4"> p.set_zlim(1e-31,5e-26)</font></div><div><font face="courier new, monospace" size="4"> p.set_cmap("jet") </font></div>
<div><font face="courier new, monospace" size="4"> p.modify["contour"]("Density", ncont=10, plot_args = {'colors':'w'},clim=(2e-28,2e-26)) </font></div><div><font face="courier new, monospace" size="4"> p.modify["contour"]("Temperature", ncont=10, plot_args = {'colors':'k'},clim=(3e7,1e8))</font></div>
<div><font face="courier new, monospace" size="4"> #pc.set_width(3.0, 'mpc') </font></div><div><font face="courier new, monospace" size="4"> #break</font></div><div><font face="courier new, monospace" size="4"> # i = i+1</font></div>
<div><font face="courier new, monospace" size="4"><br></font></div><div><font face="courier new, monospace" size="4"> </font></div><div><font face="courier new, monospace" size="4">for p, cax in zip(pc.plots, colorbars):</font></div>
<div><font face="courier new, monospace" size="4"> cbar = cb.Colorbar(cax, p.image, orientation='vertical')</font></div><div><font face="courier new, monospace" size="4"> p.colorbar = cbar</font></div><div>
<font face="courier new, monospace" size="4"> p._autoset_label()</font></div>
<div><font face="courier new, monospace" size="4">fig.savefig("multi_plot_3_3" % pf)</font></div></div><div><font face="courier new, monospace" size="4"><br></font></div><div><font face="courier new, monospace" size="4"><br>
</font></div><div><font face="arial, helvetica, sans-serif">But I am getting a wrong result. It is printing same figure in all panels.</font></div><div><br></div><div><font face="arial, helvetica, sans-serif">I think my logic(algorithm) is wrong. We have to reverse first two for loop. But that also making problem. Please help me. </font><span style="font-family:arial,helvetica,sans-serif"> </span></div>
<div><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><font face="arial, helvetica, sans-serif">And also if I include the following line in the code. (in my code I commented it out)</font></div>
<div><font face="arial, helvetica, sans-serif"><br>
</font></div><div><span style="font-family:'courier new',monospace;font-size:large">pc.set_width(3.0, 'mpc')</span><font face="arial, helvetica, sans-serif"><br></font></div><div><br></div><div><font face="arial, helvetica, sans-serif">it is showing following error. </font></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><div><i>Traceback (most recent call last):</i></div><div><i> File "multi_plot_loop.py", line 24, in <module></i></div>
<div><i> pc.set_width(3.0, 'mpc') </i></div><div><i> File "/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_collection.py", line 292, in set_width</i></div><div><i> plot.set_width(width, unit)</i></div>
<div><i> File "/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py", line 458, in set_width</i></div><div><i> self._refresh_display_width()</i></div><div><i> File "/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py", line 476, in _refresh_display_width</i></div>
<div><i> self._redraw_image()</i></div><div><i> File "/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py", line 423, in _redraw_image</i></div><div><i> self._run_callbacks()</i></div>
<div>
<i> File "/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py", line 263, in _run_callbacks</i></div><div><i> cb(self)</i></div><div><i> File "/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/visualization/plot_modifications.py", line 312, in __call__</i></div>
<div><i> self.ncont = np.linspace(self.clim[0], self.clim[1], self.ncont)</i></div><div><i> File "/data1/pdf/csurajit/yt-x86_64/lib/python2.7/site-packages/numpy/core/function_base.py", line 74, in linspace</i></div>
<div><i> num = int(num)</i></div><div><i>TypeError: only length-1 arrays can be converted to Python scalars</i></div><div><br></div></font></div><div><br></div><font color="#000000" face="Arial, Liberation Sans, DejaVu Sans, sans-serif"><span style="font-size:14px;line-height:18px">Please suggest me the most efficient way to achieve my goal (</span></font>create a muti plot of density's at different red-shift<font color="#000000" face="Arial, Liberation Sans, DejaVu Sans, sans-serif"><span style="font-size:14px;line-height:18px">).</span></font><span><font color="#888888"><span><font color="#888888"><span><font color="#888888"><br clear="all">
<div><br></div></font></span></font></span></font></span></div></div></div></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Reju Sam John</div>
</font></span></div>
<br></div></div>_______________________________________________<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></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Cameron Hummels<div>Postdoctoral Researcher</div><div>Steward Observatory</div><div>University of Arizona</div><div>
<a href="http://chummels.org" target="_blank">http://chummels.org</a></div>
</font></span></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><br clear="all"><div><br></div>-- <br><div dir="ltr">Reju Sam John</div>
</div>