source: sasview/sansmodels/src/setup.py @ 8a25523

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 8a25523 was 8e36cdd, checked in by Jae Cho <jhjcho@…>, 15 years ago

fixed and tested ppmodel 2d and cleaned it up.

  • Property mode set to 100644
File size: 8.3 KB
Line 
1"""
2 Installation script for SANS models
3
4  - To compile and install:
5      python setup.py install
6  - To create distribution:
7      python setup.py bdist_wininst
8  - To create odb files:
9      python setup.py odb
10
11"""
12import sys
13import os
14
15
16numpy_incl_path = os.path.join(sys.prefix, "Lib", "site-packages", "numpy", "core", "include", "numpy")
17
18
19
20def createODBcontent(class_name):
21    """
22        Return the content of the Pyre odb file for a given class
23        @param class_name: Name of the class to write an odb file for [string]
24        @return: content of the file [string]
25    """
26    content  = "\"\"\"\n"
27    content += "  Facility for SANS model\n\n"
28    content += "  WARNING: THIS FILE WAS AUTOGENERATED AT INSTALL TIME\n"
29    content += "           DO NOT MODIFY\n\n"
30    content += "  This code was written as part of the DANSE project\n"
31    content += "  http://danse.us/trac/sans/\n"
32    content += "  @copyright 2007:"
33    content += "  SANS/DANSE Group (University of Tennessee), for the DANSE project\n\n"
34    content += "\"\"\"\n"
35    content += "def model():\n"
36    content += "    from ScatteringIntensityFactory import ScatteringIntensityFactory\n"
37    content += "    from sans.models.%s import %s\n" % (class_name, class_name)
38    content += "    return ScatteringIntensityFactory(%s)('%s')\n"\
39                 % (class_name, class_name)
40
41    return content
42
43def createODBfiles():
44    """
45       Create odb files for all available models
46    """
47    from sans.models.ModelFactory import ModelFactory
48   
49    class_list = ModelFactory().getAllModels()
50    for name in class_list:
51        odb = open("sans/models/pyre/%s.odb" % name, 'w')
52        odb.write(createODBcontent(name))
53        odb.close()
54        print "sans/models/pyre/%s.odb created" % name
55       
56#
57# Proceed with installation
58#
59
60# First, create the odb files
61if len(sys.argv) > 1 and sys.argv[1].lower() == 'odb':
62    print "Creating odb files"
63    try:
64        createODBfiles()
65    except:   
66        print "ERROR: could not create odb files"
67        print sys.exc_value
68    sys.exit()
69
70# Then build and install the modules
71from distutils.core import setup, Extension
72
73
74# Build the module name
75srcdir  = "sans/models/c_extensions"
76igordir = "libigor"
77
78print "Installing SANS models"
79
80
81setup(
82    name="models",
83    version = "0.1",
84    description = "Python module for SANS scattering models",
85    author = "Mathieu Doucet",
86    author_email = "doucet@nist.gov",
87    url = "http://danse.us/trac/sans",
88   
89    # Place this module under the sans package
90    #ext_package = "sans",
91   
92    # Use the pure python modules
93    package_dir = {"sans_extension":"sans/models/c_extensions"},
94   
95    packages = ["sans","sans.models","sans.models.test",
96                "sans_extension","sans.models.pyre"],
97   
98    ext_modules = [ Extension("sans_extension.c_models",
99     sources = [
100        "sans/models/c_models/c_models.cpp",
101        #srcdir+"/CSphereModel.c",
102        #srcdir+"/sphere.c",
103        "sans/models/c_models/CSphereModel.cpp",
104        srcdir+"/SquareWell.c",
105        "sans/models/c_models/CSquareWellStructure.cpp", 
106        "sans/models/c_models/SquareWell.cpp", 
107        srcdir+"/StickyHS.c",         
108        "sans/models/c_models/CStickyHSStructure.cpp", 
109        "sans/models/c_models/StickyHS.cpp",     
110        srcdir+"/Hardsphere.c",         
111        "sans/models/c_models/CHardsphereStructure.cpp", 
112        "sans/models/c_models/Hardsphere.cpp",     
113        srcdir+"/DiamCyl.c",         
114        "sans/models/c_models/CDiamCylFunc.cpp", 
115        "sans/models/c_models/DiamCyl.cpp",   
116        srcdir+"/DiamEllip.c",         
117        "sans/models/c_models/CDiamEllipFunc.cpp", 
118        "sans/models/c_models/DiamEllip.cpp",   
119        srcdir+"/HayterMSA.c",         
120        "sans/models/c_models/CHayterMSAStructure.cpp", 
121        "sans/models/c_models/HayterMSA.cpp",             
122        "sans/models/c_models/sphere.cpp",
123        #srcdir+"/CCylinderModel.c",
124        "sans/models/c_models/CCylinderModel.cpp",
125        "sans/models/c_models/cylinder.cpp",
126        "sans/models/c_models/parameters.cpp",
127        "sans/models/c_models/dispersion_visitor.cpp",
128        srcdir+"/cylinder.c",
129        #srcdir+"/CParallelepiped.c",
130        "sans/models/c_models/CParallelepipedModel.cpp",
131        "sans/models/c_models/parallelepiped.cpp",
132        srcdir+"/parallelepiped.c",
133        #srcdir+"/CCoreShellCylinderModel.c",
134        "sans/models/c_models/CCoreShellCylinderModel.cpp",
135        "sans/models/c_models/coreshellcylinder.cpp",
136        srcdir+"/core_shell_cylinder.c",
137        #srcdir+"/CHollowCylinderModel.c",
138        "sans/models/c_models/CHollowCylinderModel.cpp",
139        "sans/models/c_models/hollowcylinder.cpp",
140        srcdir+"/hollow_cylinder.c",
141        #srcdir+"/CCoreShellModel.c",
142        #srcdir+"/core_shell.c",
143        "sans/models/c_models/CCoreShellModel.cpp",
144        "sans/models/c_models/coreshellsphere.cpp",
145        #srcdir+"/CEllipsoidModel.c",
146        "sans/models/c_models/CEllipsoidModel.cpp",
147        "sans/models/c_models/ellipsoid.cpp",       
148        srcdir+"/ellipsoid.c",
149        #srcdir+"/CEllipticalCylinderModel.c",
150        "sans/models/c_models/CEllipticalCylinderModel.cpp",
151        "sans/models/c_models/ellipticalcylinder.cpp",               
152        srcdir+"/elliptical_cylinder.c",
153        #srcdir+"/CTriaxialEllipsoidModel.c",
154        "sans/models/c_models/CTriaxialEllipsoidModel.cpp",
155        "sans/models/c_models/triaxialellipsoid.cpp",               
156        srcdir+"/triaxial_ellipsoid.c",
157        #srcdir+"/CFlexibleCylinderModel.c",
158        "sans/models/c_models/CFlexibleCylinderModel.cpp",
159        "sans/models/c_models/flexiblecylinder.cpp",               
160        srcdir+"/flexible_cylinder.c",
161        #srcdir+"/CStakedDisksModel.c",
162        "sans/models/c_models/CStackedDisksModel.cpp",
163        "sans/models/c_models/stackeddisks.cpp",               
164        srcdir+"/stacked_disks.c",
165        #srcdir+"/CLamellarModel.c",
166        "sans/models/c_models/CLamellarModel.cpp",
167        "sans/models/c_models/lamellar.cpp",               
168        srcdir+"/lamellar.c",
169        #srcdir+"/CLamellarFFHGModel.c",
170        "sans/models/c_models/CLamellarFFHGModel.cpp",
171        "sans/models/c_models/lamellarFF_HG.cpp",               
172        srcdir+"/lamellarFF_HG.c",
173        #srcdir+"/CLamellarPSModel.c",
174        "sans/models/c_models/CLamellarPSModel.cpp",
175        "sans/models/c_models/lamellarPS.cpp",               
176        srcdir+"/lamellarPS.c",
177        #srcdir+"/CLamellarPSHGModel.c",
178        "sans/models/c_models/CLamellarPSHGModel.cpp",
179        "sans/models/c_models/lamellarPS_HG.cpp",               
180        srcdir+"/lamellarPS_HG.c",
181        #srcdir+"/COblateModel.c",
182        "sans/models/c_models/CCoreShellEllipsoidModel.cpp",
183        "sans/models/c_models/spheroid.cpp",   
184        srcdir+"/spheroid.c",             
185        #srcdir+"/COblateModel.c",
186        "sans/models/c_models/COblateModel.cpp",
187        "sans/models/c_models/oblate.cpp",               
188        srcdir+"/oblate.c",
189        #srcdir+"/CProlateModel.c",
190        "sans/models/c_models/CProlateModel.cpp",
191        "sans/models/c_models/prolate.cpp",               
192        srcdir+"/prolate.c",
193        #srcdir+"/CMultishellModel.c",
194        "sans/models/c_models/CMultishellModel.cpp",
195        "sans/models/c_models/multishell.cpp",               
196        srcdir+"/multishell.c",
197        #srcdir+"/CVesicleModel.c",
198        "sans/models/c_models/CVesicleModel.cpp",
199        "sans/models/c_models/vesicle.cpp",               
200        srcdir+"/vesicle.c",
201        #srcdir+"/CBinaryHSModel.c",
202        "sans/models/c_models/CBinaryHSModel.cpp",
203        "sans/models/c_models/binaryHS.cpp",               
204        srcdir+"/binaryHS.c",
205        srcdir+"/disperser.c",
206        igordir+"/libCylinder.c",
207        igordir+"/libStructureFactor.c",
208        igordir+"/libSphere.c",
209        srcdir+"/gaussian.c",
210        srcdir+"/CGaussian.c",
211        srcdir+"/logNormal.c",
212        srcdir+"/CLogNormal.c",
213        srcdir+"/schulz.c",
214        srcdir+"/CSchulz.c",
215        srcdir+"/lorentzian.c",
216        srcdir+"/CLorentzian.c"
217            ],
218         include_dirs=[igordir,srcdir,"sans/models/c_models",numpy_incl_path])])
219       
Note: See TracBrowser for help on using the repository browser.