On Mon, Oct 29, 2012 at 9:54 AM, Hsi-Yu Schive firstname.lastname@example.org wrote:
I'm trying to add new fields used in GAMER by editing the file "field.py", but I'm confused about the following declarations.
KnownGAMERFields = FieldInfoContainer() add_gamer_field = KnownGAMERFields.add_field
GAMERFieldInfo = FieldInfoContainer.create_with_fallback(FieldInfo) add_field = GAMERFieldInfo.add_field
What is the difference between "KnownGAMERField" and "GAMERFieldInfo"? To me, it seems that they are both instantiations of the class FieldInfoContainer, except that GAMERFieldInfo has a fallback function "FieldInfo". Similarly, what's the difference between "add_gamer_field" and "add_field"?
Ah, this is something that should be made a bit clearer in the documentation. The distinction is somewhat subtle, and relies on whether a field is something that could reasonably be expected to exist in a file, or
A "known" field would be one that can exist in an output file. The others are fields that could be derived from output from the particular code. It's a bit of a semantic difference, but it helps with how derived fields are detected. So if you know a field is going to (potentially) exist inside a data dump, it gets added with add_gamer_field. As an example, FLASH has the field "dens". We want to be able to access this field with either "dens" or "Density", so we do:
add_flash_field("dens", function=NullFunc, ...)
and then we add a translation (i.e., a flash-specific derived field) with:
I hope that helps!
Also, thanks for adding support for GAMER!
Thanks in advance for the help!!
yt-dev mailing list email@example.com http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org