Changes in / [aff7904:3371d81] in sasview


Ignore:
Files:
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • check_packages.py

    r243fbc0 r96e151f  
    77# Fix for error: hash-collision-3-both-1-and-1/ 
    88# See http://jaredforsyth.com/blog/2010/apr/28/accessinit-hash-collision-3-both-1-and-1/ 
    9 import PIL.Image 
    10 sys.modules['Image'] = PIL.Image 
     9try: 
     10    import PIL.Image 
     11except ImportError: 
     12    pass 
     13else: 
     14    sys.modules['Image'] = PIL.Image 
     15 
    1116 
    1217common_required_package_list = { 
  • docs/sphinx-docs/Makefile

    rc23de6a r1d5f5c2  
    118118        $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 
    119119        @echo "Running LaTeX files through pdflatex..." 
    120         $(MAKE) -C $(BUILDDIR)/latex all-pdf 
     120        "$(MAKE)" -C $(BUILDDIR)/latex all-pdf 
    121121        @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 
    122122 
     
    124124        $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 
    125125        @echo "Running LaTeX files through platex and dvipdfmx..." 
    126         $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 
     126        "$(MAKE)" -C $(BUILDDIR)/latex all-pdf-ja 
    127127        @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 
    128128 
  • sasview/installer_generator.py

    r50008e3 r6a698c0  
    197197    msg += """Source: "dist\*";\tDestDir: "{app}";\t""" 
    198198    msg += """Flags: ignoreversion recursesubdirs createallsubdirs\n""" 
    199     msg += """Source: "dist\plugin_models\*";\tDestDir: "{userdesktop}\..\.sasview\plugin_models";\t"""  
     199    msg += """Source: "dist\plugin_models\*";\tDestDir: "{userdesktop}\..\.sasview\plugin_models";\t""" 
     200    msg += """Flags: recursesubdirs createallsubdirs\n"""  
     201    msg += """Source: "dist\compiled_models\*";\tDestDir: "{userdesktop}\..\.sasmodels\compiled_models";\t""" 
    200202    msg += """Flags: recursesubdirs createallsubdirs\n""" 
    201203    msg += """Source: "dist\config\custom_config.py";\tDestDir: "{userdesktop}\..\.sasview\config";\t"""  
  • sasview/setup_exe.py

    ra7c4ad2 r6a698c0  
    197197# Select the appropriate manifest to use. 
    198198py26MSdll_x86 = None 
    199 if sys.version_info >= (3, 0) or sys.version_info < (2, 5): 
    200     print "*** This script only works with Python 2.5, 2.6, or 2.7." 
     199if sys.version_info >= (3, 0) or sys.version_info < (2, 6): 
     200    print "*** This script only works with Python 2.6 or 2.7." 
    201201    sys.exit() 
    202202elif sys.version_info >= (2, 6): 
     
    208208    except: 
    209209        pass 
    210 elif sys.version_info >= (2, 5): 
    211     manifest = manifest_for_python25 
    212     py26MSdll = None 
    213210 
    214211 
     
    256253data_files += guiframe.data_files() 
    257254 
    258 #import sas.models as models 
    259 import sasmodels.models as models 
    260 data_files += models.data_files() 
     255# precompile sas models into the sasview build path; doesn't matter too much 
     256# where it is so long as it is a place that will get cleaned up afterwards. 
     257import sasmodels.core 
     258dll_path = os.path.join(build_path, 'compiled_models') 
     259compiled_dlls += sasmodels.core.precompile_dlls(dll_path, dtype='double') 
     260 
     261# include the compiled models as data; coordinate the target path for the 
     262# data with installer_generator.py 
     263datafiles.append('compiled_models', compiled_dlls) 
     264 
     265import sasmodels 
     266data_files += sasmodels.data_files() 
    261267 
    262268for f in matplotlibdata: 
  • setup.py

    r5881b17 re791cca  
    99from distutils.command.build_ext import build_ext 
    1010from distutils.core import Command 
    11 from shutil import rmtree 
    12  
    13 try: 
    14     from numpy.distutils.misc_util import get_numpy_include_dirs 
    15     NUMPY_INC = get_numpy_include_dirs()[0] 
    16 except: 
    17     try: 
    18         import numpy 
    19         NUMPY_INC = os.path.join(os.path.split(numpy.__file__)[0],  
    20                                  "core","include") 
    21     except: 
    22         msg = "\nNumpy is needed to build SasView. " 
    23         print msg, "Try easy_install numpy.\n  %s" % str(sys.exc_value) 
    24         sys.exit(0) 
    2511 
    2612# Manage version number ###################################### 
     
    204190 
    205191# sas.sascalc.calculator 
    206 numpy_incl_path = os.path.join(NUMPY_INC, "numpy") 
    207192gen_dir = os.path.join("src", "sas", "sascalc", "calculator", "c_extensions") 
    208193package_dir["sas.sascalc.calculator.core"] = gen_dir 
     
    215200            os.path.join(gen_dir, "libfunc.c"), 
    216201            os.path.join(gen_dir, "librefl.c"), 
    217             os.path.join(gen_dir, "winFuncs.c"), 
    218202        ], 
    219         include_dirs=[numpy_incl_path, gen_dir], 
     203        include_dirs=[gen_dir], 
    220204    ) 
    221205) 
     
    231215                                         os.path.join(srcdir, "invertor.c"), 
    232216                                         ], 
    233                               include_dirs=[numpy_incl_path], 
     217                              include_dirs=[], 
    234218                              ) ) 
    235219         
     
    267251# package_dir["sas.models"] = os.path.join("src", "sas", "models") 
    268252# packages.append("sas.models") 
    269  
    270 IGNORED_FILES = [".svn"] 
    271 if not os.name=='nt': 
    272     IGNORED_FILES.extend(["gamma_win.c","winFuncs.c"]) 
    273253 
    274254EXTENSIONS = [".c", ".cpp"] 
     
    281261        if os.path.isfile(os.path.join(dir_path, f)): 
    282262            _, ext = os.path.splitext(f) 
    283             if ext.lower() in EXTENSIONS and f not in IGNORED_FILES: 
     263            if ext.lower() in EXTENSIONS: 
    284264                file_list.append(os.path.join(dir_path, f)) 
    285265        elif os.path.isdir(os.path.join(dir_path, f)) and \ 
     
    289269                if os.path.isfile(os.path.join(sub_dir, new_f)): 
    290270                    _, ext = os.path.splitext(new_f) 
    291                     if ext.lower() in EXTENSIONS and\ 
    292                          new_f not in IGNORED_FILES: 
     271                    if ext.lower() in EXTENSIONS: 
    293272                        file_list.append(os.path.join(sub_dir, new_f)) 
    294273 
     
    334313    required.extend(['html5lib', 'reportlab']) 
    335314else: 
    336     required.extend(['pil']) 
     315    # 'pil' is now called 'pillow' 
     316    required.extend(['pillow']) 
    337317 
    338318# Set up SasView     
  • src/sas/sascalc/calculator/c_extensions/librefl.c

    r9e531f2 r4c29e4d  
    88#include <stdlib.h> 
    99#if defined(_MSC_VER) 
    10 #include "winFuncs.h" 
     10#define NEED_ERF 
    1111#endif 
     12 
     13 
     14 
     15#if defined(NEED_ERF) 
     16/* erf.c  - public domain implementation of error function erf(3m) 
     17 
     18reference - Haruhiko Okumura: C-gengo niyoru saishin algorithm jiten 
     19            (New Algorithm handbook in C language) (Gijyutsu hyouron 
     20            sha, Tokyo, 1991) p.227 [in Japanese]                 */ 
     21 
     22 
     23#ifdef _WIN32 
     24# include <float.h> 
     25# if !defined __MINGW32__ || defined __NO_ISOCEXT 
     26#  ifndef isnan 
     27#   define isnan(x) _isnan(x) 
     28#  endif 
     29#  ifndef isinf 
     30#   define isinf(x) (!_finite(x) && !_isnan(x)) 
     31#  endif 
     32#  ifndef finite 
     33#   define finite(x) _finite(x) 
     34#  endif 
     35# endif 
     36#endif 
     37 
     38static double q_gamma(double, double, double); 
     39 
     40/* Incomplete gamma function 
     41   1 / Gamma(a) * Int_0^x exp(-t) t^(a-1) dt  */ 
     42static double p_gamma(double a, double x, double loggamma_a) 
     43{ 
     44    int k; 
     45    double result, term, previous; 
     46 
     47    if (x >= 1 + a) return 1 - q_gamma(a, x, loggamma_a); 
     48    if (x == 0)     return 0; 
     49    result = term = exp(a * log(x) - x - loggamma_a) / a; 
     50    for (k = 1; k < 1000; k++) { 
     51        term *= x / (a + k); 
     52        previous = result;  result += term; 
     53        if (result == previous) return result; 
     54    } 
     55    fprintf(stderr, "erf.c:%d:p_gamma() could not converge.", __LINE__); 
     56    return result; 
     57} 
     58 
     59/* Incomplete gamma function 
     60   1 / Gamma(a) * Int_x^inf exp(-t) t^(a-1) dt  */ 
     61static double q_gamma(double a, double x, double loggamma_a) 
     62{ 
     63    int k; 
     64    double result, w, temp, previous; 
     65    double la = 1, lb = 1 + x - a;  /* Laguerre polynomial */ 
     66 
     67    if (x < 1 + a) return 1 - p_gamma(a, x, loggamma_a); 
     68    w = exp(a * log(x) - x - loggamma_a); 
     69    result = w / lb; 
     70    for (k = 2; k < 1000; k++) { 
     71        temp = ((k - 1 - a) * (lb - la) + (k + x) * lb) / k; 
     72        la = lb;  lb = temp; 
     73        w *= (k - 1 - a) / k; 
     74        temp = w / (la * lb); 
     75        previous = result;  result += temp; 
     76        if (result == previous) return result; 
     77    } 
     78    fprintf(stderr, "erf.c:%d:q_gamma() could not converge.", __LINE__); 
     79    return result; 
     80} 
     81 
     82#define LOG_PI_OVER_2 0.572364942924700087071713675675 /* log_e(PI)/2 */ 
     83 
     84double erf(double x) 
     85{ 
     86    if (!finite(x)) { 
     87        if (isnan(x)) return x;      /* erf(NaN)   = NaN   */ 
     88        return (x>0 ? 1.0 : -1.0);   /* erf(+-inf) = +-1.0 */ 
     89    } 
     90    if (x >= 0) return   p_gamma(0.5, x * x, LOG_PI_OVER_2); 
     91    else        return - p_gamma(0.5, x * x, LOG_PI_OVER_2); 
     92} 
     93 
     94double erfc(double x) 
     95{ 
     96    if (!finite(x)) { 
     97        if (isnan(x)) return x;      /* erfc(NaN)   = NaN      */ 
     98        return (x>0 ? 0.0 : 2.0);    /* erfc(+-inf) = 0.0, 2.0 */ 
     99    } 
     100    if (x >= 0) return  q_gamma(0.5, x * x, LOG_PI_OVER_2); 
     101    else        return  1 + p_gamma(0.5, x * x, LOG_PI_OVER_2); 
     102} 
     103#endif // NEED_ERF 
    12104 
    13105complex cassign(real, imag) 
  • src/sas/sascalc/calculator/c_extensions/sld2i.cpp

    r9e531f2 rb523c0e  
    164164        //Assume that pixel volumes are given in vol_pix in A^3 unit 
    165165        // Loop over q-values and multiply apply matrix 
    166         for(size_t i=0; i<npoints; i++){ 
     166        for(int i=0; i<npoints; i++){ 
    167167                sumj =0.0;               
    168                 for(size_t j=0; j<n_pix; j++){ 
     168                for(int j=0; j<n_pix; j++){ 
    169169                        //Isotropic: Assumes all slds are real (no magnetic) 
    170170                        //Also assumes there is no polarization: No dependency on spin 
     
    183183                                //full calculation 
    184184                                //pragma omp parallel for 
    185                                 for(size_t k=0; k<n_pix; k++){ 
     185                                for(int k=0; k<n_pix; k++){ 
    186186                                        sld_j =  sldn_val[j] * sldn_val[k] * vol_pix[j] * vol_pix[k]; 
    187187                                        qr = (x_val[j]-x_val[k])*(x_val[j]-x_val[k])+ 
  • src/sas/sascalc/calculator/c_extensions/sld2i.hh

    r9e531f2 r4c29e4d  
    3939                        double s_theta); 
    4040        // compute function 
    41         virtual void genicomXY(int npoints, double* qx, double* qy, double *I_out); 
    42         virtual void genicom(int npoints, double* q, double *I_out); 
     41        void genicomXY(int npoints, double* qx, double* qy, double *I_out); 
     42        void genicom(int npoints, double* q, double *I_out); 
    4343}; 
    4444 
  • src/sas/sascalc/calculator/c_extensions/sld2i_module.cpp

    r9e531f2 rb523c0e  
    153153initsld2i(void) 
    154154{ 
    155     PyObject* m; 
    156  
    157     m = Py_InitModule3("sld2i", module_methods, 
    158                        "Sld2i module"); 
     155    Py_InitModule3("sld2i", module_methods, "Sld2i module"); 
    159156} 
  • src/sas/sascalc/pr/c_extensions/Cinvertor.c

    rb699768 rb523c0e  
    115115 
    116116        //self->params.x = data; 
    117         self->params.npoints = ndata; 
     117        self->params.npoints = (int)ndata; 
    118118        return Py_BuildValue("i", self->params.npoints); 
    119119} 
     
    180180 
    181181        //self->params.y = data; 
    182         self->params.ny = ndata; 
     182        self->params.ny = (int)ndata; 
    183183        return Py_BuildValue("i", self->params.ny); 
    184184} 
     
    245245 
    246246        //self->params.err = data; 
    247         self->params.nerr = ndata; 
     247        self->params.nerr = (int)ndata; 
    248248        return Py_BuildValue("i", self->params.nerr); 
    249249} 
     
    523523    residuals = PyList_New(self->params.npoints); 
    524524 
    525     regterm = reg_term(pars, self->params.d_max, npars, nslice); 
     525    regterm = reg_term(pars, self->params.d_max, (int)npars, nslice); 
    526526 
    527527    for(i=0; i<self->params.npoints; i++) { 
    528         diff = self->params.y[i] - iq(pars, self->params.d_max, npars, self->params.x[i]); 
     528        diff = self->params.y[i] - iq(pars, self->params.d_max, (int)npars, self->params.x[i]); 
    529529        residual = diff*diff / (self->params.err[i]*self->params.err[i]); 
    530530 
     
    573573    residuals = PyList_New(self->params.npoints); 
    574574 
    575     regterm = reg_term(pars, self->params.d_max, npars, nslice); 
     575    regterm = reg_term(pars, self->params.d_max, (int)npars, nslice); 
    576576 
    577577 
    578578    for(i=0; i<self->params.npoints; i++) { 
    579         diff = self->params.y[i] - pr(pars, self->params.d_max, npars, self->params.x[i]); 
     579        diff = self->params.y[i] - pr(pars, self->params.d_max, (int)npars, self->params.x[i]); 
    580580        residual = diff*diff / (self->params.err[i]*self->params.err[i]); 
    581581 
     
    611611        OUTVECTOR(data_obj,pars,npars); 
    612612 
    613         iq_value = iq(pars, self->params.d_max, npars, q); 
     613        iq_value = iq(pars, self->params.d_max, (int)npars, q); 
    614614        return Py_BuildValue("f", iq_value); 
    615615} 
     
    636636        OUTVECTOR(data_obj,pars,npars); 
    637637 
    638         iq_value = iq_smeared(pars, self->params.d_max, npars, 
     638        iq_value = iq_smeared(pars, self->params.d_max, (int)npars, 
    639639                                                        self->params.slit_height, self->params.slit_width, 
    640640                                                        q, 21); 
     
    661661        OUTVECTOR(data_obj,pars,npars); 
    662662 
    663         pr_value = pr(pars, self->params.d_max, npars, r); 
     663        pr_value = pr(pars, self->params.d_max, (int)npars, r); 
    664664        return Py_BuildValue("f", pr_value); 
    665665} 
     
    689689 
    690690        if (err_obj == Py_None) { 
    691                 pr_value = pr(pars, self->params.d_max, npars, r); 
     691                pr_value = pr(pars, self->params.d_max, (int)npars, r); 
    692692                pr_err_value = 0.0; 
    693693        } else { 
    694694                OUTVECTOR(err_obj,pars_err,npars2); 
    695                 pr_err(pars, pars_err, self->params.d_max, npars, r, &pr_value, &pr_err_value); 
     695                pr_err(pars, pars_err, self->params.d_max, (int)npars, r, &pr_value, &pr_err_value); 
    696696        } 
    697697        return Py_BuildValue("ff", pr_value, pr_err_value); 
     
    728728        OUTVECTOR(data_obj,pars,npars); 
    729729 
    730         oscill = reg_term(pars, self->params.d_max, npars, 100); 
    731         norm   = int_p2(pars, self->params.d_max, npars, 100); 
     730        oscill = reg_term(pars, self->params.d_max, (int)npars, 100); 
     731        norm   = int_p2(pars, self->params.d_max, (int)npars, 100); 
    732732        return Py_BuildValue("f", sqrt(oscill/norm)/acos(-1.0)*self->params.d_max ); 
    733733 
     
    749749        OUTVECTOR(data_obj,pars,npars); 
    750750 
    751         count = npeaks(pars, self->params.d_max, npars, 100); 
     751        count = npeaks(pars, self->params.d_max, (int)npars, 100); 
    752752 
    753753        return Py_BuildValue("i", count ); 
     
    770770        OUTVECTOR(data_obj,pars,npars); 
    771771 
    772         fraction = positive_integral(pars, self->params.d_max, npars, 100); 
     772        fraction = positive_integral(pars, self->params.d_max, (int)npars, 100); 
    773773 
    774774        return Py_BuildValue("f", fraction ); 
     
    795795        OUTVECTOR(err_obj,pars_err,npars2); 
    796796 
    797         fraction = positive_errors(pars, pars_err, self->params.d_max, npars, 51); 
     797        fraction = positive_errors(pars, pars_err, self->params.d_max, (int)npars, 51); 
    798798 
    799799        return Py_BuildValue("f", fraction ); 
     
    815815        OUTVECTOR(data_obj,pars,npars); 
    816816 
    817         value = rg(pars, self->params.d_max, npars, 101); 
     817        value = rg(pars, self->params.d_max, (int)npars, 101); 
    818818 
    819819        return Py_BuildValue("f", value ); 
     
    835835        OUTVECTOR(data_obj,pars,npars); 
    836836 
    837         value = 4.0*acos(-1.0)*int_pr(pars, self->params.d_max, npars, 101); 
     837        value = 4.0*acos(-1.0)*int_pr(pars, self->params.d_max, (int)npars, 101); 
    838838 
    839839        return Py_BuildValue("f", value ); 
Note: See TracChangeset for help on using the changeset viewer.