[yt-dev] Native field discussion

Nathan Goldbaum goldbaum at ucolick.org
Mon May 6 15:39:38 PDT 2013


Hey Casey,

That's pretty much what I was thinking, although I wanted to add a little
bit of syntactic sugar so the CGS conversion happens automatically:

http://paste.yt-project.org/show/3443/

The ensure_cgs decorator would simply call convert_to_cgs on the returned
YTArray.  The nice thing about this is the flow of data is clear, things
come in to the field definition code units and leave in CGS.  This also
eliminates the need for the unit conversion functions that are scattered
throughout the frontends and universal_fields.py.

This has the nice feature that each of the code frontends will need to
explicitly define mappings to the CGS fields (like Density) needed by
universal fields.

-Nathan


On Mon, May 6, 2013 at 3:33 PM, Casey W. Stark <caseywstark at gmail.com>wrote:

> Hey yt.
>
> Nathan and I had a cool idea as an extension of the units work, but I am
> hitting a yt internals knowledge wall writing a YTEP. I would like some
> input on technical details or general feelings before I move ahead with the
> write-up.
>
> One of the things mentioned in the units YTEP is handling code units.
> Basically each frontend static output should register the code units. In
> Nyx for instance, we would do something like registering "code_length" as
> Mpccm, "code_mass" as Msun, etc. Then any field from the dataset can be
> loaded in code units with something like
> dd["density"].in_units("code_density").
>
> This got us thinking -- why load native fields in CGS now? Instead, we can
> define native fields exactly as they are on disk and users who want code
> units will never have to convert by hand again. If frontend developers
> define the fields and units on disk, and some mapping to the universal
> fields, we shouldn't have to define or convert units anywhere else.
>
> I made a quick and dirty example of what we're thinking here:
> http://paste.yt-project.org/show/3441/
>
> So, is something like this a good idea? Is it realistic? Would this make
> for a simpler field info container? Nathan, is there anything I missed?
>
> - Casey
>
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20130506/857eff88/attachment.htm>


More information about the yt-dev mailing list