[Yt-svn] yt-commit r975 - in trunk/yt: . extensions

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Wed Dec 3 14:58:59 PST 2008


Author: mturk
Date: Wed Dec  3 14:58:59 2008
New Revision: 975
URL: http://yt.spacepope.org/changeset/975

Log:
Added two new commands: yt_export_amira and yt_hop.  The hop command (right
now) works only on a single dataset.  I'll add a yt_multi_hop in a bit.  The
amira export changed slightly as well, in that I added a subtract-time option
that makes all your times relative to the first timestep; this is good for (for
instance) me, but maybe not for everyone.



Modified:
   trunk/yt/commands.py
   trunk/yt/extensions/HierarchySubset.py

Modified: trunk/yt/commands.py
==============================================================================
--- trunk/yt/commands.py	(original)
+++ trunk/yt/commands.py	Wed Dec  3 14:58:59 2008
@@ -74,6 +74,10 @@
                    action="store", type="string",
                    dest="output", default="frames/",
                    help="Folder in which to place output images"),
+    outputfn= dict(short="-o", long="--output",
+                   action="store", type="string",
+                   dest="output", default=None,
+                   help="File in which to place output"),
     skip    = dict(short="-s", long="--skip",
                    action="store", type="int",
                    dest="skip", default=1,
@@ -115,6 +119,14 @@
                    action="store_true",
                    dest="unit_boxes",
                    help="Display helpful unit boxes"),
+    thresh  = dict(short="", long="--threshold",
+                   action="store", type="float",
+                   dest="threshold", default=None,
+                   help="Density threshold"),
+    dm_only = dict(short="", long="--all-particles",
+                   action="store_false", 
+                   dest="dm_only", default=True,
+                   help="Use all particles"),
     )
 
 def _add_options(parser, *options):
@@ -209,3 +221,17 @@
         pc.set_cmap(opts.cmap)
         if opts.zlim: pc.set_zlim(*opts.zlim)
         pc.save(os.path.join(opts.output,"%s" % (pf)))
+
+def hop_single():
+    parser = _get_parser("outputfn", "thresh", 'dm_only')
+    opts, args = parser.parse_args()
+
+    pf = _fix_pf(args[-1])
+    sp = pf.h.sphere((pf["DomainLeftEdge"] + pf["DomainRightEdge"])/2.0,
+                     pf['unitary'])
+    kwargs = {'dm_only' : opts.dm_only}
+    if opts.threshold is not None: kwargs['threshold'] = opts.threshold
+    hop_list = hop.HopList(sp, **kwargs)
+    if opts.output is None: fn = "%s.hop" % pf
+    else: fn = opts.output
+    hop_list.write_out(fn)

Modified: trunk/yt/extensions/HierarchySubset.py
==============================================================================
--- trunk/yt/extensions/HierarchySubset.py	(original)
+++ trunk/yt/extensions/HierarchySubset.py	Wed Dec  3 14:58:59 2008
@@ -143,6 +143,9 @@
     parser.add_option("", "--maxlevel", action="store", type="int",
                       dest="max_level", default=-1,
                       help="The maximum level to extract (chooses first grid at that level)")
+    parser.add_option("-d","--subtract-time", action="store_true",
+                      dest="subtract_time", help="Subtract the physical time of " + \
+                        "the first timestep (useful for small delta t)")
     parser.add_option("-r","--recenter", action="store_true",
                       dest="recenter", help="Recenter on maximum density in final output")
     parser.usage = "%prog [options] FIRST_ID LAST_ID"
@@ -190,7 +193,7 @@
     mda.numTimeSteps = len(timesteps)
 
     # I think we just want one value here
-    rel_times = na.array(times, dtype='float64') - times[0]
+    rel_times = na.array(times, dtype='float64') - int(opts.subtract_time)*times[0]
     afile.createArray(md, "sorted_times", na.array(rel_times))
     afile.createArray(md, "sorted_timesteps", timesteps)
 



More information about the yt-svn mailing list