Hi Junhwan,

After registering your new field, you can tell yt to plot it on a linear scale using the following invocation:

pf.field_info['PotentialFieldCGS'].take_log = False

Alternatively you can tell yt to plot your field on a linear scale in your call to add_field:

add_field('PotentialFieldCGS',take_log=False,function=_PotentialFieldCGS)

This assumes the field is defined through a function called _PotentialFieldCGS.  For more details, take a look at this page of the docs: http://yt-project.org/docs/2.4/analyzing/creating_derived_fields.html?highlight=add_field

As for your second question, SlicePlot internally uses the FixedResolutionBuffer class to pixelize the data.  FixedResolutionBuffer does not do any interpolation to smooth over pixelized data.  One could take the image array and smooth it in postprocessing but that functionality has not been built in to FixedResolutionBuffer up to this point.  For more details about FixedResolutionBuffer, take a look at its page in the API docs: http://yt-project.org/docs/2.4/api/generated/yt.visualization.fixed_resolution.FixedResolutionBuffer.__init__.html

You may have more luck making a smoothed image using the manual plotting interface: http://yt-project.org/docs/2.4/visualizing/manual_plotting.html

If you went this route, you would have to come up with a recipe to smooth the image and then manually construct the plot.

Cheers,

Nathan

On Jan 17, 2013, at 11:41 AM, Jun-Hwan Choi wrote:

Hi all,

I have two questions on yt SlicePlot.
First, when I make a new field and generate the SlicePlot of the simulation with a given field, I face on following error message:
Traceback (most recent call last):
 File "Pot.py", line 16, in <module>
   pc = SlicePlot(pf, "x", "PotentialFieldCGS", width = (6.0, 'kpc'),center=den_center)
 File "/home/jhchoi/common/lib/python2.7/site-packages/yt-2.4-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 804, in __init__
   PWViewerMPL.__init__(self, slc, bounds, origin=origin)
 File "/home/jhchoi/common/lib/python2.7/site-packages/yt-2.4-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 447, in __init__
   if setup: self._setup_plots()
 File "/home/jhchoi/common/lib/python2.7/site-packages/yt-2.4-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 617, in _setup_plots
   self.plots[f].image, cax = self.plots[f].cax)
 File "/home/jhchoi/common/lib/python2.7/site-packages/matplotlib/figure.py", line 1104, in colorbar
   cb = cbar.Colorbar(cax, mappable, **kw)
 File "/home/jhchoi/common/lib/python2.7/site-packages/matplotlib/colorbar.py", line 731, in __init__
   ColorbarBase.__init__(self, ax, **kw)
 File "/home/jhchoi/common/lib/python2.7/site-packages/matplotlib/colorbar.py", line 246, in __init__
   self.draw_all()
 File "/home/jhchoi/common/lib/python2.7/site-packages/matplotlib/colorbar.py", line 260, in draw_all
   self._process_values()
 File "/home/jhchoi/common/lib/python2.7/site-packages/matplotlib/colorbar.py", line 558, in _process_values
   b = self.norm.inverse(self._uniform_y(self.cmap.N+1))
 File "/home/jhchoi/common/lib/python2.7/site-packages/matplotlib/colors.py", line 895, in inverse
   return vmin * ma.power((vmax/vmin), val)
 File "/home/jhchoi/common/lib/python2.7/site-packages/numpy/ma/core.py", line 6043, in power
   m |= invalid
ValueError: invalid return array shape

I suspect the reason is that Field value is negative and z value tends to be log scale (because I make it positive the yt work).
Is there any way to make plot in negative with making linear z-value?

Second, when I make a SlicePlot with small region, owing to resolution (certain grid cell size is not 1/10 of the Sire x-y size) the plot looks ugly.
Is there any way to visually improve the low resolution SlicePlot?

Thank you in advance,
Junhwan

--
--------------------------------------------------------------
Jun-Hwan Choi, Ph.D.
Department of Physics and Astronomy, University of Kentucky
Tel: (859) 897-6737        Fax: (859) 323-2846
Email: jhchoi@pa.uky.edu   URL: http://www.pa.uky.edu/~jhchoi
--------------------------------------------------------------

_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org