Changes in / [c22b621:2b538cd] in sasview


Ignore:
Files:
55 added
20 edited

Legend:

Unmodified
Added
Removed
  • docs/sphinx-docs/build_sphinx.py

    rdf72475 r6e546f8  
    1010import subprocess 
    1111import os 
    12 from os.path import join as joinpath, abspath, dirname, isdir, exists, relpath 
    1312import sys 
    1413import fnmatch 
     
    2625platform = '.%s-%s'%(get_platform(),sys.version[:3]) 
    2726 
    28 # sphinx paths 
    29 SPHINX_ROOT = dirname(abspath(__file__)) 
    30 SPHINX_BUILD = joinpath(SPHINX_ROOT, "build") 
    31 SPHINX_SOURCE = joinpath(SPHINX_ROOT, "source-temp") 
    32 SPHINX_PERSPECTIVES = joinpath(SPHINX_SOURCE, "user", "sasgui", "perspectives") 
    33  
    34 # sasview paths 
    35 SASVIEW_ROOT = joinpath(SPHINX_ROOT, '..', '..') 
    36 SASVIEW_DOCS = joinpath(SPHINX_ROOT, "source") 
    37 SASVIEW_BUILD = abspath(joinpath(SASVIEW_ROOT, "build", "lib"+platform)) 
    38 SASVIEW_MEDIA_SOURCE = joinpath(SASVIEW_ROOT, "src", "sas") 
    39 SASVIEW_DOC_TARGET = joinpath(SASVIEW_BUILD, "doc") 
    40 SASVIEW_API_TARGET = joinpath(SPHINX_SOURCE, "dev", "sasview-api") 
    41  
    42 # sasmodels paths 
    43 SASMODELS_ROOT = joinpath(SASVIEW_ROOT, "..", "sasmodels") 
    44 SASMODELS_DOCS = joinpath(SASMODELS_ROOT, "doc") 
    45 SASMODELS_BUILD = joinpath(SASMODELS_ROOT, "build", "lib") 
    46 SASMODELS_MODEL_SOURCE = joinpath(SASMODELS_DOCS, "model") 
    47 SASMODELS_MODEL_TARGET = joinpath(SPHINX_SOURCE, "user", "models") 
    48 #SASMODELS_API_SOURCE = joinpath(SASMODELS_DOCS, "api") 
    49 SASMODELS_API_TARGET = joinpath(SPHINX_SOURCE, "dev", "sasmodels-api") 
    50 SASMODELS_DEV_SOURCE = joinpath(SASMODELS_DOCS, "developer") 
    51 SASMODELS_DEV_TARGET = joinpath(SPHINX_SOURCE, "dev", "sasmodels-dev") 
    52 SASMODELS_GUIDE_SOURCE = joinpath(SASMODELS_DOCS, "guide") 
    53 SASMODELS_GUIDE_TARGET = joinpath(SPHINX_PERSPECTIVES, "fitting") 
    54 SASMODELS_GUIDE_EXCLUDE = [ 
    55     "index.rst", "install.rst", "intro.rst", 
    56 ] 
    57  
    58 # bumps paths 
    59 BUMPS_DOCS = joinpath(SASVIEW_ROOT, "..", "bumps", "doc") 
    60 BUMPS_SOURCE = joinpath(BUMPS_DOCS, "guide") 
    61 BUMPS_TARGET = joinpath(SPHINX_PERSPECTIVES, "fitting") 
    62  
    63 run = imp.load_source('run', joinpath(SASVIEW_ROOT, 'run.py')) 
     27CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 
     28 
     29run = imp.load_source('run', os.path.join(CURRENT_SCRIPT_DIR, '..', '..', 'run.py')) 
    6430run.prepare() 
     31 
     32SASVIEW_SRC = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "src") 
     33SASVIEW_BUILD = os.path.abspath(os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "build", "lib"+platform)) 
     34SASVIEW_DOCS = os.path.join(SASVIEW_BUILD, "doc") 
     35SASVIEW_TEST = os.path.join(SASVIEW_SRC, "..", "sasview", "test", "media") 
     36SASVIEW_TOC_SOURCE = os.path.join(CURRENT_SCRIPT_DIR, "source") 
     37 
     38# Need to slurp in the new sasmodels model definitions to replace the old model_functions.rst 
     39# We are currently here: 
     40#/sasview-local-trunk/docs/sphinx-docs/build_sphinx.py 
     41SASMODELS_SOURCE_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc") 
     42SASMODELS_SOURCE_GPU = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "gpu") 
     43SASMODELS_SOURCE_SESANS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "sesans") 
     44SASMODELS_SOURCE_SESANSIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "sesans", "sesans_img") 
     45SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "magnetism") 
     46SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "magnetism", "mag_img") 
     47SASMODELS_SOURCE_REF_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "models") 
     48SASMODELS_SOURCE_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model") 
     49SASMODELS_SOURCE_IMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model", "img") 
     50SASMODELS_SOURCE_AUTOIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "_build", "html","_images") 
     51## Don't do assemble-in-place 
     52## Assemble the docs in a temporary folder 
     53SASMODELS_DEST_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "source-temp") 
     54SASMODELS_DEST_REF_MODELS = os.path.join(SASMODELS_DEST_PROLOG, "user") 
     55SASMODELS_DEST_MODELS = os.path.join(SASMODELS_DEST_PROLOG, "user", "models") 
     56SASMODELS_DEST_IMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "model-imgs", "new-models") 
     57SASMODELS_DEST_MAGIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "mag_img") 
     58SASMODELS_DEST_SESANSIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "sesans_img") 
     59SASMODELS_DEST_BUILDIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "models", "img") 
     60 
     61 
     62SPHINX_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build") 
     63SPHINX_SOURCE = os.path.join(CURRENT_SCRIPT_DIR, "source-temp") 
     64SPHINX_SOURCE_API = os.path.join(SPHINX_SOURCE, "dev", "api") 
     65SPHINX_SOURCE_GUIFRAME = os.path.join(SPHINX_SOURCE, "user", "sasgui", "guiframe") 
     66SPHINX_SOURCE_MODELS = os.path.join(SPHINX_SOURCE, "user", "models") 
     67SPHINX_SOURCE_PERSPECTIVES = os.path.join(SPHINX_SOURCE, "user", "sasgui", "perspectives") 
     68SPHINX_SOURCE_TEST = os.path.join(SPHINX_SOURCE, "test") 
     69SPHINX_SOURCE_USER = os.path.join(SPHINX_SOURCE, "user") 
     70 
     71BUMPS_DOCS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", 
     72                          "bumps", "doc", "guide") 
     73BUMPS_TARGET = os.path.join(SPHINX_SOURCE_PERSPECTIVES, "fitting") 
    6574 
    6675def inplace_change(filename, old_string, new_string): 
     
    7988def _remove_dir(dir_path): 
    8089    """Removes the given directory.""" 
    81     if isdir(dir_path): 
     90    if os.path.isdir(dir_path): 
    8291        print("Removing \"%s\"... " % dir_path) 
    8392        shutil.rmtree(dir_path) 
     
    8897    """ 
    8998    print("=== Cleaning Sphinx Build ===") 
    90     _remove_dir(SASVIEW_DOC_TARGET) 
     99    _remove_dir(SASVIEW_DOCS) 
    91100    _remove_dir(SPHINX_BUILD) 
    92101    _remove_dir(SPHINX_SOURCE) 
     102    #_remove_dir(SPHINX_SOURCE_GUIFRAME) 
     103    #_remove_dir(SPHINX_SOURCE_MODELS) 
     104    #_remove_dir(SPHINX_SOURCE_PERSPECTIVES) 
     105    #_remove_dir(SPHINX_SOURCE_TEST) 
    93106 
    94107def setup_source_temp(): 
     
    97110    """ 
    98111    print("=== Copying Source toctrees ===") 
    99     shutil.copytree(SASVIEW_DOCS, SPHINX_SOURCE) 
     112    if os.path.exists(SASVIEW_TOC_SOURCE): 
     113       print("Found docs folder at", SASVIEW_TOC_SOURCE) 
     114       shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE) 
    100115 
    101116def retrieve_user_docs(): 
     
    117132    print("=== Retrieve User Docs ===") 
    118133 
    119     # Copy documentation files from sas/.../media to the sphinx directory 
    120     for root, dirs, _ in os.walk(SASVIEW_MEDIA_SOURCE): 
    121         if 'media' in dirs: 
    122             source_dir = abspath(joinpath(root, "media")) 
    123             relative = dirname(relpath(source_dir, SASVIEW_MEDIA_SOURCE)) 
    124             dest_dir = joinpath(SPHINX_SOURCE, "user", relative) 
    125  
    126             print("Found sasview docs folder at \"%s\"." % relative) 
    127             copy_tree(source_dir, dest_dir) 
    128  
    129     print("=== Sasmodels Docs ===") 
    130     shutil.copy(joinpath(SASMODELS_DOCS, "rst_prolog"), SPHINX_SOURCE) 
    131     copy_tree(SASMODELS_MODEL_SOURCE, SASMODELS_MODEL_TARGET) 
    132     #copy_tree(SASMODELS_API_SOURCE, SASMODELS_API_TARGET) 
    133     copy_tree(SASMODELS_DEV_SOURCE, SASMODELS_DEV_TARGET) 
    134     copy_tree(SASMODELS_GUIDE_SOURCE, SASMODELS_GUIDE_TARGET) 
    135     for filename in SASMODELS_GUIDE_EXCLUDE: 
    136         os.unlink(joinpath(SASMODELS_GUIDE_TARGET, filename)) 
    137  
    138     # Model category files reference the model as ../../model/name.rst.  Since 
    139     # we are rearranging the tree, we need to update each of these links. 
    140     catdir = joinpath(SASMODELS_GUIDE_TARGET, "models") 
    141     for filename in os.listdir(catdir): 
    142         inplace_change(joinpath(catdir, filename), "../../model/", "/user/models/") 
    143  
     134    # Copy documentation files from their "source" to their "destination". 
     135    for root, dirnames, _ in os.walk(SASVIEW_SRC): 
     136        for dirname in fnmatch.filter(dirnames, 'media'): 
     137 
     138            docs = os.path.abspath(os.path.join(root, dirname)) 
     139            print("Found docs folder at \"%s\"." % docs) 
     140 
     141            dest_dir_part = os.path.dirname(os.path.relpath(docs, SASVIEW_SRC)) 
     142            if os.sep in dest_dir_part: 
     143                dest_dir_part = dest_dir_part[dest_dir_part.index(os.sep) + 1:] 
     144            dest_dir = os.path.join(SPHINX_SOURCE, "user", dest_dir_part) 
     145 
     146            copy_tree(docs, dest_dir) 
     147 
     148    # Now pickup testdata_help.rst 
     149    print("=== Including Test Data Docs ===") 
     150    if os.path.exists(SASVIEW_TEST): 
     151       print("Found docs folder at", SASVIEW_TEST) 
     152       shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST) 
     153 
     154    print("=== And the Sasmodels Docs ===") 
     155    # Make sure we have the relevant images for the new sasmodels documentation 
     156    # First(!) we'll make a local reference copy for SasView (/new-models will be cleaned each build) 
     157    if os.path.exists(SASMODELS_SOURCE_IMG): 
     158        print("Found img folder SASMODELS_SOURCE_IMG at", SASMODELS_SOURCE_IMG) 
     159        if not os.path.exists(SASMODELS_DEST_IMG): 
     160            print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG) 
     161            os.makedirs(SASMODELS_DEST_IMG) 
     162            print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG) 
     163        else: 
     164            print("Found img folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG) 
     165        print("Copying sasmodels model image files...") 
     166        for files in os.listdir(SASMODELS_SOURCE_IMG): 
     167            fromhere=os.path.join(SASMODELS_SOURCE_IMG,files) 
     168            tohere=os.path.join(SASMODELS_DEST_IMG,files) 
     169            shutil.copy(fromhere,tohere) 
     170    else: 
     171        print("no source directory",SASMODELS_SOURCE_IMG,"was found") 
     172 
     173    if os.path.exists(SASMODELS_SOURCE_AUTOIMG): 
     174        print("Found img folder SASMODELS_SOURCE_AUTOIMG at", SASMODELS_SOURCE_AUTOIMG) 
     175        if not os.path.exists(SASMODELS_DEST_IMG): 
     176            print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG) 
     177            os.makedirs(SASMODELS_DEST_BUILDIMG) 
     178            print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG) 
     179        print("Copying sasmodels model auto-generated image files...") 
     180        for files in os.listdir(SASMODELS_SOURCE_AUTOIMG): 
     181            fromhere=os.path.join(SASMODELS_SOURCE_AUTOIMG,files) 
     182            tohere=os.path.join(SASMODELS_DEST_IMG,files) 
     183            shutil.copy(fromhere,tohere) 
     184    else: 
     185        print("no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found") 
     186 
     187    # And the rst prolog with the unit substitutions 
     188    if os.path.exists(SASMODELS_SOURCE_PROLOG): 
     189        print("Found prolog folder SASMODELS_SOURCE_PROLOG at", SASMODELS_SOURCE_PROLOG) 
     190        if os.path.exists(SASMODELS_DEST_PROLOG): 
     191            print("Found docs folder SASMODELS_DEST_PROLOG at", SASMODELS_DEST_PROLOG) 
     192            print("Copying sasmodels rst_prolog file...") 
     193            for files in os.listdir(SASMODELS_SOURCE_PROLOG): 
     194                if files.startswith("rst"): 
     195                    fromhere=os.path.join(SASMODELS_SOURCE_PROLOG,files) 
     196                    tohere=os.path.join(SASMODELS_DEST_PROLOG,files) 
     197                    shutil.copy(fromhere,tohere) 
     198    else: 
     199        print("no source directory",SASMODELS_SOURCE_PROLOG, "was found") 
     200 
     201    if os.path.exists(SASMODELS_SOURCE_GPU): 
     202        print("Found docs folder SASMODELS_SOURCE_GPU at", SASMODELS_SOURCE_GPU) 
     203        if os.path.exists(SPHINX_SOURCE_USER): 
     204            print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER) 
     205            print("Copying sasmodels gpu files...") 
     206            for files in os.listdir(SASMODELS_SOURCE_GPU): 
     207                if files.endswith(".rst"): 
     208                    fromhere=os.path.join(SASMODELS_SOURCE_GPU,files) 
     209                    tohere=os.path.join(SPHINX_SOURCE_USER,files) 
     210                    shutil.copy(fromhere,tohere) 
     211    else: 
     212        print("no source directory",SASMODELS_SOURCE_GPU,"was found") 
     213 
     214    if os.path.exists(SASMODELS_SOURCE_SESANS): 
     215        print("Found docs folder SASMODELS_SOURCE_SESANS at", SASMODELS_SOURCE_SESANS) 
     216        if os.path.exists(SPHINX_SOURCE_USER): 
     217            print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER) 
     218            print("Copying sasmodels sesans files...") 
     219            for files in os.listdir(SASMODELS_SOURCE_SESANS): 
     220                if files.endswith(".rst"): 
     221                    fromhere=os.path.join(SASMODELS_SOURCE_SESANS,files) 
     222                    tohere=os.path.join(SPHINX_SOURCE_USER,files) 
     223                    shutil.copy(fromhere,tohere) 
     224    else: 
     225        print("no source directory",SASMODELS_SOURCE_SESANS,"was found") 
     226 
     227    if os.path.exists(SASMODELS_SOURCE_MAGNETISM): 
     228        print("Found docs folder SASMODELS_SOURCE_MAGNETISM at", SASMODELS_SOURCE_MAGNETISM) 
     229        if os.path.exists(SASMODELS_DEST_REF_MODELS): 
     230            print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS) 
     231            print("Copying sasmodels model toctree files...") 
     232            for files in os.listdir(SASMODELS_SOURCE_MAGNETISM): 
     233                if files.endswith(".rst"): 
     234                    fromhere=os.path.join(SASMODELS_SOURCE_MAGNETISM,files) 
     235                    tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files) 
     236                    shutil.copy(fromhere,tohere) 
     237    else: 
     238        print("no source directory",SASMODELS_SOURCE_MAGNETISM,"was found") 
     239 
     240    if os.path.exists(SASMODELS_SOURCE_MAGIMG): 
     241        print("Found img folder SASMODELS_SOURCE_MAGIMG   at", SASMODELS_SOURCE_MAGIMG) 
     242        if not os.path.exists(SASMODELS_DEST_MAGIMG): 
     243            print("Missing img folder SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG) 
     244            os.makedirs(SASMODELS_DEST_MAGIMG) 
     245            print("created SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG) 
     246        print("Copying sasmodels mag image files...") 
     247        for files in os.listdir(SASMODELS_SOURCE_MAGIMG): 
     248            fromhere=os.path.join(SASMODELS_SOURCE_MAGIMG,files) 
     249            tohere=os.path.join(SASMODELS_DEST_MAGIMG,files) 
     250            shutil.copy(fromhere,tohere) 
     251    else: 
     252        print("no source directory",SASMODELS_SOURCE_MAGIMG ,"was found") 
     253 
     254    if os.path.exists(SASMODELS_SOURCE_SESANSIMG): 
     255        print("Found img folder SASMODELS_SOURCE_SESANSIMG at", SASMODELS_SOURCE_SESANSIMG) 
     256        if not os.path.exists(SASMODELS_DEST_SESANSIMG): 
     257            print("Missing img folder SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG) 
     258            os.makedirs(SASMODELS_DEST_SESANSIMG) 
     259            print("created SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG) 
     260        print("Copying sasmodels sesans image files...") 
     261        for files in os.listdir(SASMODELS_SOURCE_SESANSIMG): 
     262            fromhere=os.path.join(SASMODELS_SOURCE_SESANSIMG,files) 
     263            tohere=os.path.join(SASMODELS_DEST_SESANSIMG,files) 
     264            shutil.copy(fromhere,tohere) 
     265    else: 
     266        print("no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found") 
     267 
     268    if os.path.exists(SASMODELS_SOURCE_REF_MODELS): 
     269        print("Found docs folder SASMODELS_SOURCE_REF_MODELS at", SASMODELS_SOURCE_REF_MODELS) 
     270        if os.path.exists(SASMODELS_DEST_REF_MODELS): 
     271            print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS) 
     272            print("Copying sasmodels model toctree files...") 
     273            for files in os.listdir(SASMODELS_SOURCE_REF_MODELS): 
     274                if files.endswith(".rst"): 
     275                    fromhere=os.path.join(SASMODELS_SOURCE_REF_MODELS,files) 
     276                    tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files) 
     277                    shutil.copy(fromhere,tohere) 
     278            # But need to change the path to the model docs in the tocs 
     279            for files in os.listdir(SASMODELS_DEST_REF_MODELS): 
     280        #        print files 
     281                if files.startswith("shape"): 
     282                    print("Changing toc paths in", files) 
     283                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 
     284                if files.startswith("sphere"): 
     285                    print("Changing toc paths in", files) 
     286                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 
     287                if files.startswith("custom"): 
     288                    print("Changing toc paths in", files) 
     289                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 
     290                if files.startswith("structure"): 
     291                    print("Changing toc paths in", files) 
     292                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 
     293    else: 
     294        print("no source directory",SASMODELS_SOURCE_REF_MODELS," was found") 
     295 
     296    if os.path.exists(SASMODELS_SOURCE_MODELS): 
     297        print("Found docs folder SASMODELS_SOURCE_MODELS at", SASMODELS_SOURCE_MODELS) 
     298        if os.path.exists(SASMODELS_DEST_MODELS): 
     299            print("Found docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS) 
     300            print("Copying sasmodels model files...") 
     301            for files in os.listdir(SASMODELS_SOURCE_MODELS): 
     302                if files.endswith(".rst"): 
     303                    fromhere=os.path.join(SASMODELS_SOURCE_MODELS,files) 
     304                    tohere=os.path.join(SASMODELS_DEST_MODELS,files) 
     305                    shutil.copy(fromhere,tohere) 
     306        else: 
     307            print("Missing docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS) 
     308            os.makedirs(SASMODELS_DEST_MODELS) 
     309            if not os.path.exists(SASMODELS_DEST_BUILDIMG): 
     310                os.makedirs(SASMODELS_DEST_BUILDIMG) 
     311            print("Created docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS) 
     312            print("Copying model files for build...") 
     313            for files in os.listdir(SASMODELS_SOURCE_MODELS): 
     314                if files.endswith(".rst"): 
     315                    fromhere=os.path.join(SASMODELS_SOURCE_MODELS,files) 
     316                    tohere=os.path.join(SASMODELS_DEST_MODELS,files) 
     317                    shutil.copy(fromhere,tohere) 
     318            # No choice but to do this because model files are all coded for images in /models/img 
     319            print("Copying image files for build...") 
     320            for files in os.listdir(SASMODELS_DEST_IMG): 
     321                fromhere=os.path.join(SASMODELS_DEST_IMG,files) 
     322                tohere=os.path.join(SASMODELS_DEST_BUILDIMG,files) 
     323                shutil.copy(fromhere,tohere) 
     324    else: 
     325        print("no source directory",SASMODELS_SOURCE_MODELS,"was found.") 
     326        print("!!!!NO MODEL DOCS WILL BE BUILT!!!!") 
    144327 
    145328def retrieve_bumps_docs(): 
     
    147330    Copies select files from the bumps documentation into fitting perspective 
    148331    """ 
    149     if exists(BUMPS_SOURCE): 
     332    if os.path.exists(BUMPS_DOCS): 
    150333        print("=== Retrieve BUMPS Docs ===") 
    151         filenames = [joinpath(BUMPS_SOURCE, "optimizer.rst")] 
    152         filenames += glob(joinpath(BUMPS_SOURCE, "dream-*.png")) 
    153         filenames += glob(joinpath(BUMPS_SOURCE, "fit-*.png")) 
     334        filenames = [os.path.join(BUMPS_DOCS, "optimizer.rst")] 
     335        filenames += glob(os.path.join(BUMPS_DOCS, "dream-*.png")) 
     336        filenames += glob(os.path.join(BUMPS_DOCS, "fit-*.png")) 
    154337        for f in filenames: 
    155338            print("Copying file", f) 
     
    171354 
    172355    # Clean directory before generating a new version. 
    173     #_remove_dir(SASVIEW_API_TARGET) 
     356    _remove_dir(SPHINX_SOURCE_API) 
    174357 
    175358    subprocess.call(["sphinx-apidoc", 
    176                      "-o", SASVIEW_API_TARGET, # Output dir. 
     359                     "-o", SPHINX_SOURCE_API, # Output dir. 
    177360                     "-d", "8", # Max depth of TOC. 
    178                      "-H", "SasView", # Package header 
    179361                     SASVIEW_BUILD]) 
    180  
    181     subprocess.call(["sphinx-apidoc", 
    182                      "-o", SASMODELS_API_TARGET, # Output dir. 
    183                      "-d", "8", # Max depth of TOC. 
    184                      "-H", "sasmodels", # Package header 
    185                      SASMODELS_BUILD, 
    186                      joinpath(SASMODELS_BUILD, "sasmodels", "models"), # exclude 
    187                      ]) 
    188362 
    189363def build_pdf(): 
     
    194368    subprocess.call(["sphinx-build", 
    195369                     "-b", "latex", # Builder name. TODO: accept as arg to setup.py. 
    196                      "-d", joinpath(SPHINX_BUILD, "doctrees"), 
     370                     "-d", os.path.join(SPHINX_BUILD, "doctrees"), 
    197371                     SPHINX_SOURCE, 
    198                      joinpath(SPHINX_BUILD, "latex")]) 
    199  
    200     LATEXDIR = joinpath(SPHINX_BUILD, "latex") 
     372                     os.path.join(SPHINX_BUILD, "latex")]) 
     373 
     374    LATEXDIR = os.path.join(SPHINX_BUILD, "latex") 
    201375    #TODO: Does it need to be done so many time? 
    202376    def pdflatex(): 
     
    210384 
    211385    print("=== Copy PDF to HTML Directory ===") 
    212     source = joinpath(LATEXDIR, "SasView.pdf") 
    213     target = joinpath(SASVIEW_DOC_TARGET, "SasView.pdf") 
     386    source = os.path.join(LATEXDIR, "SasView.pdf") 
     387    target = os.path.join(SASVIEW_DOCS, "SasView.pdf") 
    214388    shutil.copyfile(source, target) 
    215389 
     
    221395    subprocess.call(["sphinx-build", 
    222396                     "-b", "html", # Builder name. TODO: accept as arg to setup.py. 
    223                      "-d", joinpath(SPHINX_BUILD, "doctrees"), 
     397                     "-d", os.path.join(SPHINX_BUILD, "doctrees"), 
    224398                     SPHINX_SOURCE, 
    225                      joinpath(SPHINX_BUILD, "html")]) 
     399                     os.path.join(SPHINX_BUILD, "html")]) 
    226400 
    227401    print("=== Copy HTML Docs to Build Directory ===") 
    228     html = joinpath(SPHINX_BUILD, "html") 
    229     copy_tree(html, SASVIEW_DOC_TARGET) 
     402    html = os.path.join(SPHINX_BUILD, "html") 
     403    copy_tree(html, SASVIEW_DOCS) 
    230404 
    231405def fetch_katex(version, destination="_static"): 
     
    234408    url = "https://github.com/Khan/KaTeX/releases/download/%s/katex.zip" % version 
    235409    cache_path = "katex_%s.zip" % version 
    236     if not exists(cache_path): 
     410    if not os.path.exists(cache_path): 
    237411        try: 
    238412            fd_in = urllib2.urlopen(url) 
     
    246420def convert_katex(): 
    247421    print("=== Preprocess HTML, converting latex to html ===") 
    248     subprocess.call(["node", "convertKaTex.js", SASVIEW_DOC_TARGET]) 
     422    subprocess.call(["node", "convertKaTex.js", SASVIEW_DOCS]) 
    249423 
    250424def convert_mathjax(): 
    251425    print("=== Preprocess HTML, converting latex to html ===") 
    252     subprocess.call(["node", "convertMathJax.js", SASVIEW_DOC_TARGET]) 
     426    subprocess.call(["node", "convertMathJax.js", SASVIEW_DOCS]) 
    253427 
    254428def fetch_mathjax(): 
  • docs/sphinx-docs/source/dev/dev.rst

    r3bd677b r959eb01  
    1010   :maxdepth: 1 
    1111 
    12    SasView API <sasview-api/modules> 
    13    sasmodels overview <sasmodels-dev/index> 
    14    sasmodels API <sasmodels-api/modules> 
     12   SasView API <api/modules> 
    1513 
    1614Indices and Search 
  • docs/sphinx-docs/source/user/marketplace.rst

    r59dfb53 r959eb01  
    33Model Marketplace 
    44================= 
    5 The Model Marketplace allows members of the SAS Community to contribute 
    6 plug-in fitting models for *SasView* for all to use. 
     5The Model Marketplace allows members of the SAS Community to contribute plug-in fitting models for *SasView* for all to use. 
    76 
    87.. note:: These plug-in models require SasView version 4.0 or later. 
    98 
    10 Contributed models should be written in Python (only version 2.7.x is 
    11 currently supported) or, if computational speed is an issue, in a 
    12 combination of Python and C. You only need to upload the .py/.c source 
    13 code files to the Marketplace! 
     9Contributed models should be written in Python (only version 2.7.x is currently supported) or, if computational speed is an issue, in a combination of Python and C. You only need to upload the .py/.c source code files to the Marketplace! 
    1410 
    15 For guidance on how to write a plugin model see :ref:`Writing_a_Plugin` . It 
    16 may also be helpful to examine the library models in 
    17 the */sasmodels-data/models* sub-folder of your SasView installation directory. 
     11For guidance on how to write a plugin model see :ref:`Writing_a_Plugin` . It may also be helpful to examine the library models in the */sasmodels-data/models* sub-folder of your SasView installation directory. 
    1812 
    19 The Marketplace also provides the option to upload a SasView text file of 
    20 the scattering function data computed by your model. If you do this a graph 
    21 of the scattering function will appear under the Marketplace entry for 
    22 your model. 
     13The Marketplace also provides the option to upload a SasView text file of the scattering function data computed by your model. If you do this a graph of the scattering function will appear under the Marketplace entry for your model. 
    2314 
    24 .. note:: 
    25     The SasView Development Team regret to say that they do not have the 
    26     resources to fix the bugs or polish the code in every model contributed 
    27     to the Marketplace! 
     15.. note:: The SasView Development Team regret to say that they do not have the resources to fix the bugs or polish the code in every model contributed to the Marketplace! 
  • docs/sphinx-docs/source/user/tutorial.rst

    r3bd677b r9a76292  
    88.. note:: In Windows use [Alt]-[Cursor left] to return to the previous page 
    99 
    10 :download:`Getting Started with Sasview <sasview/getting_started_with_sasview.pdf>` 
     10:download:`Getting Started with Sasview <../../../../src/sas/sasview/media/getting_started_with_sasview.pdf>` 
    1111 
    12 :download:`Old Tutorial <sasview/Tutorial.pdf>` 
     12:download:`Old Tutorial <../../../../src/sas/sasview/media/Tutorial.pdf>` 
  • docs/sphinx-docs/source/user/user.rst

    r3bd677b r959eb01  
    77   :maxdepth: 1 
    88 
    9    Model Documentation <sasgui/perspectives/fitting/models/index> 
    10  
     9   Model Documentation <index> 
     10    
    1111   Menu Bar <menu_bar> 
    1212 
    1313   Fitting & Other Analyses <analysis> 
    14  
     14    
    1515   Tools & Utilities <tools> 
    16  
     16          
    1717   Working with SasView <working> 
  • docs/sphinx-docs/source/user/working.rst

    r3bd677b r9a76292  
    88 
    99   Data Formats <sasgui/guiframe/data_formats_help> 
    10  
     10    
    1111   Loading Data <sasgui/guiframe/data_explorer_help> 
    12  
     12    
    1313   Plotting Data/Models <sasgui/guiframe/graph_help> 
    14  
    15    Test Data <sasview/test/testdata_help> 
    16  
    17    Tutorials <tutorial> 
    18  
    19    Writing a Plugin Model <sasgui/perspectives/fitting/plugin> 
    20  
    21    Model marketplace <marketplace> 
     14    
     15   Test Data <../test/testdata_help.rst> 
     16       
     17   Tutorials <tutorial.rst> 
     18    
     19   Writing a Plugin Model <sasgui/perspectives/fitting/plugin.rst> 
     20    
     21   Computations with a GPU <gpu_computations> 
     22    
  • src/sas/sascalc/corfunc/corfunc_calculator.py

    ra26f67f r92eee84  
    177177        """ 
    178178        Extract the interesting measurements from a correlation function 
    179  
    180         :param transformed_data: Fourier transformation of the extrapolated data 
     179        :param transformed_data: Fourier transformation of the 
     180            extrapolated data 
    181181        """ 
    182182        # Calculate indexes of maxima and minima 
  • src/sas/sascalc/data_util/registry.py

    ra26f67f rdc8d1c2  
    121121        Call the loader for the file type of path. 
    122122 
    123         :raises ValueError: if no loader is available. 
    124         :raises KeyError: if format is not available. 
    125  
     123        :raise ValueError: if no loader is available. 
     124        :raise KeyError: if format is not available. 
    126125        May raise a loader-defined exception if loader fails. 
    127126        """ 
  • src/sas/sascalc/file_converter/c_ext/__init__.py

    ra26f67f r18e7309  
    1 """ 
    2     Data loader for the Diamond BSL beamline. 
    3 """ 
  • src/sas/sasgui/guiframe/CategoryInstaller.py

    ra26f67f rb963b20  
    112112    def check_install(homedir = None, model_list=None): 
    113113        """ 
    114         Makes sure categories.json exists and if not compile it and install. 
    115  
    116         This is the main method of this class. 
    117  
     114        the main method of this class 
     115        makes sure categories.json exists and if not 
     116        compile it and install 
    118117        :param homefile: Override the default home directory 
    119         :param model_list: List of model names except those in 
    120             Plugin Models which are user supplied. 
     118        :param model_list: List of model names except those in Plugin Models 
     119              which are user supplied. 
    121120        """ 
    122121        _model_dict = {model.name: model for model in model_list} 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py

    ra26f67f r47d93073  
    395395        """ 
    396396        Event based parameter setting. 
    397  
    398397        :param evt: Event triggered to apply parameters to a list of plots 
    399            evt should have attrs plot_list and params 
    400  
     398                    evt should have attrs plot_list and params 
    401399        """ 
    402400        if evt is None: 
     
    469467        """ 
    470468        Send a list of data to the fitting perspective 
    471         :param fit: fit type desired 
     469        :param fit: fit type desired  
    472470        :param file_list: list of loaded file names to send to fit 
    473471        """ 
  • src/sas/sasgui/perspectives/file_converter/converter_panel.py

    ra26f67f r19296dc  
    9393        <SasData> element. 
    9494 
    95         :param frame_data: If single_file is true, an array of Data1D 
    96             objects. If single_file is false, a dictionary of the 
    97             form *{frame_number: Data1D}*. 
     95        :param frame_data: If single_file is true, an array of Data1D objects. 
     96        If single_file is false, a dictionary of the form frame_number: Data1D. 
    9897        :param filepath: Where to save the CanSAS file 
    99         :param single_file: If true, array is saved as a single file, 
    100             if false, each item in the array is saved to it's own file 
     98        :param single_file: If true, array is saved as a single file, if false, 
     99        each item in the array is saved to it's own file 
    101100        """ 
    102101        writer = CansasWriter() 
     
    193192        :return x_data: A 1D array containing all the x coordinates of the data 
    194193        :return y_data: A 1D array containing all the y coordinates of the data 
    195         :return frame_data: A dictionary of the form *{frame_number: data}*, where data is a 2D numpy array containing the intensity data 
     194        :return frame_data: A dictionary of the form frame_number: data, where 
     195        data is a 2D numpy array containing the intensity data 
    196196        """ 
    197197        loader = BSLLoader(filename) 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    r3bd677b r33dc18f  
    28162816                                              "", name + " Help") 
    28172817        else: 
    2818             _TreeLocation = 'user/sasgui/perspectives/fitting/models/index.html' 
     2818            _TreeLocation = 'user/index.html' 
    28192819            _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 
    28202820                                              "", "General Model Help") 
     
    28872887        """ 
    28882888 
    2889         _TreeLocation = "user/sasgui/perspectives/fitting/magnetism/magnetism.html" 
     2889        _TreeLocation = "user/magnetism.html" 
    28902890        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "", 
    28912891                                          "Polarized Beam/Magnetc Help") 
     
    29332933        """ 
    29342934 
    2935         _TreeLocation = "user/sasgui/perspectives/fitting/pd/polydispersity.html" 
     2935        _TreeLocation = "user/sasgui/perspectives/fitting/pd_help.html" 
    29362936        _PageAnchor = "" 
    29372937        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    r3bd677b r48154abb  
    10791079        """ 
    10801080 
    1081         _TreeLocation = "user/sasgui/perspectives/fitting/resolution.html" 
     1081        _TreeLocation = "user/sasgui/perspectives/fitting/sm_help.html" 
    10821082        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "", 
    10831083                                          "Instrumental Resolution Smearing \ 
  • src/sas/sasgui/perspectives/fitting/gpu_options.py

    r3bd677b r73cbeec  
    318318        Provide help on opencl options. 
    319319        """ 
    320         TreeLocation = "user/sasgui/perspectives/fitting/gpu_setup.html" 
     320        TreeLocation = "user/gpu_computations.html" 
    321321        anchor = "#device-selection" 
    322322        DocumentationWindow(self, -1, 
  • src/sas/sasgui/perspectives/fitting/media/fitting.rst

    r3bd677b r46dfee9  
    1313   Assessing Fit Quality <residuals_help> 
    1414 
    15    Polydispersity Distributions <pd/polydispersity> 
     15   Polydispersity Distributions <pd_help> 
    1616 
    17    Smearing Functions <resolution> 
     17   Smearing Functions <sm_help> 
    1818 
    19    Polarisation/Magnetic Scattering <magnetism/magnetism> 
     19   Polarisation/Magnetic Scattering <mag_help> 
    2020 
    21    Information on the SasView Optimisers <optimizer> 
    22  
    23    Converting SANS to SESANS for Fitting <sesans/sans_to_sesans> 
    24  
    25    Fitting SESANS Data <sesans/sesans_fitting> 
    26  
    27    Writing a Plugin Model <plugin> 
    28  
    29    Computations with a GPU <gpu_setup> 
    30  
    31    Scripting interface to sasmodels <scripting> 
    32  
    33    References <refs> 
     21   Information on the SasView Optimisers <optimizer.rst> 
     22       
     23   Converting SANS to SESANS for Fitting <../../../sans_to_sesans> 
     24    
     25   Fitting SESANS Data <../../../sesans_fitting.rst> 
     26    
     27   Writing a Plugin Model <plugin.rst> 
     28       
     29   Computations with a GPU <../../../gpu_computations> 
     30    
  • src/sas/sasgui/perspectives/fitting/media/fitting_help.rst

    r5005ae0 rca383a0  
    33.. This is a port of the original SasView html help file to ReSTructured text 
    44.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
     5 
     6.. |inlineimage004| image:: sm_image004.png 
     7.. |inlineimage005| image:: sm_image005.png 
     8.. |inlineimage008| image:: sm_image008.png 
     9.. |inlineimage009| image:: sm_image009.png 
     10.. |inlineimage010| image:: sm_image010.png 
     11.. |inlineimage011| image:: sm_image011.png 
     12.. |inlineimage012| image:: sm_image012.png 
     13.. |inlineimage018| image:: sm_image018.png 
     14.. |inlineimage019| image:: sm_image019.png 
     15 
    516 
    617Fitting 
     
    2738   for example, if you have measured the same sample at different contrasts) 
    2839 
    29 *  in *Batch* fit mode - multiple data sets are fitted sequentially to the 
    30    *same* model (this might be useful, for example, if you have performed 
    31    a kinetic or time-resolved experiment and have *lots* of data sets!) 
     40*  in *Batch* fit mode - multiple data sets are fitted sequentially to the *same* model (this might be useful, for example, if you have performed a kinetic or time-resolved experiment and have *lots* of data sets!) 
    3241 
    3342.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    4554*  *Lamellae* - lamellar shapes (lamellar, core shell lamellar, stacked 
    4655   lamellar, etc) 
    47 *  *Shape-Independent* - models describing structure in terms of density 
    48    correlation functions, fractals, peaks, power laws, etc 
     56*  *Shape-Independent* - models describing structure in terms of density correlation functions, fractals, peaks, power laws, etc 
    4957*  *Paracrystal* - semi ordered structures (bcc, fcc, etc) 
    5058*  *Structure Factor* - S(Q) models 
     
    135143   and/or relatively simple models) 
    136144*  By copying/editing an existing model (this can include models generated by 
    137    the New Plugin Model* dialog) in the :ref:`Python_shell` or 
     145   the New Plugin Model* dialog) in the :ref:`Python_shell` or  
    138146   :ref:`Advanced_Plugin_Editor` (suitable for all use cases) 
    139147*  By writing a model from scratch outside of SasView (only recommended for code 
     
    173181.. image:: new_model.png 
    174182 
    175 When using this feature, be aware that even if your code has errors, including 
    176 syntax errors, a model file is still generated. When you then correct the errors 
    177 and click 'Apply' again to re-compile you will get an error informing you that 
    178 the model already exists if the 'Overwrite' box is not checked. In this case you 
    179 will need to supply a new model function name. By default the 'Overwrite' box is 
     183When using this feature, be aware that even if your code has errors, including  
     184syntax errors, a model file is still generated. When you then correct the errors  
     185and click 'Apply' again to re-compile you will get an error informing you that  
     186the model already exists if the 'Overwrite' box is not checked. In this case you  
     187will need to supply a new model function name. By default the 'Overwrite' box is  
    180188*checked*\ . 
    181189 
     
    187195the :ref:`Advanced_Plugin_Editor` . 
    188196 
    189 **SasView version 4.2** made it possible to specify whether a plugin created with 
    190 the *New Plugin Model* dialog is actually a form factor P(Q) or a structure factor 
    191 S(Q). To do this, simply add one or other of the following lines under the *import* 
     197**SasView version 4.2** made it possible to specify whether a plugin created with  
     198the *New Plugin Model* dialog is actually a form factor P(Q) or a structure factor  
     199S(Q). To do this, simply add one or other of the following lines under the *import*  
    192200statements. 
    193201 
     
    195203 
    196204     form_factor = True 
    197  
     205          
    198206or for a structure factor:: 
    199207 
    200208     structure_factor = True 
    201  
    202 If the plugin is a structure factor it is *also* necessary to add two variables to 
     209          
     210If the plugin is a structure factor it is *also* necessary to add two variables to  
    203211the parameter list:: 
    204212 
    205      parameters = [ 
     213     parameters = [  
    206214                     ['radius_effective', '', 1, [0.0, numpy.inf], 'volume', ''], 
    207215                     ['volfraction', '', 1, [0.0, 1.0], '', ''], 
     
    214222     def Iqxy(x, y, radius_effective, volfraction, ...): 
    215223 
    216 Such a plugin should then be available in the S(Q) drop-down box on a FitPage (once 
     224Such a plugin should then be available in the S(Q) drop-down box on a FitPage (once  
    217225a P(Q) model has been selected). 
    218226 
     
    235243them. Finally, click the *Apply* button to generate and test the model and then click *Close*. 
    236244 
    237 Any changes to a plugin model generated in this way only become effective *after* it is re-selected 
    238 from the plugin models drop-down menu on the FitPage. If the model is not listed you can force a 
     245Any changes to a plugin model generated in this way only become effective *after* it is re-selected  
     246from the plugin models drop-down menu on the FitPage. If the model is not listed you can force a  
    239247recompilation of the plugins by selecting *Fitting* > *Plugin Model Operations* > *Load Plugin Models*. 
    240248 
    241 **SasView version 4.2** introduced a much simplified and more extensible structure for plugin models 
    242 generated through the Easy Sum/Multi Editor. For example, the code for a combination of a sphere model 
     249**SasView version 4.2** introduced a much simplified and more extensible structure for plugin models  
     250generated through the Easy Sum/Multi Editor. For example, the code for a combination of a sphere model  
    243251with a power law model now looks like this:: 
    244252 
    245253     from sasmodels.core import load_model_info 
    246254     from sasmodels.sasview_model import make_model_from_info 
    247  
     255      
    248256     model_info = load_model_info('sphere+power_law') 
    249257     model_info.name = 'MyPluginModel' 
     
    251259     Model = make_model_from_info(model_info) 
    252260 
    253 To change the models or operators contributing to this plugin it is only necessary to edit the string 
    254 in the brackets after *load_model_info*, though it would also be a good idea to update the model name 
     261To change the models or operators contributing to this plugin it is only necessary to edit the string  
     262in the brackets after *load_model_info*, though it would also be a good idea to update the model name  
    255263and description too!!! 
    256264 
    257 The model specification string can handle multiple models and combinations of operators (+ or *) which 
    258 are processed according to normal conventions. Thus 'model1+model2*model3' would be valid and would 
    259 multiply model2 by model3 before adding model1. In this example, parameters in the *FitPage* would be 
    260 prefixed A (for model2), B (for model3) and C (for model1). Whilst this might appear a little 
    261 confusing, unless you were creating a plugin model from multiple instances of the same model the parameter 
     265The model specification string can handle multiple models and combinations of operators (+ or *) which  
     266are processed according to normal conventions. Thus 'model1+model2*model3' would be valid and would  
     267multiply model2 by model3 before adding model1. In this example, parameters in the *FitPage* would be  
     268prefixed A (for model2), B (for model3) and C (for model1). Whilst this might appear a little  
     269confusing, unless you were creating a plugin model from multiple instances of the same model the parameter  
    262270assignments ought to be obvious when you load the plugin. 
    263271 
    264 If you need to include another plugin model in the model specification string, just prefix the name of 
     272If you need to include another plugin model in the model specification string, just prefix the name of  
    265273that model with *custom*. For instance:: 
    266274 
     
    270278 
    271279     sphere@hardsphere 
    272  
    273 This streamlined approach to building complex plugin models from existing library models, or models 
    274 available on the *Model Marketplace*, also permits the creation of P(Q)*\S(Q) plugin models, something 
    275 that was not possible in earlier versions of SasView. 
     280      
     281This streamlined approach to building complex plugin models from existing library models, or models  
     282available on the *Model Marketplace*, also permits the creation of P(Q)*\S(Q) plugin models, something  
     283that was not possible in earlier versions of SasView.  
    276284 
    277285.. _Advanced_Plugin_Editor: 
     
    463471 
    464472This mode is an extension of the :ref:`Single_Fit_Mode` that fits two or more data 
    465 sets *to the same model* simultaneously. If necessary it is possible to constrain 
     473sets *to the same model* simultaneously. If necessary it is possible to constrain  
    466474fit parameters between data sets (eg, to fix a background level, or radius, etc). 
    467475 
     
    681689recognises the operators +, -, \*, /, or 'pow', and allows the following 
    682690types of expression : 
    683  
     691  
    684692  1) if an axis label range is a function of 1 or more *columns*, write 
    685693     this type of expression 
     
    698706 
    699707     Example: radius [2 : 5] , radius [10 : 25] 
    700  
     708      
    701709.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    702710 
     
    748756   p#_ appended to the beginning and thus radius and p1_radius will not be 
    749757   recognized as the same parameter. 
    750  
     758    
    751759.. image:: combine_batch_grid.png 
    752760 
     
    756764time is not listed in the file but the file name contains the information. As 
    757765described in :ref:`Grid_Window`, a column can be added manually, in this case 
    758 called time, and the peak position plotted against time. 
     766called time, and the peak position plotted against time.  
    759767 
    760768.. image:: combine_batch_plot.png 
  • src/sas/sasgui/perspectives/fitting/media/residuals_help.rst

    r99ded31 r940d034  
    2626^^^^ 
    2727 
    28 $\chi^2$ is a statistical parameter that quantifies the differences between 
    29 an observed data set and an expected dataset (or 'theory'). 
     28Chi2 is a statistical parameter that quantifies the differences between an observed 
     29data set and an expected dataset (or 'theory'). 
    3030 
    31 When showing the a model with the data, *SasView* displays this parameter 
    32 normalized to the number of data points, $N_\mathrm{pts}$ such that 
     31*SasView* actually returns this parameter normalized to the number of data points, 
     32*Npts* such that 
    3333 
    3434.. math:: 
    3535 
    36   \chi^2_N 
    37   =  \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] / N_\mathrm{pts} 
     36  \chi^2/N_{pts} =  \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] / N_{pts} 
    3837 
    39 When performing a fit, *SasView* instead displays the reduced $\chi^2_R$, 
    40 which takes into account the number of fitting parameters $N_\mathrm{par}$ 
    41 (to calculate the number of 'degrees of freedom'). This is computed as 
     38This differs slightly from what is sometimes called the 'reduced $\chi^2$' 
     39because it does not take into account the number of fitting parameters (to 
     40calculate the number of 'degrees of freedom'), but the 'normalized $\chi^2$ 
     41and the 'reduced $\chi^2$ are very close to each other when $N_{pts} \gg 
     42\text{number of parameters}. 
    4243 
    43 .. math:: 
     44For a good fit, $\chi^2/N_{pts}$ tends to 1. 
    4445 
    45   \chi^2_R 
    46   =  \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] 
    47   / [N_\mathrm{pts} - N_\mathrm{par}] 
    48  
    49 The normalized $\chi^2_N$ and the reduced $\chi^2_R$ are very close to each 
    50 other when $N_\mathrm{pts} \gg N_\mathrm{par}$. 
    51  
    52 For a good fit, $\chi^2_R$ tends to 1. 
    53  
    54 $\chi^2_R$ is sometimes referred to as the 'goodness-of-fit' parameter. 
     46$\chi^2/N_{pts}$ is sometimes referred to as the 'goodness-of-fit' parameter. 
    5547 
    5648.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    6052 
    6153A residual is the difference between an observed value and an estimate of that 
    62 value, such as a 'theory' calculation (whereas the difference between an 
    63 observed value and its *true* value is its error). 
     54value, such as a 'theory' calculation (whereas the difference between an observed 
     55value and its *true* value is its error). 
    6456 
    6557*SasView* calculates 'normalized residuals', $R_i$, for each data point in the 
     
    6860.. math:: 
    6961 
    70   R_i = (Y_i - \mathrm{theory}_i) / \mathrm{error}_i 
     62  R_i = (Y_i - Y_theory_i) / (Y_err_i) 
    7163 
    72 Think of each normalized residual as the number of standard deviations 
    73 between the measured value and the theory.  For a good fit, 68% of $R_i$ 
    74 will be within one standard deviation, which will show up in the Residuals 
    75 plot as $R_i$ values between $-1$ and $+1$.  Almost all the values should 
    76 be between $-3$ and $+3$. 
    77  
    78 Residuals values larger than $\pm 3$ indicate that the model 
    79 is not fit correctly, the wrong model was chosen (e.g., because there is 
    80 more than one phase in your system), or there are problems in 
    81 the data reduction.  Since the goodness of fit is calculated from the 
    82 sum-squared residuals, these extreme values will drive the choice of fit 
    83 parameters.  Any uncertainties calculated for the fitting parameters will 
    84 be meaningless. 
     64For a good fit, $R_i \sim 0$. 
    8565 
    8666.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    8767 
    88 *Document History* 
    89  
    90 | 2015-06-08 Steve King 
    91 | 2017-09-28 Paul Kienzle 
     68.. note::  This help document was last changed by Steve King, 08Jun2015 
  • src/sas/sasgui/perspectives/fitting/plugin_models/__init__.py

    r64cdb0d rab0b93f  
    1 """ 
    2 Example plugin models to be added to the SasView plugin directory on startup 
    3 if no plugins are present. 
    4  
    5 This is currently empty. 
    6 """ 
  • src/sas/sasgui/plottools/LineModel.py

    ra26f67f r959eb01  
    22""" 
    33Provide Line function (y= Ax + B). Until July 10, 2016 this function provided 
    4 (y= A + Bx).  This however was contrary to all the other code using it which 
     4(y= A + Bx).  This however was contrary to all the other code using it which  
    55assumed (y= mx+b) or in this nomenclature (y=Ax + B). This lead to some 
    66contortions in the code and worse incorrect calculations until now for at least 
     
    6767        Evaluate the model 
    6868 
     69        :note: This is the function called by fitDialog to calculate the 
     70        the y(xmin) and y(xmax), but the only difference between this and 
     71        runXY is when the if statement is true. I however cannot see what that 
     72        function is for.  It needs to be documented here or removed. 
     73        PDB 7/10/16  
     74 
    6975        :param x: simple value 
    7076 
    7177        :return: (Line value) 
    72  
    73         .. note:: 
    74             This is the function called by fitDialog to calculate the 
    75             the y(xmin) and y(xmax), but the only difference between this and 
    76             runXY is when the if statement is true. I however cannot see what 
    77             that function is for.  It needs to be documented here or removed. 
    78             PDB 7/10/16 
    7978        """ 
    8079        if x.__class__.__name__ == 'list': 
     
    9089        """ 
    9190        Evaluate the model. 
     91         
     92        :note: This is to be what is called by fitDialog for the actual fit 
     93        but the only difference between this and run is when the if  
     94        statement is true. I however cannot see what that function 
     95        is for.  It needs to be documented here or removed. PDB 7/10/16  
    9296 
    9397        :param x: simple value 
     
    9599        :return: Line value 
    96100 
    97         .. note:: 
    98             This is to be what is called by fitDialog for the actual fit 
    99             the only difference between this and run is when the if 
    100             statement is true. I however cannot see what that function 
    101             is for.  It needs to be documented here or removed. PDB 7/10/16 
    102101        """ 
    103102        if x.__class__.__name__ == 'list': 
Note: See TracChangeset for help on using the changeset viewer.