Index: src/sans/simulation/pointsmodelpy/tests/Make.mm
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/Make.mm	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/Make.mm	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,61 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+PROJECT = pointsmodelpy
+PACKAGE = tests
+
+PROJ_CLEAN += $(PROJ_CPPTESTS)
+
+PROJ_CXX_INCLUDES += ../../iqPy/libiqPy   \
+                     ../../iqPy/libiqPy/tnt \
+                     ../../geoshapespy/libgeoshapespy   \
+                     ../../analmodelpy/libanalmodelpy   \
+		     ../libpointsmodelpy
+
+PROJ_PYTESTS = signon.py
+PROJ_CPPTESTS = testlores \
+                testpdb  \
+                testcomplexmodel
+PROJ_TESTS = $(PROJ_PYTESTS) $(PROJ_CPPTESTS)
+PROJ_LIBRARIES = -L$(BLD_LIBDIR) -lpointsmodelpy -lgeoshapespy -liqPy
+
+
+#--------------------------------------------------------------------------
+#
+
+all: $(PROJ_TESTS)
+
+test:
+	for test in $(PROJ_TESTS) ; do $${test}; done
+
+release: tidy
+	cvs release .
+
+update: clean
+	cvs update .
+
+#--------------------------------------------------------------------------
+#
+
+testlores: testlores.cc $(BLD_LIBDIR)/libpointsmodelpy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -g -o $@ testlores.cc $(PROJ_LIBRARIES)
+
+testpdb: testpdb.cc $(BLD_LIBDIR)/libpointsmodelpy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -g -o $@ testpdb.cc $(PROJ_LIBRARIES)
+
+testcomplexmodel: testcomplexmodel.cc $(BLD_LIBDIR)/libpointsmodelpy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -g -o $@ testcomplexmodel.cc $(PROJ_LIBRARIES)
+
+# version
+# $Id$
+
+# End of file
Index: src/sans/simulation/pointsmodelpy/tests/signon.py
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/signon.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/signon.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+if __name__ == "__main__":
+
+    import pointsmodelpy
+    from pointsmodelpy import pointsmodelpy as pointsmodelpymodule
+
+    print "copyright information:"
+    print "   ", pointsmodelpy.copyright()
+    print "   ", pointsmodelpymodule.copyright()
+
+    print
+    print "module information:"
+    print "    file:", pointsmodelpymodule.__file__
+    print "    doc:", pointsmodelpymodule.__doc__
+    print "    contents:", dir(pointsmodelpymodule)
+
+    print
+    print pointsmodelpymodule.hello()
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: src/sans/simulation/pointsmodelpy/tests/test.pdb
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/test.pdb	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/test.pdb	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,10 @@
+REMARK FILENAME="if0.pdb"
+REMARK  TOPH19.pep -MACRO for protein sequence
+REMARK DATE:17-Aug-02  11:05:39       created by user:
+ATOM      1  CB  SER     1      -1.115 -11.617 -11.368
+ATOM      2  OG  SER     1       0.202 -11.845 -10.894  1.00 54.67          
+ATOM      3  C   SER     1      -2.076 -12.837  -9.369  1.00 44.10          
+ATOM      4  O   SER     1      -3.108 -12.947  -8.704  1.00 43.77          
+ATOM      5  N   SER     1      -3.465 -12.399 -11.363  1.00 83.41          
+ATOM      6  CA  SER     1      -2.108 -12.709 -10.900  1.00 57.67          
+END
Index: src/sans/simulation/pointsmodelpy/tests/test2.pdb
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/test2.pdb	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/test2.pdb	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,7 @@
+ATOM      1  CB  SER     1      -1.115 -11.617 -11.368  1.00 52.49
+ATOM      2  OG  SER     1       0.202 -11.845 -10.894  1.00 54.67
+ATOM      3  C   SER     1      -2.076 -12.837  -9.369  1.00 44.10
+ATOM      4  O   SER     1      -3.108 -12.947  -8.704  1.00 43.77
+ATOM      5  N   SER     1      -3.465 -12.399 -11.363  1.00 83.41
+ATOM      6  CA  SER     1      -2.108 -12.709 -10.900  1.00 57.67
+END
Index: src/sans/simulation/pointsmodelpy/tests/test2dui.py
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/test2dui.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/test2dui.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+"""
+Demonstration of drawing a 2D image plot using the "hot" colormap
+"""
+
+#--------------------------------------------------------------------------------
+#  Imports:
+#--------------------------------------------------------------------------------
+
+import wx
+
+from enthought.traits import Any, Instance
+from enthought.enable.wx     import Window
+from enthought.pyface        import ApplicationWindow, GUI
+from enthought.util.numerix  import pi, concatenate, array, zeros, ones, \
+                                    arange, resize, ravel
+from enthought.util.numerix import Float as NumericFloat
+from math import sqrt, sin
+
+from enthought.chaco.plot_component import PlotComponent
+from enthought.chaco.plot_axis import PlotAxis
+from enthought.chaco.plot_canvas import PlotCanvas
+from enthought.chaco.plot_group import PlotGroup
+from enthought.chaco.image_plot_value import ImageData, CmapImagePlotValue
+from enthought.chaco.colormap import LinearColormap
+from enthought.chaco.colormap_legend import ColormapLegend
+from enthought.chaco.default_colormaps import hot, gray
+from enthought.chaco.demo.demo_base import PlotApplicationWindow
+
+
+class ImagePlotApplicationWindow( PlotApplicationWindow ):
+
+    ###########################################################################
+    # PlotApplicationWindow interface.
+    ###########################################################################
+    
+    def _create_plot( self ):
+        """ Create the plot to be displayed. """
+        
+        # Create the image data and the index values
+        #value_grid = zeros((100,100), NumericFloat)
+        from testlores2d import get2d_2        
+        value_grid = get2d_2()
+        #self._compute_function(value_grid)
+        index_vals = (arange(value_grid.shape[0]), arange(value_grid.shape[1]))
+
+        data = ImageData(value_grid, index_vals)
+        print value_grid, index_vals
+        
+        # Create the index axes
+        xaxis = PlotAxis(tick_visible=False, grid_visible=False)
+                        # bound_low = index_vals[0][0], bound_high = index_vals[0][-1])
+        yaxis = PlotAxis(tick_visible=False, grid_visible=False)
+                     #bound_low = index_vals[1][0], bound_high = index_vals[1][-1])
+        xaxis.visible = False
+        yaxis.visible = False
+        
+        # Create the value axis (i.e. colormap)
+        cmap = hot(0,1)
+                
+        # Create the Image PlotValue
+#        image = CmapImagePlotValue(data, cmap, axis_index = xaxis, axis = yaxis, type='image')
+        image = CmapImagePlotValue(data, cmap,type='image')
+        image.weight = 10
+        
+        cmap_legend = ColormapLegend(cmap, margin_width=31, margin_height=31)
+        cmap_legend.weight = 0.4
+        
+        group = PlotGroup(cmap_legend, image, orientation='horizontal')
+
+        return group
+
+    ###########################################################################
+    # Private interface.
+    ###########################################################################
+
+    def _compute_function(self, ary):
+        "Fills in ary with the sin(r)/r function"
+        
+        width, height = ary.shape
+        for i in range(width):
+            for j in range(height):
+                x = i - width / 2.0
+                x = x / (width/2.0) * 15
+                y = j - height / 2.0
+                y = y / (height/2.0) * 15
+                
+                radius = sqrt(x*x + y*y)
+                if radius == 0.0:
+                    ary[i,j] = 1
+                else:
+                    ary[i,j] = sin(radius) / radius
+
+        return
+    
+def main():
+
+    # Create the GUI (this does NOT start the GUI event loop).
+    gui = GUI()
+
+    # Screen size:
+    screen_width = gui.system_metrics.screen_width or 1024
+    screen_height = gui.system_metrics.screen_height or 768
+
+    # Create and open the main window.
+    window = ImagePlotApplicationWindow( title = "Plot" )
+    #window.plot_item = object
+    window.size = ( 2 * screen_width / 3, 2 * screen_height / 3 )
+    window.open()
+    
+    # Start the GUI event loop.
+    gui.start_event_loop()
+
+
+#=============================================================================== 
+#  Program start-up:
+#=============================================================================== 
+
+if __name__ == '__main__':
+    main()
Index: src/sans/simulation/pointsmodelpy/tests/testcomplexmodel.cc
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/testcomplexmodel.cc	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/testcomplexmodel.cc	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,41 @@
+#include "complex_model.h"
+#include "lores_model.h"
+#include "sphere.h"
+#include "pdb_model.h"
+#include <vector>
+#include "Point3D.h"
+#include <string>
+
+int main(){
+
+  //Get a few points from a lores model
+  vector<Point3D> vplores;
+  LORESModel lm(0.1);
+  Sphere s1(10);
+  lm.Add(s1,1);
+  lm.GetPoints(vplores);
+  
+  //get a few points from a pdb model
+  vector<Point3D> vppdb;
+  string pdbfile("ff0.pdb");
+  PDBModel p1;
+  p1.AddPDB(pdbfile);
+  p1.GetPoints(vppdb);
+  //should be error,argument vector has to be empty
+  //p1.GetPoints(vppdb);
+
+  //merge points
+  vector<Point3D> vptotal;
+  ComplexModel cm;
+  cm.Add(&lm);
+  cm.Add(&p1);
+  cout << "boundary"<< cm.GetDimBound() <<endl;
+
+  cm.GetPoints(vptotal);
+
+  cm.DistDistribution(vptotal);
+  cm.OutputPR("testcomplexcc.pr");
+  //pm.AddPoints(vptotal,vplores,vppdb);
+
+  return 0;
+}
Index: src/sans/simulation/pointsmodelpy/tests/testcomplexmodel.py
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/testcomplexmodel.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/testcomplexmodel.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,119 @@
+from sansModeling.pointsmodelpy import pointsmodelpy
+from sansModeling.iqPy import iqPy
+from sansModeling.geoshapespy import geoshapespy
+
+#First testing: a normal case, a lores model holds a sphere
+#and a pdbmodel holds one pdb file. and merged into a complex
+#model, then perform calculation
+def test_complex():
+    p = pointsmodelpy.new_pdbmodel()
+    pointsmodelpy.pdbmodel_add(p,"ff0.pdb")
+
+    vp = pointsmodelpy.new_point3dvec()
+    pointsmodelpy.get_pdbpoints(p,vp);
+
+    pointsmodelpy.get_pdb_pr(p,vp)
+    pointsmodelpy.save_pdb_pr(p,"testcomplex.pr")
+
+    iq = iqPy.new_iq(100,0.001, 0.3)
+    pointsmodelpy.get_pdb_iq(p,iq)
+
+    iqPy.OutputIQ(iq,"testcomplex.iq")
+
+    a = geoshapespy.new_sphere(10)
+    lm = pointsmodelpy.new_loresmodel(0.1)
+    pointsmodelpy.lores_add(lm,a,1.0)
+
+    vpcomplex = pointsmodelpy.new_point3dvec();
+    complex = pointsmodelpy.new_complexmodel()
+    pointsmodelpy.complexmodel_add(complex,p,"PDB");
+    pointsmodelpy.complexmodel_add(complex,lm,"LORES");
+    
+    pointsmodelpy.get_complexpoints(complex,vpcomplex);
+    pointsmodelpy.get_complex_pr(complex,vpcomplex);
+    pointsmodelpy.save_complex_pr(complex,"testcomplex1.pr");
+
+    iqcomplex = iqPy.new_iq(100,0.001, 0.3)
+    pointsmodelpy.get_complex_iq(complex,iqcomplex);
+
+    iqPy.OutputIQ(iq,"testcomplex1.iq")
+
+#testing 2, insert one pdbmodel and one empty loresmodel
+def test_complex2():
+  pdb = pointsmodelpy.new_pdbmodel()
+  pointsmodelpy.pdbmodel_add(pdb,"ff0.pdb")
+
+  lores = pointsmodelpy.new_loresmodel(0.1)
+
+  complex = pointsmodelpy.new_complexmodel()	
+  pointsmodelpy.complexmodel_add(complex,pdb,"PDB");
+  pointsmodelpy.complexmodel_add(complex,lores,"LORES")
+
+  points = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_complexpoints(complex,points)
+
+  pointsmodelpy.get_complex_pr(complex,points);
+  pointsmodelpy.save_complex_pr(complex,"testcomplex2.pr")
+
+  iqcomplex = iqPy.new_iq(100,0.001, 0.3)
+  pointsmodelpy.get_complex_iq(complex,iqcomplex)
+
+  iqPy.OutputIQ(iqcomplex,"testcomplex2.iq")
+
+  print "p(r) is saved in testcomplex2.pr"
+  print "I(Q) is saved in testcomplex2.iq"
+  print "pass"
+
+#testing 3, insert one empty pdbmodel and one loresmodel
+def test_complex3():
+  pdb = pointsmodelpy.new_pdbmodel()
+
+  lores = pointsmodelpy.new_loresmodel(0.1)
+  sph = geoshapespy.new_sphere(10)
+  pointsmodelpy.lores_add(lores,sph,1.0)
+
+  complex = pointsmodelpy.new_complexmodel()	
+  pointsmodelpy.complexmodel_add(complex,pdb,"PDB");
+  pointsmodelpy.complexmodel_add(complex,lores,"LORES")
+
+  points = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_complexpoints(complex,points)
+
+  pointsmodelpy.get_complex_pr(complex,points);
+  pointsmodelpy.save_complex_pr(complex,"testcomplex3.pr")
+
+  iqcomplex = iqPy.new_iq(100,0.001, 0.3)
+  pointsmodelpy.get_complex_iq(complex,iqcomplex)
+
+  iqPy.OutputIQ(iqcomplex,"testcomplex3.iq")
+
+  print "p(r) is saved in testcomplex3.pr"
+  print "I(Q) is saved in testcomplex3.iq"
+  print "pass"
+
+# Test 2D complex model
+def test_complex4():
+
+
+    a = geoshapespy.new_sphere(10)
+    lm = pointsmodelpy.new_loresmodel(0.1)
+    pointsmodelpy.lores_add(lm,a,1.0)
+
+    vpcomplex = pointsmodelpy.new_point3dvec();
+    complex = pointsmodelpy.new_complexmodel()
+    pointsmodelpy.complexmodel_add(complex,lm,"LORES");
+    
+    pointsmodelpy.get_complexpoints(complex,vpcomplex);
+ 
+    print pointsmodelpy.get_complex_iq_2D(complex,vpcomplex,0.1,0.1);
+    print pointsmodelpy.get_complex_iq_2D(complex,vpcomplex,0.01,0.1);
+
+
+if __name__ == "__main__":
+    #print "test 1, adding one nonempty loresmodel and one nonempty pdbmodel to complex model"
+    #test_complex()
+    #print "test 2, adding a nonempty pdbmodel, and adding an empty loresmodel"
+    #test_complex2()
+    #print "test 3, adding an empty pdbmodel, and adding a nonempty loresmodel"
+    #test_complex3()
+    test_complex4()
Index: src/sans/simulation/pointsmodelpy/tests/testlores.cc
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/testlores.cc	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/testlores.cc	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,209 @@
+#include <cstdlib>
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include "lores_model.h"
+#include "sphere.h"
+#include "cylinder.h"
+#include "ellipsoid.h"
+#include "Point3D.h"
+
+using namespace std;
+
+void test_calculateIQ(LORESModel &lm);
+
+void WritePointsCoor(vector<Point3D> &vp){
+  ofstream outfile("testcc.coor");
+  for(size_t i=0; i<vp.size(); ++i){
+    outfile<<vp[i].getX()<<" "<<vp[i].getY()<<" "<<vp[i].getZ()<<" "<<1.0<<endl;
+  }
+}
+
+void test_lores(){
+
+  LORESModel lm(0.5);
+  cout << "density is:" << lm.GetDensity() << endl;
+   
+  Sphere s1(10);
+  s1.SetOrientation(10,10,20);
+  s1.SetCenter(10,10,10);
+  lm.Add(s1,1.0);
+   
+  Cylinder c1(5,20);
+  c1.SetCenter(0,0,0);
+  c1.SetOrientation(10,20,30);
+  lm.Add(c1,1.0);
+  
+  /*
+  Cylinder c2(40,100);
+  c2.SetCenter(-30,-40,-35);
+  lm.Add(c2,1.0);
+  */
+  /*
+  Ellipsoid e1(20,15,10);
+  e1.SetCenter(0,0,0);
+  e1.SetOrientation(10,10,20);
+  lm.Add(e1,1.0);
+  */
+  /*test multiple spheres
+  int range = 20;
+  int r = 5;
+  for (int k = 0; k < 1000; ++k) {
+    Sphere s(r + rand() % r);
+    s.SetCenter(rand() % range, rand() % range, rand() % range);
+    lm.Add(s, 1.0);
+  }
+  */
+  /*
+  Sphere s1(10);
+  cout << "sphere information:" << s1.GetVolume() << " " << s1.GetRadius() <<endl;
+  s1.SetOrientation(10,20,10);
+  s1.SetCenter(1,5,2);
+  lm.Add(s1,1.0); 
+
+  Sphere s2(15);
+  s2.SetCenter(20,20,20);
+  lm.Add(s2,2.0);
+
+  Sphere s3(5);
+  s3.SetCenter(0,0,0);
+  lm.Add(s3,2.0);
+
+  Sphere s4(5);
+  s4.SetCenter(0,0,10);
+  lm.Add(s4,2.0);
+
+  Sphere s5(10);
+  s5.SetCenter(20,0,0);
+  lm.Add(s5,2.0);
+  */
+
+  test_calculateIQ(lm);
+}
+
+void test_calculateIQ(LORESModel &lm){
+
+  IQ iq1(10,0.001,0.3);
+  cout << "iq information:" << iq1.GetQmin() <<endl;
+
+  vector<Point3D> vp;
+  lm.GetPoints(vp);
+  WritePointsCoor(vp);
+  cout << "vp size:" <<vp.size()<<endl;
+  cout << "save into pdb file" << endl;
+  lm.OutputPDB(vp,"model.pdb");
+
+  //  for (vector<Point3D>::iterator iter = vp.begin(); 
+  //     iter != vp.end(); ++iter){
+  //  cout << *iter << endl;
+  //}
+
+  lm.DistDistribution(vp);
+  Array2D<double> pr(lm.GetPr());
+  //for(int i = 0; i< pr.dim1(); ++i)
+  //  cout << pr[i][0] << " " << pr[i][1] << " " << pr[i][2] << endl;
+  lm.OutputPR("test.pr");
+  cout << "pass ddfunction, and print out the pr file" <<endl;
+
+  lm.CalculateIQ(&iq1); 
+  cout <<"I(Q): \n" ;
+  //for (int i = 0; i< iq1.iq_data.dim1(); i++)
+  //  cout << iq1.iq_data[i][0]<< " " << iq1.iq_data[i][1] <<endl;
+}
+
+void test_lores2d(){
+
+  LORESModel lm(0.1);
+
+  Cylinder c1(5,20);
+  c1.SetCenter(0,0,0);
+  c1.SetOrientation(10,20,30);
+  lm.Add(c1,1.0);
+
+  vector<Point3D> vp;
+  lm.GetPoints(vp);
+
+  lm.DistDistributionXY(vp);
+  lm.OutputPR_XY("test2d.pr");
+
+  IQ iq(10,0.001,0.3);
+  lm.CalculateIQ_2D(&iq,10);
+
+  iq.OutputIQ("test2d.iq");
+}
+
+void test_lores2d_qxqy(){
+
+  LORESModel lm(0.1);
+
+  Cylinder c1(5,20);
+  c1.SetCenter(0,0,0);
+  c1.SetOrientation(10,20,30);
+  lm.Add(c1,1.0);
+
+  vector<Point3D> vp;
+  lm.GetPoints(vp);
+
+  lm.DistDistributionXY(vp);  
+
+  double aI = lm.CalculateIQ_2D(0.1,0.2);
+
+  cout << " a single I is: "<<aI<<" at Qx,Qy = 0.1,0.2" <<endl;
+}
+
+void test_GetCenter()
+{
+  LORESModel lm(0.1);
+
+  Sphere s1(10);
+  s1.SetCenter(-1,-1,-1);
+  Sphere s2(20);
+  s2.SetCenter(1,1,1);
+
+  lm.Add(s1,1.0);
+  lm.Add(s2,1.0);
+
+  vector<double> center(3);
+  center = lm.GetCenter();
+
+  cout << "center should be (0,0,0) after adding two spheres:"<<endl;
+  cout << center[0] <<" "<< center[1] <<" "<< center[2]<<endl;
+
+}
+
+void test_CalSingleI(){
+  LORESModel lm(0.1);
+
+  Cylinder cyn(10,40);  
+
+  lm.Add(cyn,1.0);
+
+  vector<Point3D> vp;
+  lm.GetPoints(vp);
+
+  lm.DistDistribution(vp);
+
+  double result = lm.CalculateIQ(0.1);
+  cout << "The I(0.1) is: " << result << endl;      
+}
+
+int main(){
+
+  printf("this\n");
+  cout << "Start" << endl;
+  //test_lores();
+  cout <<"testing DistDistributionXY"<<endl;
+  test_lores2d();
+
+  cout <<"testing GetCenter (center of the list of shapes)"<<endl;
+  test_GetCenter();
+
+  cout <<"testing calculate_2d(Qx,Qy)"<<endl;
+  test_lores2d_qxqy();
+  cout << "Pass" << endl;
+
+  cout <<"testing CalculateIQ(q)"<<endl;
+  test_CalSingleI();
+
+  return 0;
+}
Index: src/sans/simulation/pointsmodelpy/tests/testlores.py
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/testlores.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/testlores.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,63 @@
+if __name__ == "__main__":
+
+    from sansModeling.iqPy import iqPy
+    #from sansModeling.analmodelpy import analmodelpy as analmodelpymodule
+    from sansModeling.geoshapespy import geoshapespy
+    from sansModeling.pointsmodelpy import pointsmodelpy
+
+#    print "copyright information:"
+#    print "   ", pointsmodelpy.copyright()
+#    print "   ", pointsmodelpymodule.copyright()
+
+    print
+    print "module information:"
+    print "    file:", pointsmodelpy.__file__
+    print "    doc:", pointsmodelpy.__doc__
+    print "    contents:", dir(pointsmodelpy)
+    print "    contents:", dir(geoshapespy)
+
+#    a = geoshapespy.new_singlehelix(10,2,30,2)
+    #a = geoshapespy.new_sphere(20)
+    
+    iq = iqPy.new_iq(100,0.001, 0.3)
+
+#    geoshapespy.set_orientation(a,20,40,60)
+#    geoshapespy.set_center(a,0,0,0)
+    lm = pointsmodelpy.new_loresmodel(0.1)
+#    pointsmodelpy.lores_add(lm,a,1.0)
+
+#    b = geoshapespy.new_sphere(15)
+#    geoshapespy.set_center(b,15,15,15)
+#    pointsmodelpy.lores_add(lm,b,2.0)
+
+    
+    c = geoshapespy.new_cylinder(10,40)
+    geoshapespy.set_center(c,1,1,1)
+    geoshapespy.set_orientation(c,0,0,0)
+    pointsmodelpy.lores_add(lm,c,3.0)
+    
+#    d = geoshapespy.new_ellipsoid(10,8,6)
+#    geoshapespy.set_center(d,3,3,3)
+#    geoshapespy.set_orientation(c,30,30,30)
+#    pointsmodelpy.lores_add(lm,d,1.0)
+
+    vp = pointsmodelpy.new_point3dvec()
+    pointsmodelpy.get_lorespoints(lm,vp)
+    pointsmodelpy.outputPDB(lm,vp,"modelpy.pseudo.pdb")
+
+    print "calculating distance distribution"
+    rmax = pointsmodelpy.get_lores_pr(lm,vp)
+    print "finish calculating get_lores_pr, and rmax is:", rmax
+    pointsmodelpy.outputPR(lm,"testlores.pr")
+    pointsmodelpy.get_lores_iq(lm,iq)
+
+    iqPy.OutputIQ(iq, "testlores.iq")
+
+    print "Testing get I from a single q"
+    result = pointsmodelpy.get_lores_i(lm,0.1)
+    print "The I(0.1) is: %s" % str(result) 
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: src/sans/simulation/pointsmodelpy/tests/testlores2d.py
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/testlores2d.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/testlores2d.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,115 @@
+def test_lores2d(phi):
+  from sansModeling.pointsmodelpy import pointsmodelpy 
+  from sansModeling.iqPy import iqPy
+  from sansModeling.geoshapespy import geoshapespy
+
+  #lores model is to hold several geometric objects
+  lm = pointsmodelpy.new_loresmodel(0.1)
+
+  #generate single geometry shape
+  c = geoshapespy.new_cylinder(10,40)
+  geoshapespy.set_center(c,1,1,1)
+  geoshapespy.set_orientation(c,0,0,0)
+
+  #add single geometry shape to lores model
+  pointsmodelpy.lores_add(lm,c,3.0)
+
+  #retrieve the points from lores model for sans calculation
+  vp = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_lorespoints(lm,vp)
+
+  #Calculate I(Q) and P(r) 2D
+  pointsmodelpy.distdistribution_xy(lm,vp)
+  pointsmodelpy.outputPR_xy(lm,"out_xy.pr")
+  iq = iqPy.new_iq(100,0.001, 0.3)
+  pointsmodelpy.calculateIQ_2D(lm,iq,phi)
+  iqPy.OutputIQ(iq, "out_xy.iq")
+
+def get2d():
+  from math import pi
+  from Numeric import arange,zeros
+  from enthought.util.numerix import Float,zeros
+  from sansModeling.file2array import readfile2array
+  from sansModeling.pointsmodelpy import pointsmodelpy
+  from sansModeling.geoshapespy import geoshapespy
+
+  lm = pointsmodelpy.new_loresmodel(0.1)
+  sph = geoshapespy.new_sphere(20)
+  pointsmodelpy.lores_add(lm,sph,1.0)
+
+  vp = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_lorespoints(lm,vp)
+
+  pointsmodelpy.distdistribution_xy(lm,vp)
+
+  value_grid = zeros((100,100),Float)
+  width, height = value_grid.shape
+  print width,height
+
+  I = pointsmodelpy.calculateI_Qxy(lm,0.00001,0.000002)
+  print I
+
+  Imax = 0
+  for i in range(width):
+    for j in range(height):
+      qx = float(i-50)/200.0
+      qy = float(j-50)/200.0
+      value_grid[i,j] = pointsmodelpy.calculateI_Qxy(lm,qx,qy)
+      if value_grid[i][j] > Imax:
+        Imax = value_grid[i][j]
+
+  for i in range(width):
+    for j in range(height):
+      value_grid[i][j] = value_grid[i][j]/Imax
+
+  value_grid[50,50] = 1
+  return value_grid
+
+def get2d_2():
+  from math import pi
+  from Numeric import arange,zeros
+  from enthought.util.numerix import Float,zeros
+  from sansModeling.file2array import readfile2array
+  from sansModeling.pointsmodelpy import pointsmodelpy
+  from sansModeling.geoshapespy import geoshapespy
+
+  lm = pointsmodelpy.new_loresmodel(0.1)
+  cyn = geoshapespy.new_cylinder(5,20)
+  geoshapespy.set_orientation(cyn,0,0,90)
+  pointsmodelpy.lores_add(lm,cyn,1.0)
+
+  vp = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_lorespoints(lm,vp)
+
+  pointsmodelpy.distdistribution_xy(lm,vp)
+
+  value_grid = zeros((100,100),Float)
+  width, height = value_grid.shape
+  print width,height
+
+  I = pointsmodelpy.calculateI_Qxy(lm,0.00001,0.000002)
+  print I
+
+  Imax = 0
+  for i in range(width):
+    for j in range(height):
+      qx = float(i-50)/200.0
+      qy = float(j-50)/200.0
+      value_grid[i,j] = pointsmodelpy.calculateI_Qxy(lm,qx,qy)
+      if value_grid[i][j] > Imax:
+        Imax = value_grid[i][j]
+
+  for i in range(width):
+    for j in range(height):
+      value_grid[i][j] = value_grid[i][j]/Imax
+
+  value_grid[50,50] = 1
+  return value_grid
+  
+if __name__ == "__main__":
+
+  print "start to test lores 2D"
+#  test_lores2d(10)
+  value_grid = get2d_2()
+  print value_grid
+  print "pass"
Index: src/sans/simulation/pointsmodelpy/tests/testnegativepr.py
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/testnegativepr.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/testnegativepr.py	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,16 @@
+if __name__ == "__main__":
+  from sansModeling.pointsmodelpy import pointsmodelpy
+  from sansModeling.iqPy import iqPy
+  from sansModeling.geoshapespy import geoshapespy
+
+  a = geoshapespy.new_sphere(10)
+  lm = pointsmodelpy.new_loresmodel(0.0005)
+  pointsmodelpy.lores_add(lm,a,1.0)
+  b = geoshapespy.new_sphere(20)
+  geoshapespy.set_center(b,20,20,20)
+  pointsmodelpy.lores_add(lm,b,-1.0)
+
+  vp = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_lorespoints(lm,vp)
+
+  pointsmodelpy.get_lores_pr(lm,vp)
Index: src/sans/simulation/pointsmodelpy/tests/testpdb.cc
===================================================================
--- src/sans/simulation/pointsmodelpy/tests/testpdb.cc	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
+++ src/sans/simulation/pointsmodelpy/tests/testpdb.cc	(revision aa639ea269b76d78cd120b41705f70280ef4e03e)
@@ -0,0 +1,42 @@
+#include "pdb_model.h"
+#include "Point3D.h"
+#include <vector>
+#include <string>
+#include "iq.h"
+
+typedef vector<Point3D> PointsVector;
+
+int main(){
+
+  //Test PDB with adding one normal pdb file
+  PointsVector vp;
+  IQ iq(100,0.001,0.3);
+
+  string name("test.pdb");
+
+  //initialize a PDBModel with a pdb file name
+  PDBModel mpdb;
+  mpdb.AddPDB(name);
+  //parse coordinates in pdb file into a vector
+  //of points
+  mpdb.GetPoints(vp);
+  //output the vector of points into a pseudo pdb
+  //file, for testing only
+  mpdb.OutputPDB(vp,"testpdb.pdb");
+  mpdb.DistDistribution(vp);
+  mpdb.OutputPR("test.pr");
+  mpdb.CalculateIQ(&iq);
+  iq.OutputIQ("test.iq");
+  cout << "check test.pr and test.iq files" <<endl;
+
+
+  //second test: add second pdb file
+  vector<Point3D> vp2;
+  string second("test2.pdb");
+  mpdb.AddPDB(second);
+  mpdb.GetPoints(vp2);
+  mpdb.OutputPDB(vp2,"testpdb2.pdb");
+  cout <<"check whether testpdb2.pdb has 12 points" <<endl;
+
+  return 0;
+}
