[yt-users] volume rendering colorbar issue

Stephanie Tonnesen stonnes at gmail.com
Wed Aug 12 00:03:41 PDT 2015


Actually, it looks like camera.py is calling get_label, which does try to
latex-up the units.  Could it be that the command r"$g/cm**3$" will not
work and what the label input needs is r"$g/cm^3$"?  Just double-checked in
my own python code, and even though I am not actually sure how to fix it, I
bet that is the issue!

-Stephanie

--
Dr. Stephanie Tonnesen
Alvin E. Nashman Postdoctoral Fellow
Carnegie Observatories, Pasadena, CA
stonnes at gmail.com

On Tue, Aug 11, 2015 at 11:44 PM, Stephanie Tonnesen <stonnes at gmail.com>
wrote:

> Yeah, I cant figure out where it is being set either--I am certainly not
> consciously setting it in my script!  I will look into it more tomorrow.
> Thanks,
>
> Stephanie
>
> --
> Dr. Stephanie Tonnesen
> Alvin E. Nashman Postdoctoral Fellow
> Carnegie Observatories, Pasadena, CA
> stonnes at gmail.com
>
> On Tue, Aug 11, 2015 at 10:16 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>
>> You can get a nice LaTeX rendering of the units for any YTarray or
>> YTQuantity like so:
>>
>> In [9]: from yt.units import g,cm
>>
>> In [10]: g/cm**3
>> Out[10]: 1.0 g/cm**3
>>
>> In [11]: type(g/cm**3)
>> Out[11]: yt.units.yt_array.YTQuantity
>>
>> In [12]: (g/cm**3).units.latex_representation()
>> Out[12]: '\\frac{\\rm{g}}{\\rm{cm}^{3}}'
>>
>> I'm not sure where in the code the colorbar unit is getting generated,
>> but right now it's displaying str(unit) instead of
>> str(unit.latex_representation()).
>>
>> Hope that helps,
>>
>> Nathan
>>
>> On Wed, Aug 12, 2015 at 12:05 AM, Stephanie Tonnesen <stonnes at gmail.com>
>> wrote:
>>
>>> Dear Michael,
>>>
>>> That did the trick!  Thanks very much!  Since that worked so well, is
>>> there a way I can get the density units to look a bit nicer (actually have
>>> the "3" superscript instead of "cm**3"?)  Thanks again,
>>>
>>> Stephanie
>>>
>>> --
>>> Dr. Stephanie Tonnesen
>>> Alvin E. Nashman Postdoctoral Fellow
>>> Carnegie Observatories, Pasadena, CA
>>> stonnes at gmail.com
>>>
>>> On Tue, Aug 11, 2015 at 2:06 PM, Cameron Hummels <chummels at gmail.com>
>>> wrote:
>>>
>>>> I don't believe Stephanie is using the new VR interface for this
>>>> problem.
>>>>
>>>> On Tue, Aug 11, 2015 at 2:04 PM, Michael Zingale <
>>>> michael.zingale at stonybrook.edu> wrote:
>>>>
>>>>> A while back I added a label_fmt argument to save_annotated:
>>>>>
>>>>>         label_fmt : str, optional
>>>>>
>>>>>            A format specifier (e.g., label_fmt="%.2g") to use in
>>>>> formatting
>>>>>            the data values that label the transfer function colorbar.
>>>>>
>>>>>
>>>>> this fixed the values for me so they look reasonable.
>>>>>
>>>>> Note: I don't think any of this has made it over to the new VR
>>>>> interface.
>>>>>
>>>>> On Tue, Aug 11, 2015 at 2:42 PM, Stephanie Tonnesen <stonnes at gmail.com
>>>>> > wrote:
>>>>>
>>>>>> Hi yt-users,
>>>>>>
>>>>>> My last attempt was too big to make it to the user list, so I will
>>>>>> try again!
>>>>>> I am trying to make a volume rendering using
>>>>>> ---
>>>>>> Version = 3.2-dev
>>>>>> Changeset = dc2467c4eae7 (yt) tip
>>>>>> ---
>>>>>> and basically following this example:
>>>>>>
>>>>>> http://bender.astro.sunysb.edu/random/vol_rotate.py
>>>>>>
>>>>>> My problem is that the units are wonky on my colorbar.  I input them
>>>>>> in my transfer function as cgs, and the peaks seem to be in the right place
>>>>>> based on my input range and sample values.  Can I get the colorbar to
>>>>>> present the density values in cgs?  You can see the colorbar and the code
>>>>>> attached.
>>>>>>
>>>>>> Oh, I had to add in the line
>>>>>> matplotlib.use('pdf')
>>>>>> because I was getting a _tkinter can't find your screen error
>>>>>> everytime I tried to add the colorbar.  I think it was a matplotlib with my
>>>>>> computer problem.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Stephanie
>>>>>> --
>>>>>> Dr. Stephanie Tonnesen
>>>>>> Alvin E. Nashman Postdoctoral Fellow
>>>>>> Carnegie Observatories, Pasadena, CA
>>>>>> stonnes at gmail.com
>>>>>>
>>>>>> _______________________________________________
>>>>>> yt-users mailing list
>>>>>> yt-users at lists.spacepope.org
>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Michael Zingale
>>>>> Associate Professor
>>>>>
>>>>> Dept. of Physics & Astronomy • Stony Brook University • Stony Brook,
>>>>> NY 11794-3800
>>>>> *phone*:  631-632-8225
>>>>> *e-mail*: Michael.Zingale at stonybrook.edu
>>>>> *web*: http://www.astro.sunysb.edu/mzingale
>>>>> github: http://github.com/zingale
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> yt-users mailing list
>>>>> yt-users at lists.spacepope.org
>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Cameron Hummels
>>>> NSF Postdoctoral Fellow
>>>> Department of Astronomy
>>>> California Institute of Technology
>>>> http://chummels.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
>>>
>>>
>>
>> _______________________________________________
>> 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/20150812/6736c27c/attachment.html>


More information about the yt-users mailing list