[Yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Wed Apr 13 08:22:10 PDT 2011
2 new changesets in yt:
http://bitbucket.org/yt_analysis/yt/changeset/03561f6f1cde/
changeset: r4118:03561f6f1cde
branch: yt
user: MatthewTurk
date: 2011-04-13 16:46:38
summary: Adding some default tests and updating license info for the files I remember
writing
affected #: 5 files (5.0 KB)
--- a/yt/utilities/answer_testing/api.py Wed Apr 13 09:44:53 2011 -0400
+++ b/yt/utilities/answer_testing/api.py Wed Apr 13 10:46:38 2011 -0400
@@ -37,3 +37,6 @@
from .output_tests import \
YTStaticOutputTest, \
create_test
+
+from .default_tests import \
+ TestFieldStatistics
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/utilities/answer_testing/default_tests.py Wed Apr 13 10:46:38 2011 -0400
@@ -0,0 +1,73 @@
+"""
+Default tests
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
+
+ This file is part of yt.
+
+ yt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+from yt.mods import *
+from output_tests import YTStaticOutputTest, create_test
+
+class TestFieldStatistics(YTStaticOutputTest):
+
+ tolerance = None
+
+ def run(self):
+ # We're going to calculate the field statistics for every single field.
+ results = {}
+ for field in self.pf.h.field_list:
+ # Do it here so that it gets wiped each iteration
+ dd = self.pf.h.all_data()
+ results[field] = (dd[field].std(),
+ dd[field].mean(),
+ dd[field].min(),
+ dd[field].max())
+ self.result = results
+
+ def compare(self, old_result):
+ proj, pixelized_proj = self.result
+ oproj, opixelized_proj = old_result
+ for field in sorted(self.result):
+ for i in range(4):
+ oi = old_result[field][i]
+ ni = self.result[field][i]
+ self.compare_value_delta(oi, ni, self.tolerance)
+
+class TestAllProjections(YTStaticOutputTest):
+
+ tolerance = None
+
+ def run(self):
+ results = {}
+ for field in self.pf.h.field_list:
+ results[field] = []
+ for ax in range(3):
+ results[field].append(self.pf.h.proj(ax, self.field))
+ self.result = results
+
+ def compare(self, old_result):
+ for field in sorted(self.result):
+ for p1, p2 in zip(self.result[field], old_result[field]):
+ self.compare_data_arrays(p1, p2, self.tolerance)
+ self.compare_array_delta(
+ pixelized_proj[self.field],
+ opixelized_proj[self.field],
+ 1e-7)
--- a/yt/utilities/answer_testing/hydro_tests.py Wed Apr 13 09:44:53 2011 -0400
+++ b/yt/utilities/answer_testing/hydro_tests.py Wed Apr 13 10:46:38 2011 -0400
@@ -1,3 +1,28 @@
+"""
+Hydro tests
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
+
+ This file is part of yt.
+
+ yt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
import matplotlib; matplotlib.use("Agg")
import pylab
from yt.mods import *
--- a/yt/utilities/answer_testing/output_tests.py Wed Apr 13 09:44:53 2011 -0400
+++ b/yt/utilities/answer_testing/output_tests.py Wed Apr 13 10:46:38 2011 -0400
@@ -1,3 +1,28 @@
+"""
+Base classes for answer testing
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
+
+ This file is part of yt.
+
+ yt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
from yt.mods import *
# We first create our dictionary of tests to run. This starts out empty, and
--- a/yt/utilities/answer_testing/runner.py Wed Apr 13 09:44:53 2011 -0400
+++ b/yt/utilities/answer_testing/runner.py Wed Apr 13 10:46:38 2011 -0400
@@ -1,3 +1,28 @@
+"""
+Runner mechanism for answer testing
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
+
+ This file is part of yt.
+
+ yt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
import matplotlib; matplotlib.use("Agg")
import os, shelve, cPickle, sys, imp, tempfile
http://bitbucket.org/yt_analysis/yt/changeset/6275e311eed9/
changeset: r4119:6275e311eed9
branch: yt
user: MatthewTurk
date: 2011-04-13 17:21:49
summary: Fixing default tests and adding to the API
affected #: 2 files (224 bytes)
--- a/yt/utilities/answer_testing/api.py Wed Apr 13 10:46:38 2011 -0400
+++ b/yt/utilities/answer_testing/api.py Wed Apr 13 11:21:49 2011 -0400
@@ -39,4 +39,5 @@
create_test
from .default_tests import \
- TestFieldStatistics
+ TestFieldStatistics, \
+ TestAllProjections
--- a/yt/utilities/answer_testing/default_tests.py Wed Apr 13 10:46:38 2011 -0400
+++ b/yt/utilities/answer_testing/default_tests.py Wed Apr 13 11:21:49 2011 -0400
@@ -43,8 +43,6 @@
self.result = results
def compare(self, old_result):
- proj, pixelized_proj = self.result
- oproj, opixelized_proj = old_result
for field in sorted(self.result):
for i in range(4):
oi = old_result[field][i]
@@ -60,14 +58,11 @@
for field in self.pf.h.field_list:
results[field] = []
for ax in range(3):
- results[field].append(self.pf.h.proj(ax, self.field))
+ t = self.pf.h.proj(ax, field)
+ results[field].append(t.data)
self.result = results
def compare(self, old_result):
for field in sorted(self.result):
for p1, p2 in zip(self.result[field], old_result[field]):
self.compare_data_arrays(p1, p2, self.tolerance)
- self.compare_array_delta(
- pixelized_proj[self.field],
- opixelized_proj[self.field],
- 1e-7)
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