[yt-svn] commit/yt: 6 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Aug 20 09:30:52 PDT 2015
6 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/f1603dc32d14/
Changeset: f1603dc32d14
Branch: yt
User: xarthisius
Date: 2015-08-18 20:43:21+00:00
Summary: [opt] Use explict types in selector initialization. Cuts init time tenfold
Affected #: 1 file
diff -r bc21601eb3e3d89810ca3b5e914797f934fe1ef8 -r f1603dc32d1457ade4784e72358d10670ac16ad2 yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -109,6 +109,8 @@
cdef class SelectorObject:
def __cinit__(self, dobj, *args):
+ cdef np.float64_t [:] DLE
+ cdef np.float64_t [:] DRE
self.min_level = getattr(dobj, "min_level", 0)
self.max_level = getattr(dobj, "max_level", 99)
self.overlap_cells = 0
https://bitbucket.org/yt_analysis/yt/commits/416d6b262f83/
Changeset: 416d6b262f83
Branch: yt
User: xarthisius
Date: 2015-08-18 20:51:45+00:00
Summary: [opt] drop units in global_start_index computation, all vars are already in code_unists
Affected #: 1 file
diff -r f1603dc32d1457ade4784e72358d10670ac16ad2 -r 416d6b262f832ac448b9c1ebf8e3abd7351cb72b yt/data_objects/grid_patch.py
--- a/yt/data_objects/grid_patch.py
+++ b/yt/data_objects/grid_patch.py
@@ -77,13 +77,12 @@
if self.start_index is not None:
return self.start_index
if self.Parent is None:
- left = self.LeftEdge - self.ds.domain_left_edge
- start_index = left / self.dds
- return np.rint(start_index).astype('int64').ravel().view(np.ndarray)
+ left = self.LeftEdge.d - self.ds.domain_left_edge.d
+ start_index = left / self.dds.d
+ return np.rint(start_index).astype('int64').ravel()
- pdx = self.Parent.dds.ndarray_view()
- di = np.rint( (self.LeftEdge.ndarray_view() -
- self.Parent.LeftEdge.ndarray_view()) / pdx)
+ pdx = self.Parent.dds.d
+ di = np.rint((self.LeftEdge.d - self.Parent.LeftEdge.d) / pdx)
start_index = self.Parent.get_global_startindex() + di
self.start_index = (start_index * self.ds.refine_by).astype('int64').ravel()
return self.start_index
@@ -251,7 +250,7 @@
field_parameters.update(self.field_parameters)
if smoothed:
cube = self.ds.smoothed_covering_grid(
- level, new_left_edge,
+ level, new_left_edge,
field_parameters = field_parameters,
**kwargs)
else:
https://bitbucket.org/yt_analysis/yt/commits/db288158f106/
Changeset: db288158f106
Branch: yt
User: xarthisius
Date: 2015-08-18 22:28:57+00:00
Summary: [opt] multiply in-place view of YTArray in convert_to_units
Affected #: 1 file
diff -r 416d6b262f832ac448b9c1ebf8e3abd7351cb72b -r db288158f10612903f539bdeff783c2da37997d6 yt/units/yt_array.py
--- a/yt/units/yt_array.py
+++ b/yt/units/yt_array.py
@@ -424,7 +424,8 @@
(conversion_factor, offset) = self.units.get_conversion_factor(new_units)
self.units = new_units
- self *= conversion_factor
+ values = self.d
+ values *= conversion_factor
if offset:
np.subtract(self, offset*self.uq, self)
@@ -1309,7 +1310,7 @@
Parameters
----------
fname : str
- Filename to read.
+ Filename to read.
dtype : data-type, optional
Data-type of the resulting array; default: float.
delimiter : str, optional
@@ -1367,7 +1368,7 @@
footer='', comments='#'):
r"""
Write YTArrays with unit information to a text file.
-
+
Parameters
----------
fname : str
@@ -1375,7 +1376,7 @@
arrays : list of YTArrays or single YTArray
The array(s) to write to the file.
fmt : str or sequence of strs, optional
- A single format (%10.5f), or a sequence of formats.
+ A single format (%10.5f), or a sequence of formats.
delimiter : str, optional
String or character separating columns.
header : str, optional
https://bitbucket.org/yt_analysis/yt/commits/5520f0140d7f/
Changeset: 5520f0140d7f
Branch: yt
User: xarthisius
Date: 2015-08-18 22:56:07+00:00
Summary: Drop units from YTSmoothedCoveringGridBase._minimal_box All variables should be in code_units at this point
Affected #: 1 file
diff -r db288158f10612903f539bdeff783c2da37997d6 -r 5520f0140d7f8e243e5136c3ff8e91428f83ea1e yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -321,7 +321,7 @@
_units_initialized = False
with self.data_source._field_parameter_state(self.field_parameters):
for chunk in parallel_objects(self.data_source.chunks(
- [], "io", local_only = True)):
+ [], "io", local_only = True)):
mylog.debug("Adding chunk (%s) to tree (%0.3e GB RAM)",
chunk.ires.size, get_memory_usage()/1024.)
if _units_initialized is False:
@@ -910,22 +910,22 @@
return ls
def _minimal_box(self, dds):
- LL = self.left_edge - self.ds.domain_left_edge
+ LL = self.left_edge.d - self.ds.domain_left_edge.d
# Nudge in case we're on the edge
- LL += LL.uq * np.finfo(np.float64).eps
- LS = self.right_edge - self.ds.domain_left_edge
- LS += LS.uq * np.finfo(np.float64).eps
+ LL += LL * np.finfo(np.float64).eps
+ LS = self.right_edge.d - self.ds.domain_left_edge.d
+ LS += LS * np.finfo(np.float64).eps
cell_start = LL / dds # This is the cell we're inside
cell_end = LS / dds
if self.level == 0:
start_index = np.array(np.floor(cell_start), dtype="int64")
end_index = np.array(np.ceil(cell_end), dtype="int64")
- dims = np.rint((self.ActiveDimensions * self.dds) / dds).astype("int64")
+ dims = np.rint((self.ActiveDimensions * self.dds.d) / dds).astype("int64")
else:
# Give us one buffer
- start_index = np.rint(cell_start.d).astype('int64') - 1
+ start_index = np.rint(cell_start).astype('int64') - 1
# How many root cells do we occupy?
- end_index = np.rint(cell_end.d).astype('int64')
+ end_index = np.rint(cell_end).astype('int64')
dims = end_index - start_index + 1
return start_index, end_index.astype("int64"), dims.astype("int32")
@@ -1211,9 +1211,9 @@
>>> distf = 3.1e18*1e3 # distances into kpc
>>> for i, r in enumerate(rhos):
... surf = ds.surface(sp,'density',r)
- ... surf.export_obj("my_galaxy", transparency=trans[i],
- ... color_field='temperature', dist_fac = distf,
- ... plot_index = i, color_field_max = ma,
+ ... surf.export_obj("my_galaxy", transparency=trans[i],
+ ... color_field='temperature', dist_fac = distf,
+ ... plot_index = i, color_field_max = ma,
... color_field_min = mi)
>>> sp = ds.sphere("max", (10, "kpc"))
https://bitbucket.org/yt_analysis/yt/commits/26057aaf318f/
Changeset: 26057aaf318f
Branch: yt
User: xarthisius
Date: 2015-08-19 17:12:43+00:00
Summary: Nudge by eps not value*eps
Affected #: 1 file
diff -r 5520f0140d7f8e243e5136c3ff8e91428f83ea1e -r 26057aaf318f9bb79aa80e1e4859215445256548 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -912,9 +912,9 @@
def _minimal_box(self, dds):
LL = self.left_edge.d - self.ds.domain_left_edge.d
# Nudge in case we're on the edge
- LL += LL * np.finfo(np.float64).eps
+ LL += np.finfo(np.float64).eps
LS = self.right_edge.d - self.ds.domain_left_edge.d
- LS += LS * np.finfo(np.float64).eps
+ LS += np.finfo(np.float64).eps
cell_start = LL / dds # This is the cell we're inside
cell_end = LS / dds
if self.level == 0:
https://bitbucket.org/yt_analysis/yt/commits/5f98bb340f15/
Changeset: 5f98bb340f15
Branch: yt
User: ngoldbaum
Date: 2015-08-20 16:30:39+00:00
Summary: Merged in xarthisius/yt (pull request #1707)
[WIP] Minor optimization for smoothed covering grids
Affected #: 4 files
diff -r d7969f97265f2820654bbc6f23e933983fd749c6 -r 5f98bb340f15ac0d73ba37156dba9ed24d0691d6 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -321,7 +321,7 @@
_units_initialized = False
with self.data_source._field_parameter_state(self.field_parameters):
for chunk in parallel_objects(self.data_source.chunks(
- [], "io", local_only = True)):
+ [], "io", local_only = True)):
mylog.debug("Adding chunk (%s) to tree (%0.3e GB RAM)",
chunk.ires.size, get_memory_usage()/1024.)
if _units_initialized is False:
@@ -912,22 +912,22 @@
return ls
def _minimal_box(self, dds):
- LL = self.left_edge - self.ds.domain_left_edge
+ LL = self.left_edge.d - self.ds.domain_left_edge.d
# Nudge in case we're on the edge
- LL += LL.uq * np.finfo(np.float64).eps
- LS = self.right_edge - self.ds.domain_left_edge
- LS += LS.uq * np.finfo(np.float64).eps
+ LL += np.finfo(np.float64).eps
+ LS = self.right_edge.d - self.ds.domain_left_edge.d
+ LS += np.finfo(np.float64).eps
cell_start = LL / dds # This is the cell we're inside
cell_end = LS / dds
if self.level == 0:
start_index = np.array(np.floor(cell_start), dtype="int64")
end_index = np.array(np.ceil(cell_end), dtype="int64")
- dims = np.rint((self.ActiveDimensions * self.dds) / dds).astype("int64")
+ dims = np.rint((self.ActiveDimensions * self.dds.d) / dds).astype("int64")
else:
# Give us one buffer
- start_index = np.rint(cell_start.d).astype('int64') - 1
+ start_index = np.rint(cell_start).astype('int64') - 1
# How many root cells do we occupy?
- end_index = np.rint(cell_end.d).astype('int64')
+ end_index = np.rint(cell_end).astype('int64')
dims = end_index - start_index + 1
return start_index, end_index.astype("int64"), dims.astype("int32")
@@ -1213,9 +1213,9 @@
>>> distf = 3.1e18*1e3 # distances into kpc
>>> for i, r in enumerate(rhos):
... surf = ds.surface(sp,'density',r)
- ... surf.export_obj("my_galaxy", transparency=trans[i],
- ... color_field='temperature', dist_fac = distf,
- ... plot_index = i, color_field_max = ma,
+ ... surf.export_obj("my_galaxy", transparency=trans[i],
+ ... color_field='temperature', dist_fac = distf,
+ ... plot_index = i, color_field_max = ma,
... color_field_min = mi)
>>> sp = ds.sphere("max", (10, "kpc"))
diff -r d7969f97265f2820654bbc6f23e933983fd749c6 -r 5f98bb340f15ac0d73ba37156dba9ed24d0691d6 yt/data_objects/grid_patch.py
--- a/yt/data_objects/grid_patch.py
+++ b/yt/data_objects/grid_patch.py
@@ -77,13 +77,12 @@
if self.start_index is not None:
return self.start_index
if self.Parent is None:
- left = self.LeftEdge - self.ds.domain_left_edge
- start_index = left / self.dds
- return np.rint(start_index).astype('int64').ravel().view(np.ndarray)
+ left = self.LeftEdge.d - self.ds.domain_left_edge.d
+ start_index = left / self.dds.d
+ return np.rint(start_index).astype('int64').ravel()
- pdx = self.Parent.dds.ndarray_view()
- di = np.rint( (self.LeftEdge.ndarray_view() -
- self.Parent.LeftEdge.ndarray_view()) / pdx)
+ pdx = self.Parent.dds.d
+ di = np.rint((self.LeftEdge.d - self.Parent.LeftEdge.d) / pdx)
start_index = self.Parent.get_global_startindex() + di
self.start_index = (start_index * self.ds.refine_by).astype('int64').ravel()
return self.start_index
@@ -251,7 +250,7 @@
field_parameters.update(self.field_parameters)
if smoothed:
cube = self.ds.smoothed_covering_grid(
- level, new_left_edge,
+ level, new_left_edge,
field_parameters = field_parameters,
**kwargs)
else:
diff -r d7969f97265f2820654bbc6f23e933983fd749c6 -r 5f98bb340f15ac0d73ba37156dba9ed24d0691d6 yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -109,6 +109,8 @@
cdef class SelectorObject:
def __cinit__(self, dobj, *args):
+ cdef np.float64_t [:] DLE
+ cdef np.float64_t [:] DRE
self.min_level = getattr(dobj, "min_level", 0)
self.max_level = getattr(dobj, "max_level", 99)
self.overlap_cells = 0
diff -r d7969f97265f2820654bbc6f23e933983fd749c6 -r 5f98bb340f15ac0d73ba37156dba9ed24d0691d6 yt/units/yt_array.py
--- a/yt/units/yt_array.py
+++ b/yt/units/yt_array.py
@@ -424,7 +424,8 @@
(conversion_factor, offset) = self.units.get_conversion_factor(new_units)
self.units = new_units
- self *= conversion_factor
+ values = self.d
+ values *= conversion_factor
if offset:
np.subtract(self, offset*self.uq, self)
@@ -1309,7 +1310,7 @@
Parameters
----------
fname : str
- Filename to read.
+ Filename to read.
dtype : data-type, optional
Data-type of the resulting array; default: float.
delimiter : str, optional
@@ -1367,7 +1368,7 @@
footer='', comments='#'):
r"""
Write YTArrays with unit information to a text file.
-
+
Parameters
----------
fname : str
@@ -1375,7 +1376,7 @@
arrays : list of YTArrays or single YTArray
The array(s) to write to the file.
fmt : str or sequence of strs, optional
- A single format (%10.5f), or a sequence of formats.
+ A single format (%10.5f), or a sequence of formats.
delimiter : str, optional
String or character separating columns.
header : str, optional
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