[yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Wed Nov 7 18:20:26 PST 2012
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/changeset/f30c374527b4/
changeset: f30c374527b4
branch: yt
user: brittonsmith
date: 2012-11-08 03:19:56
summary: Adding find_outputs keyword to sim_dir_load.
affected #: 1 file
diff -r 52d3a540a8cf363189cd075d4cae16ab311bcec7 -r f30c374527b4591e233cc10fd3dabb7718fb3ec0 yt/utilities/answer_testing/framework.py
--- a/yt/utilities/answer_testing/framework.py
+++ b/yt/utilities/answer_testing/framework.py
@@ -152,13 +152,15 @@
pf.h
return pf
-def sim_dir_load(sim_fn, path = None, sim_type = "Enzo"):
+def sim_dir_load(sim_fn, path = None, sim_type = "Enzo",
+ find_outputs=False):
if path is None and not os.path.exists(sim_fn):
raise IOError
if os.path.exists(sim_fn) or not path:
path = "."
with temp_cwd(path):
- return simulation(sim_fn, sim_type)
+ return simulation(sim_fn, sim_type,
+ find_outputs=find_outputs)
class AnswerTestingTest(object):
reference_storage = None
https://bitbucket.org/yt_analysis/yt/changeset/92c62c32ab33/
changeset: 92c62c32ab33
branch: yt
user: brittonsmith
date: 2012-11-08 03:20:15
summary: Merged.
affected #: 2 files
diff -r f30c374527b4591e233cc10fd3dabb7718fb3ec0 -r 92c62c32ab3388ef40f7b71e0f936947528755a0 yt/utilities/answer_testing/framework.py
--- a/yt/utilities/answer_testing/framework.py
+++ b/yt/utilities/answer_testing/framework.py
@@ -164,19 +164,26 @@
class AnswerTestingTest(object):
reference_storage = None
+ prefix = ""
def __init__(self, pf_fn):
self.pf = data_dir_load(pf_fn)
def __call__(self):
nv = self.run()
if self.reference_storage is not None:
- dd = self.reference_storage.get(str(self.pf))
+ dd = self.reference_storage.get(self.storage_name)
if dd is None: raise YTNoOldAnswer()
ov = dd[self.description]
self.compare(nv, ov)
else:
ov = None
- self.result_storage[str(self.pf)][self.description] = nv
+ self.result_storage[self.storage_name][self.description] = nv
+
+ @property
+ def storage_name(self):
+ if self.prefix != "":
+ return "%s_%s" % (self.prefix, self.pf)
+ return str(self.pf)
def compare(self, new_result, old_result):
raise RuntimeError
@@ -385,11 +392,17 @@
for newc, oldc in zip(new_result["children"], old_result["children"]):
assert(newp == oldp)
-def requires_outputlog(path = "."):
+def requires_outputlog(path = ".", prefix = ""):
def ffalse(func):
return lambda: None
def ftrue(func):
- return func
+ @wraps(func)
+ def fyielder(*args, **kwargs):
+ for t in func(*args, **kwargs):
+ if isinstance(t, AnswerTestingTest):
+ t.prefix = prefix
+ yield t
+ return fyielder
if os.path.exists("OutputLog"):
return ftrue
with temp_cwd(path):
diff -r f30c374527b4591e233cc10fd3dabb7718fb3ec0 -r 92c62c32ab3388ef40f7b71e0f936947528755a0 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -809,6 +809,7 @@
def __call__(self, plot):
from matplotlib.patches import Circle
+ num = len(self.hop_output[:self.max_number])
for halo in self.hop_output[:self.max_number]:
size = halo.get_size()
if size < self.min_size or size > self.max_size: continue
@@ -825,18 +826,19 @@
(xi, yi) = (x_dict[plot.data.axis], y_dict[plot.data.axis])
(center_x,center_y) = self.convert_to_plot(plot,(center[xi], center[yi]))
- cir = Circle((center_x, center_y), radius, fill=False)
+ color = np.ones(3) * (0.4 * (num - halo.id)/ num) + 0.6
+ cir = Circle((center_x, center_y), radius, fill=False, color=color)
plot._axes.add_patch(cir)
if self.annotate:
if self.print_halo_size:
- plot._axes.text(center_x, center_y, "%s" % size,
- fontsize=self.font_size)
+ plot._axes.text(center_x+radius, center_y+radius, "%s" % size,
+ fontsize=self.font_size, color=color)
elif self.print_halo_mass:
- plot._axes.text(center_x, center_y, "%s" % halo.total_mass(),
- fontsize=self.font_size)
+ plot._axes.text(center_x+radius, center_y+radius, "%s" % halo.total_mass(),
+ fontsize=self.font_size, color=color)
else:
- plot._axes.text(center_x, center_y, "%s" % halo.id,
- fontsize=self.font_size)
+ plot._axes.text(center_x+radius, center_y+radius, "%s" % halo.id,
+ fontsize=self.font_size, color=color)
class HopParticleCallback(PlotCallback):
_type_name = "hop_particles"
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