[Yt-svn] yt-commit r1249 - trunk/yt

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Mon Apr 6 22:56:31 PDT 2009


Author: mturk
Date: Mon Apr  6 22:56:30 2009
New Revision: 1249
URL: http://yt.spacepope.org/changeset/1249

Log:
Added a 'stats' command for quick access to info about datasets.



Modified:
   trunk/yt/commands.py

Modified: trunk/yt/commands.py
==============================================================================
--- trunk/yt/commands.py	(original)
+++ trunk/yt/commands.py	Mon Apr  6 22:56:30 2009
@@ -374,6 +374,22 @@
 
         afile.close()
         
+    @add_cmd_options(['outputfn','bn','skip'])
+    @check_args
+    def do_stats(self, subcmd, opts, arg):
+        """
+        Print stats and maximum density for one or more datasets
+
+        ${cmd_option_list}
+        """
+        pf = _fix_pf(arg)
+        pf.h.print_stats()
+        v, c = pf.h.find_max("Density")
+        print "Maximum density: %0.5e at %s" % (v, c)
+        if opts.output is not None:
+            t = pf["InitialTime"] * pf['years']
+            open(opts.output, "a").write(
+                "%s (%0.5e years): %0.5e at %s\n" % (pf, t, v, c))
 
 def run_main():
     for co in ["--parallel", "--paste"]:



More information about the yt-svn mailing list