<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19328">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Calibri>Hi Matt,</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Thanks for the explanation! Now it's clearer to
me.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Let me describe what I understand so far, and please
correct me if there is anything wrong.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>When I use "add_gamer_field" to add a build-in field in
GAMER,</FONT></DIV>
<DIV><FONT face=Calibri>in principle I DON'T need to set the "function"
parameter since the field values can</FONT></DIV>
<DIV><FONT face=Calibri>be set directly to the loaded values, but I DO need to
provide the "convert_function"</FONT></DIV>
<DIV><FONT face=Calibri>parameter </FONT><FONT face=Calibri>to properly convert
unit to cgs. </FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>On the other hand, when I use "add_field" to
</FONT><FONT face=Calibri>define a derived field, I DO need to set </FONT></DIV>
<DIV><FONT face=Calibri>the "function" parameter to describe how to get the
new derived field from the </FONT></DIV>
<DIV><FONT face=Calibri>existing fields, but in principle I DON'T need to
provide the "convert_function" again</FONT></DIV>
<DIV><FONT face=Calibri>since all existing fields are already in cgs units. Is
that correct?</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>One more question. In the field.py file of flash, I saw
the following lines.</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri> def
_get_convert(fname):<BR> def
_conv(data):<BR>
return data.convert(fname)</FONT></DIV>
<DIV><FONT face=Calibri> return _conv<BR></FONT></DIV>
<DIV><FONT face=Calibri> add_flash_field("divb",
function=NullFunc,
take_log=False,<BR>
convert_function=_get_convert("divb"),<BR>
units = r"\mathrm{Gau\ss}\/\rm{cm}")</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>My question is:</FONT></DIV>
<DIV><FONT face=Calibri>1. Where can I </FONT><FONT face=Calibri>explicitly set
the operations performed by data.convert("divb")?</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>2. What "field" variables can be put into data["field"]
(may all the fields</FONT></DIV>
<DIV><FONT face=Calibri>that have been added by add_field and
gamer_add_field)?</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Thank you very much for the help. The YT group is so
active and I</FONT></DIV>
<DIV><FONT face=Calibri>will be more than willing to have GAMER supported in YT
ASAP !!</FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<DIV><FONT face=Calibri>Sincerely,</FONT></DIV>
<DIV><FONT face=Calibri>Hsi-Yu</FONT></DIV>
<DIV><FONT face=Calibri><BR></FONT></DIV>
<DIV><FONT face=Calibri></FONT> </DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt 新細明體">----- Original Message ----- </DIV>
<DIV
style="FONT: 10pt 新細明體; BACKGROUND: #e4e4e4; font-color: black"><B>From:</B>
<A title=matthewturk@gmail.com href="mailto:matthewturk@gmail.com">Matthew
Turk</A> </DIV>
<DIV style="FONT: 10pt 新細明體"><B>To:</B> <A title=yt-dev@lists.spacepope.org
href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</A> </DIV>
<DIV style="FONT: 10pt 新細明體"><B>Sent:</B> Monday, October 29, 2012 10:42
PM</DIV>
<DIV style="FONT: 10pt 新細明體"><B>Subject:</B> Re: [yt-dev] Question: adding new
fields for GAMER</DIV>
<DIV><FONT face=Calibri></FONT><BR></DIV>Hi Hsi-Yu,<BR><BR>On Mon, Oct 29,
2012 at 9:54 AM, Hsi-Yu Schive <<A
href="mailto:hyschive@ntu.edu.tw">hyschive@ntu.edu.tw</A>> wrote:<BR>>
Dear all,<BR>><BR>> I'm trying to add new fields used in GAMER by
editing the file "field.py",<BR>> but I'm confused about the following
declarations.<BR>><BR>> KnownGAMERFields =
FieldInfoContainer()<BR>> add_gamer_field =
KnownGAMERFields.add_field<BR>><BR>> GAMERFieldInfo =
FieldInfoContainer.create_with_fallback(FieldInfo)<BR>>
add_field = GAMERFieldInfo.add_field<BR>><BR>> What is the difference
between "KnownGAMERField" and "GAMERFieldInfo"?<BR>> To me, it seems that
they are both instantiations of the class<BR>> FieldInfoContainer,<BR>>
except that GAMERFieldInfo has a fallback function "FieldInfo".<BR>>
Similarly, what's the difference between "add_gamer_field" and
"add_field"?<BR><BR>Ah, this is something that should be made a bit clearer in
the<BR>documentation. The distinction is somewhat subtle, and relies
on<BR>whether a field is something that could reasonably be expected
to<BR>exist in a file, or<BR><BR>A "known" field would be one that can exist
in an output file. The<BR>others are fields that could be derived from
output from the<BR>particular code. It's a bit of a semantic difference,
but it helps<BR>with how derived fields are detected. So if you know a
field is going<BR>to (potentially) exist inside a data dump, it gets added
with<BR>add_gamer_field. As an example, FLASH has the field
"dens". We want<BR>to be able to access this field with either "dens" or
"Density", so we<BR>do:<BR><BR>add_flash_field("dens", function=NullFunc,
...)<BR><BR>and then we add a translation (i.e., a *flash-specific* derived
field) with:<BR><BR>add_field("Density",
function=TranslationFunc("dens"))<BR><BR>I hope that helps!<BR><BR>Also,
thanks for adding support for GAMER!<BR><BR>-Matt<BR><BR>><BR>> Thanks
in advance for the help!!<BR>><BR>> Sincerely,<BR>>
Hsi-Yu<BR>><BR>><BR>><BR>>
_______________________________________________<BR>> yt-dev mailing
list<BR>> <A
href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</A><BR>>
<A
href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</A><BR>><BR>_______________________________________________<BR>yt-dev
mailing list<BR><A
href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</A><BR><A
href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</A></BLOCKQUOTE></BODY></HTML>