[yt-svn] commit/yt-3.0: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Aug 20 12:02:55 PDT 2013
2 new commits in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/commits/26db032a9fff/
Changeset: 26db032a9fff
Branch: yt-3.0
User: sleitner
Date: 2013-08-03 19:27:55
Summary: fixing gadget comoving units
Affected #: 1 file
diff -r ee12a3a0500cd4a12aee012bac5b6ef0f1b404e6 -r 26db032a9fff0c28f5a16ed628ea3e34f41e85d6 yt/frontends/sph/data_structures.py
--- a/yt/frontends/sph/data_structures.py
+++ b/yt/frontends/sph/data_structures.py
@@ -112,9 +112,9 @@
if self.cosmological_simulation:
for unit in mpc_conversion:
mpch['%sh' % unit] = mpch[unit] * self.hubble_constant
- mpch['%shcm' % unit] = (mpch["%sh" % unit] /
+ mpch['%shcm' % unit] = (mpch["%sh" % unit] *
(1 + self.current_redshift))
- mpch['%scm' % unit] = mpch[unit] / (1 + self.current_redshift)
+ mpch['%scm' % unit] = mpch[unit] * (1 + self.current_redshift)
# ud == unit destination
# ur == unit registry
for ud, ur in [(self.units, mpch), (self.time_units, sec_conversion)]:
https://bitbucket.org/yt_analysis/yt-3.0/commits/6e2d52bef215/
Changeset: 6e2d52bef215
Branch: yt-3.0
User: MatthewTurk
Date: 2013-08-20 21:02:42
Summary: This is a fix from SamL that changes how Gadget comoving units are set up.
I tested this by manually setting `current_redshift` equal to 10 and seeing
that the change in the `mpch` conversion factor was in the wrong direction. I
think it's good to go, but I'd like at least one sign-off on it.
Affected #: 4 files
diff -r 26db032a9fff0c28f5a16ed628ea3e34f41e85d6 -r 6e2d52bef215f9143407aedfe46bc8e1d9ea6187 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -444,6 +444,12 @@
mylog.warning('Identical domain left edge and right edges '
'along dummy dimension (%i), attempting to read anyway' % d)
self.domain_right_edge[d] = self.domain_left_edge[d]+1.0
+ if self.dimensionality < 3 and self.geometry == "cylindrical":
+ mylog.warning("Extending theta dimension to 2PI + left edge.")
+ self.domain_right_edge[2] = self.domain_left_edge[2] + 2*np.pi
+ elif self.dimensionality < 3 and self.geometry == "polar":
+ mylog.warning("Extending theta dimension to 2PI + left edge.")
+ self.domain_right_edge[1] = self.domain_left_edge[1] + 2*np.pi
self.domain_dimensions = \
np.array([nblockx*nxb,nblocky*nyb,nblockz*nzb])
diff -r 26db032a9fff0c28f5a16ed628ea3e34f41e85d6 -r 6e2d52bef215f9143407aedfe46bc8e1d9ea6187 yt/frontends/flash/io.py
--- a/yt/frontends/flash/io.py
+++ b/yt/frontends/flash/io.py
@@ -82,7 +82,9 @@
rv = {}
for field in fields:
ftype, fname = field
- rv[field] = np.empty(size, dtype=f["/%s" % fname].dtype)
+ dt = f["/%s" % fname].dtype
+ if dt == "float32": dt = "float64"
+ rv[field] = np.empty(size, dtype=dt)
ng = sum(len(c.objs) for c in chunks)
mylog.debug("Reading %s cells of %s fields in %s blocks",
size, [f2 for f1, f2 in fields], ng)
diff -r 26db032a9fff0c28f5a16ed628ea3e34f41e85d6 -r 6e2d52bef215f9143407aedfe46bc8e1d9ea6187 yt/geometry/coordinate_handler.py
--- a/yt/geometry/coordinate_handler.py
+++ b/yt/geometry/coordinate_handler.py
@@ -189,8 +189,8 @@
class PolarCoordinateHandler(CoordinateHandler):
- def __init__(self, pf, ordering = 'rzt'):
- if ordering != 'rzt': raise NotImplementedError
+ def __init__(self, pf, ordering = 'rtz'):
+ if ordering != 'rtz': raise NotImplementedError
super(PolarCoordinateHandler, self).__init__(pf)
def coordinate_fields(self):
@@ -222,7 +222,80 @@
data_source['dr']/2.0,
data_source['theta'],
data_source['dtheta']/2.0,
- size[0], field, bounds[0])
+ size[0], data_source[field], bounds[0])
+ return buff
+
+ axis_name = { 0 : 'r', 1 : 'theta', 2 : 'z',
+ 'r' : 'r', 'theta' : 'theta', 'z' : 'z',
+ 'R' : 'r', 'Theta' : 'theta', 'Z' : 'z'}
+
+ axis_id = { 'r' : 0, 'theta' : 1, 'z' : 2,
+ 0 : 0, 1 : 1, 2 : 2}
+
+ x_axis = { 'r' : 1, 'theta' : 0, 'z' : 0,
+ 0 : 1, 1 : 0, 2 : 0}
+
+ y_axis = { 'r' : 2, 'theta' : 2, 'z' : 1,
+ 0 : 2, 1 : 2, 2 : 1}
+
+ def convert_from_cartesian(self, coord):
+ return cartesian_to_cylindrical(coord)
+
+ def convert_to_cartesian(self, coord):
+ return cylindrical_to_cartesian(coord)
+
+ def convert_to_cylindrical(self, coord):
+ return coord
+
+ def convert_from_cylindrical(self, coord):
+ return coord
+
+ def convert_to_spherical(self, coord):
+ raise NotImplementedError
+
+ def convert_from_spherical(self, coord):
+ raise NotImplementedError
+
+ @property
+ def period(self):
+ return np.array([0.0, 0.0, 2.0*np.pi])
+
+class CylindricalCoordinateHandler(CoordinateHandler):
+
+ def __init__(self, pf, ordering = 'rzt'):
+ if ordering != 'rzt': raise NotImplementedError
+ super(CylindricalCoordinateHandler, self).__init__(pf)
+
+ def coordinate_fields(self):
+ # return the fields for r, z, theta
+ return CylindricalFieldInfo
+
+ def pixelize(self, dimension, data_source, field, bounds, size, antialias = True):
+ ax_name = self.axis_name[dimension]
+ if ax_name in ('r', 'theta'):
+ return self._ortho_pixelize(data_source, field, bounds, size,
+ antialias)
+ elif ax_name == "z":
+ return self._cyl_pixelize(data_source, field, bounds, size,
+ antialias)
+ else:
+ # Pixelizing along a cylindrical surface is a bit tricky
+ raise NotImplementedError
+
+ def _ortho_pixelize(self, data_source, field, bounds, size, antialias):
+ buff = _MPL.Pixelize(data_source['px'], data_source['py'],
+ data_source['pdx'], data_source['pdy'],
+ data_source[field], size[0], size[1],
+ bounds, int(antialias),
+ True, self.period).transpose()
+ return buff
+
+ def _cyl_pixelize(self, data_source, field, bounds, size, antialias):
+ buff = pixelize_cylinder(data_source['r'],
+ data_source['dr']/2.0,
+ data_source['theta'],
+ data_source['dtheta']/2.0,
+ size[0], data_source[field], bounds[0])
return buff
axis_name = { 0 : 'r', 1 : 'z', 2 : 'theta',
@@ -260,76 +333,3 @@
def period(self):
return np.array([0.0, 0.0, 2.0*np.pi])
-class CylindricalCoordinateHandler(CoordinateHandler):
-
- def __init__(self, pf, ordering = 'rtz'):
- if ordering != 'rtz': raise NotImplementedError
- super(CylindricalCoordinateHandler, self).__init__(pf)
-
- def coordinate_fields(self):
- # return the fields for r, z, theta
- return CylindricalFieldInfo
-
- def pixelize(self, dimension, data_source, field, bounds, size, antialias = True):
- raise NotImplementedError
- if dimension == 1:
- return self._ortho_pixelize(data_source, field, bounds, size,
- antialias)
- elif dimension == 2:
- return self._cyl_pixelize(data_source, field, bounds, size,
- antialias)
- else:
- # Pixelizing along a cylindrical surface is a bit tricky
- raise NotImplementedError
-
- def _ortho_pixelize(self, data_source, field, bounds, size, antialias):
- buff = _MPL.Pixelize(data_source['px'], data_source['py'],
- data_source['pdx'], data_source['pdy'],
- data_source[field], size[0], size[1],
- bounds, int(antialias),
- True, self.period).transpose()
- return buff
-
- def _cyl_pixelize(self, data_source, field, bounds, size, antialias):
- buff = pixelize_cylinder(data_source['r'],
- data_source['dr']/2.0,
- data_source['theta'],
- data_source['dtheta']/2.0,
- size[0], field, bounds[0])
- return buff
-
- axis_name = { 0 : 'r', 1 : 'z', 2 : 'theta',
- 'r' : 'r', 'z' : 'z', 'theta' : 'theta',
- 'R' : 'r', 'Z' : 'z', 'Theta' : 'theta'}
-
- axis_id = { 'r' : 0, 'z' : 1, 'theta' : 2,
- 0 : 0, 1 : 1, 2 : 2}
-
- x_axis = { 'r' : 1, 'z' : 0, 'theta' : 0,
- 0 : 1, 1 : 0, 2 : 0}
-
- y_axis = { 'r' : 2, 'z' : 2, 'theta' : 1,
- 0 : 2, 1 : 2, 2 : 1}
-
- def convert_from_cartesian(self, coord):
- return cartesian_to_cylindrical(coord)
-
- def convert_to_cartesian(self, coord):
- return cylindrical_to_cartesian(coord)
-
- def convert_to_cylindrical(self, coord):
- return coord
-
- def convert_from_cylindrical(self, coord):
- return coord
-
- def convert_to_spherical(self, coord):
- raise NotImplementedError
-
- def convert_from_spherical(self, coord):
- raise NotImplementedError
-
- @property
- def period(self):
- return np.array([0.0, 0.0, 2.0*np.pi])
-
diff -r 26db032a9fff0c28f5a16ed628ea3e34f41e85d6 -r 6e2d52bef215f9143407aedfe46bc8e1d9ea6187 yt/utilities/lib/misc_utilities.pyx
--- a/yt/utilities/lib/misc_utilities.pyx
+++ b/yt/utilities/lib/misc_utilities.pyx
@@ -378,6 +378,8 @@
raise KeyError
@cython.cdivision(True)
+ at cython.boundscheck(False)
+ at cython.wraparound(False)
def pixelize_cylinder(np.ndarray[np.float64_t, ndim=1] radius,
np.ndarray[np.float64_t, ndim=1] dradius,
np.ndarray[np.float64_t, ndim=1] theta,
Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/
--
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