source: sasview/sansmodels/src/setup.py @ 72c7d31

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 72c7d31 was 3d25331f, checked in by Gervaise Alina <gervyh@…>, 15 years ago

add more model 1d and 2 D

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