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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Apr 2 11:02:38 PDT 2014


5 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/9d5cf6adfdad/
Changeset:   9d5cf6adfdad
Branch:      yt-3.0
User:        BW Keller
Date:        2014-04-01 21:13:23
Summary:     Fixed a bug I introduced when I changed the default tipsy left/right edges
to None from 0.
Affected #:  1 file

diff -r 4d587415567c90f92d13aa5742a80b61ede1fcae -r 9d5cf6adfdad2e15fd4f3ac418fc0961e2f4a9de yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -542,6 +542,8 @@
         if pf.domain_left_edge is not None and pf.domain_right_edge is not None:
             return
         with open(data_file.filename, "rb") as f:
+            pf.domain_left_edge = 0
+            pf.domain_right_edge = 0
             f.seek(pf._header_offset)
             for iptype, ptype in enumerate(self._ptypes):
                 # We'll just add the individual types separately


https://bitbucket.org/yt_analysis/yt/commits/f1647954e99b/
Changeset:   f1647954e99b
Branch:      yt-3.0
User:        BW Keller
Date:        2014-04-01 21:22:00
Summary:     Merged.
Affected #:  1 file

diff -r 6b95f2a269c34bcbdff3ca212b67ddce1401d9e9 -r f1647954e99b344be0fe547243b72b7f34abd73d yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -542,6 +542,8 @@
         if pf.domain_left_edge is not None and pf.domain_right_edge is not None:
             return
         with open(data_file.filename, "rb") as f:
+            pf.domain_left_edge = 0
+            pf.domain_right_edge = 0
             f.seek(pf._header_offset)
             for iptype, ptype in enumerate(self._ptypes):
                 # We'll just add the individual types separately


https://bitbucket.org/yt_analysis/yt/commits/a6f1a21e46da/
Changeset:   a6f1a21e46da
Branch:      yt-3.0
User:        BW Keller
Date:        2014-04-01 22:21:07
Summary:     I needed to make a good handful of changes to ensure that domain_left_edge and
domain_right_edge being set to None doesn't cause crashes in various areas of
the code.
Affected #:  3 files

diff -r f1647954e99b344be0fe547243b72b7f34abd73d -r a6f1a21e46da7b18f7c8e55f45a891864bbf1527 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -186,8 +186,12 @@
         self._setup_classes()
 
     def _set_derived_attrs(self):
-        self.domain_center = 0.5 * (self.domain_right_edge + self.domain_left_edge)
-        self.domain_width = self.domain_right_edge - self.domain_left_edge
+        if self.domain_left_edge is None or self.domain_right_edge is None:
+            self.domain_center = np.zeros(3)
+            self.domain_width = np.zeros(3)
+        else:
+            self.domain_center = 0.5 * (self.domain_right_edge + self.domain_left_edge)
+            self.domain_width = self.domain_right_edge - self.domain_left_edge
         if not isinstance(self.current_time, YTQuantity):
             self.current_time = self.quan(self.current_time, "code_time")
         # need to do this if current_time was set before units were set
@@ -616,7 +620,10 @@
                     self.length_unit / self.time_unit)
         self.unit_registry.modify("code_velocity", vel_unit)
         # domain_width does not yet exist
-        DW = self.arr(self.domain_right_edge - self.domain_left_edge, "code_length")
+        if self.domain_left_edge is None or self.domain_right_edge is None:
+            DW = np.zeros(3)
+        else:
+            DW = self.arr(self.domain_right_edge - self.domain_left_edge, "code_length")
         self.unit_registry.modify("unitary", DW.max())
 
     _arr = None

diff -r f1647954e99b344be0fe547243b72b7f34abd73d -r a6f1a21e46da7b18f7c8e55f45a891864bbf1527 yt/frontends/sph/data_structures.py
--- a/yt/frontends/sph/data_structures.py
+++ b/yt/frontends/sph/data_structures.py
@@ -456,6 +456,7 @@
                     continue
                 # parse parameters according to tipsy parameter type
                 param, val = (i.strip() for i in line.split('=', 1))
+                val = val.split()[0]
                 if param.startswith('n') or param.startswith('i'):
                     val = long(val)
                 elif param.startswith('d'):

diff -r f1647954e99b344be0fe547243b72b7f34abd73d -r a6f1a21e46da7b18f7c8e55f45a891864bbf1527 yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -539,7 +539,7 @@
         ind = 0
         # Check to make sure that the domain hasn't already been set
         # by the parameter file 
-        if pf.domain_left_edge is not None and pf.domain_right_edge is not None:
+        if np.all(np.isfinite(pf.domain_left_edge)) and np.all(np.isfinite(pf.domain_right_edge)):
             return
         with open(data_file.filename, "rb") as f:
             pf.domain_left_edge = 0
@@ -558,9 +558,9 @@
                         mi = pp["Coordinates"][ax].min()
                         ma = pp["Coordinates"][ax].max()
                         outlier = YTArray(np.max(np.abs((mi,ma))), 'code_length')
-                    if outlier > pf.domain_right_edge or -outlier < pf.domain_left_edge:
-                        pf.domain_left_edge = -outlier
-                        pf.domain_right_edge = outlier
+                        if outlier > pf.domain_right_edge or -outlier < pf.domain_left_edge:
+                            pf.domain_left_edge = -1.01*outlier
+                            pf.domain_right_edge = 1.01*outlier
                     ind += c
         pf.domain_left_edge = np.ones(3)*pf.domain_left_edge
         pf.domain_right_edge = np.ones(3)*pf.domain_right_edge


https://bitbucket.org/yt_analysis/yt/commits/f5b3f25f15ba/
Changeset:   f5b3f25f15ba
Branch:      yt-3.0
User:        BW Keller
Date:        2014-04-02 18:58:58
Summary:     Made some quick fixes as per PR #783 comments from Matt Turk.
Affected #:  2 files

diff -r a6f1a21e46da7b18f7c8e55f45a891864bbf1527 -r f5b3f25f15ba8ea72db4f35809cbc367743644c1 yt/frontends/sph/data_structures.py
--- a/yt/frontends/sph/data_structures.py
+++ b/yt/frontends/sph/data_structures.py
@@ -456,7 +456,7 @@
                     continue
                 # parse parameters according to tipsy parameter type
                 param, val = (i.strip() for i in line.split('=', 1))
-                val = val.split()[0]
+                val = val.split('#')[0]
                 if param.startswith('n') or param.startswith('i'):
                     val = long(val)
                 elif param.startswith('d'):

diff -r a6f1a21e46da7b18f7c8e55f45a891864bbf1527 -r f5b3f25f15ba8ea72db4f35809cbc367743644c1 yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -559,8 +559,8 @@
                         ma = pp["Coordinates"][ax].max()
                         outlier = YTArray(np.max(np.abs((mi,ma))), 'code_length')
                         if outlier > pf.domain_right_edge or -outlier < pf.domain_left_edge:
-                            pf.domain_left_edge = -1.01*outlier
-                            pf.domain_right_edge = 1.01*outlier
+                            pf.domain_left_edge = -1.01*outlier # scale these up so the domain is slightly
+                            pf.domain_right_edge = 1.01*outlier # larger than the most distant particle position
                     ind += c
         pf.domain_left_edge = np.ones(3)*pf.domain_left_edge
         pf.domain_right_edge = np.ones(3)*pf.domain_right_edge


https://bitbucket.org/yt_analysis/yt/commits/9f6ad437aa6f/
Changeset:   9f6ad437aa6f
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-04-02 20:02:28
Summary:     Merged in bwkeller/yt/yt-3.0 (pull request #783)

Bug fixes from last pull request
Affected #:  3 files

diff -r 2ef55a7a3a8b8ba66fd8f68c31b744b91ff361ee -r 9f6ad437aa6f9b677dd83ad1979d49edb923c69c yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -186,8 +186,12 @@
         self._setup_classes()
 
     def _set_derived_attrs(self):
-        self.domain_center = 0.5 * (self.domain_right_edge + self.domain_left_edge)
-        self.domain_width = self.domain_right_edge - self.domain_left_edge
+        if self.domain_left_edge is None or self.domain_right_edge is None:
+            self.domain_center = np.zeros(3)
+            self.domain_width = np.zeros(3)
+        else:
+            self.domain_center = 0.5 * (self.domain_right_edge + self.domain_left_edge)
+            self.domain_width = self.domain_right_edge - self.domain_left_edge
         if not isinstance(self.current_time, YTQuantity):
             self.current_time = self.quan(self.current_time, "code_time")
         # need to do this if current_time was set before units were set
@@ -616,7 +620,10 @@
                     self.length_unit / self.time_unit)
         self.unit_registry.modify("code_velocity", vel_unit)
         # domain_width does not yet exist
-        DW = self.arr(self.domain_right_edge - self.domain_left_edge, "code_length")
+        if self.domain_left_edge is None or self.domain_right_edge is None:
+            DW = np.zeros(3)
+        else:
+            DW = self.arr(self.domain_right_edge - self.domain_left_edge, "code_length")
         self.unit_registry.modify("unitary", DW.max())
 
     _arr = None

diff -r 2ef55a7a3a8b8ba66fd8f68c31b744b91ff361ee -r 9f6ad437aa6f9b677dd83ad1979d49edb923c69c yt/frontends/sph/data_structures.py
--- a/yt/frontends/sph/data_structures.py
+++ b/yt/frontends/sph/data_structures.py
@@ -456,6 +456,7 @@
                     continue
                 # parse parameters according to tipsy parameter type
                 param, val = (i.strip() for i in line.split('=', 1))
+                val = val.split('#')[0]
                 if param.startswith('n') or param.startswith('i'):
                     val = long(val)
                 elif param.startswith('d'):

diff -r 2ef55a7a3a8b8ba66fd8f68c31b744b91ff361ee -r 9f6ad437aa6f9b677dd83ad1979d49edb923c69c yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -539,9 +539,11 @@
         ind = 0
         # Check to make sure that the domain hasn't already been set
         # by the parameter file 
-        if pf.domain_left_edge is not None and pf.domain_right_edge is not None:
+        if np.all(np.isfinite(pf.domain_left_edge)) and np.all(np.isfinite(pf.domain_right_edge)):
             return
         with open(data_file.filename, "rb") as f:
+            pf.domain_left_edge = 0
+            pf.domain_right_edge = 0
             f.seek(pf._header_offset)
             for iptype, ptype in enumerate(self._ptypes):
                 # We'll just add the individual types separately
@@ -556,9 +558,9 @@
                         mi = pp["Coordinates"][ax].min()
                         ma = pp["Coordinates"][ax].max()
                         outlier = YTArray(np.max(np.abs((mi,ma))), 'code_length')
-                    if outlier > pf.domain_right_edge or -outlier < pf.domain_left_edge:
-                        pf.domain_left_edge = -outlier
-                        pf.domain_right_edge = outlier
+                        if outlier > pf.domain_right_edge or -outlier < pf.domain_left_edge:
+                            pf.domain_left_edge = -1.01*outlier # scale these up so the domain is slightly
+                            pf.domain_right_edge = 1.01*outlier # larger than the most distant particle position
                     ind += c
         pf.domain_left_edge = np.ones(3)*pf.domain_left_edge
         pf.domain_right_edge = np.ones(3)*pf.domain_right_edge

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