[yt-users] Custom units.

Kuo-Chuan Pan pankuoch at msu.edu
Tue Nov 1 11:25:11 PDT 2016


Dear Nathan,

Thanks very much for your help.
entropy is a filed in my FLASH dataset. The unit of entropy is kB/baryon in the code but it is recognised as dimensionless in yt.

The field “entr" is the entropy in my dataset. The derived field “Entropy” is the one I want to visualise. 
PNS_DENSITY and PNS_ENTR are just constants. 

Many thanks,
Kuo-Chuan

  11 def _entrdens(field,data):
  12     """
  13     create a new derived field to show both entropy and density
  14     """
  15     dens = data["dens"]
  16     entr = data["entr"]
  17     entrdens = entr*(np.exp(-(dens.in_cgs()/PNS_DENSITY)**5))+PNS_ENTR
  18     return entrdens
  19 yt.add_field("Entropy",function=_entrdens,units="dimensionless") 


> On Nov 1, 2016, at 2:20 PM, Nathan Goldbaum <nathan12343 at gmail.com> wrote:
> 
> Hi Kuo-Chuan,
> 
> Can you show us how you've defined your derived field?
> 
> Is entropy a derived field as well or is it a field that's included in your dataset? This is the entropy per baryon, right?
> 
> -Nathan
> 
> On Tue, Nov 1, 2016 at 1:09 PM, Kuo-Chuan Pan <pankuoch at msu.edu <mailto:pankuoch at msu.edu>> wrote:
> Dear all,
> 
> I have a custom new derived field based on density (g/cm^3) and entropy (kB/baryon but it is recognised as dimensionless).
> Currently, this new derived field is set to dimensionless (it should be kB/baryon).
> 
> Could anyone teach me how to set this new derived filed to its correct unit (which should be kB/baryon)?
> Or is it possible to simply override the field label in my volume rendering plot before using save_annotated()?
> 
> Many thanks,
> Kuo-Chuan
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
> http://lists.spacepope.org/listinfo.cgi/yt-users-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/20161101/7020bdfc/attachment.htm>


More information about the yt-users mailing list