[yt-svn] commit/yt: 6 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Feb 17 02:51:56 PST 2014


6 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/85dd9d4951e8/
Changeset:   85dd9d4951e8
Branch:      yt-3.0
User:        jwise77
Date:        2014-02-07 14:21:25
Summary:     Adding restarting capabilities to the yt-rockstar interface.
Affected #:  2 files

diff -r 1b17b7e8bcf0c9a131f8660adf6601d69302fedf -r 85dd9d4951e876658e255ebb6db562b0904698bc yt/analysis_modules/halo_finding/rockstar/rockstar.py
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar.py
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar.py
@@ -287,13 +287,23 @@
             (server_address, port))
         self.port = str(self.port)
 
-    def run(self, block_ratio = 1, callbacks = None):
+    def run(self, block_ratio = 1, callbacks = None, restart = False):
         """
         
         """
         if block_ratio != 1:
             raise NotImplementedError
         self._get_hosts()
+        # Find restart output number
+        if restart:
+            restart_file = self.outbase + "/restart.cfg"
+            if not os.path.exists(restart_file):
+                raise RuntimeError("Restart file %s not found" % (restart_file))
+            lines = open(restart_file).readlines()
+            for l in lines:
+                if l.startswith("RESTART_SNAP"):
+                    restart_num = int(l.split("=")[1])
+            del lines
         self.handler.setup_rockstar(self.server_address, self.port,
                     len(self.ts), self.total_particles, 
                     self.particle_type,
@@ -305,7 +315,8 @@
                     block_ratio = block_ratio,
                     outbase = self.outbase,
                     force_res = self.force_res,
-                    callbacks = callbacks)
+                    callbacks = callbacks,
+                    restart_num = restart_num)
         # Make the directory to store the halo lists in.
         if not self.outbase:
             self.outbase = os.getcwd()

diff -r 1b17b7e8bcf0c9a131f8660adf6601d69302fedf -r 85dd9d4951e876658e255ebb6db562b0904698bc yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
@@ -100,6 +100,7 @@
     char *INBASE
     char *FILENAME
     np.int64_t STARTING_SNAP
+    np.int64_t RESTART_SNAP
     np.int64_t NUM_SNAPS
     np.int64_t NUM_BLOCKS
     np.int64_t NUM_READERS
@@ -259,13 +260,13 @@
                        int writing_port = -1, int block_ratio = 1,
                        int periodic = 1, force_res=None,
                        int min_halo_size = 25, outbase = "None",
-                       callbacks = None):
+                       callbacks = None, int restart_num = 0):
         global PARALLEL_IO, PARALLEL_IO_SERVER_ADDRESS, PARALLEL_IO_SERVER_PORT
         global FILENAME, FILE_FORMAT, NUM_SNAPS, STARTING_SNAP, h0, Ol, Om
         global BOX_SIZE, PERIODIC, PARTICLE_MASS, NUM_BLOCKS, NUM_READERS
         global FORK_READERS_FROM_WRITERS, PARALLEL_IO_WRITER_PORT, NUM_WRITERS
         global rh, SCALE_NOW, OUTBASE, MIN_HALO_OUTPUT_SIZE
-        global OVERLAP_LENGTH, TOTAL_PARTICLES, FORCE_RES
+        global OVERLAP_LENGTH, TOTAL_PARTICLES, FORCE_RES, RESTART_SNAP
         if force_res is not None:
             FORCE_RES=np.float64(force_res)
             #print "set force res to ",FORCE_RES
@@ -284,6 +285,7 @@
         FILE_FORMAT = "GENERIC"
         OUTPUT_FORMAT = "ASCII"
         NUM_SNAPS = num_snaps
+        RESTART_SNAP = restart_num
         NUM_READERS = num_readers
         NUM_WRITERS = num_writers
         NUM_BLOCKS = num_readers


https://bitbucket.org/yt_analysis/yt/commits/b533d8f76d6c/
Changeset:   b533d8f76d6c
Branch:      yt-3.0
User:        jwise77
Date:        2014-02-07 23:09:03
Summary:     Small fixes to get the rockstar restarts working.
Affected #:  1 file

diff -r 85dd9d4951e876658e255ebb6db562b0904698bc -r b533d8f76d6c8fadf30953ef4649c3f04c4a2c66 yt/analysis_modules/halo_finding/rockstar/rockstar.py
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar.py
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar.py
@@ -295,6 +295,7 @@
             raise NotImplementedError
         self._get_hosts()
         # Find restart output number
+        num_outputs = len(self.ts)
         if restart:
             restart_file = self.outbase + "/restart.cfg"
             if not os.path.exists(restart_file):
@@ -304,8 +305,12 @@
                 if l.startswith("RESTART_SNAP"):
                     restart_num = int(l.split("=")[1])
             del lines
+            # Remove the datasets that were already analyzed
+            self.ts._pre_outputs = self.ts._pre_outputs[restart_num:]
+        else:
+            restart_num = 0
         self.handler.setup_rockstar(self.server_address, self.port,
-                    len(self.ts), self.total_particles, 
+                    num_outputs, self.total_particles, 
                     self.particle_type,
                     particle_mass = self.particle_mass,
                     parallel = self.comm.size > 1,
@@ -320,7 +325,7 @@
         # Make the directory to store the halo lists in.
         if not self.outbase:
             self.outbase = os.getcwd()
-        if self.comm.rank == 0:
+        if self.comm.rank == 0 and not restart:
             if not os.path.exists(self.outbase):
                 os.makedirs(self.outbase)
             # Make a record of which dataset corresponds to which set of


https://bitbucket.org/yt_analysis/yt/commits/9b00baba1980/
Changeset:   9b00baba1980
Branch:      yt-3.0
User:        jwise77
Date:        2014-02-09 05:46:07
Summary:     Check if the number of writers in the rockstar restart is the same as
the previous run.
Affected #:  1 file

diff -r b533d8f76d6c8fadf30953ef4649c3f04c4a2c66 -r 9b00baba198021ea91b017ba29ef30832c2b6e1d yt/analysis_modules/halo_finding/rockstar/rockstar.py
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar.py
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar.py
@@ -304,6 +304,14 @@
             for l in lines:
                 if l.startswith("RESTART_SNAP"):
                     restart_num = int(l.split("=")[1])
+                if l.startswith("NUM_WRITERS"):
+                    num_writers = int(l.split("=")[1])
+            if num_writers != self.num_writers:
+                raise RuntimeError(
+                    "Number of writers in restart has changed from the original "
+                    "run (OLD = %d, NEW = %d).  To avoid problems in the "
+                    "restart, choose the same number of writers." % \
+                        (num_writers, self.num_writers))
             del lines
             # Remove the datasets that were already analyzed
             self.ts._pre_outputs = self.ts._pre_outputs[restart_num:]


https://bitbucket.org/yt_analysis/yt/commits/9fc8bef4e5a8/
Changeset:   9fc8bef4e5a8
Branch:      yt-3.0
User:        jwise77
Date:        2014-02-09 23:45:46
Summary:     Ignore particle type references in Enzo for now to avoid crashes.
Affected #:  1 file

diff -r 9b00baba198021ea91b017ba29ef30832c2b6e1d -r 9fc8bef4e5a896cf3601c52fdfa5c2a9fdaa85bc yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -41,8 +41,8 @@
         fields = []
         add_io = "io" in grid.pf.particle_types
         for name, v in group.iteritems():
-            # NOTE: This won't work with 1D datasets.
-            if not hasattr(v, "shape"):
+            # NOTE: This won't work with 1D datasets or references.
+            if not hasattr(v, "shape") or v.dtype == "O":
                 continue
             elif len(v.dims) == 1:
                 if add_io: fields.append( ("io", str(name)) )


https://bitbucket.org/yt_analysis/yt/commits/a9efb9337d5c/
Changeset:   a9efb9337d5c
Branch:      yt-3.0
User:        jwise77
Date:        2014-02-12 20:06:03
Summary:     Should not check for particle filter if it's 'all', which is only
created after the hierarchy is loaded.
Affected #:  2 files

diff -r 9fc8bef4e5a896cf3601c52fdfa5c2a9fdaa85bc -r a9efb9337d5cb92385e0aad4e255aa8088b48c39 yt/analysis_modules/halo_finding/rockstar/rockstar.py
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar.py
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar.py
@@ -222,7 +222,7 @@
         if self.workgroup.name != "readers": return None
         tpf = ts[0]
         ptype = self.particle_type
-        if ptype not in tpf.particle_types:
+        if ptype not in tpf.particle_types and ptype != 'all':
             has_particle_filter = tpf.add_particle_filter(ptype)
             if not has_particle_filter:
                 raise RuntimeError("Particle type (filter) %s not found." % (ptype))

diff -r 9fc8bef4e5a896cf3601c52fdfa5c2a9fdaa85bc -r a9efb9337d5cb92385e0aad4e255aa8088b48c39 yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar_interface.pyx
@@ -190,7 +190,7 @@
     dd = pf.h.all_data()
 
     # Add particle type filter if not defined
-    if rh.particle_type not in pf.particle_types:
+    if rh.particle_type not in pf.particle_types and rh.particle_type != 'all':
         pf.add_particle_filter(rh.particle_type)
 
     if NUM_BLOCKS > 1:


https://bitbucket.org/yt_analysis/yt/commits/be8f535106ec/
Changeset:   be8f535106ec
Branch:      yt-3.0
User:        jwise77
Date:        2014-02-17 00:57:53
Summary:     Addressing coding style issues brought up in the PR on Rockstar restarts.
Affected #:  1 file

diff -r a9efb9337d5cb92385e0aad4e255aa8088b48c39 -r be8f535106ec53b427d8fbf04353288a17408aac yt/analysis_modules/halo_finding/rockstar/rockstar.py
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar.py
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar.py
@@ -297,22 +297,21 @@
         # Find restart output number
         num_outputs = len(self.ts)
         if restart:
-            restart_file = self.outbase + "/restart.cfg"
+            restart_file = os.path.join(self.outbase, "restart.cfg")
             if not os.path.exists(restart_file):
                 raise RuntimeError("Restart file %s not found" % (restart_file))
-            lines = open(restart_file).readlines()
-            for l in lines:
-                if l.startswith("RESTART_SNAP"):
-                    restart_num = int(l.split("=")[1])
-                if l.startswith("NUM_WRITERS"):
-                    num_writers = int(l.split("=")[1])
+            with open(restart_file) as restart_fh:
+                for l in restart_fh:
+                    if l.startswith("RESTART_SNAP"):
+                        restart_num = int(l.split("=")[1])
+                    if l.startswith("NUM_WRITERS"):
+                        num_writers = int(l.split("=")[1])
             if num_writers != self.num_writers:
                 raise RuntimeError(
                     "Number of writers in restart has changed from the original "
                     "run (OLD = %d, NEW = %d).  To avoid problems in the "
                     "restart, choose the same number of writers." % \
                         (num_writers, self.num_writers))
-            del lines
             # Remove the datasets that were already analyzed
             self.ts._pre_outputs = self.ts._pre_outputs[restart_num:]
         else:

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list