Index: sansmodels/setup.py
===================================================================
--- sansmodels/setup.py	(revision d7a2531de6ad5146245f8b11756128ac5a87c09b)
+++ sansmodels/setup.py	(revision 0abf7bf37070c95d946c2656a2e3ef5d902d0027)
@@ -1,71 +1,11 @@
 """
  Installation script for SANS models
-
-  - To compile and install:
-      python setup.py install
-  - To create distribution:
-      python setup.py bdist_wininst
-  - To create odb files:
-      python setup.py odb
-
 """
 
 import sys
 import os
-
-    
 from numpy.distutils.misc_util import get_numpy_include_dirs
 numpy_incl_path = os.path.join(get_numpy_include_dirs()[0], "numpy")
-
-def createODBcontent(class_name):
-    """
-        Return the content of the Pyre odb file for a given class
-        @param class_name: Name of the class to write an odb file for [string]
-        @return: content of the file [string]
-    """
-    content  = "\"\"\"\n"
-    content += "  Facility for SANS model\n\n"
-    content += "  WARNING: THIS FILE WAS AUTOGENERATED AT INSTALL TIME\n"
-    content += "           DO NOT MODIFY\n\n"
-    content += "  This code was written as part of the DANSE project\n"
-    content += "  http://danse.us/trac/sans/\n"
-    content += "  @copyright 2007:"
-    content += "  SANS/DANSE Group (University of Tennessee), for the DANSE project\n\n"
-    content += "\"\"\"\n"
-    content += "def model():\n"
-    content += "    from ScatteringIntensityFactory import ScatteringIntensityFactory\n"
-    content += "    from sans.models.%s import %s\n" % (class_name, class_name)
-    content += "    return ScatteringIntensityFactory(%s)('%s')\n"\
-                 % (class_name, class_name)
-
-    return content
-
-def createODBfiles():
-    """
-       Create odb files for all available models
-    """
-    from sans.models.ModelFactory import ModelFactory
-    
-    class_list = ModelFactory().getAllModels()
-    for name in class_list:
-        odb = open("src/sans/models/pyre/%s.odb" % name, 'w')
-        odb.write(createODBcontent(name))
-        odb.close()
-        print "src/sans/models/pyre/%s.odb created" % name
-        
-#
-# Proceed with installation
-#
-
-# First, create the odb files
-if len(sys.argv) > 1 and sys.argv[1].lower() == 'odb':
-    print "Creating odb files"
-    try:
-        createODBfiles()
-    except:    
-        print "ERROR: could not create odb files"
-        print sys.exc_value
-    sys.exit()
-
+   
 # Then build and install the modules
 from distutils.core import Extension, setup
@@ -139,5 +79,5 @@
     package_data={'sans.models': [os.path.join('media', "*")]},
     packages = ["sans","sans.models",
-                "sans.models.sans_extension","sans.models.pyre",],
+                "sans.models.sans_extension",],
     
     ext_modules = [ Extension("sans.models.sans_extension.c_models",
Index: sansmodels/src/sans/models/DisperseModel.py
===================================================================
--- sansmodels/src/sans/models/DisperseModel.py	(revision 79ac6f8cbc71c9a7e133d2e2e0ef6f2ffe0427eb)
+++ sansmodels/src/sans/models/DisperseModel.py	(revision 0abf7bf37070c95d946c2656a2e3ef5d902d0027)
@@ -24,5 +24,5 @@
 	Example: ::
 	
-		cyl = ModelFactory().getModel("CylinderModel")
+		cyl = CylinderModel()
 		disp = DisperseModel(cyl, ['cyl_phi'], [0.3])
 		disp.run([0.01, 1.57])
Index: nsmodels/src/sans/models/ModelFactory.py
===================================================================
--- sansmodels/src/sans/models/ModelFactory.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,69 +1,0 @@
-#!/usr/bin/env python
-""" Model factory
-    Class that creates models by looking up the name of a model
-    in the models directory
-
-    @author: Mathieu Doucet / UTK
-    @contact: mathieu.doucet@nist.gov
-"""
-
-import os
-import imp
-
-# info
-__author__ = "Mathieu Doucet"   
-
-class ModelFactory: #pylint: disable-msg=W0232
-    """ Class to create available models """
-
-    def getModel(self, name="BaseComponent"): #pylint: disable-msg=R0201
-        """ Returns the model if found 
-            @param name: name of the model to look for
-            @return: the model object
-        """
-         
-        # Look up the files in the model directory
-         
-        # Find correct directory first...
-        path = os.path.dirname(__file__)
-        if(os.path.isfile("%s/%s.py" % (path, name))):
-            fObj, path, descr = imp.find_module(name, [path])
-            modObj = imp.load_module(name, fObj, path, descr)
-            if hasattr(modObj, name):
-                return getattr(modObj, name)()
-        else:
-            raise ValueError, "Could not find module file"
-            
-        raise ValueError, "Could not find module %s" % name
-      
-    def getAllModels(self): #pylint: disable-msg=R0201
-        """ Returns a list of all available models 
-            @return: python list object
-        """
-        
-        # from AbstractModel import AbstractModel
-        # Find correct directory first...
-        path = os.path.dirname(__file__)
-        filelist = os.listdir(path)
-        internal_components = ["BaseComponent", "AddComponent",
-                "SubComponent", "DivComponent", "MulComponent",
-                "DisperseModel", "ModelFactory", "ModelIO"]
-    
-        funclist = []
-        for filename in filelist:
-            toks = filename.split('.')
-            # Look for exceptions... 
-            # TODO: These should be in another directory
-            if len(toks)==2 and toks[0].count('__')==0 and toks[1]=='py' \
-                and not toks[0] in internal_components:
-                funclist.append(toks[0])
-     
-        return funclist
-             
-# main
-if __name__ == '__main__':
-    print ModelFactory().getAllModels()
-    app = ModelFactory().getModel('CylinderModel')
-    print "%s: f(45) = %g" % (app.name, app.run(1))
-         
-# End of file
Index: nsmodels/src/sans/models/ModelIO.py
===================================================================
--- sansmodels/src/sans/models/ModelIO.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,187 +1,0 @@
-#!/usr/bin/env python
-""" Model IO
-    Class that saves and loads composite models from files
-    The parameters of the models are not set. The loaded
-    model object will have the default parameters for all
-    sub-models.
-
-    @author: Mathieu Doucet / UTK
-    @contact: mathieu.doucet@nist.gov
-"""
-
-import sys
-
-class ModelIO:
-    """ Class to create composite models from file or save a model """
-    
-    def __init__(self, factory):
-        """ Initizalization 
-            @param factory: ModelFactory object
-        """
-        
-        ## Factory used to create the right type of component
-        self.factory = factory
-    
-    def modelToXML(self, model):
-        """ Saves XML representation of the component
-            @param model: model to save
-            @param file: name of file to write to (if None, a string is returned)
-        """
-
-        try:
-            # Type
-            
-            repr = "<Component class='%s' name='%s'>\n" \
-                % (model.__class__.__name__, model.name)
-            
-            # Parameters 
-            
-            #for p in model.params:
-            #    repr += "  <Param name='%s'>\n" % p
-            #    par_type = ''
-            #    try:
-            #        type_tok = str(type(model.params[p])).split("\'")
-            #        if len(type_tok)>2:
-            #            par_type = type_tok[1]
-            #    except:
-            #        print sys.exc_value
-            #    repr += "    <Type>%s</Type>\n" % par_type
-            #    repr += "    <Value>%s</Value>\n" % model.params[p]
-            #    repr += "  </Param>"
-        
-            # Operation parameters
-            if model.__class__.__name__ in ['AddComponent', 'SubComponent', 
-                                            'MulComponent', 'DivComponent']:
-                repr += "  <operateOn>\n"
-                repr += "    %s" % self.modelToXML(model.operateOn)
-                repr += "  </operateOn>\n"
-                
-            if model.__class__.__name__ == "AddComponent":
-                repr += "  <toAdd>\n"
-                repr += "    %s" % self.modelToXML(model.other)
-                repr += "  </toAdd>\n"
-                
-            if model.__class__.__name__ == "SubComponent":
-                repr += "  <toSub>\n"
-                repr += "    %s" % self.modelToXML(model.other)
-                repr += "  </toSub>\n"
-                    
-            if model.__class__.__name__ == "MulComponent":
-                repr += "  <toMul>\n"
-                repr += "    %s" % self.modelToXML(model.other)
-                repr += "  </toMul>\n"
-                
-            if model.__class__.__name__ == "DivComponent":
-                repr += "  <toDiv>\n"
-                repr += "    %s" % self.modelToXML(model.other)
-                repr += "  </toDiv>\n"
-                
-            repr += "</Component>\n"
-        except:
-            text_out = "ModelIO.save: Error occured while reading info\n  %s" \
-                % sys.exc_value
-            raise ValueError, text_out
-        
-        # Return the XML representation of the model
-        return repr
-        
-    def save(self, model, filename):
-        """ Save the XML representation of a model to a file
-            @param model: XML representation of the model
-            @param filename: the path of the file to write to
-            @return: True if everything went well
-        """
-        file_obj = open(filename,'w')
-        file_obj.write(self.modelToXML(model))
-        file_obj.close()
-        return True
-    
-    def load(self, filename):
-        """ Load a model from a file
-            @param file: file to load
-            @return: a new BaseComponent
-        """
-        # Recurse through XML tree
-        from xml.dom.minidom import parse
-        dom = parse(filename)
-        
-        # Look for Component nodes
-        return self.lookupComponentNodes(dom)
-        
-             
-    def lookupComponentNodes(self, node):  
-        """ Look up a component node among the children of a node 
-            @param node: the minidom node to investigate
-            @return: the model object described by the component node, None otherwise
-        """
-        # Look for Component nodes
-        if node.hasChildNodes():
-            for n in node.childNodes:
-                if n.nodeName == "Component":
-                    name = None
-                    type = None
-                    if n.hasAttributes():
-                        # Get the class name & name attribute of the object
-                        for i in range(len(n.attributes)):
-                            attr_name = n.attributes.item(i).name
-                            if attr_name == "class":
-                                type = n.attributes.item(i).nodeValue
-                            elif attr_name == "name":
-                                name = n.attributes.item(i).nodeValue
-                            
-                    # Check that all the information is there
-                    if name == None or type == None:
-                        raise ValueError, \
-                        "Incomplete model description: missing name or class"
-                    else:
-                        # Create an object of the type found
-                        model_object = self.factory.getModel(type)
-                    
-                        # Process other nodes that might be attached 
-                        # to this model
-                        self.processComponentNode(n, model_object)
-                        
-                        # Return the object instantiated from the 
-                        # first node found
-                        return model_object
-                    
-        return None
-                    
-        
-    def processComponentNode(self, node, model):
-        """ Process an XML 'Component' node in a model file 
-            @param node: XML minidom node to process
-            @param model: model object to build from
-        """
-        if node.hasChildNodes():
-            for n in node.childNodes:
-                if n.nodeName == "operateOn":
-                    model.operateOn = self.lookupComponentNodes(n)
-                elif n.nodeName == "toAdd":
-                    model.other = self.lookupComponentNodes(n)
-                elif n.nodeName == "toSub":
-                    model.other = self.lookupComponentNodes(n)
-                elif n.nodeName == "toMul":
-                    model.other = self.lookupComponentNodes(n)
-                elif n.nodeName == "toDiv":
-                    model.other = self.lookupComponentNodes(n)       
-
-# main
-if __name__ == '__main__':
-    from ModelFactory import ModelFactory
-    fac = ModelFactory()
-    cyl = fac.getModel('CylinderModel')
-    sph = fac.getModel('SphereModel')
-    c = cyl+sph
-    io = ModelIO(fac)
-    io.save(c,"myModel.xml")
-    value = c.run(1)
-    print "%s: f(1) = %g" % (c.name, value)
-    loaded = io.load("myModel.xml")
-    #print io.modelToXML(loaded)    
-    value2 = loaded.run(1)
-    print "%s: f(1) = %g" % (c.name, value2)
-    if not value == value2:
-        print "AN ERROR OCCURED"
-      
-# End of file
Index: sansmodels/src/sans/models/__init__.py
===================================================================
--- sansmodels/src/sans/models/__init__.py	(revision b1a65b6788e5dcedef0d7f97d630a2072912475d)
+++ sansmodels/src/sans/models/__init__.py	(revision 0abf7bf37070c95d946c2656a2e3ef5d902d0027)
@@ -48,6 +48,6 @@
 # To create a model:
 # \verbatim
-#from sans.models.ModelFactory import ModelFactory
-#    cyl = ModelFactory().getModel('CylinderModel')
+#from sans.models.CylinderModel import CylinderModel
+#    cyl = CylinderModel()
 # \endverbatim
 #
Index: nsmodels/src/sans/models/pyre/CoreShellCylinderModel.odb
===================================================================
--- sansmodels/src/sans/models/pyre/CoreShellCylinderModel.odb	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,15 +1,0 @@
-"""
-  Facility for SANS model
-
-  WARNING: THIS FILE WAS AUTOGENERATED AT INSTALL TIME
-           DO NOT MODIFY
-
-  This code was written as part of the DANSE project
-  http://danse.us/trac/sans/
-  @copyright 2007:  Mathieu Doucet (University of Tennessee), for the DANSE project
-
-"""
-def model():
-    from ScatteringIntensityFactory import ScatteringIntensityFactory
-    from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
-    return ScatteringIntensityFactory(CoreShellCylinderModel)('CoreShellCylinderModel')
Index: nsmodels/src/sans/models/pyre/CoreShellModel.odb
===================================================================
--- sansmodels/src/sans/models/pyre/CoreShellModel.odb	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,15 +1,0 @@
-"""
-  Facility for SANS model
-
-  WARNING: THIS FILE WAS AUTOGENERATED AT INSTALL TIME
-           DO NOT MODIFY
-
-  This code was written as part of the DANSE project
-  http://danse.us/trac/sans/
-  @copyright 2007:  Mathieu Doucet (University of Tennessee), for the DANSE project
-
-"""
-def model():
-    from ScatteringIntensityFactory import ScatteringIntensityFactory
-    from sans.models.CoreShellModel import CoreShellModel
-    return ScatteringIntensityFactory(CoreShellModel)('CoreShellModel')
Index: nsmodels/src/sans/models/pyre/CylinderModel.odb
===================================================================
--- sansmodels/src/sans/models/pyre/CylinderModel.odb	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,15 +1,0 @@
-"""
-  Facility for SANS model
-
-  WARNING: THIS FILE WAS AUTOGENERATED AT INSTALL TIME
-           DO NOT MODIFY
-
-  This code was written as part of the DANSE project
-  http://danse.us/trac/sans/
-  @copyright 2007:  Mathieu Doucet (University of Tennessee), for the DANSE project
-
-"""
-def model():
-    from ScatteringIntensityFactory import ScatteringIntensityFactory
-    from sans.models.CylinderModel import CylinderModel
-    return ScatteringIntensityFactory(CylinderModel)('CylinderModel')
Index: nsmodels/src/sans/models/pyre/EllipsoidModel.odb
===================================================================
--- sansmodels/src/sans/models/pyre/EllipsoidModel.odb	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,15 +1,0 @@
-"""
-  Facility for SANS model
-
-  WARNING: THIS FILE WAS AUTOGENERATED AT INSTALL TIME
-           DO NOT MODIFY
-
-  This code was written as part of the DANSE project
-  http://danse.us/trac/sans/
-  @copyright 2007:  Mathieu Doucet (University of Tennessee), for the DANSE project
-
-"""
-def model():
-    from ScatteringIntensityFactory import ScatteringIntensityFactory
-    from sans.models.EllipsoidModel import EllipsoidModel
-    return ScatteringIntensityFactory(EllipsoidModel)('EllipsoidModel')
Index: nsmodels/src/sans/models/pyre/ScatteringIntensityFactory.py
===================================================================
--- sansmodels/src/sans/models/pyre/ScatteringIntensityFactory.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,123 +1,0 @@
-#!/usr/bin/env python
-""" Pyre Component Model factory
-    Factory class that creates pyre component models
-
-    @copyright: Mathieu Doucet (University of Tennessee), for the DANSE project
-"""
-#pylint: disable-msg=R0904
-#pylint: disable-msg=R0912
-#pylint: disable-msg=R0201
-#pylint: disable-msg=W0142
-
-from pyre.components.Component import Component
-
-def ScatteringIntensityFactory( ModelClass ):
-    """ Returns the model if found 
-        @param name: class of the model [class]
-        @return: the pyre component class [class]
-    """
-
-    ## Model object to inspect to write the adapter
-    model = ModelClass()
-     
-    class ScatteringModel(Component):
-        """
-            Pyre component adapter class for the specified model
-        """
-        has_changed = False
-
-        class Inventory(Component.Inventory):
-            """
-                Inventory class for the model adapter
-            """
-            import pyre.inventory as pyre_inventory
-            
-            # Create the inventory items from the parameters 
-            # of the model
-            for name in model.params:
-                line = '%s=pyre_inventory.float( name, default = %g )' \
-                    % (name, model.params[name])
-                exec line in locals()
-                continue
-        
-        def __init__(self, name, facility="sans"):
-            """ Initialize the component
-                @param name: name of the component object
-                @param facility: name of the facility for the object
-            """
-            Component.__init__(self, name, facility)
-            
-            ## Model to be manipulated through the adapter
-            self._engine = ModelClass()
-            return
-
-                    
-        def __call__(self, *args, **kwds):  
-            """ 
-                Evaluate the model
-            """
-            return self._engine.run(args[0])
-            
-        def _configure(self):
-            """
-                Configure the component
-            """
-            Component._configure(self)
-            
-            # Add the inventory items to the list of attributes
-            for name in model.params: 
-                line = "self.%s = self.inventory.%s" % (name, name)
-                exec line in locals()
-                continue
-            return
-                    
-            
-        def _init(self):
-            """ 
-                Initialization of the underlying model 
-            """
-            Component._init(self)
-            
-            # Set the parameters of the underlying model
-            for name in model.params: 
-                if hasattr(self, name):
-                    self.set(name, getattr(self, name))
-                else:
-                    raise ValueError, "%s not an attribute" % name
-            
-            return
-            
-        def set(self, key, value):
-            """ 
-                Set a parameter of the underlying model 
-            """
-            
-            # Check that the parameter to set is available
-            if key not in model.params: 
-                raise ValueError, "Model doesn't have param %s" % key
-            
-            # Make use of  pyre's validator to check the inputs
-            cmd = "self.inventory.%s = value" % key
-            exec cmd in locals()
-            
-            # Pass the parameter to the underlying model
-            self._engine.setParam(key, value)
-            self.has_changed = True
-            
-        def __setattr__(self, key, value):
-            self.__dict__["has_changed"] = True
-            return Component.__setattr__(self, key, value)
-        
-        def changed(self):
-            tmp = self.has_changed
-            self.has_changed = False    
-            return tmp
-        
-        def xaxis(self): 
-            return "time", "t", "s"
-        def yaxis(self): 
-            return "amplitude", "A", ""
-            
-            
-            
-    return ScatteringModel
Index: nsmodels/src/sans/models/pyre/SphereModel.odb
===================================================================
--- sansmodels/src/sans/models/pyre/SphereModel.odb	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,15 +1,0 @@
-"""
-  Facility for SANS model
-
-  WARNING: THIS FILE WAS AUTOGENERATED AT INSTALL TIME
-           DO NOT MODIFY
-
-  This code was written as part of the DANSE project
-  http://danse.us/trac/sans/
-  @copyright 2007:  Mathieu Doucet (University of Tennessee), for the DANSE project
-
-"""
-def model():
-    from ScatteringIntensityFactory import ScatteringIntensityFactory
-    from sans.models.SphereModel import SphereModel
-    return ScatteringIntensityFactory(SphereModel)('SphereModel')
Index: nsmodels/src/sans/models/pyre/cylinder.odb
===================================================================
--- sansmodels/src/sans/models/pyre/cylinder.odb	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,8 +1,0 @@
-
-
-def model():
-    from ScatteringIntensityFactory import ScatteringIntensityFactory
-    from sans.models.CylinderModel import CylinderModel
-    
-    # Invoke ModelFactory to get a model object
-    return ScatteringIntensityFactory( CylinderModel )('cylinder')
Index: nsmodels/src/sans/models/pyre/pyre_plottable.py
===================================================================
--- sansmodels/src/sans/models/pyre/pyre_plottable.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,164 +1,0 @@
-"""
-plottables.pyre is a module for registering pyre objects as plottables.
-
-Uses plottables from the reflectivity repository
-Plottables require Python 2.5
-
-"""
-from plottables import Plottable
-
-def label(model, collection):
-    """Build a label mostly unique within a collection"""
-    # Find all items in the collection of the same type
-    conflicts = []
-        
-    model_object = model.component
-    
-    for item in collection:
-        if item.component.name == model_object.name:
-            conflicts.append(item.component)
-        
-    # If no conflict, return name
-    if len(conflicts) == 0:
-        return model_object.name
-        
-    # Fill out the usual detail from the inventory
-    detail = {}
-    #for item in model_object.properties():
-    #    if not item.name.startswith("help"):
-    #        detail[item.name] = item.name
-            
-    # Check which fields differ (only to the first level!)
-    for c in conflicts:
-        
-        # Loop through the local properties and find differences
-        for item in model_object.properties():
-            if not item.name.startswith("help"):
-                
-                # Check common parameters for now
-                if hasattr(c, item.name) and hasattr(model_object, item.name):
-                    c_val = getattr(c, item.name)
-                    o_val = getattr(model_object, item.name)
-                    
-                    if not c_val == o_val:
-                        detail[item.name] = o_val
-                            
-    # Build a label out of the distinctions
-    # TODO: how do we force natural order traversal on detail keys?
-    label = model_object.name
-    for item in detail:
-        label += " %s=%s" % (item, str(detail[item]))
-
-    return label
-
-class Model(Plottable):
-    """
-    Prototype pyre model plottable.  
-    
-    Being 'model' rather than 'data' means that it will have certain style 
-    attributes (e.g., lines rather than symbols) and respond in certain ways 
-    to the callbacks (e.g., by recomputing the model when the limits change).
-    
-    We have the following attributes:
-    
-    - inventory: manage user visible state
-    - changed(): return true if a replot is required.
-    - x,y = data(): return the plottable data.
-    
-    """
-    def __init__(self, component):
-        Plottable.__init__(self)
-        self.component = component
-        self._xaxis, symbol, self._xunit = component.xaxis()
-        self._yaxis, symbol, self._yunit = component.yaxis()
-        
-        self.min = 0.1
-        self.max = 1.0
-        self.n = 20
-        
-        self.has_changed = False
-        self.dirty = True
-        
-        # Fill inventory backup
-        # Pyre Trait have no way to notify us that
-        # it has changed. Hack it for now.
-        self.value_dict = {}
-        for item in self.component.properties():
-            if not item.name.startswith("help"):
-                descr = self.component.inventory.getTraitDescriptor(item.name)                
-                self.value_dict[item.name] = descr.value
-
-    def __setattr__(self, key, value):
-        if key in ["min", "max", "n"]:
-            self.has_changed = True
-            
-        self.__dict__[key] = value
-    
-    def changed(self):
-        """
-        Return true if a replot is required.
-        
-        Queries our inventory and the inventory of our attached
-        model to see if any aspects of the model have changed, forcing a
-        replot.  Specialized plottables will be able to query the inventory
-        intelligently.  
-       
-        changed() could also be used to provide 'holographic update', where
-        the first pass does very coarse sampling, and this gets refined at
-        the next idle.  That way we can remain responsive to the mouse while
-        expensive calculations go on.
-        """
-        self.dirty = self.dirty or self.has_changed or self.component.changed()
-        return self.dirty
-    
-    def data(self):
-        """
-        Return the plottable data.  This will automatically respond to 
-        changes in inventory by recalculating.
-        
-        The plottables graph does not use this function directly, but 
-        rather calls it through render.  Later the default render for 1D 
-        theory style may want to call back to data.
-        """
-        if self.dirty:
-            import numpy as nx
-            self.x = nx.linspace(self.min, self.max, self.n)
-            self.y = []
-            import math
-            for x in self.x:
-                self.y.append(math.log(self.component(x)))
-            self.dirty = False    
-        return self.x, self.y
-
-    def update_xlim(self, lo, hi):
-        """
-        Record the change in the graph limits.  This updates the xrange
-        stored in the model plottable inventory. Later, when the application 
-        is idle, obj.changed() will note the change in inventory and ask
-        the data to recalculate.
-        """
-        self.inventory.min = lo
-        self.inventory.max = hi
-        
-    def render(self, plot, **kw):
-        """
-        Add the appropriate lines to the plot for the component.
-        
-        The plot interface implements generic styles for particular types
-        of data and formalizes the callback mechanism.  See the methods
-        available in mplplot for details.
-        """
-        Plottable.render(self, plot)
-        x, y = self.data()
-        plot.xaxis(self._xaxis, self._xunit)
-        plot.yaxis(self._yaxis, self._yunit)
-        plot.curve(x, y, **kw)
-        #plot.connect('xlim',self.update_xlim)
-
-    @classmethod
-    def labels(cls, collection):
-        """Build a label mostly unique within a collection"""
-        map = {}
-        for item in collection:
-            map[item] = label(item, collection)
-        return map
Index: nsmodels/src/sans/models/pyre/sphere.odb
===================================================================
--- sansmodels/src/sans/models/pyre/sphere.odb	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,8 +1,0 @@
-
-
-def model():
-    from ScatteringIntensityFactory import ScatteringIntensityFactory
-    from sans.models.SphereModel import SphereModel
-    
-    # Invoke ModelFactory to get a model object
-    return ScatteringIntensityFactory( SphereModel )('sphere')
Index: nsmodels/src/sans/models/pyre/test3d.py
===================================================================
--- sansmodels/src/sans/models/pyre/test3d.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,154 +1,0 @@
-import matplotlib.pylab as pylab
-import matplotlib.axes3d as axes3d
-from matplotlib.axes3d import Axes3D
-
-# Read this: http://www.scipy.org/Cookbook/Matplotlib/mplot3D
-
-import random
-import numpy as npy
-
-
-
-def test_scatter():
-
-    fig=pylab.figure()
-    ax = Axes3D(fig)
-    #
-    #
-    n = 100
-    for c,zl,zh in [('r',-50,-25),('b',-30,-5)]:
-        xs,ys,zs = zip(*
-                       [(random.randrange(23,32),
-                         random.randrange(100),
-                         random.randrange(zl,zh)
-                         ) for i in range(n)])
-        ax.scatter3D(xs,ys,zs, c=c)
-    #
-    ax.set_xlabel('------------ X Label --------------------')
-    ax.set_ylabel('------------ Y Label --------------------')
-    ax.set_zlabel('------------ Z Label --------------------')
-
-def get_test_data(delta=0.05):
-    from matplotlib.mlab import meshgrid, bivariate_normal
-    x = y = npy.arange(-3.0, 3.0, delta)
-    X, Y = meshgrid(x,y)
-
-    Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-    Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-    Z = Z2-Z1
-
-    X = X * 10
-    Y = Y * 10
-    Z = Z * 500
-    return X,Y,Z
-
-def test_wire():
-    fig=pylab.figure()
-    ax = Axes3D(fig)
-
-    X,Y,Z = get_test_data(0.05)
-    ax.plot_wireframe(X,Y,Z, rstride=10,cstride=10)
-    #
-    ax.set_xlabel('X')
-    ax.set_ylabel('Y')
-    ax.set_zlabel('Z')
-
-def test_surface():
-    fig=pylab.figure()
-    ax = Axes3D(fig)
-
-    X,Y,Z = get_test_data(0.05)
-    ax.plot_surface(X,Y,Z, rstride=10,cstride=10)
-    #
-    ax.set_xlabel('X')
-    ax.set_ylabel('Y')
-    ax.set_zlabel('Z')
-
-
-def test_contour():
-    fig=pylab.figure()
-    ax = Axes3D(fig)
-
-    X,Y,Z = get_test_data(0.05)
-    cset = ax.contour3D(X,Y,Z)
-    ax.clabel(cset, fontsize=9, inline=1)
-    #
-    ax.set_xlabel('X')
-    ax.set_ylabel('Y')
-    ax.set_zlabel('Z')
-
-def test_plot():
-    fig=pylab.figure()
-    ax = Axes3D(fig)
-    xs = npy.arange(0,4*npy.pi+0.1,0.1)
-    ys = npy.sin(xs)
-    ax.plot(xs,ys, label='zl')
-    ax.plot(xs,ys+max(xs),label='zh')
-    ax.plot(xs,ys,dir='x', label='xl')
-    ax.plot(xs,ys,dir='x', z=max(xs),label='xh')
-    ax.plot(xs,ys,dir='y', label='yl')
-    ax.plot(xs,ys,dir='y', z=max(xs), label='yh')
-    ax.set_xlabel('X')
-    ax.set_ylabel('Y')
-    ax.set_zlabel('Z')
-    ax.legend()
-
-
-def test_polys():
-    from matplotlib.collections import LineCollection, PolyCollection
-    from matplotlib.colors import colorConverter
-
-    cc = lambda arg: colorConverter.to_rgba(arg, alpha=0.6)
-
-    fig=pylab.figure()
-    ax = Axes3D(fig)
-    xs = npy.arange(0,10,0.4)
-    verts = []
-    zs = [0.0,1.0,2.0,3.0]
-    for z in zs:
-        ys = [random.random() for x in xs]
-        ys[0],ys[-1] = 0,0
-        verts.append(zip(xs,ys))
-
-    poly = PolyCollection(verts, facecolors = [cc('r'),cc('g'),cc('b'),
-                                               cc('y')])
-    #patches = art3d.Poly3DCollectionW(poly, zs=zs, dir='y')
-    #poly = PolyCollection(verts)
-    ax.add_collection(poly,zs=zs,dir='y')
-    #ax.wrapped.add_collection(poly)
-    #
-    ax.plot(xs,ys, z=z, dir='y', c='r')
-    ax.set_xlim(0,10)
-    ax.set_ylim(-1,4)
-    ax.set_zlim(0,1)
-
-def test_scatter2D():
-    xs = [random.random() for i in range(20)]
-    ys = [random.random() for x in xs]
-    fig=pylab.figure()
-    ax = Axes3D(fig)
-    ax.scatter(xs,ys)
-    ax.scatter(xs,ys, dir='y', c='r')
-    ax.scatter(xs,ys, dir='x', c='g')
-
-def test_bar2D():
-    fig=pylab.figure()
-    ax = Axes3D(fig)
-
-    for c,z in zip(['r','g','b','y'],[30,20,10,0]):
-        xs = npy.arange(20)
-        ys = [random.random() for x in xs]
-        ax.bar(xs,ys,z=z,dir='y',color=c)
-    #ax.plot(xs,ys)
-
-if __name__ == "__main__":
-    
-    #test_scatter()
-    test_wire()
-    #test_surface()
-    #test_contour()
-    #test_plot()
-    #test_polys()
-    #test_scatter2D()
-    #test_bar2D()
-    pylab.show()
Index: nsmodels/src/sans/models/pyre/test_pyre_scatt.py
===================================================================
--- sansmodels/src/sans/models/pyre/test_pyre_scatt.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,224 +1,0 @@
-#!/usr/bin/env python
-from pyre.applications.Script import Script
-import sys
-
-#pylint: disable-msg=W0212
-#pylint: disable-msg=W0613
-  
-
-from pyre.components.Component import Component
-class ToyModel(Component):
-
-    has_changed = False
-
-    class Inventory(Component.Inventory):
-        import pyre.inventory as pyre_inventory
-        
-        A = pyre_inventory.float( "A", default = 1.0 )
-        B = pyre_inventory.float( "B", default = 2.0 )
-
-    def __call__(self, *args, **kwds):  
-        """ Evaluate the model.
-            For the real component, evaluate will
-            be done through a model object.
-        """
-        return self.A*10.0*args[0] + self.B
-    
-    def _configure(self):
-        Component._configure(self)
-        self.A = self.inventory.A
-        self.B = self.inventory.B
-        
-    def set(self, key, value):
-        """ For the real component, we will push the
-            values to the underlying model object
-            using this method.
-        """
-        if hasattr(self, key.upper()):
-            setattr(self, key.upper(), value)
-        else:
-            raise ValueError, "ToyModel does not have %s" % key      
-        
-    def __setattr__(self, key, value):
-        self.__dict__["has_changed"] = True
-        return Component.__setattr__(self, key, value)
-    
-    def changed(self):
-        tmp = self.has_changed
-        self.has_changed = False    
-        return tmp
-    
-    def xaxis(self): 
-        return "time", "t", "s"
-    def yaxis(self): 
-        return "amplitude", "A", ""
-        
-    
-
-  
-class DemoApp(Script):
-    """ Demo application to demonstrate the kind of object manipulations
-        our SANS applications will need to do.
-    """
-    
-    class Inventory(Script.Inventory):  
-        import pyre.inventory  
-        ## We need a model object to manipulate
-        model = pyre.inventory.facility('model', default = 'sphere')
-
-    def demo_plotter(self,graph):
-        import wx
-        from mplplotter import Plotter
-    
-        # Make a frame to show it
-        frame = wx.Frame(None,-1,'Plottables')
-        self.plotter = Plotter(frame)
-        frame.Show()
-    
-        # render the graph to the pylab plotter
-        graph.render(self.plotter)
-        
-        def onIdle(event):
-            if graph.changed(): 
-                graph.render(self.plotter)
-                event.RequestMore()
-        frame.Bind(wx.EVT_IDLE,onIdle)
-
-
-    def main(self, *args, **kwds):
-        """
-            Main loop
-        """
-        import wx
-        app = wx.PySimpleApp()
-
-        print "Model output (%s)= %g" % (self.model.name, self.model(.1))
-        
-        # Popup graph
-        import plottables
-        import pyre_plottable
-        
-        model2 = ToyModel('toymodel','sans')
-        model2._configure()
-        model2._init()        
-        model2.set("A", 4.0)
-        
-        
-        m = pyre_plottable.Model(self.model)
-        m2 = pyre_plottable.Model(model2)
-        self.graph = plottables.Graph()
-        self.graph.title('TEST')
-        self.graph.add(m)
-        self.graph.add(m2)
-
-        self.demo_plotter(self.graph)
-        
-        import thread
-        thread.start_new(self.console,())
-               
-        app.MainLoop()
-        print "Bye"
-        return
-  
-    def newModelTest(self):
-        """ 
-            Create a cylinder model directly
-        """
-        ComponentClass = ScatteringIntensityFactory(CylinderModel)
-        self.model._fini()
-        self.model = ComponentClass('cylinder')
-        self.model._configure()
-        self.model._init()        
-        
-    def newModel(self, model_name):
-        """
-            Instantiate a new model
-            @param model_name: name of new model [string]
-        """
-        import pyre.inventory
-        
-        fac = pyre.inventory.facility('model', default = model_name)
-        new_model, locator = fac._getDefaultValue(self.inventory)
-        new_model._configure()
-        new_model._init()
-        
-        self.model._fini()    
-        self.model = new_model
-  
-    def _configure(self):
-        """
-            Get the inventory items
-        """
-        Script._configure(self)
-        self.model = self.inventory.model
-        return
-  
-    def console(self):
-        # Read user commands
-        continue_flag = True
-        while(continue_flag):
-            command = raw_input(">").lower()
-            
-            # Quit the application ######################################
-            if command.count('q')>0:
-                continue_flag = False
-                
-            # Get the value of a parameter ##############################
-            elif command.count('get')>0:
-                toks = command.split()
-                if len(toks)==2:
-                    try: 
-                        # Get the attribute with the given name
-                        print "%s = %s" % (toks[1], getattr(self.model, toks[1]))
-                    except:
-                        print sys.exc_value
-                else:
-                    print "Usage: Get <name of parameter>"
-
-            # Set the value of a parameter ##############################
-            elif command.count('set')>0:
-                toks = command.split()
-                if len(toks)==3:
-                    try:
-                        self.model.set(toks[1].lstrip().rstrip(), float(toks[2]))
-                        print "Model output: ", self.model(1.0)                     
-                    except:
-                        print sys.exc_value
-                else:
-                    print "Usage: Set <name of parameter> <value>"
-                
-            # Set the active model ######################################
-            elif command.count('model')>0:
-                toks = command.split()
-                if len(toks)==2:
-                    try:
-                        new_name = toks[1].lstrip().rstrip()
-                        self.newModel(new_name)
-                        print "Model output (%s) = %g" % (new_name, self.model(1.0))
-                    except:
-                        print sys.exc_value
-                else:
-                    print "Usage: model <name of the model>"
-
-            # Help ######################################################
-            else:
-                print "Available commands:"
-                print "   get <parameter>"
-                print "   set <parameter> <value>"
-                print "   model <model name>"
-                print "   q"
-        
-            if self.graph.changed(): 
-                self.graph.render(self.plotter)
-        
-  
-# main
-if __name__ == '__main__':
-    app = DemoApp('sans')
-    app.run()
-    
-  
-# version
-__id__ = "$Id$"
- 
-# End of file
Index: nsmodels/src/sans/models/pyre/toymodel.odb
===================================================================
--- sansmodels/src/sans/models/pyre/toymodel.odb	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,7 +1,0 @@
-
-
-def model():
-    from test_pyre_scatt import ToyModel
-    
-    # Invoke ModelFactory to get a model object
-    return ToyModel('toymodel', facility='sans')
Index: nsmodels/src/sans/models/pyre/utest_pyremodels.py
===================================================================
--- sansmodels/src/sans/models/pyre/utest_pyremodels.py	(revision ae3ce4eaa593202ebf49122e196897c0d45a25b6)
+++ 	(revision )
@@ -1,68 +1,0 @@
-"""
-    Unit tests for specific models
-    @author: Mathieu Doucet / UTK
-"""
-
-import unittest
-from pyre.applications.Script import Script
-from sans.models.ModelFactory import ModelFactory
-
-# Disable "missing docstring" complaint
-# pylint: disable-msg=C0111
-# Disable "too many methods" complaint 
-# pylint: disable-msg=R0904 
-# Disable "could be a function" complaint 
-# pylint: disable-msg=R0201
-
-class TestScript(Script):
-    
-    def main(self, *args, **kwds):
-        pass
-
-    def newModel(self, model_name):
-        """
-            Instantiate a new model
-            @param model_name: name of new model [string]
-        """
-        import pyre.inventory
-        
-        fac = pyre.inventory.facility('model', default = model_name)
-        new_model, locator = fac._getDefaultValue(self.inventory)
-        new_model._configure()
-        new_model._init()
-        
-        return new_model
-
-class TestPyreComponent(unittest.TestCase):
-    """ Unit tests for sphere model """
-    
-    def setUp(self):
-        self.pyre_script = TestScript('test')
-        self.pyre_script.run()
-
-    def testSphere(self):
-        sphere = self.pyre_script.newModel('sphere')
-        oracle = ModelFactory().getModel("SphereModel")
-        self.assertEqual(sphere(1.0), oracle.run(1.0))
-
-    def testCylinder(self):
-        sphere = self.pyre_script.newModel('cylinder')
-        oracle = ModelFactory().getModel("CylinderModel")
-        self.assertEqual(sphere(1.0), oracle.run(1.0))
-
-    def test2DSphere(self):
-        sphere = self.pyre_script.newModel('sphere')
-        oracle = ModelFactory().getModel("SphereModel")
-        self.assertEqual(sphere([1.0, 1.57]), oracle.run(1.0))
-
-    def testSetParam(self):
-        sphere = self.pyre_script.newModel('sphere')
-        sphere.set('radius', 10.0)
-        oracle = ModelFactory().getModel("SphereModel")
-        oracle.setParam('radius', 10.0)
-        self.assertEqual(sphere(1.0), oracle.run(1.0))
-
- 
-
-if __name__ == '__main__':
-    unittest.main()
Index: sansmodels/test/SmearList.py
===================================================================
--- sansmodels/test/SmearList.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/SmearList.py	(revision 0abf7bf37070c95d946c2656a2e3ef5d902d0027)
@@ -1,4 +1,3 @@
 
-from sans.models.ModelFactory import ModelFactory
 from sans.models.BaseComponent import BaseComponent
 import math
@@ -15,5 +14,4 @@
         
         ## Model to smear
-        #self.model = factory.getModel(model_name)
         self.model = model
         ## Standard deviation of the smearing
@@ -53,5 +51,4 @@
             
             # Gaussian function used to weigh points
-            #gaussian = ModelFactory().getModel("Gaussian")
             gaussian = Gaussian()
             gaussian.setParam('sigma', self.sigmas[id])
@@ -162,36 +159,2 @@
         
         return value
-        
-# main
-if __name__ == '__main__':
-    import math
-    if True:
-        cyl = ModelFactory().getModel("CylinderModel")
-        cyl.setParam('length', 2000.0)
-        cyl.setParam('cyl_phi', .45)
-        cyl.setParam('cyl_theta', 2.)
-        #app = Smear(cyl,['cyl_theta', 'cyl_phi'], [.01, .01])
-        #app = Smear(cyl,['cyl_theta', 'cyl_phi'], [2.0, 2.0])
-        #app = Smear(cyl,['cyl_theta'], [2.5])
-        app = Smear(cyl, ['cyl_phi', 'cyl_theta'], [math.pi, math.pi])
-        #app = Smear(cyl,['scale', 'scale'],[.5,1.0])
-        val_no = cyl.run([.001, 1.0])
-        print "Cylinder (no smear) f(.1):", val_no
-        val_sm =  app.run([.001, 1.0])
-        print "Cylinder (smear)    f(.1):", val_sm, app.error, app.error/val_sm
-        print "Cylinder (1D)    f(.1):", cyl.run(.001), cyl.run(.001)/val_sm
-      
-      
-    print "--------------"
-    sinsin = ModelFactory().getModel("SinSin")
-    sinsin.setParam('a', -1.7)
-    sinsin.setParam('b', 5.45)
-    #app = Smear(sinsin, ['A'], [3.1])
-    #app = Smear(sinsin, ['A', 'b'], [math.pi/2.0, .0])
-    app = Smear(sinsin, ['A'], [math.pi/2.0])
-    #app = Smear(cyl,['scale', 'scale'],[.5,1.0])
-    val_no = sinsin.run(1.0)
-    print "SinSin (no smear) :", val_no
-    val_sm =  app.run(1.0)
-    print "SinSin (smear)    : %g +- %g" % (val_sm, app.error)
-      
Index: nsmodels/test/testcase_generator.py
===================================================================
--- sansmodels/test/testcase_generator.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ 	(revision )
@@ -1,770 +1,0 @@
-"""
-    Random test-case generator for BaseComponents
-    
-"""
-import time
-
-def randomModel():
-    """ Return a random model name """
-    from sans.models.ModelFactory import ModelFactory
-    from random import random
-    from math import floor
-    
-    model_list = ModelFactory().getAllModels()
-    ready = False
-    while not ready:
-        rnd_id = int(floor(random()*len(model_list)))
-        if model_list[rnd_id] not in ["TestSphere2", "DataModel"]:
-            ready = True
-    return model_list[rnd_id]
-
-class ReportCard: # pylint: disable-msg=R0902
-    """ Class to hold test-case results """
-    
-    def __init__(self):
-        """ Initialization """
-        ## Number of test cases
-        self.n_cases = 0
-        ## Number of passed test cases
-        self.n_cases_pass = 0
-        ## Number of Evaluation calls
-        self.n_eval = 0
-        ## Number of passed Evaluation calls
-        self.n_eval_pass = 0
-        ## Number of SetParam calls
-        self.n_set = 0
-        ## Number of passed Set calls
-        self.n_set_pass = 0
-        ## Number of GetParam calls
-        self.n_get = 0
-        ## Number of passed Get calls
-        self.n_get_pass = 0
-        ## Number of load calls
-        self.n_load = 0
-        ## Number of passed Load calls
-        self.n_load_pass = 0
-        ## Number of save calls
-        self.n_save = 0
-        ## Number of passed Save calls
-        self.n_save_pass = 0
-        ## Number of Add calls
-        self.n_add = 0
-        ## Number of passed Add calls
-        self.n_add_pass = 0
-        ## Number of Sub calls
-        self.n_sub = 0
-        ## Number of passed Sub calls
-        self.n_sub_pass = 0
-        ## Number of Div calls
-        self.n_div = 0
-        ## Number of passed Div calls
-        self.n_div_pass = 0
-        ## Number of mul calls
-        self.n_mul = 0
-        ## Number of passed Mul calls
-        self.n_mul_pass = 0
-        ## Test log
-        self.log = ""
-        ## Trace
-        self.trace = ""
-        ## Model tested
-        self.model = ""
-        ## List of all models tested
-        self.modelList = []
-        
-        
-    def __add__(self, other):
-        """ Add two report cards
-            @param other: other report to add
-            @return: updated self
-        """
-        
-        self.n_cases += other.n_cases
-        self.n_cases_pass += other.n_cases_pass
-        self.n_eval += other.n_eval
-        self.n_eval_pass += other.n_eval_pass
-        self.n_set += other.n_set
-        self.n_set_pass += other.n_set_pass
-        self.n_get += other.n_get
-        self.n_get_pass += other.n_get_pass
-        self.n_load += other.n_load
-        self.n_load_pass += other.n_load_pass
-        self.n_save += other.n_save
-        self.n_save_pass += other.n_save_pass
-        self.n_add += other.n_add
-        self.n_add_pass += other.n_add_pass
-        self.n_sub += other.n_sub
-        self.n_sub_pass += other.n_sub_pass
-        self.n_mul += other.n_mul
-        self.n_mul_pass += other.n_mul_pass
-        self.n_div += other.n_div
-        self.n_div_pass += other.n_div_pass
-        if len(other.log)>0:
-            self.log += other.log
-        if len(other.trace)>0:
-            self.trace += other.trace
-            
-        if not other.model in self.modelList:
-            self.modelList.append(other.model)
-            
-        return self
-        
-    def isPassed(self):
-        """ Returns true if no error was found """
-        if self.n_cases_pass < self.n_cases \
-            or self.n_save_pass < self.n_save \
-            or self.n_load_pass < self.n_load \
-            or self.n_set_pass < self.n_set \
-            or self.n_get_pass < self.n_get \
-            or self.n_eval_pass < self.n_eval \
-            or self.n_add_pass < self.n_add \
-            or self.n_sub_pass < self.n_sub \
-            or self.n_mul_pass < self.n_mul \
-            or self.n_div_pass < self.n_div:
-            return False
-        return True
-        
-    def __str__(self):
-        """ String representation of the report card """
-        from sans.models.ModelFactory import ModelFactory
-        
-        rep = "Detailed output:\n"
-        rep += self.log
-        rep += "\n"
-        rep += "Total number of cases: %g\n" % self.n_cases
-        rep += "   Passed:             %g\n" % self.n_cases_pass
-        rep += "\n"
-        self.modelList.sort()
-        rep += "Models tested: %s\n" % self.modelList
-        all_models = ModelFactory().getAllModels()
-        all_models.sort()
-        rep += "\n"
-        rep += "Available models: %s\n" % all_models
-        rep += "\n"
-        rep += "Breakdown:\n"
-        rep += "   Eval:          %g / %g\n" % (self.n_eval_pass, self.n_eval)
-        rep += "   Set:           %g / %g\n" % (self.n_set_pass, self.n_set)
-        rep += "   Get:           %g / %g\n" % (self.n_get_pass, self.n_get)
-        rep += "   Load:          %g / %g\n" % (self.n_load_pass, self.n_load)
-        rep += "   Save:          %g / %g\n" % (self.n_save_pass, self.n_save)
-        rep += "   Add:           %g / %g\n" % (self.n_add_pass, self.n_add)
-        rep += "   Sub:           %g / %g\n" % (self.n_sub_pass, self.n_sub)
-        rep += "   Mul:           %g / %g\n" % (self.n_mul_pass, self.n_mul)
-        rep += "   Div:           %g / %g\n" % (self.n_div_pass, self.n_div)
-        return rep
-    
-        
-
-class TestCaseGenerator:
-    """ Generator for suite of test-cases
-    """
-    
-    def __init__(self):
-        """ Initialization
-        """
-        
-        self.n_tests = 0
-        self.n_passed = 0
-        self.time = 0
-        self.reportCard = ReportCard()
-    
-    def generateFiles(self, number, file_prefix):
-        """ Generate test-case files
-            @param number: number of files to generate
-            @param file_prefix: prefix for the file names
-        """
-        
-        for i in range(number):
-            filename = "%s_%d.xml" % (file_prefix, i)
-            self.generateFileTest(filename)
-            self.n_tests += 1
-            
-    def generateAndRun(self, number):
-        """ Generate test-cases and run them
-            @param number: number of test-cases to generate
-        """
-        start_time = time.time()
-        for i in range(number):
-            textcase = self.generateTest()
-            t = TestCase(text = textcase)
-            passed = t.run()
-            self.reportCard += t.reportCard
-            if not passed:
-                t = time.localtime()
-                xmloutput = open("error_%i-%i-%i-%i-%i-%i_%i.xml" % \
-                 (t[0],t[1],t[2],t[3],t[4],t[5],self.reportCard.n_cases),'w')
-                xmloutput.write(textcase)
-                xmloutput.close()
-
-                
-        self.time += time.time()-start_time
-        print self.reportCard        
-        
-    def generateFileTest(self, filename = "tmp.xml"):
-        """
-            Write a random test-case in an XML file
-            @param filename: name of file to write to
-        """
-        text = self.generateTest()
-        # Write test case in file
-        xmlfile = open(filename,'w')
-        xmlfile.write(text)
-        xmlfile.close()
-    
-    
-    def generateTest(self):
-        """
-            Generate an XML representation of a random test-case
-        """
-        import random
-        
-        #t = TestCase()
-        text = "<?xml version=\"1.0\"?>\n"
-        text  += "<TestCase>\n"
-        stimulus = "eval"
-    
-        loop = True
-        while loop:
-            rnd = random.random()
-            
-            # run 50%
-            if rnd <= 0.5:
-                stimulus = "eval"
-            elif rnd>0.5 and rnd<=0.7:
-                stimulus = "set"
-            elif rnd>0.7 and rnd<=0.72:
-                stimulus = "save"
-            elif rnd>0.72 and rnd<=0.74:
-                stimulus = "load"
-            elif rnd>0.74 and rnd<=0.8:
-                stimulus = "get"
-            elif rnd>0.8 and rnd<=0.81:
-                stimulus = "add"
-            elif rnd>0.81 and rnd<=0.82:
-                stimulus = "div"
-            elif rnd>0.82 and rnd<=0.83:
-                stimulus = "mul"
-            elif rnd>0.83 and rnd<=0.84:
-                stimulus = "sub"
-            else:
-                # just run and quit
-                stimulus = "eval"
-                loop = False
-                
-            text += "  <Stimulus id=\"%s\"/>\n" % stimulus
-        text += "</TestCase>"
-        
-        return text
-    
-        
-class TestCase:
-    """ Test-case class """
-    
-    def __init__(self, filename = None, text = None):
-        """ Initialization
-            @param filename: name of file containing the test case
-        """
-        #from sans.models.ModelFactory import ModelFactory
-        self.filename = filename
-        self.text = text
-        #self.model = ModelFactory().getModel(randomModel())
-        self.model = getRandomModelObject()
-        #self.model = ModelFactory().getModel("SphereModel")
-        self.passed = True
-        self.reportCard = ReportCard()
-        
-    
-    def run(self):
-        """ Read the test case and execute it """
-        from xml.dom.minidom import parse
-        from xml.dom.minidom import parseString
-        
-        # Initialize report
-        self.reportCard = ReportCard()
-        self.reportCard.model = self.model.name
-        self.reportCard.n_cases = 1
-        
-        if not self.text == None:
-            dom = parseString(self.text)
-        elif not self.filename == None:
-            dom = parse(self.filename)
-        else:
-            print "No input to parse"
-            return False
-        
-        if dom.hasChildNodes():
-            for n in dom.childNodes:
-                if n.nodeName == "TestCase":
-                    self.processStimuli(n)
-            
-        # Update report card        
-        if self.passed:
-            self.reportCard.n_cases_pass = 1
-            
-        return self.passed
-                          
-    def processStimuli(self, node):
-        """ Process the stimuli list in the TestCase node 
-            of an XML test-case file
-            @param node: test-case node
-        """
-        import testcase_generator as generator
-        report = ReportCard()
-        report.trace = "%s\n" % self.model.name
-        
-        self.passed = True
-        if node.hasChildNodes():
-            for n in node.childNodes:
-                if n.nodeName == "Stimulus":
-                    
-                    s_type = None
-                    if n.hasAttributes():
-                        # Get stilumus ID
-                        for i in range(len(n.attributes)):
-                            attr_name = n.attributes.item(i).name
-                            if attr_name == "id":
-                                s_type = n.attributes.item(i).nodeValue
-                    if hasattr(generator,"%sStimulus" % s_type):
-                        stimulus = getattr(generator,"%sStimulus" % s_type)
-                        #print s_type, self.model.name
-                        m, res = stimulus(self.model)
-                        #print "     ", m.name
-                        self.model = m
-                        if not res.isPassed():
-                            self.passed = False
-                        
-                        report += res
-                        
-                    else:
-                        print "Stimulus %s not found" % s_type
-                        
-        self.reportCard += report
-        
-        if not self.passed:
-            print "\nFailure:"
-            print report.trace
-        return self.passed
-        
-    
-def evalStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwise
-    """
-    minval = 0.001
-    maxval = 1.0
-    # Call run with random input
-    import random, math
-    input_value = random.random()*(maxval-minval)+minval
-    
-    # Catch division by zero, which can happen
-    # when creating random models
-    try:
-        # Choose whether we want 1D or 2D
-        if random.random()>0.5:
-            output = model.run(input_value)
-        else:
-            output = model.run([input_value, 2*math.pi*random.random()])            
-    except ZeroDivisionError:
-        print "Error evaluating model %s: %g" % (model.name, input_value)
-        output = None
-        
-    #print "Eval: %g" % output
-    
-    # Oracle bit - just check that we have a number...
-    passed = False
-    try:
-        if output != None and math.fabs(output) >= 0: 
-            passed = True
-    except:
-        print "---> Could not compute abs val", output, model.name
-        
-    
-    report = ReportCard()
-    report.n_eval = 1
-    if passed:
-        report.n_eval_pass = 1
-    else:
-        report.log = "Eval: bad output value %s\n" % str(output)
-        
-    report.trace = "Eval(%g) = %s %i\n" % (input_value, str(output), passed)    
-    return model, report
-
-def setStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    # Call run with random input
-    import random, math
-    minval = 1
-    maxval = 5
-    
-    # Choose a parameter to change
-    keys = model.getParamList()
-    if len(keys)==0:
-        #print model.name+" has no params"
-        return model, ReportCard()
-    
-    p_len = len(keys)
-    i_param = int(math.floor(random.random()*p_len))
-    p_name  = keys[i_param]
-    
-    # Choose a value
-    # Check for min/max
-    if hasattr(model, "details"):
-        if model.details.has_key(p_name):
-            if model.details[p_name][1] != None:
-                minval = model.details[p_name][1]
-            if model.details[p_name][2] != None:
-                maxval = model.details[p_name][2]
-        elif model.other.details.has_key(p_name):
-            if model.other.details[p_name][1] != None:
-                minval = model.other.details[p_name][1]
-            if model.other.details[p_name][2] != None:
-                maxval = model.other.details[p_name][2]
-        elif model.operateOn.details.has_key(p_name):
-            if model.operateOn.details[p_name][1] != None:
-                minval = model.operateOn.details[p_name][1]
-            if model.operateOn.details[p_name][2] != None:
-                maxval = model.operateOn.details[p_name][2]
-            
-    input_val = random.random()*(maxval-minval)+minval
-    model.setParam(p_name, input_val)
-    
-    # Read back
-    check_val = model.getParam(p_name)
-    #print "Set: %s = %g" % (p_name, check_val)
-    
-    # Oracle bit
-    passed = False
-    if check_val == input_val: 
-        passed = True
-    
-    report = ReportCard()
-    report.n_set = 1
-    if passed:
-        report.n_set_pass = 1
-    else:
-        report.log = "Set: parameter %s not set properly %g <> %g\n" % \
-            (p_name, input_val, check_val)
-        
-    report.trace = "Set %s = %g %i\n" % (p_name, input_val, passed)    
-    return model, report
-
-def getStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwise
-    """
-    import random, math
-    # Choose a parameter to change
-    keys = model.getParamList()
-    if len(keys)==0:
-        #print model.name+" has no params"
-        return model, ReportCard()    
-    
-    p_len = len(keys)
-    i_param = int(math.floor(random.random()*p_len))
-    p_name  = keys[i_param]
-    
-    # Read back
-    check_val = model.getParam(p_name)
-    #print "Get: %s = %g" % (p_name, check_val)
-    
-    # Oracle bit
-    passed = False
-    if math.fabs(check_val) >= 0: 
-        passed = True
-        
-    report = ReportCard()
-    report.n_get = 1
-    if passed:
-        report.n_get_pass = 1
-    else:
-        report.log = "Get: bad value for parameter %s: %g\n" % \
-            (p_name, check_val)
-        
-    report.trace = "Get %s = %g %i\n" % (p_name, check_val, passed)    
-    return model, report
-
-def loadStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    from sans.models.ModelIO import ModelIO
-    from sans.models.ModelFactory import ModelFactory
-    factory = ModelFactory()
-    io = ModelIO(factory)
-    
-    # testModel.xml should be in the directory
-    loaded = io.load("load_test_model.xml")
-    value2 = loaded.run(1)
-    
-    # Oracle bit
-    passed = False
-    if not value2 == 0: 
-        passed = True
-        
-    report = ReportCard()
-    report.n_load = 1
-    if passed:
-        report.n_load_pass = 1
-    else:
-        report.log = "Load: bad loaded model\n"
-        
-    report.trace = "Load = %s %i\n" % (loaded.name, passed)    
-    return model, report
-
-def saveStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    from sans.models.ModelIO import ModelIO
-    from sans.models.ModelFactory import ModelFactory
-    factory = ModelFactory()
-    io = ModelIO(factory)
-    io.save(model,"testModel.xml")
-    #value = model.run(1)
-
-    # Check it 
-    loaded = io.load("testModel.xml")
-    try:
-        value2 = loaded.run(1)
-    except ZeroDivisionError:
-        value2 = -1
-    
-    # Oracle bit
-    passed = False
-    
-    # The two outputs do not need to be the same
-    # since we do not save the parameters!
-    # If it's the subtraction of two identical models, 
-    # we will also get zero!
-    #if value2 == value: 
-    #    passed = True
-    
-    passed = True
-
-        
-    report = ReportCard()
-    report.n_save = 1
-    if passed:
-        report.n_save_pass = 1
-    else:
-        report.log = "Save: bad output from saved model %g\n" % value2
-        
-    report.trace = "Save %s %i\n" % (model.name, passed)    
-    return model, report
-
-def getRandomModelObject():
-    """
-        Return a random model object
-    """
-    from sans.models.ModelFactory import ModelFactory
-    while True:
-        try:
-            modelname = randomModel()
-            add_model = ModelFactory().getModel(modelname)
-            return add_model
-        except:
-            # Don't complain when a model can't be loaded.
-            # A list of tested models will appear in the 
-            # file report, which can be compared with the 
-            # list of available models, also printed.
-            pass
-            #print "Could not load ", modelname
-    
-
-def addStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    #from sans.models.ModelFactory import ModelFactory
-    #factory = ModelFactory()
-    #add_model = factory.getModel("SphereModel")
-    add_model = getRandomModelObject()
-            
-    tmp = model + add_model
-    model = tmp
-    
-    # Oracle bit
-    passed = False
-    
-    try:
-        value2 = model.run(1)
-        value2 = float(value2)
-    except:
-        passed = False
-    
-    # If we made it this far, we have a float
-    passed = True 
-        
-    report = ReportCard()
-    report.n_add = 1
-    if passed:
-        report.n_add_pass = 1
-    else:
-        report.log = "Add: bad output from composite model\n"
-        
-    report.trace = "Div %s %i\n" % (model.name, passed)    
-    return model, report
-
-def subStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    from sans.models.ModelFactory import ModelFactory
-    from random import random
-    
-    #factory = ModelFactory()
-    #sub_model = factory.getModel("CylinderModel")
-    #sub_model = factory.getModel(randomModel())
-    sub_model = getRandomModelObject()
-
-    
-    sub_model.params["scale"] = 1.1*random()
-    tmp = model - sub_model
-    
-    # Oracle bit
-    passed = False
-    
-    try:
-        value2 = tmp.run(1.1 * (1.0 + random()))
-        value2 = float(value2)
-    except:
-        value2 = None
-        passed = False
-    
-    # If we made it this far, we have a float
-    passed = True 
-        
-    report = ReportCard()
-    report.n_sub = 1
-    if passed:
-        report.n_sub_pass = 1
-    else:
-        report.log = "Sub: bad output from composite model\n"
-
-    report.trace = "Sub %s (%g - %g = %s) %i\n" % \
-        (model.name, model.run(1), \
-         sub_model.run(1), str(value2), passed)                
-    return tmp, report
-
-def mulStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwize
-    """
-    #from sans.models.ModelFactory import ModelFactory
-    #factory = ModelFactory()
-    #mul_model = factory.getModel("SphereModel")
-    #mul_model = factory.getModel(randomModel())
-    mul_model = getRandomModelObject()
-    tmp = model * mul_model
-    
-    # Oracle bit
-    passed = False
-    
-    from random import random
-    input_val = 1.1 * (1.0 + random())
-    v1 = None
-    v2 = None
-    try:
-        v1 = mul_model.run(input_val)
-        v2 = model.run(input_val)
-        value2 = tmp.run(input_val)
-        value2 = float(value2)
-    except ZeroDivisionError:
-        value2 = None
-    
-    # If we made it this far, we have a float
-    passed = True 
-        
-    report = ReportCard()
-    report.n_mul = 1
-    if passed:
-        report.n_mul_pass = 1
-    else:
-        report.log = "Mul: bad output from composite model\n"
-        
-    report.trace = "Mul %s (%s * %s = %s) %i\n" % \
-      (model.name, str(v1), str(v2), str(value2), passed)                
-    return tmp, report
-
-def divStimulus(model):
-    """ Apply the stimulus to the supplied model object
-        @param model: model to apply the stimulus to
-        @return: True if passed, False otherwise
-    """
-    #from sans.models.ModelFactory import ModelFactory
-    #factory = ModelFactory()
-    #div_model = factory.getModel("SphereModel")
-    #div_model = factory.getModel(randomModel())
-
-    from random import random
-    input_val = 1.5 * random()
-    
-    # Find a model that will not evaluate to zero
-    # at the input value
-    try_again = True
-    while try_again:
-        div_model = getRandomModelObject()
-        try:
-            v2 = div_model.run(input_val)
-            try_again = False
-        except:
-            pass
-        
-    tmp = model / div_model
-    
-    # Oracle bit
-    passed = False
-    
-    v1 = None
-    v2 = None
-    try:
-        
-        # Check individual models against bad combinations,
-        # which happen from time to time given that all 
-        # parameters are random
-        try:
-            v2 = div_model.run(input_val)
-            v1 = model.run(input_val)
-            value2 = tmp.run(input_val)
-            value2 = float(value2)
-        except ZeroDivisionError:
-            value2 = None
-    except:
-        passed = False
-    
-    # If we made it this far, we have a float
-    passed = True 
-        
-    report = ReportCard()
-    report.n_div = 1
-    if passed:
-        report.n_div_pass = 1
-    else:
-        report.log = "Div: bad output from composite model\n"
-        
-    report.trace = "Div %s/%s (%g) = %s / %s = %s %i\n" % \
-      (model.name, div_model.name, input_val, str(v1), str(v2), str(value2), passed)                
-    return tmp, report
-
-if __name__ == '__main__':
-    print "Model operations are no longer supported."
-    print "The TestCase generator for model operation can't be used with this version of sansmodels." 
-    
-    
-    #print randomModel()
-    #g = TestCaseGenerator()
-    #g.generateAndRun(20000)
-    
-    #t = TestCase(filename = "error_1.17721e+009.xml")
-    #print t.run()
-    
Index: sansmodels/test/utest_disperser.py
===================================================================
--- sansmodels/test/utest_disperser.py	(revision 77220eec89191ba4c75296b244ffd100f2ab2263)
+++ sansmodels/test/utest_disperser.py	(revision 0abf7bf37070c95d946c2656a2e3ef5d902d0027)
@@ -15,5 +15,5 @@
 
 from sans.models.sans_extension.c_models import Disperser
-from sans.models.ModelFactory import ModelFactory
+from sans.models.CylinderModel import CylinderModel
 from sans.models.DisperseModel import DisperseModel
       
@@ -22,5 +22,5 @@
     
     def setUp(self):
-        self.model = ModelFactory().getModel("CylinderModel")
+        self.model = CylinderModel()
         self.model.setParam("cyl_theta", 1.57)
         self.model.setParam("cyl_phi", 0.1)
@@ -84,5 +84,5 @@
     
     def setUp(self):
-        self.model = ModelFactory().getModel("CylinderModel")
+        self.model = CylinderModel()
         self.model.setParam("cyl_theta", 1.57)
         self.model.setParam("cyl_phi", 0.1)
Index: sansmodels/test/utest_models.py
===================================================================
--- sansmodels/test/utest_models.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/utest_models.py	(revision 0abf7bf37070c95d946c2656a2e3ef5d902d0027)
@@ -63,64 +63,5 @@
         self.comp.setParam('cyl_phi', 1*180/math.pi)
         self.assertAlmostEqual(self.comp.run([0.2, 2.5]), 
-                               0.038176446608393366, 4)
-       
-    def testIO(self):
-        from sans.models.ModelFactory import ModelFactory
-        from sans.models.ModelIO import ModelIO
-        factory = ModelFactory()
-        io = ModelIO(factory)
-        io.save(self.comp,"myModel.xml")
-        value = self.comp.run(1)
-        loaded = io.load("myModel.xml")
-        self.assertEqual(value, loaded.run(1))
-        
-    def testIO_add(self):
-        # version 0.5.0: No longer supported
-        return
-        from sans.models.ModelFactory import ModelFactory
-        from sans.models.ModelIO import ModelIO
-        factory = ModelFactory()
-        io = ModelIO(factory)
-        sph = factory.getModel("SphereModel")
-        cyl = factory.getModel("CylinderModel")
-        combo = sph - cyl
-        io.save(combo,"myModel.xml")
-        value = combo.run(1)
-        loaded = io.load("myModel.xml")
-        self.assertEqual(value, loaded.run(1))
-        
-    def testIO_add2(self):
-        # version 0.5.0: No longer supported
-        return
-        from sans.models.ModelFactory import ModelFactory
-        #from sans.models.ModelIO import ModelIO
-        factory = ModelFactory()
-        #io = ModelIO(factory)
-        sph = factory.getModel("SphereModel")
-        cyl = factory.getModel("CylinderModel")
-        sph2 = factory.getModel("SphereModel")
-        combo1 = cyl - sph
-        combo = combo1 / sph2
-        #combo1 = sph
-        #io.save(combo,"myModel.xml")
-        # Just check that we have some output
-        self.assertTrue(math.fabs(combo.run(1))>0)
-        #loaded = io.load("myModel.xml")
-        #self.assertEqual(value, loaded.run(1))
-        
-        
-      
-       
-class TestFactory(unittest.TestCase):
-    """Unit tests for Model Factory"""
-    
-    def setUp(self):
-        from sans.models.ModelFactory import ModelFactory
-        self.comp = ModelFactory().getModel('CylinderModel')
-        
-    def test1D(self):
-        """ Test 1D model of a cylinder """ 
-        self.assertAlmostEqual(self.comp.run(0.2), 0.041761386790780453, 4)
-        
+                               0.038176446608393366, 4) 
  
 class TestGaussian(unittest.TestCase):
Index: sansmodels/test/validate_1D_model.py
===================================================================
--- sansmodels/test/validate_1D_model.py	(revision 18e250cb66e3283c50a57dddaf692b17263dd72c)
+++ sansmodels/test/validate_1D_model.py	(revision 0abf7bf37070c95d946c2656a2e3ef5d902d0027)
@@ -25,5 +25,5 @@
             @param filename: name of the test data set
         """
-        from sans.models.ModelFactory import ModelFactory
+        from sans.models.CylinderModel import CylinderModel
         
         # Read the data file
@@ -46,5 +46,6 @@
                     print "Found class", toks[1]
                     classname = toks[1].lstrip().rstrip()
-                    model_object = ModelFactory().getModel(classname)
+                    exec "from sans.models.%s import %s" % (classname, classname)
+                    exec "model_object = %s()" % classname
                 
                     # Output file for plotting
Index: nsrealspace/test/simulation_stimuli.py
===================================================================
--- sansrealspace/test/simulation_stimuli.py	(revision a98171d6870d89381402f9903393eeb17ea3e07a)
+++ 	(revision )
@@ -1,345 +1,0 @@
-"""Automated testing for simulation
-
-    To be compatible with testcase_generator, a simulus
-    class must have:
-        setup(self):  to initialize the test-case
-        getRandomStimulus(self): to get a random stimulus name
-        stimuli that inherit from the Stimulus class
-        
-    @copyright: University of Tennessee, 2007
-    @license: This software is provided as part of the DANSE project.
-
-"""
-
-import testcase_generator as generator
-from testcase_generator import Stimulus
-try:
-    import VolumeCanvas
-    print "Testing local VolumeCanvas\n"
-except:
-    import sans.realspace.VolumeCanvas as VolumeCanvas
-
-def randomModel():
-    """ Return a random model name """
-    from random import random
-    from math import floor
-    
-    model_list = ['sphere', 'cylinder', 'ellipsoid', 'singlehelix']
-    rnd_id = int(floor(random()*len(model_list)))
-    
-    return model_list[rnd_id]
-
-
-class Simulation:
-    """Simulation testing class"""
-    
-    # Probability of stopping a test case without
-    # adding additional stimuli
-    end_frequency = 0.1
-    
-    def __init__(self):
-        self.end_flag = False
-        
-    def reset(self):
-        self.end_flag = False
-    
-    def setup(self):
-        """Setup the canvas for stimuli application"""
-        volume = VolumeCanvas.VolumeCanvas()
-        volume.params['lores_density'] = 0.05
-        return volume
-    
-    def getRandomStimulus(self):
-        """Return the name of a random stimulus"""
-        
-        from random import random
-        
-        # If the end flag is up, compute I(q) one last time
-        if self.end_flag == True:
-            return None
-        
-        # Get the list of stimuli
-        attrs = dir(self)
-        stim_list = []
-        
-        # Get the list of simuli and 
-        # compute the total normalization
-        sum = 0
-        for item in attrs:
-            if item.endswith('Stimulus'):
-                obj = getattr(self, item)
-                if hasattr(obj, 'frequency'):
-                    stim_list.append(item)
-                    sum += getattr(self, item).frequency
-        
-        # Choose a stimulus
-        rnd = random()
-        
-        # Check if we need to stop
-        if rnd < self.end_frequency:
-            self.end_flag = True
-            return "GetIq"
-        
-        run_sum = 0
-        for item in stim_list:
-            run_sum += getattr(self, item).frequency/sum 
-            if run_sum >= rnd:
-                pos = item.index('Stimulus')
-                
-                return item[0:pos]
-        
-    class AddStimulus(Stimulus):
-        """Add an object to the canvas"""
-
-        frequency = 0.1
-        
-        def __call__(self, canvas):
-            """Apply stimulus"""
-            report = generator.StimulusReport(tag=self.name)
-        
-            # Select random model
-            add_model = randomModel()
-
-            # Add the model
-            handle = canvas.add(add_model)
-            
-            # Check that it is in the list of objects
-            if handle in canvas.getShapeList():
-                report.passed = 1
-            else:
-                report.log = "Add: tried to add %s" % add_model
-            
-            report.trace = "Added %s" % add_model
-            
-            return canvas, report
-    
-    class GetParamStimulus(Stimulus):
-        """Get the value of a canvas or shape parameter"""
-
-        frequency = 0.05
-        
-        def __call__(self, canvas):
-            """Apply stimulus"""
-            from random import random
-            import math
-            
-            report = generator.StimulusReport(tag=self.name)
-        
-            # Read a parameter
-            #TODO: access shape parameters
-            rnd = random()
-            i_rnd = int(math.floor(rnd*len(canvas.params)))
-            par_name = canvas.params.keys()[i_rnd]
-            value = canvas.getParam(par_name)
-            
-            # Check that it is in the list of objects
-            try:
-                float(value)
-                report.passed = 1
-            except:
-                report.log = "get: bad value for [%s]" % par_name
-            
-            report.trace = "Read %s" % par_name
-            
-            return canvas, report
-    
-    class GetIqStimulus(Stimulus):
-        """Calculate I(q)"""
-
-        frequency = 0.25
-        
-        def __call__(self, canvas):
-            report = generator.StimulusReport(tag=self.name)
-            
-            # Check that a float is returned
-            # Validation testing will be done elsewhere
-            value = canvas.getIq(0.1)
-            
-            # Check that it is in the list of objects
-            try:
-                float(value)
-                report.passed = 1
-            except:
-                report.log = "GetIq: bad value for Iq "+str(value)
-            
-            report.trace = "I(q) = %g" % value
-            return canvas, report
-    
-    class GetIq2DStimulus(Stimulus):
-        """Calculate I(q)"""
-
-        frequency = 0.25
-        
-        def __call__(self, canvas):
-            report = generator.StimulusReport(tag=self.name)
-            
-            # Check that a float is returned
-            # Validation testing will be done elsewhere
-            value = canvas.getIq2D(0.01,0.01)
-            
-            # Check that it is in the list of objects
-            try:
-                float(value)
-                report.passed = 1
-            except:
-                report.log = "GetIq2D: bad value for Iq "+str(value)
-            
-            report.trace = "I(q) = %g" % value
-            return canvas, report
-    
-    class SetCanvasParamStimulus(Stimulus):
-        """Set the value of a canvas parameter"""
-
-        frequency = 0.05
-        
-        def __call__(self, canvas):
-            """Apply stimulus"""
-            from random import random
-            import math
-            
-            report = generator.StimulusReport(tag=self.name)
-        
-            # Read a parameter
-            rnd = random()
-            i_rnd = int(math.floor(rnd*len(canvas.params)))
-            par_name = canvas.params.keys()[i_rnd]
-            
-            # Get current value
-            current = canvas.getParam(par_name)
-            
-            # Set new value
-            rnd2 = random()
-            new_value = current*(1.0+rnd2)
-            canvas.setParam(par_name, new_value)
-            
-            # Read it back
-            current = canvas.getParam(par_name)
-            
-            # Check that the new value is correct
-            if current == new_value:
-                report.passed = 1
-            else:
-                report.log = "get: bad value for [%s]" % par_name
-            
-            report.trace = "Read %s" % par_name
-            
-            return canvas, report
-    
-    class SetShapeParamStimulus(Stimulus):
-        """Set the value of a canvas parameter"""
-
-        frequency = 0.1
-        
-        def __call__(self, canvas):
-            """Apply stimulus"""
-            from random import random
-            import math
-            
-            report = generator.StimulusReport(tag=self.name)
-        
-            # Read a parameter
-            rnd = random()
-            shape_list = canvas.getShapeList()
-
-            if len(shape_list)==0:
-                # No object available, let's test an error condition
-                try:
-                    canvas.setParam("shape0.test-radius", 1.0)
-                    report.log = "SetShapeParam: set didn't throw exception"
-                except:
-                    report.passed = 1
-                report.trace = "SetShapeParam: testing failure behavior"
-                
-            else:  
-                i_rnd = int(math.floor(rnd*len(shape_list)))
-                shape_name = shape_list[i_rnd]
-                
-                found = False
-                while found==False:
-                    rnd2 = random()
-                    par_keys = canvas.shapes[shape_name].params.keys()
-                    i_rnd2 = int(math.floor(rnd2*(len(par_keys))))
-                    
-                    short_name = par_keys[i_rnd2]
-                    par_name = "%s.%s" % (shape_name, short_name)
-                    if not short_name.lower() == "type":
-                        found= True
-                
-                # Get current value
-                current = canvas.getParam(par_name)
-                
-                # Set new value
-                if short_name in ['orientation', 'center']:
-                    new_value = [random(), random(), random()]
-                else:
-                    new_value = current*(1.0+random())
-
-                canvas.setParam(par_name, new_value)
-                
-                # Read it back
-                current = canvas.getParam(par_name)
-                
-                # Check that the new value is correct
-                if current == new_value:
-                    report.passed = 1
-                else:
-                    report.log = "get: bad value for [%s]" % par_name
-                
-                report.trace = "Read %s" % par_name
-            
-            return canvas, report
-    
-
-    class RemoveStimulus(Stimulus):
-        """Calculate I(q)"""
-
-        frequency = 0.05
-        
-        def __call__(self, canvas):
-            from random import random
-            import math
-            
-            report = generator.StimulusReport(tag=self.name)
-            
-            # Get list of shapes
-            if len(canvas.shapes)>0:
-                rnd = random()
-                i_rnd = int(math.floor(rnd*len(canvas.shapes)))
-                shape_name = canvas.shapes.keys()[i_rnd]
-                
-                canvas.delete(shape_name)
-                if shape_name in canvas.shapes.keys() \
-                    or shape_name in canvas.getShapeList():
-                    report.log = "Remove: object was not removed"
-                else:
-                    report.passed = 1
-                
-            else:
-                # No shape to remove: test bad remove call
-                try:
-                    canvas.delete("test-shape")
-                    report.log = "Remove: delete didn't throw exception"
-                except:
-                    report.passed = 1
-                report.trace = "Remove: testing failure behavior"
-            
-            return canvas, report
-    
-
-
-if __name__ == '__main__':
-    import sys
-    
-    stimuli = Simulation()
-    
-    if len(sys.argv)>1:
-        #t = generator.TestCase(stimuli, filename = "test-case.xml")
-        t = generator.TestCase(stimuli, filename = sys.argv[1])
-        print "Test passed =", t.run() 
-    else:   
-        g = generator.TestCaseGenerator(stimuli)
-        g.generateAndRun(200)
-    
-
-    
-    
Index: nsrealspace/test/testcase_generator.py
===================================================================
--- sansrealspace/test/testcase_generator.py	(revision a98171d6870d89381402f9903393eeb17ea3e07a)
+++ 	(revision )
@@ -1,321 +1,0 @@
-"""
-    Random test-case generator for Real-space simulation
-    
-    @copyright: University of Tennessee, 2007
-    @license: This software is provided as part of the DANSE project.
-"""
-import time
-
-class Stimulus:
-    """Base class for simuli objects"""
-    
-    frequency = 1.0
-    
-    def __init__(self):
-        """Initialization"""
-        name = self.__class__.__name__
-        pos = name.index('Stimulus')        
-        self.name = name[0:pos]
-        
-    def __call__(self, obj):
-        """
-            Stimulus application
-            @param obj: object to apply the stimulus to
-            @return: the modified object and the StimulusReport object
-        """
-        return obj, None
-    
-
-class StimulusReport:
-    """Report on the application of a stimulus"""
-    def __init__(self, tag=''):
-        """   
-            Initialization
-            @param tag: name of the applied stimulus
-        """
-        self.tag = tag
-        self.applied = 1
-        self.passed  = 0
-        self.trace = ''
-        self.log = ''
-        
-    def __str__(self):
-        """Returns a string with the success rate"""
-        return str(self.passed/self.applied)
-    
-    def __add__(self, other):
-        """Adds two reports"""
-        self.applied += other.applied
-        self.passed  += other.passed
-        if len(other.trace)>0:
-            self.trace = self.trace+'\n'+other.trace
-        if len(other.log)>0:
-            self.log = self.log+'\n'+other.log
-        return self
-
-    def isPassed(self):
-        """Returns true if report is a success"""
-        if self.applied == self.passed:
-            return True
-        return False
-
-
-class ReportCard: # pylint: disable-msg=R0902
-    """ Class to hold test-case results """
-    
-    def __init__(self):
-        """ Initialization """
-        ## Number of test cases
-        self.n_cases = 0
-        ## Number of passed test cases
-        self.n_cases_pass = 0
-        
-        ## Dictionary of stimuli
-        self.stimuli = {}
-        
-        ## Test log
-        self.log = ""
-        ## Trace
-        self.trace = ""
-        ## Model tested
-        self.model = ""
-        ## List of all models tested
-        self.modelList = []
-        
-        
-    def __add__(self, other):
-        """ Add two report cards
-            @param other: other report to add
-            @return: updated self
-        """
-        if other.__class__.__name__=='ReportCard':
-            # Adding two test-case report cards
-            self.n_cases += other.n_cases
-            self.n_cases_pass += other.n_cases_pass
-            
-            for tag in other.stimuli:
-                if tag in self.stimuli:
-                    self.stimuli[tag] += other.stimuli[tag]
-                else:
-                    self.stimuli[tag] = other.stimuli[tag]
-                    
-            if len(other.log)>0:
-                self.log += other.log
-            if len(other.trace)>0:
-                self.trace += other.trace
-                
-            if not other.model in self.modelList:
-                self.modelList.append(other.model)
-            
-        elif other.__class__.__name__ == 'StimulusReport':
-            # Adding a stimulus report to the report card
-            if other.tag in self.stimuli:
-                self.stimuli[other.tag] += other
-            else:
-                self.stimuli[other.tag] = other
-                    
-        else:
-            raise ValueError, \
-            "ReportCard: Unrecognized class %s" % other.__class__.__name__
-        return self
-        
-    def isPassed(self):
-        """ Returns true if no error was found """
-        if self.n_cases_pass < self.n_cases:
-            return False
-        return True
-        
-    def __str__(self):
-        """ String representation of the report card """
-        from sans.models.ModelFactory import ModelFactory
-        
-        log = ''
-        
-        rep = "Detailed output:\n"
-        rep += self.log
-        rep += "\n"
-        rep += "Total number of cases: %g\n" % self.n_cases
-        rep += "   Passed:             %g\n" % self.n_cases_pass
-        rep += "\n"
-        self.modelList.sort()
-        rep += "Models tested: %s\n" % self.modelList
-        rep += "\n"
-        rep += "\n"
-        rep += "Breakdown:\n"
-        
-        for tag in self.stimuli:
-            
-            rep += "   %-10s:          %g / %g\n" % (tag, self.stimuli[tag].passed, self.stimuli[tag].applied)
-            log += self.stimuli[tag].log
-        
-        rep += '\n'+log
-        return rep
-    
-        
-
-class TestCaseGenerator:
-    """ Generator for suite of test-cases
-    """
-    
-    def __init__(self, stimuli):
-        """ Initialization
-        """
-        self.stimuli = stimuli
-        self.n_tests = 0
-        self.n_passed = 0
-        self.time = 0
-        self.reportCard = ReportCard()
-    
-    def generateFiles(self, number, file_prefix):
-        """ Generate test-case files
-            @param number: number of files to generate
-            @param file_prefix: prefix for the file names
-        """
-        
-        for i in range(number):
-            filename = "%s_%d.xml" % (file_prefix, i)
-            self.generateFileTest(filename)
-            self.n_tests += 1
-            
-    def generateAndRun(self, number):
-        """ Generate test-cases and run them
-            @param number: number of test-cases to generate
-        """
-        start_time = time.time()
-        for i in range(number):
-            textcase = self.generateTest()
-            t = TestCase(self.stimuli, text = textcase)
-            passed = t.run()
-            self.reportCard += t.reportCard
-            if not passed:
-                t = time.localtime()
-                xmloutput = open("error_%i-%i-%i-%i-%i-%i_%i.xml" % \
-                 (t[0],t[1],t[2],t[3],t[4],t[5],self.reportCard.n_cases),'w')
-                xmloutput.write(textcase)
-                xmloutput.close()
-
-                
-        self.time += time.time()-start_time
-        print self.reportCard        
-        
-    def generateFileTest(self, filename = "tmp.xml"):
-        """
-            Write a random test-case in an XML file
-            @param filename: name of file to write to
-        """
-        text = self.generateTest()
-        # Write test case in file
-        xmlfile = open(filename,'w')
-        xmlfile.write(text)
-        xmlfile.close()
-    
-    
-    def generateTest(self):
-        """
-            Generate an XML representation of a random test-case
-        """
-        import random
-        
-        # Reset stimuli object
-        self.stimuli.reset()
-        #t = TestCase()
-        text = "<?xml version=\"1.0\"?>\n"
-        text  += "<TestCase>\n"
-        loop = True
-        while loop:
-            
-            stimulus = self.stimuli.getRandomStimulus()
-            if stimulus == None:
-                loop = False
-            else:   
-                text += "  <Stimulus id=\"%s\"/>\n" % stimulus
-        text += "</TestCase>"
-        
-        return text
-    
-        
-class TestCase:
-    """ Test-case class """
-    
-    def __init__(self, stimuliObject, filename = None, text = None):
-        """ Initialization
-            @param filename: name of file containing the test case
-        """
-        self.filename = filename
-        self.text = text
-        self.stimuli = stimuliObject
-        self.model = stimuliObject.setup()
-        self.passed = True
-        self.reportCard = ReportCard()
-        
-    
-    def run(self):
-        """ Read the test case and execute it """
-        from xml.dom.minidom import parse
-        from xml.dom.minidom import parseString
-        
-        # Initialize report
-        self.reportCard = ReportCard()
-        self.reportCard.model = "Canvas"
-        self.reportCard.n_cases = 1
-        
-        if not self.text == None:
-            dom = parseString(self.text)
-        elif not self.filename == None:
-            dom = parse(self.filename)
-        else:
-            print "No input to parse"
-            return False
-        
-        if dom.hasChildNodes():
-            for n in dom.childNodes:
-                if n.nodeName == "TestCase":
-                    self.processStimuli(n)
-            
-        # Update report card        
-        if self.passed:
-            self.reportCard.n_cases_pass = 1
-            
-        return self.passed
-                          
-    def processStimuli(self, node):
-        """ Process the stimuli list in the TestCase node 
-            of an XML test-case file
-            @param node: test-case node
-        """
-        report = ReportCard()
-        report.trace = "%s\n" % self.model.name
-        
-        self.passed = True
-        if node.hasChildNodes():
-            for n in node.childNodes:
-                if n.nodeName == "Stimulus":
-                    
-                    s_type = None
-                    if n.hasAttributes():
-                        # Get stilumus ID
-                        for i in range(len(n.attributes)):
-                            attr_name = n.attributes.item(i).name
-                            if attr_name == "id":
-                                s_type = n.attributes.item(i).nodeValue
-                    if hasattr(self.stimuli,"%sStimulus" % s_type):
-                        stimulus = getattr(self.stimuli,"%sStimulus" % s_type)()
-                        #print s_type, self.model.name
-                        m, res = stimulus(self.model)
-                        #print "     ", m.name
-                        self.model = m
-                        if not res.isPassed():
-                            self.passed = False
-                        
-                        report += res
-                        
-                    else:
-                        print "Stimulus %s not found" % s_type
-                        
-        self.reportCard += report
-        
-        if not self.passed:
-            print report.trace
-        return self.passed
-        
- 
