[Yt-svn] yt-commit r1480 - branches/yt-1.5 branches/yt-1.5/yt/lagos trunk trunk/yt/lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Wed Oct 7 23:12:24 PDT 2009


Author: mturk
Date: Wed Oct  7 23:12:22 2009
New Revision: 1480
URL: http://yt.enzotools.org/changeset/1480

Log:
Adding ParticleAge to 1.5 and trunk.



Modified:
   branches/yt-1.5/CREDITS
   branches/yt-1.5/yt/lagos/UniversalFields.py
   trunk/CREDITS
   trunk/yt/lagos/UniversalFields.py

Modified: branches/yt-1.5/CREDITS
==============================================================================
--- branches/yt-1.5/CREDITS	(original)
+++ branches/yt-1.5/CREDITS	Wed Oct  7 23:12:22 2009
@@ -7,6 +7,7 @@
                                 Sam Skillman (samskillman at gmail.com)
                                 Devin Silvia (devin.silvia at gmail.com)
                                 John Wise (jwise at astro.princeton.edu)
+                                David Collins (dcollins at physics.ucsd.edu)
 
 We also include the Delaunay Triangulation module written by Robert Kern of
 Enthought, the cmdln.py module by Trent Mick, and the progressbar module by

Modified: branches/yt-1.5/yt/lagos/UniversalFields.py
==============================================================================
--- branches/yt-1.5/yt/lagos/UniversalFields.py	(original)
+++ branches/yt-1.5/yt/lagos/UniversalFields.py	Wed Oct  7 23:12:22 2009
@@ -180,6 +180,15 @@
                       ValidateSpatial(0)],
           not_in_all = True)
 
+def _ParticleAge(field, data):
+    current_time = data.pf["InitialTime"]
+    return (current_time - data["creation_time"])
+def _convertParticleAge(data):
+    return data.convert("years")
+add_field("ParticleAge",
+          function=_ParticleAge, validators=[ValidateSpatial(0)],
+          particle_type=True, convert_function=_convertParticleAge)
+
 def _ParticleMass(field, data):
     particles = data["particle_mass"].astype('float64') * \
                 just_one(data["CellVolumeCode"].ravel())

Modified: trunk/CREDITS
==============================================================================
--- trunk/CREDITS	(original)
+++ trunk/CREDITS	Wed Oct  7 23:12:22 2009
@@ -7,6 +7,7 @@
                                 Sam Skillman (samskillman at gmail.com)
                                 Devin Silvia (devin.silvia at gmail.com)
                                 John Wise (jwise at astro.princeton.edu)
+                                David Collins (dcollins at physics.ucsd.edu)
 
 We also include the Delaunay Triangulation module written by Robert Kern of
 Enthought, the cmdln.py module by Trent Mick, and the progressbar module by

Modified: trunk/yt/lagos/UniversalFields.py
==============================================================================
--- trunk/yt/lagos/UniversalFields.py	(original)
+++ trunk/yt/lagos/UniversalFields.py	Wed Oct  7 23:12:22 2009
@@ -180,6 +180,15 @@
                       ValidateSpatial(0)],
           not_in_all = True)
 
+def _ParticleAge(field, data):
+    current_time = data.pf["InitialTime"]
+    return (current_time - data["creation_time"])
+def _convertParticleAge(data):
+    return data.convert("years")
+add_field("ParticleAge",
+          function=_ParticleAge, validators=[ValidateSpatial(0)],
+          particle_type=True, convert_function=_convertParticleAge)
+
 def _ParticleMass(field, data):
     particles = data["particle_mass"].astype('float64') * \
                 just_one(data["CellVolumeCode"].ravel())



More information about the yt-svn mailing list