File: __init__.py

package info (click to toggle)
sasmodels 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 15,888 kB
  • sloc: python: 25,392; ansic: 7,377; makefile: 149; sh: 61
file content (48 lines) | stat: -rw-r--r-- 1,791 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
sasmodels
=========

**sasmodels** is a package containing models for small angle neutron and xray
scattering.  Models supported are the one dimensional circular average and
two dimensional oriented patterns.  As well as the form factor calculations
for the individual shapes **sasmodels** also provides automatic shape
polydispersity, angular dispersion and resolution convolution.  SESANS
patterns can be computed for any model.

Models can be written in python or in C.  C models can run on the GPU if
OpenCL drivers are available.  See :mod:`generate` for details on
defining new models.
"""
__version__ = "1.0"

def data_files():
    """
    Return the data files to be installed with the package.

    The format is a list of (directory, [files...]) pairs which can be
    used directly in setup(...,data_files=...) for setup.py.
    """
    from os.path import join as joinpath
    import glob

    from .generate import EXTERNAL_DIR, DATA_PATH

    def _expand_patterns(path, patterns):
        target_path = joinpath(EXTERNAL_DIR, *path)
        source_path = joinpath(DATA_PATH, *path)
        files = []
        for p in patterns:
            files.extend(glob.glob(joinpath(source_path, p)))
        return target_path, files

    # Place the source for the model tree in the distribution.  Minimally we
    # need the c and cl files for running on OpenCL.  Need the py files so
    # users can easily copy existing models.  Need the img files so that we
    # can build model docs on the fly, including images.
    return_list = [
        _expand_patterns([], ['*.c', '*.cl']),
        _expand_patterns(['models'], ['*.py', '*.c']),
        _expand_patterns(['models', 'lib'], ['*.c']),
        _expand_patterns(['models', 'img'], ['*.*']),
        ]
    return return_list