source: sasview/sansmodels/src/setup.py @ f9a1279

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 f9a1279 was 6c13861, checked in by Chris Farrow <cfarrow@…>, 15 years ago

Fixing bad correction.

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