[yt-users] In temperature plot unable to plot in normal scale

Kacper Kowalik xarthisius.kk at gmail.com
Fri Aug 9 23:01:16 PDT 2013


On 08/10/2013 07:54 AM, Reju Sam John wrote:
> Dear Kacper,
> 
> but this is giving the following error
> 
> Traceback (most recent call last):
>   File "multi_plot_temp_reju.py", line 19, in <module>
>     pf.field_info["Temperature"].take_log = False
>   File
> "/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py",
> line 131, in __missing__
>     return self.fallback[key]
>   File
> "/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py",
> line 131, in __missing__
>     return self.fallback[key]
>   File
> "/data1/pdf/csurajit/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py",
> line 130, in __missing__
>     raise KeyError("No field named %s" % key)
> KeyError: 'No field named Temperature'

My bad, try calling pf.h before trying to adjust take_log:

pf.h
pf.field_info["Temperature"].take_log = False

Cheers,
Kacper


> 
> 
> On Sat, Aug 10, 2013 at 10:55 AM, Kacper Kowalik <xarthisius.kk at gmail.com>wrote:
> 
>> On 08/08/2013 10:05 AM, Reju Sam John wrote:
>>> Dear All,
>>> I am trying to plot a multi plot of temperatures at different red-shifts
>>> with following script.
>>>
>>> from yt.mods import * # set up our namespace
>>> import matplotlib.colorbar as cb
>>>
>>> fig, axes, colorbars = get_multi_plot( 3, 1, colorbar='vertical', bw = 4)
>>>
>>> file1="/app/run/csarkar/surajit/simulation_shock/simulation5/RD00"
>>> file2="/RedshiftOutput00"
>>> list = [11,13,22]
>>> m=0
>>> #for kk in range(20,37):
>>> for kk in list:
>>>     fn_i=str(kk)
>>>     fn=file1+fn_i+file2+fn_i # parameter file to load
>>>     print fn
>>>     pf = load(fn) # load data
>>>     pc = PlotCollection(pf, center=[0.5,0.5,0.5]) # defaults to center at
>>> most dense point#dd = pf.h.all_data()
>>>     p = pc.add_slice("Temperature", 1, figure = fig, axes = axes[0][m],
>>> use_colorbar=False)
>>>     p.set_log_field(False)
>>>     p.set_zlim(1e4,5e7)
>>>     #p.set_cmap("jet")# a different colormap
>>>     p.modify["contour"]("Density", ncont=9, plot_args =
>>> {'colors':'w'},clim=(5e-30,5e-25))
>>>     #p.modify["contour"]("Temperature", ncont=10, plot_args =
>>> {'colors':'k'},clim=(3e7,1e8))
>>>     pc.set_width(15, 'mpc') # change width of all plots in pc
>>>     m=m+1
>>>     #pc.save("%s_p.png" % pf) # save all plots
>>>     for p, cax in zip(pc.plots, colorbars):
>>>     cbar = cb.Colorbar(cax, p.image, orientation='vertical')
>>>     p.colorbar = cbar
>>>     p._autoset_label()
>>>     fig.savefig("Temperature_at_rd00_11,13,22" % pf)
>>>
>>> The problem is that I am getting the temperature in log scale,
>> even-though
>>> I used  p.set_log_field(False)
>>> in my script.
>>
>> Hi,
>> I'm not exactly sure why set_log_field doesn't work for you, but you
>> could try to call:
>>
>> pf.field_info["Temperature"].take_log = False
>>
>> after loading a file.
>> Cheers,
>> Kacper
>>
>>
>> _______________________________________________
>> 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
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130810/5ae06492/attachment.sig>


More information about the yt-users mailing list