<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Agreed.  I have tested for log values and it works fine, it's only in linear space...<div><br></div><div><br><div><div>On Sep 15, 2009, at 1:56 PM, Sam Skillman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi Fen and Eric,<br><br>Looks like there is definitely something wrong with setting zlim for<br>linear-space plots (especially with negative values).  I think it has<br>to do with the way the tick marks are defined in PlotTypes.py, but I'm<br>not quite sure yet.  I've done some stuff with set_zlim so I'll take a<br>deeper look but this is definitely a bug.<br><br>Best,<br>Sam<br><br>On Tue, Sep 15, 2009 at 1:46 PM, Eric Hallman <<a href="mailto:Eric.Hallman@colorado.edu">Eric.Hallman@colorado.edu</a>> wrote:<br><blockquote type="cite">Hear hear.  I am working on something right now, which is doing a similar<br></blockquote><blockquote type="cite">thing.  no matter what I set the limits to, it is giving me only a factor of<br></blockquote><blockquote type="cite">10 of the data in the color scale.  My example is very similar, just using<br></blockquote><blockquote type="cite">set_zlim...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Sep 15, 2009, at 1:34 PM, Fen Zhao wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hi all,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I've recently been having problems setting the colorbar max and min in<br></blockquote><blockquote type="cite">yt, and would appreciate some help figuring out what the problem might<br></blockquote><blockquote type="cite">be.  Full python code attached at the end, but the important parts<br></blockquote><blockquote type="cite">are:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">       pf=lagos.EnzoStaticOutput(thefile)<br></blockquote><blockquote type="cite">pc = PlotCollection(pf, center=[c1, c2, c3])<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">plot1=pc.add_slice("B", 0)<br></blockquote><blockquote type="cite">plot2=pc.add_slice("Density", 0)<br></blockquote><blockquote type="cite">plot3=pc.add_slice("Velocity_Vorticity1", 0)<br></blockquote><blockquote type="cite">plot3.set_log_field(False)<br></blockquote><blockquote type="cite">plot3.set_zlim(-200, 500)<br></blockquote><blockquote type="cite">thefile2=(output % ind) +"large"<br></blockquote><blockquote type="cite">pc.save(thefile2)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">plot1.set_width(haloradius*2,1)<br></blockquote><blockquote type="cite">plot2.set_width(haloradius*2,1)<br></blockquote><blockquote type="cite">plot3.set_width(haloradius*2,1)<br></blockquote><blockquote type="cite">plot3.set_log_field(False)<br></blockquote><blockquote type="cite">plot3.set_zlim(-200, 500)<br></blockquote><blockquote type="cite">thefile2=(output  % ind) + "halo"<br></blockquote><blockquote type="cite">pc.save(thefile2)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Neither the "large" or "halo" have the colorbar set correctly.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Cheers,<br></blockquote><blockquote type="cite">Fen<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Context of code:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">import sys<br></blockquote><blockquote type="cite">sys.path = ["/usr/work/mturk/local-testing/lib/python2.5/site-packages/"] +<br></blockquote><blockquote type="cite">\<br></blockquote><blockquote type="cite">          sys.path<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">from yt.config import ytcfg; ytcfg["lagos","serialize"] = "False"<br></blockquote><blockquote type="cite">from yt.mods import *<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">#import yt.lagos as lagos<br></blockquote><blockquote type="cite">#import yt.raven as raven<br></blockquote><blockquote type="cite">#import os.path<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">def write_out_binned_vals(plot, fn):<br></blockquote><blockquote type="cite">vals = plot.vals<br></blockquote><blockquote type="cite">x = plot.x_bins<br></blockquote><blockquote type="cite">y = plot.y_bins<br></blockquote><blockquote type="cite">print "Opening",fn, vals.shape, x.shape, y.shape<br></blockquote><blockquote type="cite">f=open(fn,"w")<br></blockquote><blockquote type="cite">for i in range(x.shape[0]):<br></blockquote><blockquote type="cite">for j in range(y.shape[0]):<br></blockquote><blockquote type="cite">print i,j<br></blockquote><blockquote type="cite">f.write("%0.5e\t%0.5e\t%0.5e\n" % (x[i],y[j],vals[i,j]))<br></blockquote><blockquote type="cite">f.close()<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">#ind=71<br></blockquote><blockquote type="cite">#inputDir="/a/wain027/g.ki.ki01/fenzhao/data/nobackup/vorticity/correct"<br></blockquote><blockquote type="cite">inputDir="/lustre/ki/orange/fenzhao/vorticity/try2"<br></blockquote><blockquote type="cite">outputDir="/a/wain027/g.ki.ki01/fenzhao/data/nobackup/vorticity/analysis/slices/data/images/other"<br></blockquote><blockquote type="cite">outputName="lustreversion"<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">start=40<br></blockquote><blockquote type="cite">end=40<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">ind=start<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">while ind<=end:<br></blockquote><blockquote type="cite">thefile= inputDir + "/star_%04i.dir/star_%04i" % (ind,ind)<br></blockquote><blockquote type="cite">output= outputDir + "/" + outputName+ "%04i"<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">pf=lagos.EnzoStaticOutput(thefile)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">timeUnits=pf["years"]<br></blockquote><blockquote type="cite">DensityUnits=pf["Density"]<br></blockquote><blockquote type="cite">LengthUnits=pf["cm"]<br></blockquote><blockquote type="cite">VelocityUnits=pf["x-velocity"]<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">newred=pf["CosmologyCurrentRedshift"]<br></blockquote><blockquote type="cite">a=1/(1+newred)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">k=1.3806503e-16<br></blockquote><blockquote type="cite">c=2.99792e10<br></blockquote><blockquote type="cite">e=4.8032068e-10<br></blockquote><blockquote type="cite">me=9.1093897e-28<br></blockquote><blockquote type="cite">mh=1.66053886e-24<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">pressure=k*(DensityUnits/mh)<br></blockquote><blockquote type="cite">density=DensityUnits/mh<br></blockquote><blockquote type="cite">graddensity=density/LengthUnits<br></blockquote><blockquote type="cite">gradpressure=pressure/LengthUnits<br></blockquote><blockquote type="cite">bbunits=(c/e)*graddensity*gradpressure/(density**2)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">vorticityUnits=VelocityUnits/LengthUnits<br></blockquote><blockquote type="cite">alpha=mh*c/e/(1+1e-4)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">def Vorticity(field,data):<br></blockquote><blockquote type="cite">return<br></blockquote><blockquote type="cite">(((data["Velocity_Vorticity1"]**2)+(data["Velocity_Vorticity2"]**2)+(data["<br></blockquote><blockquote type="cite">Velocity_Vorticity3"]**2))**0.5)*vorticityUnits<br></blockquote><blockquote type="cite">lagos.add_field("Vorticity", units=r"\rm{s}^{-1}",function=Vorticity)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">import numpy as na<br></blockquote><blockquote type="cite">def B(field, data):<br></blockquote><blockquote type="cite">return na.clip(alpha*(data["Vorticity"]),1e-30,1e30)<br></blockquote><blockquote type="cite">lagos.add_field("B", units=r"\rm{Gauss}", function=B)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">haloradius=0.013<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">halo = pf.h.sphere([0.5, 0.5, 0.5], haloradius*2.0)<br></blockquote><blockquote type="cite">v, i, c1, c2, c3, gi = halo.quantities["MaxLocation"]("Density",<br></blockquote><blockquote type="cite">lazy_reader=True)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">pc = PlotCollection(pf, center=[c1, c2, c3])<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">plot1=pc.add_slice("B", 0)<br></blockquote><blockquote type="cite">plot2=pc.add_slice("Density", 0)<br></blockquote><blockquote type="cite">plot3=pc.add_slice("Velocity_Vorticity1", 0)<br></blockquote><blockquote type="cite">plot3.set_log_field(False)<br></blockquote><blockquote type="cite">plot3.set_zlim(-200, 500)<br></blockquote><blockquote type="cite">thefile2=(output % ind) +"large"<br></blockquote><blockquote type="cite">pc.save(thefile2)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">plot1.set_width(haloradius*2,1)<br></blockquote><blockquote type="cite">plot2.set_width(haloradius*2,1)<br></blockquote><blockquote type="cite">plot3.set_width(haloradius*2,1)<br></blockquote><blockquote type="cite">plot3.set_log_field(False)<br></blockquote><blockquote type="cite">plot3.set_zlim(-200, 500)<br></blockquote><blockquote type="cite">thefile2=(output  % ind) + "halo"<br></blockquote><blockquote type="cite">pc.save(thefile2)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">ind=ind+1<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">#plot=pc.add_slice("B", 0)<br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">yt-users mailing list<br></blockquote><blockquote type="cite"><a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br></blockquote><blockquote type="cite"><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Dr. Eric J. Hallman<br></blockquote><blockquote type="cite">NSF Astronomy and Astrophysics Postdoctoral Fellow<br></blockquote><blockquote type="cite">Center for Astrophysics and Space Astronomy<br></blockquote><blockquote type="cite">University of Colorado at Boulder<br></blockquote><blockquote type="cite">hallman (at) casa.colorado.edu<br></blockquote><blockquote type="cite">office(s): (303) 735-0129 / (303) 492-7484<br></blockquote><blockquote type="cite"><a href="http://solo.colorado.edu/~hallman/">http://solo.colorado.edu/~hallman/</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">yt-users mailing list<br></blockquote><blockquote type="cite"><a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br></blockquote><blockquote type="cite"><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><br><br><br>-- <br>Samuel W. Skillman<br>DOE Computational Science Graduate Fellow<br>Center for Astrophysics and Space Astronomy<br>University of Colorado at Boulder<br>samuel.skillman[at]colorado.edu<br>_______________________________________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org<br></div></blockquote></div><br><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Dr. Eric J. Hallman</div><div>NSF Astronomy and Astrophysics Postdoctoral Fellow                    </div><div>Center for Astrophysics and Space Astronomy </div><div>University of Colorado at Boulder  </div><div>hallman (at) casa.colorado.edu </div><div>office(s): (303) 735-0129 / (303) 492-7484     </div><div><a href="http://solo.colorado.edu/~hallman/">http://solo.colorado.edu/~hallman/</a></div></div></div></span> </div><br></div></body></html>