source: sasview/sansmodels/src/setup.py @ 4d74a8f

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 4d74a8f was 25579e8, checked in by Jae Cho <jhjcho@…>, 16 years ago

Enable structure factors

  • Property mode set to 100644
File size: 5.0 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
14def createODBcontent(class_name):
15    """
16        Return the content of the Pyre odb file for a given class
17        @param class_name: Name of the class to write an odb file for [string]
18        @return: content of the file [string]
19    """
20    content  = "\"\"\"\n"
21    content += "  Facility for SANS model\n\n"
22    content += "  WARNING: THIS FILE WAS AUTOGENERATED AT INSTALL TIME\n"
23    content += "           DO NOT MODIFY\n\n"
24    content += "  This code was written as part of the DANSE project\n"
25    content += "  http://danse.us/trac/sans/\n"
26    content += "  @copyright 2007:"
[25579e8]27    content += "  SANS/DANSE Group (University of Tennessee), for the DANSE project\n\n"
[ae3ce4e]28    content += "\"\"\"\n"
29    content += "def model():\n"
30    content += "    from ScatteringIntensityFactory import ScatteringIntensityFactory\n"
31    content += "    from sans.models.%s import %s\n" % (class_name, class_name)
32    content += "    return ScatteringIntensityFactory(%s)('%s')\n"\
33                 % (class_name, class_name)
34
35    return content
36
37def createODBfiles():
38    """
39       Create odb files for all available models
40    """
41    from sans.models.ModelFactory import ModelFactory
42   
43    class_list = ModelFactory().getAllModels()
44    for name in class_list:
45        odb = open("sans/models/pyre/%s.odb" % name, 'w')
46        odb.write(createODBcontent(name))
47        odb.close()
48        print "sans/models/pyre/%s.odb created" % name
49       
50#
51# Proceed with installation
52#
53
54# First, create the odb files
55if len(sys.argv) > 1 and sys.argv[1].lower() == 'odb':
56    print "Creating odb files"
57    try:
58        createODBfiles()
59    except:   
60        print "ERROR: could not create odb files"
61        print sys.exc_value
62    sys.exit()
63
64# Then build and install the modules
65from distutils.core import setup, Extension
66
67
68# Build the module name
69srcdir  = "sans/models/c_extensions"
70igordir = "libigor"
71
72print "Installing SANS models"
73
74
75setup(
76    name="models",
77    version = "0.1",
78    description = "Python module for SANS scattering models",
79    author = "Mathieu Doucet",
80    author_email = "doucet@nist.gov",
81    url = "http://danse.us/trac/sans",
82   
83    # Place this module under the sans package
84    #ext_package = "sans",
85   
86    # Use the pure python modules
87    package_dir = {"sans_extension":"sans/models/c_extensions"},
88   
89    packages = ["sans","sans.models","sans.models.test",
90                "sans_extension","sans.models.pyre"],
91   
92    ext_modules = [ Extension("sans_extension.c_models",
93     sources = [
[8809e48]94        "sans/models/c_models/c_models.cpp",
[0f5bc9f]95        #srcdir+"/CSphereModel.c",
96        #srcdir+"/sphere.c",
97        "sans/models/c_models/CSphereModel.cpp",
[25579e8]98        srcdir+"/SquareWell.c",
99        "sans/models/c_models/CSquareWellStructure.cpp", 
100        "sans/models/c_models/SquareWell.cpp", 
101        srcdir+"/StickyHS.c",         
102        "sans/models/c_models/CStickyHSStructure.cpp", 
103        "sans/models/c_models/StickyHS.cpp",     
104        srcdir+"/Hardsphere.c",         
105        "sans/models/c_models/CHardsphereStructure.cpp", 
106        "sans/models/c_models/Hardsphere.cpp",     
107        srcdir+"/HayterMSA.c",         
108        "sans/models/c_models/CHayterMSAStructure.cpp", 
109        "sans/models/c_models/HayterMSA.cpp",     
[0f5bc9f]110        "sans/models/c_models/sphere.cpp",
[af03ddd]111        #srcdir+"/CCylinderModel.c",
112        "sans/models/c_models/CCylinderModel.cpp",
113        "sans/models/c_models/cylinder.cpp",
114        "sans/models/c_models/parameters.cpp",
115        "sans/models/c_models/dispersion_visitor.cpp",
[ae3ce4e]116        srcdir+"/cylinder.c",
[0f5bc9f]117        #srcdir+"/CCoreShellCylinderModel.c",
118        "sans/models/c_models/CCoreShellCylinderModel.cpp",
119        "sans/models/c_models/coreshellcylinder.cpp",
[ae3ce4e]120        srcdir+"/core_shell_cylinder.c",
[0f5bc9f]121        #srcdir+"/CCoreShellModel.c",
122        #srcdir+"/core_shell.c",
123        "sans/models/c_models/CCoreShellModel.cpp",
124        "sans/models/c_models/coreshellsphere.cpp",
125        #srcdir+"/CEllipsoidModel.c",
126        "sans/models/c_models/CEllipsoidModel.cpp",
127        "sans/models/c_models/ellipsoid.cpp",       
[ae3ce4e]128        srcdir+"/ellipsoid.c",
[0f5bc9f]129        #srcdir+"/CEllipticalCylinderModel.c",
130        "sans/models/c_models/CEllipticalCylinderModel.cpp",
131        "sans/models/c_models/ellipticalcylinder.cpp",               
[ae3ce4e]132        srcdir+"/elliptical_cylinder.c",
133        srcdir+"/disperser.c",
134        igordir+"/libCylinder.c",
[25579e8]135        igordir+"/libStructureFactor.c",
[ae3ce4e]136        igordir+"/libSphere.c",
137        srcdir+"/gaussian.c",
138        srcdir+"/CGaussian.c",
139        srcdir+"/lorentzian.c",
140        srcdir+"/CLorentzian.c"
141            ],
[af03ddd]142         include_dirs=[igordir,srcdir,"sans/models/c_models"])])
[ae3ce4e]143       
Note: See TracBrowser for help on using the repository browser.