[yt-svn] commit/yt: 6 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Sep 2 15:50:22 PDT 2014
6 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/84babff8894d/
Changeset: 84babff8894d
Branch: yt
User: ChrisMalone
Date: 2014-08-29 19:23:08
Summary: bug fix and add epsilon test
Affected #: 1 file
diff -r db453a34418decb342392b49f10559b5fb5f43ca -r 84babff8894df41d6d3779e2951a0968a0e8399f yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -36,6 +36,10 @@
long int lrint(double x) nogil
double fabs(double x) nogil
+# use this as an epsilon test for grids aligned with selector
+# define here to avoid the gil later
+cdef np.float64_t grid_eps = np.finfo(np.float64).eps
+
# These routines are separated into a couple different categories:
#
# * Routines for identifying intersections of an object with a bounding box
@@ -112,19 +116,18 @@
self.max_level = getattr(dobj, "max_level", 99)
self.overlap_cells = 0
- for i in range(3) :
- ds = getattr(dobj, 'ds', None)
- if ds is None:
- for i in range(3):
- # NOTE that this is not universal.
- self.domain_width[i] = 1.0
- self.periodicity[i] = False
- else:
- DLE = _ensure_code(ds.domain_left_edge)
- DRE = _ensure_code(ds.domain_right_edge)
- for i in range(3):
- self.domain_width[i] = DRE[i] - DLE[i]
- self.periodicity[i] = ds.periodicity[i]
+ ds = getattr(dobj, 'ds', None)
+ if ds is None:
+ for i in range(3):
+ # NOTE that this is not universal.
+ self.domain_width[i] = 1.0
+ self.periodicity[i] = False
+ else:
+ DLE = _ensure_code(ds.domain_left_edge)
+ DRE = _ensure_code(ds.domain_right_edge)
+ for i in range(3):
+ self.domain_width[i] = DRE[i] - DLE[i]
+ self.periodicity[i] = ds.periodicity[i]
@cython.boundscheck(False)
@cython.wraparound(False)
@@ -442,7 +445,7 @@
if child_mask[i, j, k] == 1 or this_level == 1:
mask[i, j, k] = self.select_cell(pos, dds)
total += mask[i, j, k]
- pos[2] += dds[2]
+ pos[2] += dds[1]
pos[1] += dds[1]
pos[0] += dds[0]
if total == 0: return None
@@ -1021,7 +1024,7 @@
@cython.wraparound(False)
@cython.cdivision(True)
cdef int select_cell(self, np.float64_t pos[3], np.float64_t dds[3]) nogil:
- if pos[self.axis] + 0.5*dds[self.axis] > self.coord \
+ if pos[self.axis] + 0.5*dds[self.axis] + grid_eps > self.coord \
and pos[self.axis] - 0.5*dds[self.axis] <= self.coord:
return 1
return 0
@@ -1044,7 +1047,7 @@
@cython.cdivision(True)
cdef int select_bbox(self, np.float64_t left_edge[3],
np.float64_t right_edge[3]) nogil:
- if left_edge[self.axis] <= self.coord < right_edge[self.axis]:
+ if left_edge[self.axis] <= self.coord < (right_edge[self.axis] + grid_eps):
return 1
return 0
https://bitbucket.org/yt_analysis/yt/commits/9c3384db3c4d/
Changeset: 9c3384db3c4d
Branch: yt
User: ChrisMalone
Date: 2014-08-29 22:48:56
Summary: not sure how this changed; but revert index change
Affected #: 1 file
diff -r 84babff8894df41d6d3779e2951a0968a0e8399f -r 9c3384db3c4d70ba9811bcba5020a4795c09588e yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -445,7 +445,7 @@
if child_mask[i, j, k] == 1 or this_level == 1:
mask[i, j, k] = self.select_cell(pos, dds)
total += mask[i, j, k]
- pos[2] += dds[1]
+ pos[2] += dds[2]
pos[1] += dds[1]
pos[0] += dds[0]
if total == 0: return None
https://bitbucket.org/yt_analysis/yt/commits/67682a8713d5/
Changeset: 67682a8713d5
Branch: yt
User: ChrisMalone
Date: 2014-08-30 00:49:30
Summary: no idea why, but this appears to work?
Affected #: 1 file
diff -r 9c3384db3c4d70ba9811bcba5020a4795c09588e -r 67682a8713d53b6346283c66db7cc5c1ff8bb06a yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -115,7 +115,7 @@
self.min_level = getattr(dobj, "min_level", 0)
self.max_level = getattr(dobj, "max_level", 99)
self.overlap_cells = 0
-
+
ds = getattr(dobj, 'ds', None)
if ds is None:
for i in range(3):
@@ -1024,8 +1024,8 @@
@cython.wraparound(False)
@cython.cdivision(True)
cdef int select_cell(self, np.float64_t pos[3], np.float64_t dds[3]) nogil:
- if pos[self.axis] + 0.5*dds[self.axis] + grid_eps > self.coord \
- and pos[self.axis] - 0.5*dds[self.axis] <= self.coord:
+ if pos[self.axis] + 0.5*dds[self.axis] > self.coord \
+ and pos[self.axis] - 0.5*dds[self.axis] - grid_eps<= self.coord:
return 1
return 0
@@ -1047,7 +1047,7 @@
@cython.cdivision(True)
cdef int select_bbox(self, np.float64_t left_edge[3],
np.float64_t right_edge[3]) nogil:
- if left_edge[self.axis] <= self.coord < (right_edge[self.axis] + grid_eps):
+ if left_edge[self.axis] - grid_eps <= self.coord < (right_edge[self.axis]):
return 1
return 0
https://bitbucket.org/yt_analysis/yt/commits/441dbccd46a3/
Changeset: 441dbccd46a3
Branch: yt
User: ChrisMalone
Date: 2014-08-30 17:23:51
Summary: minor syntax cleanup
Affected #: 1 file
diff -r 67682a8713d53b6346283c66db7cc5c1ff8bb06a -r 441dbccd46a3f3532df7f37c2e88f8c7b627de5c yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -1025,7 +1025,7 @@
@cython.cdivision(True)
cdef int select_cell(self, np.float64_t pos[3], np.float64_t dds[3]) nogil:
if pos[self.axis] + 0.5*dds[self.axis] > self.coord \
- and pos[self.axis] - 0.5*dds[self.axis] - grid_eps<= self.coord:
+ and pos[self.axis] - 0.5*dds[self.axis] - grid_eps <= self.coord:
return 1
return 0
@@ -1047,7 +1047,7 @@
@cython.cdivision(True)
cdef int select_bbox(self, np.float64_t left_edge[3],
np.float64_t right_edge[3]) nogil:
- if left_edge[self.axis] - grid_eps <= self.coord < (right_edge[self.axis]):
+ if left_edge[self.axis] - grid_eps <= self.coord < right_edge[self.axis]:
return 1
return 0
https://bitbucket.org/yt_analysis/yt/commits/5904d54c5e50/
Changeset: 5904d54c5e50
Branch: yt
User: ChrisMalone
Date: 2014-09-02 04:51:58
Summary: add test for shifted slice
Affected #: 1 file
diff -r 441dbccd46a3f3532df7f37c2e88f8c7b627de5c -r 5904d54c5e5007cc27902e68388fb64857bdccc8 yt/data_objects/tests/test_slice.py
--- a/yt/data_objects/tests/test_slice.py
+++ b/yt/data_objects/tests/test_slice.py
@@ -34,6 +34,7 @@
def test_slice():
fns = []
+ grid_eps = np.finfo(np.float64).eps
for nprocs in [8, 1]:
# We want to test both 1 proc and 8 procs, to make sure that
# parallelism isn't broken
@@ -52,6 +53,7 @@
yax = ds.coordinates.y_axis[ax]
for wf in ["density", None]:
slc = ds.slice(ax, slc_pos)
+ shifted_slc = ds.slice(ax, slc_pos + grid_eps)
yield assert_equal, slc["ones"].sum(), slc["ones"].size
yield assert_equal, slc["ones"].min(), 1.0
yield assert_equal, slc["ones"].max(), 1.0
@@ -66,6 +68,7 @@
p.save(name=tmpname)
fns.append(tmpname)
frb = slc.to_frb((1.0, 'unitary'), 64)
+ shifted_frb = shifted_slc.to_frb((1.0, 'unitary'), 64)
for slc_field in ['ones', 'density']:
fi = ds._get_field_info(slc_field)
yield assert_equal, frb[slc_field].info['data_source'], \
@@ -84,6 +87,8 @@
slc.center
yield assert_equal, frb[slc_field].info['coord'], \
slc_pos
+ yield assert_equal, frb[slc_field], \
+ shifted_frb[slc_field]
# wf == None
yield assert_equal, wf, None
teardown_func(fns)
https://bitbucket.org/yt_analysis/yt/commits/75d65dcf2ce6/
Changeset: 75d65dcf2ce6
Branch: yt
User: MatthewTurk
Date: 2014-09-03 00:50:14
Summary: Merged in ChrisMalone/yt (pull request #1174)
add an epsilon check to selector
Affected #: 2 files
diff -r 4966afceaddf8602f20a7a95aa02afd17bfaca39 -r 75d65dcf2ce66eaed99eef42d56033844a137160 yt/data_objects/tests/test_slice.py
--- a/yt/data_objects/tests/test_slice.py
+++ b/yt/data_objects/tests/test_slice.py
@@ -34,6 +34,7 @@
def test_slice():
fns = []
+ grid_eps = np.finfo(np.float64).eps
for nprocs in [8, 1]:
# We want to test both 1 proc and 8 procs, to make sure that
# parallelism isn't broken
@@ -52,6 +53,7 @@
yax = ds.coordinates.y_axis[ax]
for wf in ["density", None]:
slc = ds.slice(ax, slc_pos)
+ shifted_slc = ds.slice(ax, slc_pos + grid_eps)
yield assert_equal, slc["ones"].sum(), slc["ones"].size
yield assert_equal, slc["ones"].min(), 1.0
yield assert_equal, slc["ones"].max(), 1.0
@@ -66,6 +68,7 @@
p.save(name=tmpname)
fns.append(tmpname)
frb = slc.to_frb((1.0, 'unitary'), 64)
+ shifted_frb = shifted_slc.to_frb((1.0, 'unitary'), 64)
for slc_field in ['ones', 'density']:
fi = ds._get_field_info(slc_field)
yield assert_equal, frb[slc_field].info['data_source'], \
@@ -84,6 +87,8 @@
slc.center
yield assert_equal, frb[slc_field].info['coord'], \
slc_pos
+ yield assert_equal, frb[slc_field], \
+ shifted_frb[slc_field]
# wf == None
yield assert_equal, wf, None
teardown_func(fns)
diff -r 4966afceaddf8602f20a7a95aa02afd17bfaca39 -r 75d65dcf2ce66eaed99eef42d56033844a137160 yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -36,6 +36,10 @@
long int lrint(double x) nogil
double fabs(double x) nogil
+# use this as an epsilon test for grids aligned with selector
+# define here to avoid the gil later
+cdef np.float64_t grid_eps = np.finfo(np.float64).eps
+
# These routines are separated into a couple different categories:
#
# * Routines for identifying intersections of an object with a bounding box
@@ -111,20 +115,19 @@
self.min_level = getattr(dobj, "min_level", 0)
self.max_level = getattr(dobj, "max_level", 99)
self.overlap_cells = 0
-
- for i in range(3) :
- ds = getattr(dobj, 'ds', None)
- if ds is None:
- for i in range(3):
- # NOTE that this is not universal.
- self.domain_width[i] = 1.0
- self.periodicity[i] = False
- else:
- DLE = _ensure_code(ds.domain_left_edge)
- DRE = _ensure_code(ds.domain_right_edge)
- for i in range(3):
- self.domain_width[i] = DRE[i] - DLE[i]
- self.periodicity[i] = ds.periodicity[i]
+
+ ds = getattr(dobj, 'ds', None)
+ if ds is None:
+ for i in range(3):
+ # NOTE that this is not universal.
+ self.domain_width[i] = 1.0
+ self.periodicity[i] = False
+ else:
+ DLE = _ensure_code(ds.domain_left_edge)
+ DRE = _ensure_code(ds.domain_right_edge)
+ for i in range(3):
+ self.domain_width[i] = DRE[i] - DLE[i]
+ self.periodicity[i] = ds.periodicity[i]
@cython.boundscheck(False)
@cython.wraparound(False)
@@ -1017,7 +1020,7 @@
@cython.cdivision(True)
cdef int select_cell(self, np.float64_t pos[3], np.float64_t dds[3]) nogil:
if pos[self.axis] + 0.5*dds[self.axis] > self.coord \
- and pos[self.axis] - 0.5*dds[self.axis] <= self.coord:
+ and pos[self.axis] - 0.5*dds[self.axis] - grid_eps <= self.coord:
return 1
return 0
@@ -1039,7 +1042,7 @@
@cython.cdivision(True)
cdef int select_bbox(self, np.float64_t left_edge[3],
np.float64_t right_edge[3]) nogil:
- if left_edge[self.axis] <= self.coord < right_edge[self.axis]:
+ if left_edge[self.axis] - grid_eps <= self.coord < right_edge[self.axis]:
return 1
return 0
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