[Yt-svn] yt: Adding an "available_analysis_modules" list to yt.mods .

hg at spacepope.org hg at spacepope.org
Wed Sep 8 19:19:21 PDT 2010


hg Repository: yt
details:   yt/rev/eab5391f1f10
changeset: 3394:eab5391f1f10
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Sep 08 19:19:17 2010 -0700
description:
Adding an "available_analysis_modules" list to yt.mods .

diffstat:

 yt/analysis_modules/list_modules.py |  34 ++++++++++++++++++++++++++++++++++
 yt/mods.py                          |   4 ++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diffs (52 lines):

diff -r 74fd1ddb59e9 -r eab5391f1f10 yt/analysis_modules/list_modules.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/analysis_modules/list_modules.py	Wed Sep 08 19:19:17 2010 -0700
@@ -0,0 +1,34 @@
+"""
+A mechanism for listing available analysis modules.
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2007-2009 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 os
+
+def get_available_modules():
+    modpath = os.path.abspath(os.path.dirname(__file__))
+    available_modules = []
+    for d in [os.path.join(modpath, f) for f in os.listdir(modpath)]:
+        if os.path.isdir(d) and os.path.isfile(os.path.join(d, "api.py")):
+            available_modules.append(os.path.basename(d))
+    return available_modules
diff -r 74fd1ddb59e9 -r eab5391f1f10 yt/mods.py
--- a/yt/mods.py	Tue Sep 07 18:53:50 2010 -0400
+++ b/yt/mods.py	Wed Sep 08 19:19:17 2010 -0700
@@ -64,6 +64,10 @@
 from yt.frontends.chombo.api import \
     ChomboStaticOutput, ChomboFieldInfo, add_chombo_field
 
+from yt.analysis_modules.list_modules import \
+    get_available_modules
+available_analysis_modules = get_available_modules()
+
 # Import our analysis modules
 #import yt.analysis_modules.api as analysis
 from yt.analysis_modules.halo_finding.api import \



More information about the yt-svn mailing list