Changeset 3bd677b in sasview


Ignore:
Timestamp:
Sep 28, 2017 6:27:25 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
df72475
Parents:
a26f67f
Message:

refactor interface to sasmodels including the sasmodels api and using its version of pd, resolution and magnetism

Files:
55 deleted
9 edited

Legend:

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

    r6e546f8 r3bd677b  
    1010import subprocess 
    1111import os 
     12from os.path import join as joinpath, abspath, dirname, isdir, exists, relpath 
    1213import sys 
    1314import fnmatch 
     
    2526platform = '.%s-%s'%(get_platform(),sys.version[:3]) 
    2627 
    27 CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 
    28  
    29 run = imp.load_source('run', os.path.join(CURRENT_SCRIPT_DIR, '..', '..', 'run.py')) 
     28# sphinx paths 
     29SPHINX_ROOT = dirname(abspath(__file__)) 
     30SPHINX_BUILD = joinpath(SPHINX_ROOT, "build") 
     31SPHINX_SOURCE = joinpath(SPHINX_ROOT, "source-temp") 
     32SPHINX_PERSPECTIVES = joinpath(SPHINX_SOURCE, "user", "sasgui", "perspectives") 
     33 
     34# sasview paths 
     35SASVIEW_ROOT = joinpath(SPHINX_ROOT, '..', '..') 
     36SASVIEW_DOCS = joinpath(SPHINX_ROOT, "source") 
     37SASVIEW_BUILD = abspath(joinpath(SASVIEW_ROOT, "build", "lib"+platform)) 
     38SASVIEW_MEDIA_SOURCE = joinpath(SASVIEW_ROOT, "src", "sas") 
     39SASVIEW_DOC_TARGET = joinpath(SASVIEW_BUILD, "doc") 
     40SASVIEW_API_TARGET = joinpath(SPHINX_SOURCE, "dev", "sasview-api") 
     41 
     42# sasmodels paths 
     43SASMODELS_ROOT = joinpath(SASVIEW_ROOT, "..", "sasmodels") 
     44SASMODELS_DOCS = joinpath(SASMODELS_ROOT, "doc") 
     45SASMODELS_BUILD = joinpath(SASMODELS_ROOT, "build", "lib") 
     46SASMODELS_MODEL_SOURCE = joinpath(SASMODELS_DOCS, "model") 
     47SASMODELS_MODEL_TARGET = joinpath(SPHINX_SOURCE, "user", "models") 
     48#SASMODELS_API_SOURCE = joinpath(SASMODELS_DOCS, "api") 
     49SASMODELS_API_TARGET = joinpath(SPHINX_SOURCE, "dev", "sasmodels-api") 
     50SASMODELS_DEV_SOURCE = joinpath(SASMODELS_DOCS, "developer") 
     51SASMODELS_DEV_TARGET = joinpath(SPHINX_SOURCE, "dev", "sasmodels-dev") 
     52SASMODELS_GUIDE_SOURCE = joinpath(SASMODELS_DOCS, "guide") 
     53SASMODELS_GUIDE_TARGET = joinpath(SPHINX_PERSPECTIVES, "fitting") 
     54SASMODELS_GUIDE_EXCLUDE = [ 
     55    "index.rst", "install.rst", "intro.rst", 
     56] 
     57 
     58# bumps paths 
     59BUMPS_DOCS = joinpath(SASVIEW_ROOT, "..", "bumps", "doc") 
     60BUMPS_SOURCE = joinpath(BUMPS_DOCS, "guide") 
     61BUMPS_TARGET = joinpath(SPHINX_PERSPECTIVES, "fitting") 
     62 
     63run = imp.load_source('run', joinpath(SASVIEW_ROOT, 'run.py')) 
    3064run.prepare() 
    31  
    32 SASVIEW_SRC = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "src") 
    33 SASVIEW_BUILD = os.path.abspath(os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "build", "lib"+platform)) 
    34 SASVIEW_DOCS = os.path.join(SASVIEW_BUILD, "doc") 
    35 SASVIEW_TEST = os.path.join(SASVIEW_SRC, "..", "sasview", "test", "media") 
    36 SASVIEW_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 
    41 SASMODELS_SOURCE_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc") 
    42 SASMODELS_SOURCE_GPU = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "gpu") 
    43 SASMODELS_SOURCE_SESANS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "sesans") 
    44 SASMODELS_SOURCE_SESANSIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "sesans", "sesans_img") 
    45 SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "magnetism") 
    46 SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "magnetism", "mag_img") 
    47 SASMODELS_SOURCE_REF_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "guide", "models") 
    48 SASMODELS_SOURCE_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model") 
    49 SASMODELS_SOURCE_IMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model", "img") 
    50 SASMODELS_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 
    53 SASMODELS_DEST_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "source-temp") 
    54 SASMODELS_DEST_REF_MODELS = os.path.join(SASMODELS_DEST_PROLOG, "user") 
    55 SASMODELS_DEST_MODELS = os.path.join(SASMODELS_DEST_PROLOG, "user", "models") 
    56 SASMODELS_DEST_IMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "model-imgs", "new-models") 
    57 SASMODELS_DEST_MAGIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "mag_img") 
    58 SASMODELS_DEST_SESANSIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "sesans_img") 
    59 SASMODELS_DEST_BUILDIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "models", "img") 
    60  
    61  
    62 SPHINX_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build") 
    63 SPHINX_SOURCE = os.path.join(CURRENT_SCRIPT_DIR, "source-temp") 
    64 SPHINX_SOURCE_API = os.path.join(SPHINX_SOURCE, "dev", "api") 
    65 SPHINX_SOURCE_GUIFRAME = os.path.join(SPHINX_SOURCE, "user", "sasgui", "guiframe") 
    66 SPHINX_SOURCE_MODELS = os.path.join(SPHINX_SOURCE, "user", "models") 
    67 SPHINX_SOURCE_PERSPECTIVES = os.path.join(SPHINX_SOURCE, "user", "sasgui", "perspectives") 
    68 SPHINX_SOURCE_TEST = os.path.join(SPHINX_SOURCE, "test") 
    69 SPHINX_SOURCE_USER = os.path.join(SPHINX_SOURCE, "user") 
    70  
    71 BUMPS_DOCS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", 
    72                           "bumps", "doc", "guide") 
    73 BUMPS_TARGET = os.path.join(SPHINX_SOURCE_PERSPECTIVES, "fitting") 
    7465 
    7566def inplace_change(filename, old_string, new_string): 
     
    8879def _remove_dir(dir_path): 
    8980    """Removes the given directory.""" 
    90     if os.path.isdir(dir_path): 
     81    if isdir(dir_path): 
    9182        print("Removing \"%s\"... " % dir_path) 
    9283        shutil.rmtree(dir_path) 
     
    9788    """ 
    9889    print("=== Cleaning Sphinx Build ===") 
    99     _remove_dir(SASVIEW_DOCS) 
     90    _remove_dir(SASVIEW_DOC_TARGET) 
    10091    _remove_dir(SPHINX_BUILD) 
    10192    _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) 
    10693 
    10794def setup_source_temp(): 
     
    11097    """ 
    11198    print("=== Copying Source toctrees ===") 
    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) 
     99    shutil.copytree(SASVIEW_DOCS, SPHINX_SOURCE) 
    115100 
    116101def retrieve_user_docs(): 
     
    132117    print("=== Retrieve User Docs ===") 
    133118 
    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!!!!") 
     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 
    327144 
    328145def retrieve_bumps_docs(): 
     
    330147    Copies select files from the bumps documentation into fitting perspective 
    331148    """ 
    332     if os.path.exists(BUMPS_DOCS): 
     149    if exists(BUMPS_SOURCE): 
    333150        print("=== Retrieve BUMPS Docs ===") 
    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")) 
     151        filenames = [joinpath(BUMPS_SOURCE, "optimizer.rst")] 
     152        filenames += glob(joinpath(BUMPS_SOURCE, "dream-*.png")) 
     153        filenames += glob(joinpath(BUMPS_SOURCE, "fit-*.png")) 
    337154        for f in filenames: 
    338155            print("Copying file", f) 
     
    354171 
    355172    # Clean directory before generating a new version. 
    356     _remove_dir(SPHINX_SOURCE_API) 
     173    #_remove_dir(SASVIEW_API_TARGET) 
    357174 
    358175    subprocess.call(["sphinx-apidoc", 
    359                      "-o", SPHINX_SOURCE_API, # Output dir. 
     176                     "-o", SASVIEW_API_TARGET, # Output dir. 
    360177                     "-d", "8", # Max depth of TOC. 
     178                     "-H", "SasView", # Package header 
    361179                     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                     ]) 
    362188 
    363189def build_pdf(): 
     
    368194    subprocess.call(["sphinx-build", 
    369195                     "-b", "latex", # Builder name. TODO: accept as arg to setup.py. 
    370                      "-d", os.path.join(SPHINX_BUILD, "doctrees"), 
     196                     "-d", joinpath(SPHINX_BUILD, "doctrees"), 
    371197                     SPHINX_SOURCE, 
    372                      os.path.join(SPHINX_BUILD, "latex")]) 
    373  
    374     LATEXDIR = os.path.join(SPHINX_BUILD, "latex") 
     198                     joinpath(SPHINX_BUILD, "latex")]) 
     199 
     200    LATEXDIR = joinpath(SPHINX_BUILD, "latex") 
    375201    #TODO: Does it need to be done so many time? 
    376202    def pdflatex(): 
     
    384210 
    385211    print("=== Copy PDF to HTML Directory ===") 
    386     source = os.path.join(LATEXDIR, "SasView.pdf") 
    387     target = os.path.join(SASVIEW_DOCS, "SasView.pdf") 
     212    source = joinpath(LATEXDIR, "SasView.pdf") 
     213    target = joinpath(SASVIEW_DOC_TARGET, "SasView.pdf") 
    388214    shutil.copyfile(source, target) 
    389215 
     
    395221    subprocess.call(["sphinx-build", 
    396222                     "-b", "html", # Builder name. TODO: accept as arg to setup.py. 
    397                      "-d", os.path.join(SPHINX_BUILD, "doctrees"), 
     223                     "-d", joinpath(SPHINX_BUILD, "doctrees"), 
    398224                     SPHINX_SOURCE, 
    399                      os.path.join(SPHINX_BUILD, "html")]) 
     225                     joinpath(SPHINX_BUILD, "html")]) 
    400226 
    401227    print("=== Copy HTML Docs to Build Directory ===") 
    402     html = os.path.join(SPHINX_BUILD, "html") 
    403     copy_tree(html, SASVIEW_DOCS) 
     228    html = joinpath(SPHINX_BUILD, "html") 
     229    copy_tree(html, SASVIEW_DOC_TARGET) 
    404230 
    405231def fetch_katex(version, destination="_static"): 
     
    408234    url = "https://github.com/Khan/KaTeX/releases/download/%s/katex.zip" % version 
    409235    cache_path = "katex_%s.zip" % version 
    410     if not os.path.exists(cache_path): 
     236    if not exists(cache_path): 
    411237        try: 
    412238            fd_in = urllib2.urlopen(url) 
     
    420246def convert_katex(): 
    421247    print("=== Preprocess HTML, converting latex to html ===") 
    422     subprocess.call(["node", "convertKaTex.js", SASVIEW_DOCS]) 
     248    subprocess.call(["node", "convertKaTex.js", SASVIEW_DOC_TARGET]) 
    423249 
    424250def convert_mathjax(): 
    425251    print("=== Preprocess HTML, converting latex to html ===") 
    426     subprocess.call(["node", "convertMathJax.js", SASVIEW_DOCS]) 
     252    subprocess.call(["node", "convertMathJax.js", SASVIEW_DOC_TARGET]) 
    427253 
    428254def fetch_mathjax(): 
     
    440266    build() 
    441267    if find_executable('latex'): 
    442         build_pdf() 
     268        #build_pdf() 
     269        pass 
    443270    #convert_katex() 
    444271    #convert_mathjax() 
  • docs/sphinx-docs/source/dev/dev.rst

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

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

    r959eb01 r3bd677b  
    77   :maxdepth: 1 
    88 
    9    Model Documentation <index> 
    10     
     9   Model Documentation <sasgui/perspectives/fitting/models/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

    r8cc39d6 r3bd677b  
    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 <../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     
     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> 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rd3b0c77 r3bd677b  
    28162816                                              "", name + " Help") 
    28172817        else: 
    2818             _TreeLocation = 'user/index.html' 
     2818            _TreeLocation = 'user/sasgui/perspectives/fitting/models/index.html' 
    28192819            _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 
    28202820                                              "", "General Model Help") 
     
    28872887        """ 
    28882888 
    2889         _TreeLocation = "user/magnetism.html" 
     2889        _TreeLocation = "user/sasgui/perspectives/fitting/magnetism/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_help.html" 
     2935        _TreeLocation = "user/sasgui/perspectives/fitting/pd/polydispersity.html" 
    29362936        _PageAnchor = "" 
    29372937        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

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

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

    r46dfee9 r3bd677b  
    1313   Assessing Fit Quality <residuals_help> 
    1414 
    15    Polydispersity Distributions <pd_help> 
     15   Polydispersity Distributions <pd/polydispersity> 
    1616 
    17    Smearing Functions <sm_help> 
     17   Smearing Functions <resolution> 
    1818 
    19    Polarisation/Magnetic Scattering <mag_help> 
     19   Polarisation/Magnetic Scattering <magnetism/magnetism> 
    2020 
    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     
     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> 
Note: See TracChangeset for help on using the changeset viewer.