[Yt-svn] yt: Added GadgetFields.py

hg at spacepope.org hg at spacepope.org
Wed Aug 11 10:32:34 PDT 2010


hg Repository: yt
details:   yt/rev/f76765bcffe4
changeset: 1944:f76765bcffe4
user:      Christopher Erick Moody <cemoody at ucsc.edu>
date:
Wed Aug 11 10:09:12 2010 -0700
description:
Added GadgetFields.py

diffstat:

 yt/lagos/GadgetFields.py |  86 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)

diffs (90 lines):

diff -r 64ee81fb9b62 -r f76765bcffe4 yt/lagos/GadgetFields.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/lagos/GadgetFields.py	Wed Aug 11 10:09:12 2010 -0700
@@ -0,0 +1,86 @@
+"""
+Gadget-specific fields
+
+Author: Christopher E Moody <juxtaposicion at gmail.com>
+Affiliation: UC Santa Cruz
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2010 Christopher E Moody, Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+from UniversalFields import *
+class GadgetFieldContainer(CodeFieldInfoContainer):
+    _shared_state = {}
+    _field_list = {}
+GadgetFieldInfo = GadgetFieldContainer()
+add_gadget_field = GadgetFieldInfo.add_field
+
+add_field = add_gadget_field
+
+translation_dict = {"Position": "POS",
+                    "Velocity": "VEL",
+                    "ID": "ID",
+                    "Mass":"MASS"
+                   }
+
+for f,v in translation_dict.items():
+    if v not in GadgetFieldInfo:
+        add_field(f, function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("POS")],
+          units=r"\rm{cm}")
+          
+add_field("Density", function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("POS")],
+          units=r"\rm{cm}")
+
+add_field("VEL", function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("VEL")],
+          units=r"\rm{cm}/\rm{s}")
+
+add_field("ID", function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("ID")],
+          units=r"")
+
+add_field("MASS", function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("MASS")],
+          units=r"\rm{g}")
+
+add_field("U", function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("U")],
+          units=r"")
+
+add_field("NE", function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("NE")],
+          units=r"")
+
+add_field("POT", function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("POT")],
+          units=r"")
+
+add_field("ACCE", function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("ACCE")],
+          units=r"")
+
+add_field("ENDT", function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("ENDT")],
+          units=r"")
+
+add_field("TSTP", function=lambda a,b: None, take_log=True,
+          validators = [ValidateDataField("TSTP")],
+          units=r"")
+



More information about the yt-svn mailing list