[yt-users] log scale image for zero dynamic range

Nathan Goldbaum nathan12343 at gmail.com
Sun May 18 11:00:45 PDT 2014


On Sun, May 18, 2014 at 10:44 AM, Chang-Goo Kim
<cgkim at astro.princeton.edu>wrote:

> Hi Nathan,
>
>
>
>
> On Sun, May 18, 2014 at 2:17 AM, Nathan Goldbaum <nathan12343 at gmail.com>wrote:
>
>> Although it occurs to me that you might be able to work around this
>> behavior by doing something like:
>>
>> slc = SlicePlot(ds, 'x', 'density')
>> slc.set_zlim('density', 1e-4, 1e-0)
>> slc.set_log('density', True)
>>
>> The key here is to call set_log after set_zlim.
>>
>
>
> As seen in the source code, this is exactly what I did. But, it didn't
> work.
>

That's what I get for replying to technical e-mail on my phone on a plane...

In any case, I've issued a PR that *should* fix this issue:

https://bitbucket.org/yt_analysis/yt/pull-request/909/making-it-possible-to-specify-colorbar/diff

I'd appreciate it if you tried it on your workflow.  If you'd like, leave a
comment on the PR indicating whether or not it worked for you.


>
> Chang-Goo
>
>
>>
>> Just for some context: it is set up that way to avoid a crash in
>> matplotlib which does not like creating logarithmic colorbars for data
>> with zero dynamic range.
>>
>> Hope that's helpful,
>>
>> Nathan
>>
>> On Saturday, May 17, 2014, Nathan Goldbaum <nathan12343 at gmail.com> wrote:
>>
>>> Ah, thanks for the report - I replied hastily before getting on a
>>> plane without looking at the source.
>>>
>>> I'll look at this tomorrow.
>>>
>>> Nathan
>>>
>>> On Saturday, May 17, 2014, Chang-Goo Kim <cgkim at astro.princeton.edu>
>>> wrote:
>>>
>>>> Hi Nathan,
>>>>
>>>> I did set the limits explicitly, but yt switches colorer before it
>>>> saves. See below for the link for my source code and the last part of error
>>>> message.
>>>>
>>>> Chang-Goo
>>>>
>>>>
>>>> http://paste.yt-project.org/show/4645/
>>>>
>>>>
>>>> yt : [INFO     ] 2014-05-17 23:29:15,766 Making a fixed resolution
>>>> buffer of (('gas', 'pok')) 512 by 512
>>>>
>>>> yt : [INFO     ] 2014-05-17 23:29:15,780 Making a fixed resolution
>>>> buffer of (('athena', 'density')) 512 by 512
>>>>
>>>> yt : [INFO     ] 2014-05-17 23:29:15,795 Making a fixed resolution
>>>> buffer of (('gas', 'nH')) 512 by 512
>>>>
>>>> yt : [INFO     ] 2014-05-17 23:29:15,810 Making a fixed resolution
>>>> buffer of (('gas', 'density')) 512 by 512
>>>>
>>>> yt : [INFO     ] 2014-05-17 23:29:15,825 Making a fixed resolution
>>>> buffer of (('gas', 'temp')) 512 by 512
>>>>
>>>> yt : [INFO     ] 2014-05-17 23:29:15,839 Making a fixed resolution
>>>> buffer of (('athena', 'pressure')) 512 by 512
>>>>
>>>> yt : [INFO     ] 2014-05-17 23:29:15,854 Making a fixed resolution
>>>> buffer of (('gas', 'pressure')) 512 by 512
>>>>
>>>> yt : [WARNING  ] 2014-05-17 23:29:15,889 Plot image for field ('gas',
>>>> 'nH') has zero dynamic range. Min = Max = 3.
>>>>
>>>> yt : [WARNING  ] 2014-05-17 23:29:15,889 Switching to linear colorbar
>>>> scaling.
>>>>
>>>> yt : [WARNING  ] 2014-05-17 23:29:16,364 Plot image for field ('gas',
>>>> 'nH') has zero dynamic range. Min = Max = 3.
>>>>
>>>> yt : [WARNING  ] 2014-05-17 23:29:16,364 Switching to linear colorbar
>>>> scaling.
>>>>
>>>> yt : [INFO     ] 2014-05-17 23:29:17,385 Saving plot
>>>> /scratch/gpfs/changgoo/sntest_TI/png/n2_SN_dx2_L256_TE_multi_fm3/n2_SN_dx2_L256_TE_multi_fm3.0000_Slice_z_temp.png
>>>>
>>>> yt : [INFO     ] 2014-05-17 23:29:17,916 Saving plot
>>>> /scratch/gpfs/changgoo/sntest_TI/png/n2_SN_dx2_L256_TE_multi_fm3/n2_SN_dx2_L256_TE_multi_fm3.0000_Slice_z_nH.png
>>>>
>>>>
>>>>
>>>>
>>>> On Sat, May 17, 2014 at 7:50 PM, Nathan Goldbaum <nathan12343 at gmail.com
>>>> > wrote:
>>>>
>>>>> Hi Chang-Goo
>>>>>
>>>>> If you explicitly set the limits of the colorbar using the set_zlim
>>>>> function you will avoid the zero dynamic range check.  That will also keep
>>>>> the colorbar limits the same from frame to frame.
>>>>>
>>>>> Nathan
>>>>>
>>>>>
>>>>> On Saturday, May 17, 2014, Chang-Goo Kim <cgkim at astro.princeton.edu>
>>>>> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> When initial condition is uniform, it has zero dynamic range.
>>>>>> Although it has no dynamic range, sometimes I need to plot it with log
>>>>>> scale colorbar to make a movie with the same colorbar for later times. But,
>>>>>> yt forced switch to linear colorbar. How can I make yt not to do that.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Chang-Goo
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140518/b314be26/attachment.html>


More information about the yt-users mailing list