[Yt-svn] yt: Changed how_to_develop, added a small new callback to the im...
hg at spacepope.org
hg at spacepope.org
Wed Sep 1 07:24:39 PDT 2010
hg Repository: yt
details: yt/rev/7d3965489006
changeset: 3361:7d3965489006
user: Matthew Turk <matthewturk at gmail.com>
date:
Wed Sep 01 07:24:25 2010 -0700
description:
Changed how_to_develop, added a small new callback to the image panner, removed
old files
diffstat:
doc/REORG_NOTES | 7 --
doc/REORG_NOTES~ | 1 -
doc/how_to_develop_yt.txt | 2 +-
make_apipy.py | 42 --------------
make_setuppy.py | 25 --------
yt/__init__.py | 75 +++++++++++++------------
yt/visualization/image_panner/vm_panner.py | 26 ++++++++
7 files changed, 66 insertions(+), 112 deletions(-)
diffs (239 lines):
diff -r 8ef67bebbef5 -r 7d3965489006 doc/REORG_NOTES
--- a/doc/REORG_NOTES Mon Aug 30 22:44:08 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-* creating yt/frontends for the front end to each code
- - created a uniform set of files for each:
- data_structures.py
- definitions.py
- fields.py
- io.py
- misc.py
\ No newline at end of file
diff -r 8ef67bebbef5 -r 7d3965489006 doc/REORG_NOTES~
--- a/doc/REORG_NOTES~ Mon Aug 30 22:44:08 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-* as part of new
\ No newline at end of file
diff -r 8ef67bebbef5 -r 7d3965489006 doc/how_to_develop_yt.txt
--- a/doc/how_to_develop_yt.txt Mon Aug 30 22:44:08 2010 -0700
+++ b/doc/how_to_develop_yt.txt Wed Sep 01 07:24:25 2010 -0700
@@ -53,7 +53,7 @@
yt is organized into several sub-packages, each of which governs a different
conceptual regime.
- frontends
+ frontends
This is where interfaces to codes are created. Within each subdirectory of
yt/frontends/ there must exist the following files, even if empty:
diff -r 8ef67bebbef5 -r 7d3965489006 make_apipy.py
--- a/make_apipy.py Mon Aug 30 22:44:08 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-ss = """\"\"\"
-API for %s
-
-Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: UCSD
-Author: J.S. Oishi <jsoishi at gmail.com>
-Affiliation: KIPAC/SLAC/Stanford
-Author: Britton Smith <brittonsmith at gmail.com>
-Affiliation: MSU
-Homepage: http://yt.enzotools.org/
-License:
- Copyright (C) 2010 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 sys, os
-n = sys.argv[-1]
-
-fn = os.path.join(os.path.abspath(n), "api.py")
-#if os.path.exists(fn):
- #print "%s exists! Not overwriting." % fn
-bn = n.replace("/",".")
-
-print "%s -> %s" % (bn, fn)
-
-open(fn, "w").write(ss % (bn))
diff -r 8ef67bebbef5 -r 7d3965489006 make_setuppy.py
--- a/make_setuppy.py Mon Aug 30 22:44:08 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-ss = r"""#!/usr/bin/env python
-import setuptools
-import os, sys, os.path
-
-import os.path
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('%s',parent_package,top_path)
- config.make_config_py() # installs __config__.py
- config.make_svn_version_py()
- return config
-"""
-
-import sys, os
-n = sys.argv[-1]
-
-fn = os.path.join(os.path.abspath(n), "setup.py")
-if os.path.exists(fn):
- print "%s exists! Not overwriting." % fn
-bn = os.path.basename(n)
-
-print "%s -> %s" % (bn, fn)
-
-open(fn, "w").write(ss % bn)
diff -r 8ef67bebbef5 -r 7d3965489006 yt/__init__.py
--- a/yt/__init__.py Mon Aug 30 22:44:08 2010 -0700
+++ b/yt/__init__.py Wed Sep 01 07:24:25 2010 -0700
@@ -7,55 +7,58 @@
An ever-growing collection of documentation is also available at
http://yt.enzotools.org/doc/ . Additionally, there is a
-project site at http://yt.enzotools.org/ with recipes, a wiki, a subversion
-changelog and a bug-reporting system.
+project site at http://yt.enzotools.org/ with recipes, a wiki, a variety of
+ways of peering into the version control, and a bug-reporting system.
-YT is divided into several packages, all named after characters from Snow
-Crash.
+YT is divided into several packages.
-Lagos
-=====
+frontends
+---------
-Lagos deals with data structures. It defines things like EnzoGrid, EnzoData,
-Enzo2DData, EnzoSphere, etc. If you want to handle actual data, use Lagos.
+This is where interfaces to codes are created. Within each subdirectory of
+yt/frontends/ there must exist the following files, even if empty:
-Raven
-=====
+* data_structures.py, where subclasses of AMRGridPatch, StaticOutput and
+ AMRHierarchy are defined.
+* io.py, where a subclass of IOHandler is defined.
+* misc.py, where any miscellaneous functions or classes are defined.
+* definitions.py, where any definitions specific to the frontend are
+ defined. (i.e., header formats, etc.)
-Raven is the plotting interface. All data plotting goes through
-Raven.
+visualization
+-------------
-Enki
-====
+This is where all visualization modules are stored. This includes plot
+collections, the volume rendering interface, and pixelization frontends.
-Enki is the package used to create data, and instantiate runs. It supports
-creating Enzo Problems, and then using SWIG-interfaced Enzo calls to
-actually create the data for those problems. Additionally, facilities are
-being developed to use Enki to directly execute runs.
+data_objects
+------------
-Right now, Enki is still largely experimental. It provides some primitive
-methods for interacting with Enzo, but more work needs to be done before
-it reaches its vision.
+All objects that handle data, processed or unprocessed, not explicitly
+defined as visualization are located in here. This includes the base
+classes for data regions, covering grids, time series, and so on. This
+also includes derived fields and derived quantities.
-Fido
-====
+analysis_modules
+----------------
-Fido is the messenger/protector of data. It takes data outputs, puts them
-wherever you want, and then calls a function handler to deal with that data.
-Ultimately Fido will deal with all file-handling; submission of runs to a
-central (user-specific) database is in the works, and Fido will be the
-entity that moves the files in and out of storage.
+This is where all mechanisms for processing data live. This includes
+things like clump finding, halo profiling, halo finding, and so on. This
+is something of a catchall, but it serves as a level of greater
+abstraction that simply data selection and modification.
-Deliverator
-===========
+gui
+---
-The Deliverator is a TurboGears-based system for querying and displaying
-images. Images are dumped from Raven into local, web-accessible storage
-space, and then metadata about those images is submitted to The Deliverator.
-The user (you) then goes to the Deliverator website and views those plots.
+This is where all GUI components go. Typically this will be some small
+tool used for one or two things, which contains a launching mechanism on
+the command line.
-The base package YT provides facilities for configuration files and logging (via
-the Python logger.)
+utilities
+---------
+
+All broadly useful code that doesn't clearly fit in one of the other
+categories goes here.
Author: Matthew Turk <matthewturk at gmail.com>
Affiliation: KIPAC/SLAC/Stanford
diff -r 8ef67bebbef5 -r 7d3965489006 yt/visualization/image_panner/vm_panner.py
--- a/yt/visualization/image_panner/vm_panner.py Mon Aug 30 22:44:08 2010 -0700
+++ b/yt/visualization/image_panner/vm_panner.py Wed Sep 01 07:24:25 2010 -0700
@@ -456,6 +456,32 @@
self.pylab.imshow(na.log10(val), interpolation='nearest')
self.pylab.savefig("wimage_%03i.png" % self.tile_id)
+class TransportAppender(object):
+ def __init__(self, transport):
+ """
+ This is a simple callback that appends the latest buffer to the
+ supplied *transport* object.
+ """
+ self.transport = transport
+
+ def __call__(self, val):
+ from yt.utilities.amr_utils import write_png_to_file
+ from yt.visualization.image_writer import map_to_colors
+ image = na.log10(val)
+ mi = na.nanmin(image[~na.isinf(image)])
+ ma = na.nanmax(image[~na.isinf(image)])
+ color_bounds = mi, ma
+ image = (image - color_bounds[0])/(color_bounds[1] - color_bounds[0])
+ to_plot = map_to_colors(image, "algae")
+ to_plot = na.clip(to_plot, 0, 255)
+ tf = tempfile.TemporaryFile()
+ write_png_to_file(to_plot, tf)
+ tf.seek(0)
+ s = tf.read()
+ response_body = "data:image/png;base64," + base64.encodestring(s)
+ tf.close()
+ self.transport.append(response_body)
+
class PanningCeleritasStreamer(object):
_initialized = False
def __init__(self, tile_id, cmap = "algae", port = 9988,
More information about the yt-svn
mailing list