[yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Tue May 8 14:54:10 PDT 2012
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/changeset/9ef3fe7a7c53/
changeset: 9ef3fe7a7c53
branch: yt
user: chummels
date: 2012-05-08 23:53:02
summary: Fixing a bug in off_axis_projections, which occurred when you use a weight field and a homogenized volume, whereby a temporary field*weight product field was not being deleted from individual grids upon completion. Thanks for the help, Matt!
affected #: 1 file
diff -r c1c90403232b0636bf8473538d26e964427373fb -r 9ef3fe7a7c53d8b31030cb760caf33dd7fc2a1a8 yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -1291,8 +1291,13 @@
fields = [field]
if weight is not None:
# This is a temporary field, which we will remove at the end.
+ def _wf(f1, w1):
+ def WeightField(field, data):
+ return data[f1].astype("float64") * \
+ data[w1].astype("float64")
+ return WeightField
pf.field_info.add_field("temp_weightfield",
- function=lambda a,b:b[field]*b[weight].astype("float64"))
+ function=_wf(field, weight))
fields = ["temp_weightfield", weight]
tf = ProjectionTransferFunction(n_fields = 2)
tf = ProjectionTransferFunction(n_fields = len(fields))
@@ -1313,4 +1318,7 @@
else:
image /= vals[:,:,1]
pf.field_info.pop("temp_weightfield")
+ for g in pf.h.grids:
+ if "temp_weightfield" in g.keys():
+ del g["temp_weightfield"]
return image
https://bitbucket.org/yt_analysis/yt/changeset/db3f6890e9a2/
changeset: db3f6890e9a2
branch: yt
user: chummels
date: 2012-05-08 23:53:47
summary: Merging.
affected #: 5 files
diff -r 9ef3fe7a7c53d8b31030cb760caf33dd7fc2a1a8 -r db3f6890e9a256a289dc740002aee72f2dbeb54e yt/frontends/art/fields.py
--- a/yt/frontends/art/fields.py
+++ b/yt/frontends/art/fields.py
@@ -54,9 +54,8 @@
#Add the fields, then later we'll individually defined units and names
for f in known_art_fields:
- if f not in ARTFieldInfo:
- add_field(f, function=lambda a,b: None, take_log=True,
- validators = [ValidateDataField(f)])
+ add_art_field(f, function=NullFunc, take_log=True,
+ validators = [ValidateDataField(f)])
#Hydro Fields that are verified to be OK unit-wise:
#Density
@@ -91,81 +90,81 @@
def _convertDensity(data):
return data.convert("Density")
-ARTFieldInfo["Density"]._units = r"\rm{g}/\rm{cm}^3"
-ARTFieldInfo["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
-ARTFieldInfo["Density"]._convert_function=_convertDensity
+KnownARTFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
+KnownARTFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["Density"]._convert_function=_convertDensity
def _convertTotalEnergy(data):
return data.convert("GasEnergy")
-ARTFieldInfo["TotalEnergy"]._units = r"\rm{g}/\rm{cm}^3"
-ARTFieldInfo["TotalEnergy"]._projected_units = r"\rm{K}"
-ARTFieldInfo["TotalEnergy"]._convert_function=_convertTotalEnergy
+KnownARTFields["TotalEnergy"]._units = r"\rm{g}/\rm{cm}^3"
+KnownARTFields["TotalEnergy"]._projected_units = r"\rm{K}"
+KnownARTFields["TotalEnergy"]._convert_function=_convertTotalEnergy
def _convertXMomentumDensity(data):
tr = data.convert("Mass")*data.convert("Velocity")
tr *= (data.convert("Density")/data.convert("Mass"))
return tr
-ARTFieldInfo["XMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-ARTFieldInfo["XMomentumDensity"]._projected_units = r"\rm{K}"
-ARTFieldInfo["XMomentumDensity"]._convert_function=_convertXMomentumDensity
+KnownARTFields["XMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
+KnownARTFields["XMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["XMomentumDensity"]._convert_function=_convertXMomentumDensity
def _convertYMomentumDensity(data):
tr = data.convert("Mass")*data.convert("Velocity")
tr *= (data.convert("Density")/data.convert("Mass"))
return tr
-ARTFieldInfo["YMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-ARTFieldInfo["YMomentumDensity"]._projected_units = r"\rm{K}"
-ARTFieldInfo["YMomentumDensity"]._convert_function=_convertYMomentumDensity
+KnownARTFields["YMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
+KnownARTFields["YMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["YMomentumDensity"]._convert_function=_convertYMomentumDensity
def _convertZMomentumDensity(data):
tr = data.convert("Mass")*data.convert("Velocity")
tr *= (data.convert("Density")/data.convert("Mass"))
return tr
-ARTFieldInfo["ZMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-ARTFieldInfo["ZMomentumDensity"]._projected_units = r"\rm{K}"
-ARTFieldInfo["ZMomentumDensity"]._convert_function=_convertZMomentumDensity
+KnownARTFields["ZMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
+KnownARTFields["ZMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["ZMomentumDensity"]._convert_function=_convertZMomentumDensity
def _convertPressure(data):
return data.convert("Pressure")
-ARTFieldInfo["Pressure"]._units = r"\rm{g}/\rm{cm}/\rm{s}^2"
-ARTFieldInfo["Pressure"]._projected_units = r"\rm{g}/\rm{s}^2"
-ARTFieldInfo["Pressure"]._convert_function=_convertPressure
+KnownARTFields["Pressure"]._units = r"\rm{g}/\rm{cm}/\rm{s}^2"
+KnownARTFields["Pressure"]._projected_units = r"\rm{g}/\rm{s}^2"
+KnownARTFields["Pressure"]._convert_function=_convertPressure
def _convertGamma(data):
return 1.0
-ARTFieldInfo["Gamma"]._units = r""
-ARTFieldInfo["Gamma"]._projected_units = r""
-ARTFieldInfo["Gamma"]._convert_function=_convertGamma
+KnownARTFields["Gamma"]._units = r""
+KnownARTFields["Gamma"]._projected_units = r""
+KnownARTFields["Gamma"]._convert_function=_convertGamma
def _convertGasEnergy(data):
return data.convert("GasEnergy")
-ARTFieldInfo["GasEnergy"]._units = r"\rm{ergs}/\rm{g}"
-ARTFieldInfo["GasEnergy"]._projected_units = r""
-ARTFieldInfo["GasEnergy"]._convert_function=_convertGasEnergy
+KnownARTFields["GasEnergy"]._units = r"\rm{ergs}/\rm{g}"
+KnownARTFields["GasEnergy"]._projected_units = r""
+KnownARTFields["GasEnergy"]._convert_function=_convertGasEnergy
def _convertMetalDensitySNII(data):
return data.convert("Density")
-ARTFieldInfo["MetalDensitySNII"]._units = r"\rm{g}/\rm{cm}^3"
-ARTFieldInfo["MetalDensitySNII"]._projected_units = r"\rm{g}/\rm{cm}^2"
-ARTFieldInfo["MetalDensitySNII"]._convert_function=_convertMetalDensitySNII
+KnownARTFields["MetalDensitySNII"]._units = r"\rm{g}/\rm{cm}^3"
+KnownARTFields["MetalDensitySNII"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["MetalDensitySNII"]._convert_function=_convertMetalDensitySNII
def _convertMetalDensitySNIa(data):
return data.convert("Density")
-ARTFieldInfo["MetalDensitySNIa"]._units = r"\rm{g}/\rm{cm}^3"
-ARTFieldInfo["MetalDensitySNIa"]._projected_units = r"\rm{g}/\rm{cm}^2"
-ARTFieldInfo["MetalDensitySNIa"]._convert_function=_convertMetalDensitySNIa
+KnownARTFields["MetalDensitySNIa"]._units = r"\rm{g}/\rm{cm}^3"
+KnownARTFields["MetalDensitySNIa"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["MetalDensitySNIa"]._convert_function=_convertMetalDensitySNIa
def _convertPotentialNew(data):
return data.convert("Potential")
-ARTFieldInfo["PotentialNew"]._units = r"\rm{g}/\rm{cm}^3"
-ARTFieldInfo["PotentialNew"]._projected_units = r"\rm{g}/\rm{cm}^2"
-ARTFieldInfo["PotentialNew"]._convert_function=_convertPotentialNew
+KnownARTFields["PotentialNew"]._units = r"\rm{g}/\rm{cm}^3"
+KnownARTFields["PotentialNew"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["PotentialNew"]._convert_function=_convertPotentialNew
def _convertPotentialOld(data):
return data.convert("Potential")
-ARTFieldInfo["PotentialOld"]._units = r"\rm{g}/\rm{cm}^3"
-ARTFieldInfo["PotentialOld"]._projected_units = r"\rm{g}/\rm{cm}^2"
-ARTFieldInfo["PotentialOld"]._convert_function=_convertPotentialOld
+KnownARTFields["PotentialOld"]._units = r"\rm{g}/\rm{cm}^3"
+KnownARTFields["PotentialOld"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["PotentialOld"]._convert_function=_convertPotentialOld
####### Derived fields
@@ -181,24 +180,24 @@
x /= data.pf.conversion_factors["GasEnergy"]
x *= data.pf.conversion_factors["Temperature"]
return x
-add_field("Temperature", function=_temperature, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Temperature"]._units = r"\mathrm{K}"
-ARTFieldInfo["Temperature"]._projected_units = r"\mathrm{K}"
-ARTFieldInfo["Temperature"]._convert_function=_converttemperature
+add_art_field("Temperature", function=_temperature, units = r"\mathrm{K}",take_log=True)
+KnownARTFields["Temperature"]._units = r"\mathrm{K}"
+KnownARTFields["Temperature"]._projected_units = r"\mathrm{K}"
+KnownARTFields["Temperature"]._convert_function=_converttemperature
def _metallicity_snII(field, data):
tr = data["MetalDensitySNII"] / data["Density"]
return tr
-add_field("Metallicity_SNII", function=_metallicity_snII, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity_SNII"]._units = r""
-ARTFieldInfo["Metallicity_SNII"]._projected_units = r""
+add_art_field("Metallicity_SNII", function=_metallicity_snII, units = r"\mathrm{K}",take_log=True)
+KnownARTFields["Metallicity_SNII"]._units = r""
+KnownARTFields["Metallicity_SNII"]._projected_units = r""
def _metallicity_snIa(field, data):
tr = data["MetalDensitySNIa"] / data["Density"]
return tr
-add_field("Metallicity_SNIa", function=_metallicity_snIa, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity_SNIa"]._units = r""
-ARTFieldInfo["Metallicity_SNIa"]._projected_units = r""
+add_art_field("Metallicity_SNIa", function=_metallicity_snIa, units = r"\mathrm{K}",take_log=True)
+KnownARTFields["Metallicity_SNIa"]._units = r""
+KnownARTFields["Metallicity_SNIa"]._projected_units = r""
def _x_velocity(data):
tr = data["XMomentumDensity"]/data["Density"]
@@ -226,9 +225,9 @@
tr = data["MetalDensitySNIa"]
tr += data["MetalDensitySNII"]
return tr
-add_field("Metal_Density", function=_metal_density, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metal_Density"]._units = r""
-ARTFieldInfo["Metal_Density"]._projected_units = r""
+add_art_field("Metal_Density", function=_metal_density, units = r"\mathrm{K}",take_log=True)
+KnownARTFields["Metal_Density"]._units = r""
+KnownARTFields["Metal_Density"]._projected_units = r""
#Particle fields
diff -r 9ef3fe7a7c53d8b31030cb760caf33dd7fc2a1a8 -r db3f6890e9a256a289dc740002aee72f2dbeb54e yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -568,10 +568,11 @@
def parallel_profile(prefix):
import cProfile
from yt.config import ytcfg
- fn = "%s_%04i.cprof" % (prefix,
+ fn = "%s_%04i_%04i.cprof" % (prefix,
+ ytcfg.getint("yt", "__topcomm_parallel_size"),
ytcfg.getint("yt", "__topcomm_parallel_rank"))
p = cProfile.Profile()
p.enable()
- yield
+ yield fn
p.disable()
p.dump_stats(fn)
diff -r 9ef3fe7a7c53d8b31030cb760caf33dd7fc2a1a8 -r db3f6890e9a256a289dc740002aee72f2dbeb54e yt/startup_tasks.py
--- a/yt/startup_tasks.py
+++ b/yt/startup_tasks.py
@@ -124,6 +124,9 @@
#sys.argv = [a for a in unparsed_args]
if opts.parallel:
parallel_capable = turn_on_parallelism()
+ subparsers = parser.add_subparsers(title="subcommands",
+ dest='subcommands',
+ description="Valid subcommands",)
else:
subparsers = parser.add_subparsers(title="subcommands",
dest='subcommands',
diff -r 9ef3fe7a7c53d8b31030cb760caf33dd7fc2a1a8 -r db3f6890e9a256a289dc740002aee72f2dbeb54e yt/utilities/minimal_representation.py
--- a/yt/utilities/minimal_representation.py
+++ b/yt/utilities/minimal_representation.py
@@ -58,6 +58,7 @@
setattr(self, attr, getattr(obj, attr, None))
if hasattr(obj, "pf"):
self.output_hash = obj.pf._hash()
+ self._pf_mrep = obj.pf._mrep
def __init__(self, obj):
self._update_attrs(obj, self._attr_list)
@@ -93,6 +94,8 @@
api_key = ytcfg.get("yt","hub_api_key")
url = ytcfg.get("yt","hub_url")
metadata, (final_name, chunks) = self._generate_post()
+ if hasattr(self, "_pf_mrep"):
+ self._pf_mrep.upload()
for i in metadata:
if isinstance(metadata[i], na.ndarray):
metadata[i] = metadata[i].tolist()
diff -r 9ef3fe7a7c53d8b31030cb760caf33dd7fc2a1a8 -r db3f6890e9a256a289dc740002aee72f2dbeb54e yt/utilities/parallel_tools/parallel_analysis_interface.py
--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py
@@ -397,6 +397,9 @@
self.communicators.pop()
self._update_parallel_state(self.communicators[-1])
+def _reconstruct_communicator():
+ return communication_system.communicators[-1]
+
class Communicator(object):
comm = None
_grids = None
@@ -411,6 +414,11 @@
functions for analyzing something in parallel.
"""
+ def __reduce__(self):
+ # We don't try to reconstruct any of the properties of the communicator
+ # or the processors. In general, we don't want to.
+ return (_reconstruct_communicator, ())
+
def barrier(self):
if not self._distributed: return
mylog.debug("Opening MPI Barrier on %s", self.comm.rank)
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