Changeset 51335d7 in sasview


Ignore:
Timestamp:
Jan 20, 2017 3:33:50 AM (6 years ago)
Author:
Gonzalez, Miguel <gonzalez@…>
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, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
c5251f6
Parents:
2fd2d99 (diff), ef0e644 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://github.com/SasView/sasview

Files:
62 added
174 deleted
87 edited
34 moved

Legend:

Unmodified
Added
Removed
  • .gitignore

    re04f87b r5dd7499  
    88# generated. 
    99# 
    10 # Feel free to add more stuff to this as and when it becomes an issue.  
     10# Feel free to add more stuff to this as and when it becomes an issue. 
    1111 
    1212.project 
     
    4141 
    4242/docs/sphinx-docs/build 
     43/docs/sphinx-docs/source-temp 
    4344/docs/sphinx-docs/source/dev/api 
    4445/docs/sphinx-docs/source/user/guiframe 
    4546/docs/sphinx-docs/source/user/models 
    4647/docs/sphinx-docs/source/user/perspectives 
     48/docs/sphinx-docs/source/user/sasgui 
     49 
    4750 
    4851# test outputs 
     
    5053/test/sasdataloader/test/plugins.zip 
    5154/test/sasdataloader/test/test_log.txt 
     55/test/sasdataloader/test/isis_1_0_write_test.xml 
     56/test/sasdataloader/test/isis_1_1_write_test.xml 
     57/test/sasdataloader/test/write_test.xml 
    5258 
    5359# autogenerated scripts 
    5460/sasview/installer.iss 
    55  
  • .pydevproject

    re82a901 r26c8be3  
    44<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> 
    55<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> 
    6 <path>/sasview/src</path> 
     6<path>/sasview4/src</path> 
    77</pydev_pathproperty> 
    88</pydev_project> 
  • .travis.yml

    r58918de red8f27e7  
    1212  system_site_packages: true 
    1313before_install: 
    14   - 'if [ $TRAVIS_PYTHON_VERSION == "2.7" ]; then sudo apt-get update;sudo apt-get install python-numpy python-scipy python-matplotlib libhdf5-serial-dev python-h5py fglrx opencl-headers python-pyopencl; fi' 
     14  - 'if [ $TRAVIS_PYTHON_VERSION == "2.7" ]; then sudo apt-get update;sudo apt-get install python-matplotlib libhdf5-serial-dev python-h5py fglrx opencl-headers python-pyopencl gfortran libblas-dev liblapack-dev libatlas-dev; fi' 
    1515 
    1616install: 
  • Vagrantfile

    r96032b3 r601b93d  
    2121  # Every Vagrant development environment requires a box. You can search for 
    2222  # boxes at https://atlas.hashicorp.com/search. 
    23   config.vm.box = "ubuntu1404" 
    24   config.vm.box_url = "https://github.com/hnakamur/packer-templates/releases/download/v1.0.2/ubuntu-14-04-x64-virtualbox.box" 
     23  config.vm.box = "ubuntu/trusty64" 
    2524  #config.vm.box = "fedora19" 
    2625  #config.vm.box_url = "https://dl.dropboxusercontent.com/u/86066173/fedora-19.box" 
  • build_tools/jenkins_linux_build.sh

    r8ca1ba1 r128c287  
    3737cd sasmodels 
    3838$PYTHON setup.py bdist_egg 
    39  
     39$PYTHON -m sasmodels.model_test all 
    4040 
    4141# SASVIEW 
  • build_tools/jenkins_osx_build.sh

    r8ca1ba1 rb742b8b5  
    3737make html 
    3838 
     39#SASMODELS - BUILDING AND TESTING 
    3940cd $WORKSPACE 
    4041cd sasmodels 
    4142$PYTHON setup.py bdist_egg 
    42  
     43$PYTHON -m sasmodels.model_test all 
    4344 
    4445# SASVIEW 
  • build_tools/jenkins_win64_build.bat

    rb636c0ba rec57735  
    4747cd sasmodels 
    4848%PYTHON% setup.py bdist_egg 
     49%PYTHON% -m sasmodels.model_test all 
    4950 
    5051:: SASMODELS install egg ############################################## 
  • build_tools/jenkins_win_build.bat

    rb188f53 r5dab2bc  
    4848cd sasmodels 
    4949%PYTHON% setup.py bdist_egg 
    50  
     50%PYTHON% -m sasmodels.model_test all 
    5151 
    5252:: SASMODELS install egg ############################################## 
  • build_tools/requirements.txt

    r785cc657 r131d94b  
    77reportlab==2.5 
    88lxml==2.3 
    9 PIL==1.1.7 
     9#PIL==1.1.7 
    1010periodictable==1.3.0 
    1111bumps==0.7.5.9 
    12 # numpy==1.6.1 
    13 # scipy==0.10.1 
     12numpy>=1.7.1 
     13scipy>=0.18.0 
    1414# wx==2.8.12.1 
    1515# matplotlib==1.1.0 
     
    1717sphinx==1.2.1 
    1818h5py==2.5 
     19pyopencl==2015.1 
  • check_packages.py

    r68aa210 r131d94b  
    2626    'periodictable':{'version':'1.3.0','import_name':'periodictable','test':'__version__'}, 
    2727    'bumps':{'version':'0.7.5.9','import_name':'bumps','test':'__version__'}, 
    28     'numpy':{'version':'1.6.1','import_name':'numpy','test':'__version__'}, 
    29     'scipy':{'version':'0.10.1','import_name':'scipy','test':'__version__'}, 
     28    'numpy':{'version':'1.7.1','import_name':'numpy','test':'__version__'}, 
     29    'scipy':{'version':'0.18.0','import_name':'scipy','test':'__version__'}, 
    3030    'wx':{'version':'2.8.12.1','import_name':'wx','test':'__version__'}, 
    3131    'matplotlib':{'version':'1.1.0','import_name':'matplotlib','test':'__version__'}, 
     
    3333    'sphinx':{'version':'1.2.1','import_name':'sphinx','test':'__version__'}, 
    3434    'unittest-xml-reporting':{'version':'1.10.0','import_name':'xmlrunner','test':'__version__'}, 
     35    'pyopencl':{'version':'2015.1','import_name':'pyopencl','test':'VERSION_TEXT'}, 
    3536} 
    3637win_required_package_list = { 
  • docs/sphinx-docs/build_sphinx.py

    r8096b446 r751f4bd  
    3030SASVIEW_DOCS = os.path.join(SASVIEW_BUILD, "doc") 
    3131SASVIEW_TEST = os.path.join(SASVIEW_SRC, "..", "sasview", "test", "media") 
     32SASVIEW_TOC_SOURCE = os.path.join(CURRENT_SCRIPT_DIR, "source") 
    3233 
    3334# Need to slurp in the new sasmodels model definitions to replace the old model_functions.rst 
     
    3536#/sasview-local-trunk/docs/sphinx-docs/build_sphinx.py 
    3637SASMODELS_SOURCE_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc") 
     38SASMODELS_SOURCE_GPU = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "gpu") 
     39SASMODELS_SOURCE_SESANS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "sesans") 
     40SASMODELS_SOURCE_SESANSIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "sesans", "sesans_img") 
    3741SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism") 
    3842SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism", "mag_img") 
     
    4145SASMODELS_SOURCE_IMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model", "img") 
    4246SASMODELS_SOURCE_AUTOIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "_build", "html","_images") 
    43 SASMODELS_DEST_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "source") 
    44 SASMODELS_DEST_REF_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "source", "user") 
    45 SASMODELS_DEST_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "source", "user", "models") 
    46 SASMODELS_DEST_IMG = os.path.join(CURRENT_SCRIPT_DIR,  "source", "user", "model-imgs", "new-models") 
    47 SASMODELS_DEST_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR,  "source", "user", "mag_img") 
    48 SASMODELS_DEST_BUILDIMG = os.path.join(CURRENT_SCRIPT_DIR,  "source", "user", "models", "img") 
     47## Don't do assemble-in-place 
     48## Assemble the docs in a temporary folder 
     49SASMODELS_DEST_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "source-temp") 
     50SASMODELS_DEST_REF_MODELS = os.path.join(SASMODELS_DEST_PROLOG, "user") 
     51SASMODELS_DEST_MODELS = os.path.join(SASMODELS_DEST_PROLOG, "user", "models") 
     52SASMODELS_DEST_IMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "model-imgs", "new-models") 
     53SASMODELS_DEST_MAGIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "mag_img") 
     54SASMODELS_DEST_SESANSIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "sesans_img") 
     55SASMODELS_DEST_BUILDIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "models", "img") 
    4956 
    5057#if os.path.exists(SASMODELS_SOURCE_PROLOG): 
     
    6572 
    6673SPHINX_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build") 
    67 SPHINX_SOURCE = os.path.join(CURRENT_SCRIPT_DIR, "source") 
     74SPHINX_SOURCE = os.path.join(CURRENT_SCRIPT_DIR, "source-temp") 
    6875SPHINX_SOURCE_API = os.path.join(SPHINX_SOURCE, "dev", "api") 
    6976SPHINX_SOURCE_GUIFRAME = os.path.join(SPHINX_SOURCE, "user", "sasgui", "guiframe") 
     
    7178SPHINX_SOURCE_PERSPECTIVES = os.path.join(SPHINX_SOURCE, "user", "sasgui", "perspectives") 
    7279SPHINX_SOURCE_TEST = os.path.join(SPHINX_SOURCE, "test") 
     80SPHINX_SOURCE_USER = os.path.join(SPHINX_SOURCE, "user") 
    7381 
    7482BUMPS_DOCS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", 
     
    102110    _remove_dir(SASVIEW_DOCS) 
    103111    _remove_dir(SPHINX_BUILD) 
    104     _remove_dir(SPHINX_SOURCE_GUIFRAME) 
    105     _remove_dir(SPHINX_SOURCE_MODELS) 
    106     _remove_dir(SPHINX_SOURCE_PERSPECTIVES) 
    107     _remove_dir(SPHINX_SOURCE_TEST) 
    108  
     112    _remove_dir(SPHINX_SOURCE) 
     113    #_remove_dir(SPHINX_SOURCE_GUIFRAME) 
     114    #_remove_dir(SPHINX_SOURCE_MODELS) 
     115    #_remove_dir(SPHINX_SOURCE_PERSPECTIVES) 
     116    #_remove_dir(SPHINX_SOURCE_TEST) 
     117 
     118def setup_source_temp(): 
     119    """ 
     120    Copy the source toctrees to new folder for assembling the sphinx-docs 
     121    """ 
     122    print "=== Copying Source toctrees ===" 
     123    if os.path.exists(SASVIEW_TOC_SOURCE): 
     124       print "Found docs folder at ", SASVIEW_TOC_SOURCE 
     125       shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE) 
    109126 
    110127def retrieve_user_docs(): 
     
    176193            tohere=os.path.join(SASMODELS_DEST_IMG,files) 
    177194            shutil.copy(fromhere,tohere) 
    178         else: print "no source directorty",SASMODELS_SOURCE_AUTOIMG ,"was found" 
     195    else: print "no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found" 
    179196 
    180197    # And the rst prolog with the unit substitutions 
     
    190207                    shutil.copy(fromhere,tohere) 
    191208 
     209    if os.path.exists(SASMODELS_SOURCE_GPU): 
     210        print "Found docs folder SASMODELS_SOURCE_GPU at ", SASMODELS_SOURCE_GPU 
     211        if os.path.exists(SPHINX_SOURCE_USER): 
     212            print "Found docs folder SPHINX_SOURCE_USER      at ", SPHINX_SOURCE_USER 
     213            print "Copying sasmodels gpu files..." 
     214            for files in os.listdir(SASMODELS_SOURCE_GPU): 
     215                if files.endswith(".rst"): 
     216                    fromhere=os.path.join(SASMODELS_SOURCE_GPU,files) 
     217                    tohere=os.path.join(SPHINX_SOURCE_USER,files) 
     218                    shutil.copy(fromhere,tohere) 
     219 
     220    if os.path.exists(SASMODELS_SOURCE_SESANS): 
     221        print "Found docs folder SASMODELS_SOURCE_SESANS at ", SASMODELS_SOURCE_SESANS 
     222        if os.path.exists(SPHINX_SOURCE_USER): 
     223            print "Found docs folder SPHINX_SOURCE_USER      at ", SPHINX_SOURCE_USER 
     224            print "Copying sasmodels sesans files..." 
     225            for files in os.listdir(SASMODELS_SOURCE_SESANS): 
     226                if files.endswith(".rst"): 
     227                    fromhere=os.path.join(SASMODELS_SOURCE_SESANS,files) 
     228                    tohere=os.path.join(SPHINX_SOURCE_USER,files) 
     229                    shutil.copy(fromhere,tohere) 
     230 
    192231    if os.path.exists(SASMODELS_SOURCE_MAGNETISM): 
    193232        print "Found docs folder SASMODELS_SOURCE_MAGNETISM at ", SASMODELS_SOURCE_MAGNETISM 
     
    202241 
    203242    if os.path.exists(SASMODELS_SOURCE_MAGIMG): 
    204         print "Found img  folder SASMODELS_SOURCE_MAGIMG    at ", SASMODELS_SOURCE_MAGIMG 
     243        print "Found img folder SASMODELS_SOURCE_MAGIMG   at ", SASMODELS_SOURCE_MAGIMG 
    205244        if not os.path.exists(SASMODELS_DEST_MAGIMG): 
    206             print "Missing docs folder SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG 
     245            print "Missing img folder SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG 
    207246            os.makedirs(SASMODELS_DEST_MAGIMG) 
    208247            print "created SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG 
    209         print "Copying sasmodels model auto-generated image files..." 
     248        print "Copying sasmodels mag image files..." 
    210249        for files in os.listdir(SASMODELS_SOURCE_MAGIMG): 
    211250            fromhere=os.path.join(SASMODELS_SOURCE_MAGIMG,files) 
    212251            tohere=os.path.join(SASMODELS_DEST_MAGIMG,files) 
    213252            shutil.copy(fromhere,tohere) 
    214         else: print "no source directorty",SASMODELS_SOURCE_MAGIMG ,"was found" 
     253    else: print "no source directory",SASMODELS_SOURCE_MAGIMG ,"was found" 
     254 
     255    if os.path.exists(SASMODELS_SOURCE_SESANSIMG): 
     256        print "Found img folder SASMODELS_SOURCE_SESANSIMG   at ", SASMODELS_SOURCE_SESANSIMG 
     257        if not os.path.exists(SASMODELS_DEST_SESANSIMG): 
     258            print "Missing img folder SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG 
     259            os.makedirs(SASMODELS_DEST_SESANSIMG) 
     260            print "created SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG 
     261        print "Copying sasmodels sesans image files..." 
     262        for files in os.listdir(SASMODELS_SOURCE_SESANSIMG): 
     263            fromhere=os.path.join(SASMODELS_SOURCE_SESANSIMG,files) 
     264            tohere=os.path.join(SASMODELS_DEST_SESANSIMG,files) 
     265            shutil.copy(fromhere,tohere) 
     266    else: print "no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found" 
    215267 
    216268    if os.path.exists(SASMODELS_SOURCE_REF_MODELS): 
     
    323375def rebuild(): 
    324376    clean() 
     377    setup_source_temp() 
    325378    retrieve_user_docs() 
    326379    retrieve_bumps_docs() 
  • docs/sphinx-docs/source/conf.py

    r86eb046 r9a182b2  
    6262version = '4.0' 
    6363# The full version, including alpha/beta/rc tags. 
    64 release = '4.0b1' 
     64release = '4.0.0' 
    6565 
    6666# The language for content autogenerated by Sphinx. Refer to documentation 
  • docs/sphinx-docs/source/dev/dev.rst

    r476d4e3 re8447d8  
    11Developer Documentation 
    22======================= 
     3 
     4.. note:: In Windows use [Alt]-[Cursor left] to return to the previous page 
    35 
    46Contents 
  • docs/sphinx-docs/source/user/README-ABOUT-TOCTREE-FILES.TXT

    r54a2c927 re697487  
    11 
    2 The .rst files here in /sasview/docs/sphinx-docs/source/user are Sphinx toctree files. 
     2Several of the .rst files here in /sasview/docs/sphinx-docs/source/user are Sphinx toctree files. 
    33 
    44DO NOT delete them! 
    55 
     6analysis.rst 
     7tools.rst 
     8user.rst 
     9working.rst 
     10 
    611They are based on, but are different - because the SasView and Sasmodels directory trees  
    712are different - to files with the same name in /sasmodels/doc/ref/models. 
  • docs/sphinx-docs/source/user/analysis.rst

    r8f46df7 r46dfee9  
    1 Types of Analysis 
    2 ================= 
     1.. _analysis: 
     2 
     3Fitting & Other Analyses 
     4======================== 
    35 
    46.. note:: In Windows use [Alt]-[Cursor left] to return to the previous page 
     
    68.. toctree:: 
    79   :maxdepth: 1 
    8     
     10 
    911   Model Fitting <sasgui/perspectives/fitting/fitting> 
    10     
     12 
    1113   P(r) Inversion <sasgui/perspectives/pr/pr_help> 
    12     
     14 
    1315   Invariant Calculation <sasgui/perspectives/invariant/invariant_help> 
     16 
     17   Correlation Function <sasgui/perspectives/corfunc/corfunc_help> 
  • docs/sphinx-docs/source/user/tools.rst

    r8f46df7 r46dfee9  
    1 Tools 
    2 ===== 
     1.. _tools: 
     2 
     3Tools & Utilities 
     4================= 
    35 
    46.. note:: In Windows use [Alt]-[Cursor left] to return to the previous page 
     
    810 
    911   Data Operations Utility <sasgui/perspectives/calculator/data_operator_help> 
    10        
     12 
     13   SLD Calculator <sasgui/perspectives/calculator/sld_calculator_help> 
     14 
    1115   Density/Volume Calculator <sasgui/perspectives/calculator/density_calculator_help> 
     16 
     17   Slit Size Calculator <sasgui/perspectives/calculator/slit_calculator_help> 
     18 
     19   Kiessig Thickness Calculator <sasgui/perspectives/calculator/kiessig_calculator_help> 
     20 
     21   Q Resolution Estimator <sasgui/perspectives/calculator/resolution_calculator_help> 
     22 
     23   Generic SANS Calculator <sasgui/perspectives/calculator/sas_calculator_help> 
     24 
     25   Python Shell <sasgui/perspectives/calculator/python_shell_help> 
     26 
     27   Image Viewer <sasgui/perspectives/calculator/image_viewer_help> 
     28 
     29   File Converter <sasgui/perspectives/file_converter/file_converter_help> 
    1230    
    13    Generic SANS Calculator <sasgui/perspectives/calculator/sas_calculator_help> 
    14     
    15    Image Viewer <sasgui/perspectives/calculator/image_viewer_help> 
    16     
    17    Kiessig Thickness Calculator <sasgui/perspectives/calculator/kiessig_calculator_help> 
    18     
    19    SLD Calculator <sasgui/perspectives/calculator/sld_calculator_help> 
    20     
    21    Slit Size Calculator <sasgui/perspectives/calculator/slit_calculator_help> 
    22     
    23    Q Resolution Estimator <sasgui/perspectives/calculator/resolution_calculator_help> 
    24     
    25    Python Shell <sasgui/perspectives/calculator/python_shell_help> 
    26     
  • docs/sphinx-docs/source/user/tutorial.rst

    r13161ac re8447d8  
    11.. tutorial.rst 
     2 
     3.. _tutorial: 
    24 
    35Tutorial 
    46======== 
    57 
     8.. note:: In Windows use [Alt]-[Cursor left] to return to the previous page 
     9 
    610:download:`Tutorial <../../../../sasview/media/Tutorial.pdf>` 
  • docs/sphinx-docs/source/user/user.rst

    r20a3c55 r46dfee9  
    77   :maxdepth: 1 
    88 
    9    SasView Model Documentation <index> 
     9   Model Documentation <index> 
     10    
     11   Menu Bar <menu_bar> 
    1012 
    11    Analysis <analysis> 
     13   Fitting & Other Analyses <analysis> 
    1214    
    13    Tools <tools> 
     15   Tools & Utilities <tools> 
    1416          
    1517   Working with SasView <working> 
    16  
    17    Computations with GPU <gpu_computations> 
  • docs/sphinx-docs/source/user/working.rst

    r3a6b10d r46dfee9  
    1616       
    1717   Tutorial <tutorial.rst> 
     18    
     19   Writing a Plugin Model <sasgui/perspectives/fitting/plugin.rst> 
     20    
     21   Computations with a GPU <gpu_computations> 
     22    
  • run.py

    r832fea2 r18e7309  
    7272    platform = '%s-%s'%(get_platform(),sys.version[:3]) 
    7373    build_path = joinpath(root, 'build','lib.'+platform) 
    74      
    75     # Notify the help menu that the Sphinx documentation is in a different  
     74 
     75    # Notify the help menu that the Sphinx documentation is in a different 
    7676    # place than it otherwise would be. 
    7777    os.environ['SASVIEW_DOC_PATH'] = joinpath(build_path, "doc") 
     
    123123    # Compiled modules need to be pulled from the build directory. 
    124124    # Some packages are not where they are needed, so load them explicitly. 
     125    import sas.sascalc.file_converter 
     126    sas.sascalc.file_converter.core = import_package('sas.sascalc.file_converter.core', 
     127                                  joinpath(build_path, 'sas', 'sascalc', 'file_converter', 'core'))                     
     128 
     129    # Compiled modules need to be pulled from the build directory. 
     130    # Some packages are not where they are needed, so load them explicitly. 
    125131    import sas.sascalc.calculator 
    126132    sas.sascalc.calculator.core = import_package('sas.sascalc.calculator.core', 
  • sasview/README.txt

    r86eb046 r9a182b2  
    441- Features 
    55=========== 
     6    - New in Version 4.0 
     7      ------------------ 
     8      This release fixes the various bugs found during the alpha and beta testing 
     9      - Improvements 
     10        - Support for reading data files from Anton Paar Saxess instruments 
     11        - Adds documentation on how to write custom models in the new framework 
     12      - Bug Fixes 
     13        - Fixes bug #604 Pringle model questions 
     14        - Fixes bug #472 Reparameterize Teubner-Strey 
     15        - Fixes bug #530 Numerical instabilities in Teubner Strey model 
     16        - Fixes bug #658 ASCII reader very broken 
     17 
    618 
    719    - New in Version 4.0 beta 1 
     
    1426         - Old custom models should now still work 
    1527            - '''NOTE:''' These will be deprecated in a future version. Old 
    16             custom models should be converted to the new model format which  
     28            custom models should be converted to the new model format which 
    1729            is now the same as the built in models and offers much better 
    1830            support. 
     
    7991   - New in Version 3.1.2 
    8092     -------------------- 
    81      This release is a major stability improvement, having fixed a serious bug  
     93     This release is a major stability improvement, having fixed a serious bug 
    8294     that came to light since release 3.1.1. All users should upgrade. 
    8395 
    84      - Fixes bug #468 broken remove constraint buttons in  
     96     - Fixes bug #468 broken remove constraint buttons in 
    8597       simultaneous/constrained fitting panel 
    86      - Fixes bug #474 resulting from changes in 3.1.1 that had  
     98     - Fixes bug #474 resulting from changes in 3.1.1 that had 
    8799       introduced an error in the high-Q of slit-smeared models. 
    88      - Fixes bug #478 which would cause wx to run out of IDs and result  
     100     - Fixes bug #478 which would cause wx to run out of IDs and result 
    89101       in SasView crashing even if left alone. 
    90102     - Fixes bug #479 missing help button on simultaneous/constrained fit page 
     
    110122         documentation. 
    111123       - The model help has been split so that the Details button now brings up 
    112          a very short pop-up giving the equation being used while HELP goes to  
     124         a very short pop-up giving the equation being used while HELP goes to 
    113125         the section in the full documentation describing the model. 
    114        - Extensive help has also been added for the new optimizer engine (see  
     126       - Extensive help has also been added for the new optimizer engine (see 
    115127         below) including rules of thumb on how and when to choose a given 
    116128         optimizer and what the parameters do. 
     
    127139         - A Nelder-Mead Simplex optimizer 
    128140         - A Differential Evolution optimizer 
    129          - A Monte Carlo optimizer (DREAM)  
     141         - A Monte Carlo optimizer (DREAM) 
    130142     - New models were added: 
    131143         - MicelleSphCoreModel (currently residing in the Uncategorized category) 
     
    136148         - RectangularHollowPrismInfThinWallsModel 
    137149     - Infrastructure to allow SESANS data to be fit with models was added. This 
    138        will become available in a future release but can currently be used from  
     150       will become available in a future release but can currently be used from 
    139151       the command line with some caveats. 
    140152     - A number of bugs were fixed including a thread crashing issue and an 
     
    161173       floating. 
    162174     - Five new models have been added: PringlesModel, CoreShellEllipsoidXTModel, 
    163        RectangularPrismModel, RectangularHollowPrismModel and  
     175       RectangularPrismModel, RectangularHollowPrismModel and 
    164176       RectangularHollowPrismInfThinWallsModel. 
    165      - The data loader now supports ILL DAT data files and reads the full meta  
     177     - The data loader now supports ILL DAT data files and reads the full meta 
    166178       information from canSAS file formats. 
    167179     - Redefined convention for specifying angular parameters for anisotropic 
    168180       models. 
    169      - A number of minor features have been added such as permitting a log  
    170        distribution of points when using a model to simulate data, and the  
     181     - A number of minor features have been added such as permitting a log 
     182       distribution of points when using a model to simulate data, and the 
    171183       addition of a Kratky plot option to the linear plots. 
    172184     - A number of bugs have also been fixed. 
    173185     - Save Project and Save Analysis now work more reliably. 
    174      - BETA: Magnetic contrast supporting full polarization analysis has been  
     186     - BETA: Magnetic contrast supporting full polarization analysis has been 
    175187       implemented for some spherical and cylindrical models. 
    176188     - BETA: Two new tools have been added: 
    177        - A generic scattering calculator which takes an atomic, magnetic or  
    178          SLD distribution in space and generates the appropriate 2D  
    179          scattering pattern. In some cases the orientationally averaged  
    180          (powder) 1D scattering can also be computed. Supported formats  
    181          include: SLD or text, PDB, and OMF magnetic moment distribution  
     189       - A generic scattering calculator which takes an atomic, magnetic or 
     190         SLD distribution in space and generates the appropriate 2D 
     191         scattering pattern. In some cases the orientationally averaged 
     192         (powder) 1D scattering can also be computed. Supported formats 
     193         include: SLD or text, PDB, and OMF magnetic moment distribution 
    182194         file. 
    183        - An image viewer/converter for data in image format; this reads in  
    184          an image file and will attempt to convert the image pixels to  
     195       - An image viewer/converter for data in image format; this reads in 
     196         an image file and will attempt to convert the image pixels to 
    185197         data. Supported formats include: TIFF, TIF, PNG, BMP, JPG. 
    186198 
     
    210222     - Added more plot symbols options for 1d plots 
    211223     - Added improved trapping of compiling errors to the 'New model editor' 
    212      - Added some intelligent outputs (e.g., Rg, background, or rod diameter  
     224     - Added some intelligent outputs (e.g., Rg, background, or rod diameter 
    213225       depending on the choice of axis scale of the plot) to the linear fits 
    214226     - Added more models 
    215       
    216    - Feature set from previous versions          
     227 
     228   - Feature set from previous versions 
    217229     ----------------------------------- 
    218230     - Perspectives Available 
     
    220232         specific surface area. 
    221233       - P(r) inversion calculator: Indirect Fourier transformation method. 
    222        - Fitting: the tool used for modeling and fitting 1D and 2D data to  
     234       - Fitting: the tool used for modeling and fitting 1D and 2D data to 
    223235         analytical model functions 
    224236       - Tools: provides a number of useful supplementary tools such as SLD 
    225          calculation   
    226      
    227      - Fitting  
     237         calculation 
     238 
     239     - Fitting 
    228240       - Includes a large number of model functions, both form factors and structure factors. 
    229241       - Support P(Q)*S(Q) for form factors that flag they can be so multiplied. 
     
    233245       - Anisotropic shapes and magnetic moment modeling in 2D allow for a non-uniform 
    234246         distribution of orientations of a given axis leading to modeling and fitting 
    235          capabilities of non azimuthaly symmetric data.   
     247         capabilities of non azimuthaly symmetric data. 
    236248       - User can choose to weight fits or not. If using weights, the user can choose 
    237249         the error bar on each point if provided in the file, the square root 
    238          of the intensity or the intensity itself.  
     250         of the intensity or the intensity itself. 
    239251       - Instrumental resolution smearing of model or fits is provided with several 
    240252         options: read the resolution/point fromt he file. Input a pinhole resolution 
     
    249261         data set or several different sets simultaneously with the application 
    250262         of advanced constraints relating fit parameters to functions of other 
    251          parameters (including from a different set). For example thickness of  
    252          shell = sin(30) times the length.   
     263         parameters (including from a different set). For example thickness of 
     264         shell = sin(30) times the length. 
    253265       - Models that are the sum of two other models can be easily generated through the 
    254266         SUM Model menubar item. 
     
    259271         and the mathematical function of the model (box 2) and generating the 
    260272         necessary *.py file.  A separate advanced model editor provides a full Python 
    261          file editor.  Either way once saved the model becomes immediately available  
    262          to the application.  
     273         file editor.  Either way once saved the model becomes immediately available 
     274         to the application. 
    263275       - A batch fitting capability allows for the analysis of a series of data sets to 
    264276         a single model and provides the results in a tabular form suitable for saving 
    265277         or plotting the evolution of the fit parameters with error bars (from within 
    266278         the application). 
    267   
     279 
    268280     - Tools 
    269281       - A scattering length density calculator,including some X-ray information 
     
    275287       - A slit size calculator optimized for Anton Paar Saxess is provided. 
    276288       - A kiessig fringe thickness calculator is provided 
    277           
     289 
    278290     - Plots and plot management 
    279291       - A 3D graphing option (for 2d data/results) is provided with the view 
     
    289301       - Extensive context sensitive plot/fitting/manipulation options are available 
    290302         through a right mouse click pop-up menu on plots. 
    291             
     303 
    292304     - Data management 
    293305       - Supports 2 + column 1D ASCII data, NIST 1D and 2D data, and canSAS data 
    294          via plug-in mechanism which can easily allow other readers as appropriate.  
     306         via plug-in mechanism which can easily allow other readers as appropriate. 
    295307       - 2D data is expected in Q space but for historical reasons accepts the 
    296308         NIST 2D raw pixel format and will do conversion internally. 
     
    298310         right clicking on a data set and choosing Data Info in the DataExplorer 
    299311         or on the plots 
    300        - Supports loading a single file, multiple files, or a whole folder    
     312       - Supports loading a single file, multiple files, or a whole folder 
    301313       - An optional Data Explorer is provided (default) which simplifies managing, 
    302314         plotting, deleting, or setup for computation. Most functions however do 
     
    304316         right click menus and the toolbar.  The data explorer can be re-started 
    305317         from the menu bar. 
    306             
     318 
    307319     - Data manipulation 
    308320       - Support various 2D averaging methods : Circular, sectors, annular, 
     
    310322       - A 2D data maks editor is provided 
    311323       - 2D mask can be applied to the circular averaging. 
    312           
     324 
    313325     - Miscellaneous features 
    314326       - limited reports can be generated in pdf format 
     
    3313432- Downloading and Installing 
    332344============================= 
    333          
     345 
    334346   *** Note 1:  Much more information is available at www.sasview.org under links. 
    335347                    Look in the 'For Developers' section and particularly the wiki at 
     
    370382        - The following modules are required (version numbers are what are used 
    371383          in the windows release build): 
    372            
     384 
    373385          - Common Packages 
    374386            - reportlab 3.1.44 
     
    387399            - html5lib Version Installed: 0.99999 
    388400            - wx Version Installed: 3.0.2.0 
    389            
     401 
    390402          - Windows Specific Packages 
    391403            - pywin 219 
     
    393405            - comtypes 1.1.1 
    394406            - MinGW w/ gcc version 4.6.1 (WIN) 
    395             - vcredist_x86.exe (version 9.0.21022.8  -microsoft visual C 2008  
     407            - vcredist_x86.exe (version 9.0.21022.8  -microsoft visual C 2008 
    396408              re-distributable) 
    397409            - Innosetup (WIN - isetup 5.4.2-unicode) - used to create distributable 
     
    399411            *** Note: Windows build dependencies can be set up using anaconda. Instructions 
    400412                can be found at http://trac.sasview.org/wiki/AnacondaSetup 
    401              
     413 
    402414          - MAC Specifc Packages 
    403415            - py2app 0.7.1 
    404            
     416 
    405417 
    4064183- Known Issues 
     
    412424          equations will render properly. Until then they will show in their 
    413425          original TeX format. 
    414         - If the documentation window remains stubbornly blank, try installing a  
     426        - If the documentation window remains stubbornly blank, try installing a 
    415427          different browser and set that as your default browser. Issues have 
    416428          been noted with Internet Explorer 11. 
    417         - Check for Updates may fail (with the status bar message ' Cannot  
    418           connect to the application server') if your internet connection uses  
    419           a proxy server. Tested resolutions for this are described on the  
     429        - Check for Updates may fail (with the status bar message ' Cannot 
     430          connect to the application server') if your internet connection uses 
     431          a proxy server. Tested resolutions for this are described on the 
    420432          website FAQ. 
    421433        - The copy and paste functions (^C, ^V) in the batch mode results grid 
    422434          require two clicks: one to select the cell and a second to select the 
    423           contents of the cell.  
     435          contents of the cell. 
    424436        - The tutorial has not yet been updated and is somewhat out of date 
    425437        - Very old computers may struggle to run the 3.x and later releases 
     
    436448        - The angular distribution angles are not clearly defined and may in 
    437449          some cases lead to incorrect calculations(ticket #332) 
    438            
     450 
    439451   3.2- Windows: 
    440452        - If installed to same directory as old version without first removing 
     
    443455          have the old name even though pointing to the new version.  Usually 
    444456          safest to uninstall old version prior to installing new version anyway. 
    445                  
     457 
    446458   3.3- MAC: 
    447459        - Application normally starts up hidden. Click icon in Dock to view/use 
    448           application.  
     460          application. 
    449461        - Multiprocessing does not currently work on MAC OS 
    450                  
     462 
    451463   3.4- Linux: 
    452464        - Not well tested 
     
    456468================== 
    457469 
    458    - www.sasview.org.  This main project site is the gateway to all  
     470   - www.sasview.org.  This main project site is the gateway to all 
    459471     information about the sasview project.  It includes information 
    460472     about the project, a FAQ page and links to all developer and user 
     
    475487   - Latest developer builds 
    476488     - https://jenkins.esss.dk/sasview/view/Master-Builds/ 
    477  
    478      
  • sasview/__init__.py

    r4ac4caa r9a182b2  
    1 __version__ = "4.0b1" 
     1__version__ = "4.0" 
    22__build__ = "GIT_COMMIT" 
    33try: 
  • sasview/custom_config.py

    r79492222 r73cbeec  
    1515TOOLBAR_SHOW = True 
    1616DEFAULT_PERSPECTIVE = "Fitting" 
     17SAS_OPENCL = "None" 
  • sasview/installer_generator.py

    r525aaa2 r450c6f6  
    203203    msg += """Source: "dist\config\custom_config.py";\tDestDir: "{userdesktop}\..\.sasview\config";\t"""  
    204204    msg += """Flags: recursesubdirs createallsubdirs\n""" 
    205     msg += """Source: "dist\default_categories.json";    DestDir: "{userdesktop}\..\.sasview";\t"""  
    206     msg += """DestName: "categories.json";\n""" 
     205    #msg += """Source: "dist\default_categories.json";    DestDir: "{userdesktop}\..\.sasview";\t"""  
     206    #msg += """DestName: "categories.json";\n""" 
    207207    msg += """;\tNOTE: Don't use "Flags: ignoreversion" on any shared system files""" 
    208208    return msg 
  • sasview/local_config.py

    rd85c194 r73cbeec  
    3131_acknowledgement_preamble =\ 
    3232'''To ensure the long term support and development of this software please''' +\ 
    33 ''' remember to do the following.''' 
     33''' remember to:''' 
    3434_acknowledgement_preamble_bullet1 =\ 
    35 '''Acknowledge its use in your publications as suggested below''' 
     35'''Acknowledge its use in your publications as suggested below;''' 
    3636_acknowledgement_preamble_bullet2 =\ 
    37 '''Reference the following website: http://www.sasview.org''' 
     37'''Reference SasView as : M. Doucet, et al. SasView Version 4.0, Zenodo''' +\ 
     38''', http://doi.org/10.5281/zenodo.159083;''' 
    3839_acknowledgement_preamble_bullet3 =\ 
    39 '''Reference the model you used if appropriate (see documentation for refs)''' 
     40'''Reference the model you used if appropriate (see documentation for refs);''' 
    4041_acknowledgement_preamble_bullet4 =\ 
    4142'''Send us your reference for our records: developers@sasview.org''' 
    4243_acknowledgement_publications = \ 
    43 '''This work benefited from the use of the SasView application, originally 
    44 developed under NSF award DMR-0520547. 
    45 ''' 
     44'''This work benefited from the use of the SasView application, originally developed under NSF Award  
     45DMR-0520547. SasView also contains code developed with funding from the EU Horizon 2020 programme  
     46under the SINE2020 project Grant No 654000, and by Patrick O'Brien & Adam Washington.''' 
     47 
    4648_acknowledgement =  \ 
    47 '''This work originally developed as part of the DANSE project funded by the NSF 
    48 under grant DMR-0520547, and currently maintained by NIST, UMD, ORNL, ISIS, ESS 
    49 and ILL. 
     49'''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547, but is currently maintained  
     50by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO and TU Delft. SasView also contains code developed with funding from the  
     51EU Horizon 2020 programme under the SINE2020 project (Grant No 654000), and by Patrick O'Brien (pycrust) and Adam Washington (corfunc-py).''' 
    5052 
    51 ''' 
    5253_homepage = "http://www.sasview.org" 
    5354_download = __download_page__ 
     
    6566_umd_logo = os.path.join(icon_path, "umd_logo.png") 
    6667_sns_logo = os.path.join(icon_path, "sns_logo.png") 
     68_ornl_logo = os.path.join(icon_path, "ornl_logo.png") 
    6769_isis_logo = os.path.join(icon_path, "isis_logo.png") 
    6870_ess_logo = os.path.join(icon_path, "ess_logo.png") 
    6971_ill_logo = os.path.join(icon_path, "ill_logo.png") 
     72_ansto_logo = os.path.join(icon_path, "ansto_logo.png") 
     73_tudelft_logo = os.path.join(icon_path, "tudelft_logo.png") 
    7074_nsf_logo = os.path.join(icon_path, "nsf_logo.png") 
    7175_danse_logo = os.path.join(icon_path, "danse_logo.png") 
     
    7478_umd_url = "http://www.umd.edu/" 
    7579_sns_url = "http://neutrons.ornl.gov/" 
     80_ornl_url = "http://neutrons.ornl.gov/" 
    7681_nsf_url = "http://www.nsf.gov" 
    7782_isis_url = "http://www.isis.stfc.ac.uk/" 
    7883_ess_url = "http://ess-scandinavia.eu/" 
    7984_ill_url = "http://www.ill.eu/" 
     85_ansto_url = "http://www.ansto.gov.au/" 
     86_tudelft_url = "http://www.tnw.tudelft.nl/en/cooperation/facilities/reactor-instituut-delft/" 
    8087_danse_url = "http://www.cacr.caltech.edu/projects/danse/release/index.html" 
    8188_inst_url = "http://www.utk.edu" 
    8289_corner_image = os.path.join(icon_path, "angles_flat.png") 
    8390_welcome_image = os.path.join(icon_path, "SVwelcome.png") 
    84 _copyright = "(c) 2009 - 2013, UTK, UMD, NIST, ORNL, ISIS, ESS and ILL" 
    85  
     91_copyright = "(c) 2009 - 2016, UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO and TU Delft" 
     92marketplace_url = "http://marketplace.sasview.org/" 
    8693 
    8794#edit the list of file state your plugin can read 
     
    9097GUIFRAME_WIDTH = 1150 
    9198GUIFRAME_HEIGHT = 840 
    92 PLUGIN_STATE_EXTENSIONS = ['.fitv', '.inv', '.prv'] 
     99PLUGIN_STATE_EXTENSIONS = ['.fitv', '.inv', '.prv', '.crf'] 
    93100PLUGINS_WLIST = ['Fitting files (*.fitv)|*.fitv', 
    94101                 'Invariant files (*.inv)|*.inv', 
    95                  'P(r) files (*.prv)|*.prv'] 
     102                 'P(r) files (*.prv)|*.prv', 
     103                 'Corfunc files (*.crf)|*.crf'] 
    96104PLOPANEL_WIDTH = 415 
    97105PLOPANEL_HEIGTH = 370 
     
    132140UPDATE_TIMEOUT = 2 
    133141 
     142#OpenCL option 
     143SAS_OPENCL = None 
     144 
    134145def printEVT(message): 
    135146    if __EVT_DEBUG__: 
  • sasview/sasview.py

    rcde6e52 r8d3d20a  
    148148            logging.error(traceback.format_exc()) 
    149149 
     150        # Corfunc perspective 
     151        try: 
     152            import sas.sasgui.perspectives.corfunc as module 
     153            corfunc_plug = module.Plugin() 
     154            self.gui.add_perspective(corfunc_plug) 
     155        except: 
     156            logging.error("Unable to load corfunc module") 
     157 
    150158        #Calculator perspective 
    151159        try: 
     
    155163        except: 
    156164            logging.error("%s: could not find Calculator plug-in module"% \ 
     165                                                        APP_NAME) 
     166            logging.error(traceback.format_exc()) 
     167 
     168        # File converter tool 
     169        try: 
     170            import sas.sasgui.perspectives.file_converter as module 
     171            converter_plug = module.Plugin() 
     172            self.gui.add_perspective(converter_plug) 
     173        except: 
     174            logging.error("%s: could not find File Converter plug-in module"% \ 
    157175                                                        APP_NAME) 
    158176            logging.error(traceback.format_exc()) 
  • sasview/setup_exe.py

    r525aaa2 r8b645cc  
    165165        self.version = local_config.__version__ 
    166166        self.company_name = "SasView.org" 
    167         self.copyright = "copyright 2009 - 2013" 
     167        self.copyright = "copyright 2009 - 2016" 
    168168        self.name = "SasView" 
    169169         
     
    239239    data_files.append(('.', [f])) 
    240240 
    241 f = 'default_categories.json' 
    242 if os.path.isfile(f): 
    243     data_files.append(('.', [f])) 
     241#f = 'default_categories.json' 
     242#if os.path.isfile(f): 
     243#    data_files.append(('.', [f])) 
    244244 
    245245# numerical libraries 
     
    372372    ) 
    373373 
    374 bundle_option = 2 
     374# bundle_option = 2 
     375bundle_option = 3 
    375376if is_64bits: 
    376377    bundle_option = 3 
  • sasview/setup_mac.py

    r3d8e3c7 rb58654c  
    6262 
    6363APP = ['sasview.py'] 
    64 DATA_FILES += ['images','test','media', 'custom_config.py', 'local_config.py', 
    65                'default_categories.json'] 
     64DATA_FILES += ['images','test','media', 'custom_config.py', 'local_config.py'] 
    6665if os.path.isfile("BUILD_NUMBER"): 
    6766    DATA_FILES.append("BUILD_NUMBER") 
  • sasview/test/README.txt

    rd4c88e24 r3f9a18a  
    1 Test data sets are included as a convenience to our users. The data sets are organized based on their data structure; 1D data, 2D data, SASVIEW saved states, and data in formats that are not yet implemented but are in the works for future versions. 
    2 1D data sets have at least two columns of data with I(abs. units) on the y-axis and Q on the x-axis. 2D data sets are data sets that give the deduced intensity for each detector pixel. Depending on the file extension, uncertainty and meta data may also be available. 
     1Test data sets are included as a convenience to our users. The data sets are organized based on their data structure; 1D data (ie, I(Q)), 2D data (ie, I(Qx,Qy)), coordinate data (eg, PDB files), image data (eg, TIFF files), SasView saved states, SESANS data, and data in formats that are not yet implemented but which are in the works for future releases. 
     2 
     31D data sets EITHER a) have at least two columns of data with I(abs. units) on the y-axis and Q on the x-axis, OR b) have I and Q in separate files. Data in the latter format (/convertible_files) need to be converted to a single file format with the File Converter tool before SasView will analyse them. 
     4 
     52D data sets are data sets that give the deduced intensity for each detector pixel. Depending on the file extension, uncertainty and metadata may also be available. 
     6 
     7Coordinate data sets are designed to be read by the Generic Scattering Calculator tool. 
     8 
     9Image data sets are designed to be read by the Image Viewer tool. 
     10 
    311Save states are projects and analyses saved by the SASVIEW program. A single analysis file contains the data and parameters for a single fit (.fit), p(r) inversion (.pr), or invariant calculation (.inv). A project file (.svs) contains the results for every active analysis. 
     12 
     13SESANS data sets primarily contain the neutron polarisation as a function of the spin-echo length. 
  • sasview/test/media/testdata_help.rst

    ra32aa3e r3f9a18a  
    77sub-folder in your SasView installation folder. 
    88 
    9 The data sets are organized based on their data structure; 1D data, 2D data,  
    10 SASVIEW saved states, and data in formats that are not yet implemented but  
    11 which are in the works for future versions. 
     9The test data sets are organized based on their data structure: 
    1210 
    13 1D data sets have at least two columns of data with Intensity (assumed  
    14 absolute units) on the Y-axis and Q on the X-axis.  
    15  
    16 2D data sets are data sets that give the deduced intensity for each detector  
    17 pixel. Depending on the file extension, uncertainty and meta data may also be  
    18 available. 
    19  
    20 Saved states are projects and analyses saved by the SasView program. A single  
    21 analysis file contains the data and parameters for a single fit (.fit), p(r)  
    22 inversion (.pr), or invariant calculation (.inv). A project file (.svs) contains  
    23 the results for every active analysis. 
    24  
    25 Some of the available test data is described below. 
     11- *1D data* 
     12- *convertible 1D data files* 
     13- *2D data* 
     14- *coordinate data* 
     15- *image data* 
     16- *SESANS data* 
     17- *save states* 
     18- *upcoming formats* 
    2619 
    2720.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    2821 
     221D Data 
     23^^^^^^^ 
     241D data sets EITHER have: 
     25 
     26- at least two columns of data with I(Q) (assumed to be in absolute units) on the y-axis and Q on the x-axis. And additional columns of data may carry uncertainty data, resolution data, or other metadata. 
     27 
     28OR: 
     29 
     30- the I(Q) and Q data in separate files *with no other information*. 
     31 
     32Data in the latter format need to be converted to a single file format with the :ref:`File_Converter_Tool` before they can be analysed in SasView. Test files are located in the /convertible_files folder. 
     33 
    29341D Test Data 
    30 ^^^^^^^^^^^^ 
     35............ 
     3633837rear_1D_1.75_16.5 
     37  - Data from a magnetically-oriented surfactant liquid crystal output by the Mantid framework. The data was collected on the SANS2D instrument at ISIS. 
    3138 
     3910wtAOT_Reline_120_reduced / Anton-Paar / saxsess_example 
     40  - Data from Anton-Paar SAXSess instruments saved in Otto Glatter's PDH format. 
     41   
    3242AOT_Microemulsion 
    3343  - Aerosol-OT surfactant stabilised oil-in-water microemulsion data at three  
     
    3545    (surfactant layer). 
    3646  - Suitable for testing simultaneous fitting. 
    37    
     47 
     48APS_DND-CAT 
     49  - ASCII data from the DND-CAT beamline at the APS. 
     50 
    3851hSDS_D2O 
    3952  - h25-sodium dodecyl sulphate solutions at two concentrations: 0.5wt% (just  
     
    4255  - Suitable for testing charged S(Q) models. 
    4356 
    44 P123_D2O 
    45   - Lyotropic liquid crystalline solutions of non-ionic ABA block copolymer  
    46     Pluronic P123 in water at three concentrations: 10wt%, 30wt%, and 40wt%. 
    47   - Suitable for testing paracrystal models. 
     57ISIS_83404 / ISIS_98929 
     58  - Polyamide-6 fibres hydrated in D2O exhibiting a broad lamellar peak from the semi-crystalline nanostructure. 
     59  - This is the *same data* as that in the BSL/OTOKO Z8300* / Z9800* files but in an amalgamated ASCII format! 
     60  - Suitable for testing :ref:`Correlation_Function_Analysis` . 
    4861 
    4962ISIS_Polymer_Blend_TK49 
     
    5164    polymer blend. 
    5265  - Suitable for testing Poly_GaussCoil and RPA10 models. 
    53  
    54 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    55  
    56 2D Test Data 
    57 ^^^^^^^^^^^^ 
    5866 
    5967P123_D2O 
     
    6472.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    6573 
     74Convertible 1D Data 
     75^^^^^^^^^^^^^^^^^^^ 
     76 
     77APS_X / APS_Y 
     78  - ASCII data output by a reduction software package at the APS. 
     79  - Suitable for testing the :ref:`File_Converter_Tool` . 
     80 
     81FIT2D_I / FIT2D_Q 
     82  - ASCII data output by the FIT2D software package at the ESRF. 
     83  - Suitable for testing the :ref:`File_Converter_Tool` . 
     84 
     85Z8300*.I1D / Z8300*.QAX / Z9800*.I1D / Z9800*.QAX 
     86  - BSL/OTOKO data from polyamide-6 fibres hydrated in D2O exhibiting a broad lamellar peak from the semi-crystalline nanostructure. 
     87  - This is the *same data* as that in ISIS_83404 / ISIS_98929 but in an older separated format! 
     88  - Suitable for testing the :ref:`File_Converter_Tool` . 
     89  - Suitable for testing :ref:`Correlation_Function_Analysis` . 
     90 
     91.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     92 
     932D Data 
     94^^^^^^^ 
     952D data sets are data sets that give the reduced intensity for each Qx-Qy bin. Depending on the file format, uncertainty data and metadata may also be available. 
     96 
     972D Test Data 
     98............ 
     9933837rear_2D_1.75_16.5 
     100  - Data from a magnetically-oriented surfactant liquid crystal output by the Mantid framework. The data was collected on the SANS2D instrument at ISIS. 
     101 
     102P123_D2O 
     103  - Lyotropic liquid crystalline solutions of non-ionic ABA block copolymer  
     104    Pluronic P123 in water at three concentrations: 10wt%, 30wt%, and 40wt%. 
     105  - Suitable for testing paracrystal models. 
     106 
     107.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     108 
     109Coordinate Data 
     110^^^^^^^^^^^^^^^ 
     111Coordinate data sets, such as PDB or OMF files, and which describe a specific structure, are designed to be read and viewed in the :ref:`SANS_Calculator_Tool` . 
     112 
     113Coordinate Test Data 
     114.................... 
     115A_Raw_Example-1 
     116  - OMF format data file from a simulation of magnetic spheres. 
     117 
     118diamond 
     119  - PDB format data file for diamond. 
     120 
     121dna 
     122  - PDB format data file for DNA. 
     123 
     124sld_file 
     125  - Example SLD format data file. 
     126 
     127.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     128 
     129Image Data 
     130^^^^^^^^^^ 
     131Image data sets are designed to be read by the :ref:`Image_Viewer_Tool` . They can be converted into synthetic 2D data. 
     132 
     133Image Test Data 
     134............... 
     135ISIS_98940 
     136  - Polyamide-6 fibres hydrated in D2O exhibiting a broad lamellar peak from the semi-crystalline nanostructure. 
     137  - Data is presented in Windows Bitmap (BMP), GIF, JPEG (JPG), PNG, and TIFF (TIF) formats. 
     138 
     139.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     140 
     141SESANS Data 
     142^^^^^^^^^^^ 
     143SESANS (Spin-Echo SANS) data sets primarily contain the neutron polarisation as a function of the spin-echo length. Also see :ref:`SESANS` . 
     144 
     145SESANS Test Data 
     146................ 
     147spheres2micron 
     148  - SESANS data from 2 micron polystyrene spheres in 53% H2O / 47% D2O. 
     149 
     150.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     151 
     152Save States 
     153^^^^^^^^^^^ 
     154Saved states are projects and analyses saved by the SasView program. A single  
     155analysis file contains the data and parameters for a single fit (.fit), p(r)  
     156inversion (.prv), or invariant calculation (.inv). A project file (.svs) contains  
     157the results for every active analysis in a SasView session. 
     158 
    66159Saved State Test Data 
    67 ^^^^^^^^^^^^^^^^^^^^^ 
     160..................... 
     161fitstate.fitv 
     162  - a saved fitting analysis. 
    68163 
    69 _phi_weights.txt 
     164test.inv 
     165  - a saved invariant analysis. 
    70166 
    71 _radius_dist.txt 
     167test002.inv 
     168  - a saved invariant analysis. 
    72169 
    73 _THETA_weights.txt 
    74  
    75 fitstate.fitv 
     170prstate.prv 
     171  - a saved P(r) analysis. 
    76172 
    77173newone.svs 
     174  - a saved SasView project. 
    78175 
    79 prstate.prv 
     176.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    80177 
    81 sld_file.sld 
    82  
    83 test.inv 
    84  
    85 test002.inv 
     178Upcoming Formats 
     179^^^^^^^^^^^^^^^^ 
     180Data in this folder are in formats that are not yet implemented in SasView but which might be in future versions of the program. 
    86181 
    87182.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    89184Other Test Data 
    90185^^^^^^^^^^^^^^^ 
     186phi_weights.txt 
    91187 
    92 1000A_sphere_sm.xml 
     188radius_dist.txt 
    93189 
    94 diamond.pdb 
    95  
    96 dna.pdb 
     190THETA_weights.txt 
    97191 
    98192.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    99193 
    100 .. note::  This help document was last changed by Steve King, 26Jun2015 
     194.. note::  This help document was last changed by Steve King, 06Oct2016 
  • setup.py

    rdb74ee8 r18e7309  
    99from distutils.command.build_ext import build_ext 
    1010from distutils.core import Command 
     11import numpy 
    1112 
    1213# Manage version number ###################################### 
     
    5455        print "Removing existing build directory", SASVIEW_BUILD, "for a clean build" 
    5556        shutil.rmtree(SASVIEW_BUILD) 
    56                      
     57 
    5758# 'sys.maxsize' and 64bit: Not supported for python2.5 
    5859is_64bits = False 
    5960if sys.version_info >= (2, 6): 
    6061    is_64bits = sys.maxsize > 2**32 
    61      
     62 
    6263enable_openmp = False 
    6364 
     
    118119        c = self.compiler.compiler_type 
    119120        print "Compiling with %s (64bit=%s)" % (c, str(is_64bits)) 
    120          
     121 
    121122        # OpenMP build options 
    122123        if enable_openmp: 
     
    127128                for e in self.extensions: 
    128129                    e.extra_link_args = lopt[ c ] 
    129                      
     130 
    130131        # Platform-specific build options 
    131132        if platform_lopt.has_key(c): 
     
    205206) 
    206207 
    207      
     208 
    208209# sas.sascalc.pr 
    209210srcdir  = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") 
     
    217218                              include_dirs=[], 
    218219                              ) ) 
    219          
     220 
     221# sas.sascalc.file_converter 
     222mydir = os.path.join("src", "sas", "sascalc", "file_converter", "c_ext") 
     223package_dir["sas.sascalc.file_converter.core"] = mydir 
     224package_dir["sas.sascalc.file_converter"] = os.path.join("src","sas", "sascalc", "file_converter") 
     225packages.extend(["sas.sascalc.file_converter","sas.sascalc.file_converter.core"]) 
     226ext_modules.append( Extension("sas.sascalc.file_converter.core.bsl_loader", 
     227                              sources = [os.path.join(mydir, "bsl_loader.c")], 
     228                              include_dirs=[numpy.get_include()], 
     229                              ) ) 
     230 
    220231# sas.sascalc.fit 
    221232package_dir["sas.sascalc.fit"] = os.path.join("src", "sas", "sascalc", "fit") 
     
    239250packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.calculator"]) 
    240251package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*'] 
    241      
     252 
    242253# Data util 
    243254package_dir["sas.sascalc.data_util"] = os.path.join("src", "sas", "sascalc", "data_util") 
     
    294305                               'test/2d_data/*', 
    295306                               'test/save_states/*', 
    296                                'test/upcoming_formats/*',  
     307                               'test/upcoming_formats/*', 
    297308                                 'default_categories.json'] 
    298309packages.append("sas.sasview") 
     
    316327    required.extend(['pillow']) 
    317328 
    318 # Set up SasView     
     329# Set up SasView 
    319330setup( 
    320331    name="sasview", 
     
    341352                'docs': BuildSphinxCommand, 
    342353                'disable_openmp': DisableOpenMPCommand} 
    343     )    
     354    ) 
  • src/sas/sascalc/data_util/qsmearing.py

    rf8aa738 rd3911e3  
    4141        elif data.dqx_data == None or data.dqy_data == None: 
    4242            return None 
    43         return Pinhole2D(data) 
     43        return PySmear2D(data, model) 
    4444 
    4545    if  not hasattr(data, "dx") and not hasattr(data, "dxl")\ 
     
    142142    width = data.dx if data.dx is not None else 0 
    143143    return PySmear(Pinhole1D(q, width), model) 
     144 
     145 
     146class PySmear2D(object): 
     147    """ 
     148    Q smearing class for SAS 2d pinhole data 
     149    """ 
     150 
     151    def __init__(self, data=None, model=None): 
     152        self.data = data 
     153        self.model = model 
     154        self.accuracy = 'Low' 
     155        self.limit = 3.0 
     156        self.index = None 
     157        self.coords = 'polar' 
     158        self.smearer = True 
     159 
     160    def set_accuracy(self, accuracy='Low'): 
     161        """ 
     162        Set accuracy. 
     163 
     164        :param accuracy:  string 
     165        """ 
     166        self.accuracy = accuracy 
     167 
     168    def set_smearer(self, smearer=True): 
     169        """ 
     170        Set whether or not smearer will be used 
     171 
     172        :param smearer: smear object 
     173 
     174        """ 
     175        self.smearer = smearer 
     176 
     177    def set_data(self, data=None): 
     178        """ 
     179        Set data. 
     180 
     181        :param data: DataLoader.Data_info type 
     182        """ 
     183        self.data = data 
     184 
     185    def set_model(self, model=None): 
     186        """ 
     187        Set model. 
     188 
     189        :param model: sas.models instance 
     190        """ 
     191        self.model = model 
     192 
     193    def set_index(self, index=None): 
     194        """ 
     195        Set index. 
     196 
     197        :param index: 1d arrays 
     198        """ 
     199        self.index = index 
     200 
     201    def get_value(self): 
     202        """ 
     203        Over sampling of r_nbins times phi_nbins, calculate Gaussian weights, 
     204        then find smeared intensity 
     205        """ 
     206        if self.smearer: 
     207            res = Pinhole2D(data=self.data, index=self.index, 
     208                            nsigma=3.0, accuracy=self.accuracy, 
     209                            coords=self.coords) 
     210            val = self.model.evalDistribution(res.q_calc) 
     211            return res.apply(val) 
     212        else: 
     213            index = self.index if self.index is not None else slice(None) 
     214            qx_data = self.data.qx_data[index] 
     215            qy_data = self.data.qy_data[index] 
     216            q_calc = [qx_data, qy_data] 
     217            val = self.model.evalDistribution(q_calc) 
     218            return val 
     219 
  • src/sas/sascalc/dataloader/data_info.py

    r45d7662 r345e7e4  
    881881                raise ValueError, msg 
    882882            # Here we could also extrapolate between data points 
    883             ZERO = 1.0e-12 
     883            TOLERANCE = 0.01 
    884884            for i in range(len(self.x)): 
    885                 if math.fabs(self.x[i] - other.x[i]) > ZERO: 
     885                if math.fabs((self.x[i] - other.x[i])/self.x[i]) > TOLERANCE: 
    886886                    msg = "Incompatible data sets: x-values do not match" 
    887887                    raise ValueError, msg 
     
    10931093        """ 
    10941094        err_other = None 
     1095        TOLERANCE = 0.01 
    10951096        if isinstance(other, Data2D): 
    10961097            # Check that data lengths are the same 
     
    11011102                raise ValueError, msg 
    11021103            for ind in range(len(self.data)): 
    1103                 if self.qx_data[ind] != other.qx_data[ind]: 
    1104                     msg = "Incompatible data sets: qx-values do not match" 
     1104                if math.fabs((self.qx_data[ind] - other.qx_data[ind])/self.qx_data[ind]) > TOLERANCE: 
     1105                    msg = "Incompatible data sets: qx-values do not match: %s %s" % (self.qx_data[ind], other.qx_data[ind]) 
    11051106                    raise ValueError, msg 
    1106                 if self.qy_data[ind] != other.qy_data[ind]: 
    1107                     msg = "Incompatible data sets: qy-values do not match" 
     1107                if math.fabs((self.qy_data[ind] - other.qy_data[ind])/self.qy_data[ind]) > TOLERANCE: 
     1108                    msg = "Incompatible data sets: qy-values do not match: %s %s" % (self.qy_data[ind], other.qy_data[ind]) 
    11081109                    raise ValueError, msg 
    11091110 
  • src/sas/sascalc/dataloader/manipulations.py

    rb699768 rb2b36932  
    143143        :return: Data1D object 
    144144        """ 
    145         if len(data2D.detector) != 1: 
     145        if len(data2D.detector) > 1: 
    146146            msg = "_Slab._avg: invalid number of " 
    147147            msg += " detectors: %g" % len(data2D.detector) 
     
    299299            error on number of counts, number of entries summed 
    300300        """ 
    301         if len(data2D.detector) != 1: 
     301        if len(data2D.detector) > 1: 
    302302            msg = "Circular averaging: invalid number " 
    303303            msg += "of detectors: %g" % len(data2D.detector) 
  • src/sas/sascalc/dataloader/readers/anton_paar_saxs_reader.py

    r80c5d46 ra235f715  
    4545    output = None 
    4646 
    47     def __init__(self): 
     47    def reset_state(self): 
    4848        self.current_dataset = Data1D(np.empty(0), np.empty(0), 
    4949                                            np.empty(0), np.empty(0)) 
     
    7272 
    7373        ## Reinitialize the class when loading a new data file to reset all class variables 
    74         self.__init__() 
     74        self.reset_state() 
    7575        ## Check that the file exists 
    7676        if os.path.isfile(filename): 
     
    8484                self.raw_data = buff.splitlines() 
    8585                self.read_data() 
    86                 xml_intermediate = self.raw_data[self.upper:] 
    87                 xml = ''.join(xml_intermediate) 
    88                 self.set_xml_file(xml) 
    8986        return self.output 
    9087 
     
    10097        self.lower = 5 
    10198        self.upper = self.lower + self.data_points 
    102         self.detector.distance = float(line4[1]) 
     99        self.source.radiation = 'x-ray' 
     100        normal = float(line4[3]) 
    103101        self.current_dataset.source.radiation = "x-ray" 
    104102        self.current_dataset.source.name = "Anton Paar SAXSess Instrument" 
    105103        self.current_dataset.source.wavelength = float(line4[4]) 
    106         normal = line4[3] 
     104        xvals = [] 
     105        yvals = [] 
     106        dyvals = [] 
    107107        for i in range(self.lower, self.upper): 
     108            index = i - self.lower 
    108109            data = self.raw_data[i].split() 
    109             x_val = [float(data[0])] 
    110             y_val = [float(data[1])] 
    111             dy_val = [float(data[2])] 
    112             self.current_dataset.x = np.append(self.current_dataset.x, x_val) 
    113             self.current_dataset.y = np.append(self.current_dataset.y, y_val) 
    114             self.current_dataset.dy = np.append(self.current_dataset.dy, dy_val) 
    115         self.current_dataset.xaxis("Q (%s)" % (q_unit), q_unit) 
    116         self.current_dataset.yaxis("Intensity (%s)" % (i_unit), i_unit) 
    117         self.current_dataset.detector.append(self.detector) 
     110            xvals.insert(index, normal * float(data[0])) 
     111            yvals.insert(index, normal * float(data[1])) 
     112            dyvals.insert(index, normal * float(data[2])) 
     113        self.current_dataset.x = np.append(self.current_dataset.x, xvals) 
     114        self.current_dataset.y = np.append(self.current_dataset.y, yvals) 
     115        self.current_dataset.dy = np.append(self.current_dataset.dy, dyvals) 
     116        if self.data_points != self.current_dataset.x.size: 
     117            self.errors.add("Not all data was loaded properly.") 
     118        if self.current_dataset.dx.size != self.current_dataset.x.size: 
     119            dxvals = np.zeros(self.current_dataset.x.size) 
     120            self.current_dataset.dx = dxvals 
     121        if self.current_dataset.x.size != self.current_dataset.y.size: 
     122            self.errors.add("The x and y data sets are not the same size.") 
     123        if self.current_dataset.y.size != self.current_dataset.dy.size: 
     124            self.errors.add("The y and dy datasets are not the same size.") 
     125        self.current_dataset.errors = self.errors 
     126        self.current_dataset.xaxis("Q", q_unit) 
     127        self.current_dataset.yaxis("Intensity", i_unit) 
     128        xml_intermediate = self.raw_data[self.upper:] 
     129        xml = ''.join(xml_intermediate) 
     130        self.set_xml_string(xml) 
     131        dom = self.xmlroot.xpath('/fileinfo') 
     132        self._parse_child(dom) 
    118133        self.output.append(self.current_dataset) 
     134 
     135    def _parse_child(self, dom, parent=''): 
     136        """ 
     137        Recursive method for stepping through the embedded XML 
     138        :param dom: XML node with or without children 
     139        """ 
     140        for node in dom: 
     141            tagname = node.tag 
     142            value = node.text 
     143            attr = node.attrib 
     144            key = attr.get("key", '') 
     145            if len(node.getchildren()) > 1: 
     146                self._parse_child(node, key) 
     147                if key == "SampleDetector": 
     148                    self.current_dataset.detector.append(self.detector) 
     149                    self.detector = Detector() 
     150            else: 
     151                if key == "value": 
     152                    if parent == "Wavelength": 
     153                        self.current_dataset.source.wavelength = value 
     154                    elif parent == "SampleDetector": 
     155                        self.detector.distance = value 
     156                    elif parent == "Temperature": 
     157                        self.current_dataset.sample.temperature = value 
     158                    elif parent == "CounterSlitLength": 
     159                        self.detector.slit_length = value 
     160                elif key == "unit": 
     161                    value = value.replace("_", "") 
     162                    if parent == "Wavelength": 
     163                        self.current_dataset.source.wavelength_unit = value 
     164                    elif parent == "SampleDetector": 
     165                        self.detector.distance_unit = value 
     166                    elif parent == "X": 
     167                        self.current_dataset.xaxis(self.current_dataset._xaxis, value) 
     168                    elif parent == "Y": 
     169                        self.current_dataset.yaxis(self.current_dataset._yaxis, value) 
     170                    elif parent == "Temperature": 
     171                        self.current_dataset.sample.temperature_unit = value 
     172                    elif parent == "CounterSlitLength": 
     173                        self.detector.slit_length_unit = value 
     174                elif key == "quantity": 
     175                    if parent == "X": 
     176                        self.current_dataset.xaxis(value, self.current_dataset._xunit) 
     177                    elif parent == "Y": 
     178                        self.current_dataset.yaxis(value, self.current_dataset._yunit) 
  • src/sas/sascalc/dataloader/readers/ascii_reader.py

    r7d94915 rd2471870  
    172172                input_f.close() 
    173173                if not is_data: 
    174                     return None 
     174                    msg = "ascii_reader: x has no data" 
     175                    raise RuntimeError, msg 
    175176                # Sanity check 
    176177                if has_error_dy == True and not len(ty) == len(tdy): 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r654e8e0 r0639476  
    11771177            written = written | self.write_node(pix, "z", item.pixel_size.z, 
    11781178                                                {"unit": item.pixel_size_unit}) 
    1179             written = written | self.write_node(det, "slit_length", 
    1180                                                 item.slit_length, 
    1181                                                 {"unit": item.slit_length_unit}) 
    11821179            if written == True: 
    11831180                self.append(pix, det) 
     1181            self.write_node(det, "slit_length", item.slit_length, 
     1182                {"unit": item.slit_length_unit}) 
     1183 
    11841184 
    11851185    def _write_process_notes(self, datainfo, entry_node): 
  • src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py

    r479799c rbbd0f37  
    2323 
    2424    Any number of SASdata sets may be present in a SASentry and the data within can be either 1D I(Q) or 2D I(Qx, Qy). 
     25 
     26    Also supports reading NXcanSAS formatted HDF5 files 
    2527 
    2628    :Dependencies: 
     
    7678                ## Add the last data set to the list of outputs 
    7779                self.add_data_set() 
     80                ## Close the data file 
     81                self.raw_data.close() 
    7882        ## Return data set(s) 
    7983        return self.output 
     
    159163                        self.current_dataset.x = data_set.flatten() 
    160164                    continue 
     165                elif key == u'Qdev': 
     166                    self.current_dataset.dx = data_set.flatten() 
     167                    continue 
    161168                elif key == u'Qy': 
    162169                    self.current_dataset.yaxis("Q_y", unit) 
     
    183190                    elif key == u'run': 
    184191                        self.current_datainfo.run.append(data_point) 
     192                        try: 
     193                            run_name = value.attrs['name'] 
     194                            run_dict = {data_point: run_name} 
     195                            self.current_datainfo.run_name = run_dict 
     196                        except: 
     197                            pass 
    185198                    elif key == u'title': 
    186199                        self.current_datainfo.title = data_point 
     
    189202 
    190203                    ## Sample Information 
    191                     elif key == u'Title' and self.parent_class == u'SASsample': 
     204                    elif key == u'Title' and self.parent_class == u'SASsample': # CanSAS 2.0 format 
     205                        self.current_datainfo.sample.name = data_point 
     206                    elif key == u'ID' and self.parent_class == u'SASsample': # NXcanSAS format 
    192207                        self.current_datainfo.sample.name = data_point 
    193208                    elif key == u'thickness' and self.parent_class == u'SASsample': 
     
    195210                    elif key == u'temperature' and self.parent_class == u'SASsample': 
    196211                        self.current_datainfo.sample.temperature = data_point 
     212                    elif key == u'transmission' and self.parent_class == u'SASsample': 
     213                        self.current_datainfo.sample.transmission = data_point 
     214                    elif key == u'x_position' and self.parent_class == u'SASsample': 
     215                        self.current_datainfo.sample.position.x = data_point 
     216                    elif key == u'y_position' and self.parent_class == u'SASsample': 
     217                        self.current_datainfo.sample.position.y = data_point 
     218                    elif key == u'polar_angle' and self.parent_class == u'SASsample': 
     219                        self.current_datainfo.sample.orientation.x = data_point 
     220                    elif key == u'azimuthal_angle' and self.parent_class == u'SASsample': 
     221                        self.current_datainfo.sample.orientation.z = data_point 
     222                    elif key == u'details' and self.parent_class == u'SASsample': 
     223                        self.current_datainfo.sample.details.append(data_point) 
    197224 
    198225                    ## Instrumental Information 
     
    204231                        self.detector.distance = float(data_point) 
    205232                        self.detector.distance_unit = unit 
     233                    elif key == u'slit_length' and self.parent_class == u'SASdetector': 
     234                        self.detector.slit_length = float(data_point) 
     235                        self.detector.slit_length_unit = unit 
     236                    elif key == u'x_position' and self.parent_class == u'SASdetector': 
     237                        self.detector.offset.x = float(data_point) 
     238                        self.detector.offset_unit = unit 
     239                    elif key == u'y_position' and self.parent_class == u'SASdetector': 
     240                        self.detector.offset.y = float(data_point) 
     241                        self.detector.offset_unit = unit 
     242                    elif key == u'polar_angle' and self.parent_class == u'SASdetector': 
     243                        self.detector.orientation.x = float(data_point) 
     244                        self.detector.orientation_unit = unit 
     245                    elif key == u'azimuthal_angle' and self.parent_class == u'SASdetector': 
     246                        self.detector.orientation.z = float(data_point) 
     247                        self.detector.orientation_unit = unit 
     248                    elif key == u'beam_center_x' and self.parent_class == u'SASdetector': 
     249                        self.detector.beam_center.x = float(data_point) 
     250                        self.detector.beam_center_unit = unit 
     251                    elif key == u'beam_center_y' and self.parent_class == u'SASdetector': 
     252                        self.detector.beam_center.y = float(data_point) 
     253                        self.detector.beam_center_unit = unit 
     254                    elif key == u'x_pixel_size' and self.parent_class == u'SASdetector': 
     255                        self.detector.pixel_size.x = float(data_point) 
     256                        self.detector.pixel_size_unit = unit 
     257                    elif key == u'y_pixel_size' and self.parent_class == u'SASdetector': 
     258                        self.detector.pixel_size.y = float(data_point) 
     259                        self.detector.pixel_size_unit = unit 
    206260                    elif key == u'SSD' and self.parent_class == u'SAScollimation': 
    207261                        self.collimation.length = data_point 
     
    213267                    elif key == u'name' and self.parent_class == u'SASprocess': 
    214268                        self.process.name = data_point 
    215                     elif key == u'Title' and self.parent_class == u'SASprocess': 
     269                    elif key == u'Title' and self.parent_class == u'SASprocess': # CanSAS 2.0 format 
     270                        self.process.name = data_point 
     271                    elif key == u'name' and self.parent_class == u'SASprocess': # NXcanSAS format 
    216272                        self.process.name = data_point 
    217273                    elif key == u'description' and self.parent_class == u'SASprocess': 
     
    230286                        self.trans_spectrum.wavelength.append(data_point) 
    231287 
    232                     ## Other Information 
     288                    ## Source 
    233289                    elif key == u'wavelength' and self.parent_class == u'SASdata': 
    234290                        self.current_datainfo.source.wavelength = data_point 
    235                         self.current_datainfo.source.wavelength.unit = unit 
     291                        self.current_datainfo.source.wavelength_unit = unit 
     292                    elif key == u'incident_wavelength' and self.parent_class == u'SASsource': 
     293                        self.current_datainfo.source.wavelength = data_point 
     294                        self.current_datainfo.source.wavelength_unit = unit 
     295                    elif key == u'wavelength_max' and self.parent_class == u'SASsource': 
     296                        self.current_datainfo.source.wavelength_max = data_point 
     297                        self.current_datainfo.source.wavelength_max_unit = unit 
     298                    elif key == u'wavelength_min' and self.parent_class == u'SASsource': 
     299                        self.current_datainfo.source.wavelength_min = data_point 
     300                        self.current_datainfo.source.wavelength_min_unit = unit 
     301                    elif key == u'wavelength_spread' and self.parent_class == u'SASsource': 
     302                        self.current_datainfo.source.wavelength_spread = data_point 
     303                        self.current_datainfo.source.wavelength_spread_unit = unit 
     304                    elif key == u'beam_size_x' and self.parent_class == u'SASsource': 
     305                        self.current_datainfo.source.beam_size.x = data_point 
     306                        self.current_datainfo.source.beam_size_unit = unit 
     307                    elif key == u'beam_size_y' and self.parent_class == u'SASsource': 
     308                        self.current_datainfo.source.beam_size.y = data_point 
     309                        self.current_datainfo.source.beam_size_unit = unit 
     310                    elif key == u'beam_shape' and self.parent_class == u'SASsource': 
     311                        self.current_datainfo.source.beam_shape = data_point 
    236312                    elif key == u'radiation' and self.parent_class == u'SASsource': 
    237313                        self.current_datainfo.source.radiation = data_point 
     
    376452        self.current_datainfo = DataInfo() 
    377453 
     454 
    378455    def _initialize_new_data_set(self, parent_list = None): 
    379456        """ 
  • src/sas/sascalc/dataloader/readers/xml_reader.py

    rb699768 ra235f715  
    7070            self.xmldoc = etree.parse(self.xml, parser=PARSER) 
    7171            self.xmlroot = self.xmldoc.getroot() 
     72        except etree.XMLSyntaxError as xml_error: 
     73            logging.info(xml_error) 
     74        except Exception: 
     75            self.xml = None 
     76            self.xmldoc = None 
     77            self.xmlroot = None 
     78 
     79    def set_xml_string(self, tag_soup): 
     80        """ 
     81        Set an XML string as the working XML. 
     82 
     83        :param tag_soup: XML formatted string 
     84        """ 
     85        try: 
     86            self.xml = tag_soup 
     87            self.xmldoc = tag_soup 
     88            self.xmlroot = etree.fromstring(tag_soup) 
    7289        except etree.XMLSyntaxError as xml_error: 
    7390            logging.info(xml_error) 
  • src/sas/sascalc/fit/AbstractFitEngine.py

    rfc18690 rd3911e3  
    359359        if self.smearer != None: 
    360360            fn.set_index(self.idx) 
    361             # Get necessary data from self.data and set the data for smearing 
    362             fn.get_data() 
    363  
    364361            gn = fn.get_value() 
    365362        else: 
  • src/sas/sascalc/fit/BumpsFitting.py

    rb699768 r345e7e4  
    44import os 
    55from datetime import timedelta, datetime 
     6import traceback 
    67 
    78import numpy 
     
    293294            R.success = result['success'] 
    294295            if R.success: 
    295                 R.stderr = numpy.hstack((result['stderr'][fitted_index], 
    296                                          numpy.NaN*numpy.ones(len(fitness.computed_pars)))) 
     296                if result['stderr'] is None: 
     297                    R.stderr = numpy.NaN*numpy.ones(len(param_list)) 
     298                else: 
     299                    R.stderr = numpy.hstack((result['stderr'][fitted_index], 
     300                                             numpy.NaN*numpy.ones(len(fitness.computed_pars)))) 
    297301                R.pvec = numpy.hstack((result['value'][fitted_index], 
    298302                                      [p.value for p in fitness.computed_pars])) 
     
    306310                R.uncertainty_state = result['uncertainty'] 
    307311            all_results.append(R) 
     312        all_results[0].mesg = result['errors'] 
    308313 
    309314        if q is not None: 
     
    344349    try: 
    345350        best, fbest = fitdriver.fit() 
    346     except: 
    347         import traceback; traceback.print_exc() 
    348         raise 
     351        errors = [] 
     352    except Exception as exc: 
     353        best, fbest = None, numpy.NaN 
     354        errors = [str(exc), traceback.traceback.format_exc()] 
    349355    finally: 
    350356        mapper.stop_mapper(fitdriver.mapper) 
     
    356362 
    357363    success = best is not None 
     364    try: 
     365        stderr = fitdriver.stderr() if success else None 
     366    except Exception as exc: 
     367        errors.append(str(exc)) 
     368        errors.append(traceback.format_exc()) 
     369        stderr = None 
    358370    return { 
    359371        'value': best if success else None, 
    360         'stderr': fitdriver.stderr() if success else None, 
     372        'stderr': stderr, 
    361373        'success': success, 
    362374        'convergence': convergence, 
    363375        'uncertainty': getattr(fitdriver.fitter, 'state', None), 
     376        'errors': '\n'.join(errors), 
    364377        } 
    365378 
  • src/sas/sascalc/fit/MultiplicationModel.py

    rcb4ef58 r68669da  
    88    r""" 
    99        Use for P(Q)\*S(Q); function call must be in the order of P(Q) and then S(Q): 
    10         The model parameters are combined from both models, P(Q) and S(Q), except 1) 'effect_radius' of S(Q) 
    11         which will be calculated from P(Q) via calculate_ER(),  
    12         and 2) 'scale' in P model which is synchronized w/ volfraction in S  
     10        The model parameters are combined from both models, P(Q) and S(Q), except 1) 'radius_effective' of S(Q) 
     11        which will be calculated from P(Q) via calculate_ER(), 
     12        and 2) 'scale' in P model which is synchronized w/ volfraction in S 
    1313        then P*S is multiplied by a new parameter, 'scale_factor'. 
    1414        The polydispersion is applicable only to P(Q), not to S(Q). 
     
    3434        ## Parameter details [units, min, max] 
    3535        self.details = {} 
    36          
    37         ##models  
     36 
     37        ## Define parameters to exclude from multiplication model 
     38        self.excluded_params={'radius_effective','scale','background'} 
     39 
     40        ##models 
    3841        self.p_model = p_model 
    39         self.s_model = s_model         
     42        self.s_model = s_model 
    4043        self.magnetic_params = [] 
    4144        ## dispersion 
     
    4548        ## New parameter:Scaling factor 
    4649        self.params['scale_factor'] = 1 
    47          
     50        self.params['background']  = 0 
     51 
    4852        ## Parameter details [units, min, max] 
    4953        self._set_details() 
    5054        self.details['scale_factor'] = ['', 0.0, numpy.inf] 
    51          
     55        self.details['background'] = ['',-numpy.inf,numpy.inf] 
     56 
    5257        #list of parameter that can be fitted 
    53         self._set_fixed_params()   
     58        self._set_fixed_params() 
    5459        ## parameters with orientation 
    5560        for item in self.p_model.orientation_params: 
    5661            self.orientation_params.append(item) 
    57         for item in self.p_model.magnetic_params:   
    58             self.magnetic_params.append(item)  
     62        for item in self.p_model.magnetic_params: 
     63            self.magnetic_params.append(item) 
    5964        for item in self.s_model.orientation_params: 
    6065            if not item in self.orientation_params: 
     
    6671            multiplicity = 1 
    6772        ## functional multiplicity of the model 
    68         self.multiplicity = multiplicity     
    69            
     73        self.multiplicity = multiplicity 
     74 
    7075        # non-fittable parameters 
    71         self.non_fittable = p_model.non_fittable   
    72         self.multiplicity_info = []  
     76        self.non_fittable = p_model.non_fittable 
     77        self.multiplicity_info = [] 
    7378        self.fun_list = {} 
    7479        if self.non_fittable > 1: 
    7580            try: 
    76                 self.multiplicity_info = p_model.multiplicity_info  
     81                self.multiplicity_info = p_model.multiplicity_info 
    7782                self.fun_list = p_model.fun_list 
    7883                self.is_multiplicity_model = True 
     
    8287            self.is_multiplicity_model = False 
    8388            self.multiplicity_info = [0] 
    84              
     89 
    8590    def _clone(self, obj): 
    8691        """ 
     
    96101        #obj = copy.deepcopy(self) 
    97102        return obj 
    98      
    99      
     103 
     104 
    100105    def _set_dispersion(self): 
    101106        """ 
     
    103108        applied to s_model 
    104109        """ 
    105         ##set dispersion only from p_model  
     110        ##set dispersion only from p_model 
    106111        for name , value in self.p_model.dispersion.iteritems(): 
    107             self.dispersion[name] = value  
    108                                        
     112            self.dispersion[name] = value 
     113 
    109114    def getProfile(self): 
    110115        """ 
    111116        Get SLD profile of p_model if exists 
    112          
     117 
    113118        :return: (r, beta) where r is a list of radius of the transition points\ 
    114119                beta is a list of the corresponding SLD values 
     
    121126            x = None 
    122127            y = None 
    123              
     128 
    124129        return x, y 
    125      
     130 
    126131    def _set_params(self): 
    127132        """ 
    128133        Concatenate the parameters of the two models to create 
    129         these model parameters  
     134        these model parameters 
    130135        """ 
    131136 
    132137        for name , value in self.p_model.params.iteritems(): 
    133             if not name in self.params.keys() and name != 'scale': 
     138            if not name in self.params.keys() and name not in self.excluded_params: 
    134139                self.params[name] = value 
    135              
     140 
    136141        for name , value in self.s_model.params.iteritems(): 
    137             #Remove the effect_radius from the (P*S) model parameters. 
    138             if not name in self.params.keys() and name != 'effect_radius': 
     142            #Remove the radius_effective from the (P*S) model parameters. 
     143            if not name in self.params.keys() and name not in self.excluded_params: 
    139144                self.params[name] = value 
    140                  
     145 
    141146        # Set "scale and effec_radius to P and S model as initializing 
    142147        # since run P*S comes from P and S separately. 
     148        self._set_backgrounds() 
    143149        self._set_scale_factor() 
    144         self._set_effect_radius()        
    145              
     150        self._set_radius_effective() 
     151 
    146152    def _set_details(self): 
    147153        """ 
    148154        Concatenate details of the two models to create 
    149         this model's details  
     155        this model's details 
    150156        """ 
    151157        for name, detail in self.p_model.details.iteritems(): 
    152             if name != 'scale': 
     158            if name not in self.excluded_params: 
    153159                self.details[name] = detail 
    154              
     160 
    155161        for name , detail in self.s_model.details.iteritems(): 
    156             if not name in self.details.keys() or name != 'effect_radius': 
     162            if not name in self.details.keys() or name not in self.exluded_params: 
    157163                self.details[name] = detail 
    158      
     164 
     165    def _set_backgrounds(self): 
     166        """ 
     167        Set component backgrounds to zero 
     168        """ 
     169        if 'background' in self.p_model.params: 
     170            self.p_model.setParam('background',0) 
     171        if 'background' in self.s_model.params: 
     172            self.s_model.setParam('background',0) 
     173 
     174 
    159175    def _set_scale_factor(self): 
    160176        """ 
     
    162178        """ 
    163179        value = self.params['volfraction'] 
    164         if value != None:  
     180        if value != None: 
    165181            factor = self.p_model.calculate_VR() 
    166182            if factor == None or factor == NotImplemented or factor == 0.0: 
     
    170186            self.p_model.setParam('scale', value) 
    171187            self.s_model.setParam('volfraction', val) 
    172              
    173     def _set_effect_radius(self): 
     188 
     189    def _set_radius_effective(self): 
    174190        """ 
    175191        Set effective radius to S(Q) model 
    176192        """ 
    177         if not 'effect_radius' in self.s_model.params.keys(): 
     193        if not 'radius_effective' in self.s_model.params.keys(): 
    178194            return 
    179195        effective_radius = self.p_model.calculate_ER() 
    180196        #Reset the effective_radius of s_model just before the run 
    181197        if effective_radius != None and effective_radius != NotImplemented: 
    182             self.s_model.setParam('effect_radius', effective_radius) 
    183                  
     198            self.s_model.setParam('radius_effective', effective_radius) 
     199 
    184200    def setParam(self, name, value): 
    185         """  
     201        """ 
    186202        Set the value of a model parameter 
    187          
     203 
    188204        :param name: name of the parameter 
    189205        :param value: value of the parameter 
     
    191207        # set param to P*S model 
    192208        self._setParamHelper( name, value) 
    193          
    194         ## setParam to p model  
    195         # set 'scale' in P(Q) equal to volfraction  
     209 
     210        ## setParam to p model 
     211        # set 'scale' in P(Q) equal to volfraction 
    196212        if name == 'volfraction': 
    197213            self._set_scale_factor() 
    198         elif name in self.p_model.getParamList(): 
     214        elif name in self.p_model.getParamList() and name not in self.excluded_params: 
    199215            self.p_model.setParam( name, value) 
    200          
    201         ## setParam to s model  
    202         # This is a little bit abundant: Todo: find better way          
    203         self._set_effect_radius() 
    204         if name in self.s_model.getParamList(): 
     216 
     217        ## setParam to s model 
     218        # This is a little bit abundant: Todo: find better way 
     219        self._set_radius_effective() 
     220        if name in self.s_model.getParamList() and name not in self.excluded_params: 
    205221            if name != 'volfraction': 
    206222                self.s_model.setParam( name, value) 
    207              
     223 
    208224 
    209225        #self._setParamHelper( name, value) 
    210          
     226 
    211227    def _setParamHelper(self, name, value): 
    212228        """ 
     
    228244                    self.params[item] = value 
    229245                    return 
    230              
     246 
    231247        raise ValueError, "Model does not contain parameter %s" % name 
    232               
    233     
     248 
     249 
    234250    def _set_fixed_params(self): 
    235251        """ 
     
    240256 
    241257        self.fixed.sort() 
    242                  
    243                  
     258 
     259 
    244260    def run(self, x = 0.0): 
    245         """  
     261        """ 
    246262        Evaluate the model 
    247          
     263 
    248264        :param x: input q-value (float or [float, float] as [r, theta]) 
    249265        :return: (scattering function value) 
    250266        """ 
    251267        # set effective radius and scaling factor before run 
    252         self._set_effect_radius() 
     268        self._set_radius_effective() 
    253269        self._set_scale_factor() 
    254270        return self.params['scale_factor'] * self.p_model.run(x) * \ 
    255                             self.s_model.run(x) 
     271                            self.s_model.run(x) + self.params['background'] 
    256272 
    257273    def runXY(self, x = 0.0): 
    258         """  
     274        """ 
    259275        Evaluate the model 
    260          
     276 
    261277        :param x: input q-value (float or [float, float] as [qx, qy]) 
    262278        :return: scattering function value 
    263         """   
     279        """ 
    264280        # set effective radius and scaling factor before run 
    265         self._set_effect_radius() 
     281        self._set_radius_effective() 
    266282        self._set_scale_factor() 
    267283        out = self.params['scale_factor'] * self.p_model.runXY(x) * \ 
    268                         self.s_model.runXY(x) 
     284                        self.s_model.runXY(x) + self.params['background'] 
    269285        return out 
    270      
    271     ## Now (May27,10) directly uses the model eval function  
     286 
     287    ## Now (May27,10) directly uses the model eval function 
    272288    ## instead of the for-loop in Base Component. 
    273289    def evalDistribution(self, x = []): 
    274         """  
     290        """ 
    275291        Evaluate the model in cartesian coordinates 
    276          
     292 
    277293        :param x: input q[], or [qx[], qy[]] 
    278294        :return: scattering function P(q[]) 
    279295        """ 
    280296        # set effective radius and scaling factor before run 
    281         self._set_effect_radius() 
     297        self._set_radius_effective() 
    282298        self._set_scale_factor() 
    283299        out = self.params['scale_factor'] * self.p_model.evalDistribution(x) * \ 
    284                         self.s_model.evalDistribution(x) 
     300                        self.s_model.evalDistribution(x) + self.params['background'] 
    285301        return out 
    286302 
     
    288304        """ 
    289305        Set the dispersion object for a model parameter 
    290          
     306 
    291307        :param parameter: name of the parameter [string] 
    292308        :dispersion: dispersion object of type DispersionModel 
     
    299315            return value 
    300316        except: 
    301             raise  
     317            raise 
    302318 
    303319    def fill_description(self, p_model, s_model): 
     
    306322        """ 
    307323        description = "" 
    308         description += "Note:1) The effect_radius (effective radius) of %s \n"%\ 
     324        description += "Note:1) The radius_effective (effective radius) of %s \n"%\ 
    309325                                                                (s_model.name) 
    310326        description += "             is automatically calculated " 
     
    318334        description += "        for details of individual models." 
    319335        self.description += description 
    320      
  • src/sas/sasgui/guiframe/CategoryInstaller.py

    r50008e3 r212bfc2  
    1111import os 
    1212import sys 
    13 import shutil 
    1413import json 
    15 from collections import defaultdict 
     14import logging 
     15from collections import defaultdict, OrderedDict 
    1616 
    1717USER_FILE = 'categories.json' 
     
    2323    Note - class is entirely static! 
    2424    """ 
    25  
    2625 
    2726    def __init__(self): 
     
    4342        import sas.sasgui.perspectives.fitting.models 
    4443        return sas.sasgui.perspectives.fitting.models.get_model_python_path() 
    45      
     44 
    4645    @staticmethod 
    4746    def _get_default_cat_file_dir(): 
     
    5453        import sas.sasview 
    5554        cat_file = "default_categories.json" 
    56          
     55 
    5756        possible_cat_file_paths = [ 
    5857            os.path.join(os.path.split(sas.sasview.__file__)[0], cat_file),           # Source 
     
    6463            if os.path.isfile(path): 
    6564                return os.path.dirname(path) 
    66              
     65 
    6766        raise RuntimeError('CategoryInstaller: Could not find folder containing default categories') 
    6867 
     
    8988                by_model_dict[model].append(category) 
    9089                model_enabled_dict[model] = enabled 
    91      
     90 
    9291        return (by_model_dict, model_enabled_dict) 
    93  
    9492 
    9593    @staticmethod 
     
    105103                master_category_dict[category].append(\ 
    106104                    (model, model_enabled_dict[model])) 
    107          
    108         return master_category_dict 
     105        return OrderedDict(sorted(master_category_dict.items(), key=lambda t: t[0])) 
    109106 
    110107    @staticmethod 
     
    113110        returns the user data file, eg .sasview/categories.json.json 
    114111        """ 
    115         return os.path.join(CategoryInstaller._get_home_dir(), 
    116                             USER_FILE) 
     112        return os.path.join(CategoryInstaller._get_home_dir(), USER_FILE) 
    117113 
    118114    @staticmethod 
    119115    def get_default_file(): 
    120         """ 
    121         returns the path of the default file 
    122         e.g. blahblah/default_categories.json 
    123         """ 
    124         return os.path.join(\ 
    125             CategoryInstaller._get_default_cat_file_dir(), "default_categories.json") 
    126          
     116        logging.warning("CategoryInstaller.get_default_file is deprecated.") 
     117 
    127118    @staticmethod 
    128119    def check_install(homedir = None, model_list=None): 
     
    134125        :param model_list: List of model names except customized models 
    135126        """ 
    136         #model_list = [] 
    137         default_file = CategoryInstaller.get_default_file() 
     127        _model_dict = { model.name: model for model in model_list} 
     128        _model_list = _model_dict.keys() 
     129 
    138130        serialized_file = None 
    139         master_category_dict = defaultdict(list) 
    140131        if homedir == None: 
    141132            serialized_file = CategoryInstaller.get_user_file() 
     
    143134            serialized_file = os.path.join(homedir, USER_FILE) 
    144135        if os.path.isfile(serialized_file): 
    145             cat_file = open(serialized_file, 'rb') 
     136            with open(serialized_file, 'rb') as f: 
     137                master_category_dict = json.load(f) 
    146138        else: 
    147             cat_file = open(default_file, 'rb') 
    148         master_category_dict = json.load(cat_file) 
    149 #        master_category_dict = pickle.Unpickler(cat_file).load() 
     139            master_category_dict = defaultdict(list) 
     140 
    150141        (by_model_dict, model_enabled_dict) = \ 
    151142                CategoryInstaller._regenerate_model_dict(master_category_dict) 
    152         cat_file.close() 
    153         add_list = model_list 
     143        add_list = _model_list 
    154144        del_name = False 
    155145        for cat in master_category_dict.keys(): 
    156146            for ind in range(len(master_category_dict[cat])): 
    157147                model_name, enabled = master_category_dict[cat][ind] 
    158                 if model_name not in model_list: 
     148                if model_name not in _model_list: 
    159149                    del_name = True  
    160150                    try: 
     
    162152                        model_enabled_dict.pop(model_name) 
    163153                    except: 
    164                         pass 
     154                        logging.error("CategoryInstaller: %s", sys.exc_value) 
    165155                else: 
    166156                    add_list.remove(model_name) 
     
    168158            for model in add_list: 
    169159                model_enabled_dict[model]= True 
    170                 by_model_dict[model].append('Uncategorized') 
    171      
     160                if _model_dict[model].category is None or len(str(_model_dict[model].category.capitalize())) == 0: 
     161                    by_model_dict[model].append('Uncategorized') 
     162                else: 
     163                    category = _model_dict[model].category 
     164                    toks = category.split(':') 
     165                    category = toks[-1] 
     166                    toks = category.split('-') 
     167                    capitalized_words = [t.capitalize() for t in toks] 
     168                    category = ' '.join(capitalized_words) 
     169 
     170                    by_model_dict[model].append(category) 
     171 
    172172            master_category_dict = \ 
    173173                CategoryInstaller._regenerate_master_dict(by_model_dict, 
    174174                                                          model_enabled_dict) 
    175              
    176             json.dump( master_category_dict, 
    177                          open(serialized_file, 'wb') ) 
     175 
     176            json.dump(master_category_dict, open(serialized_file, 'wb')) 
  • src/sas/sasgui/guiframe/CategoryManager.py

    r80b1df3 r212bfc2  
    1313import sys 
    1414import os 
     15import logging 
    1516from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin 
    1617from collections import defaultdict 
     
    366367        """ 
    367368        try: 
    368             file = CategoryInstaller.get_user_file() 
    369             if os.path.isfile(file): 
    370                 cat_file = open(file, 'rb') 
    371 #               self.master_category_dict = pickle.load(cat_file) 
    372                 self.master_category_dict = json.load(cat_file) 
    373             else: 
    374                 cat_file = open(CategoryInstaller.get_default_file(), 'rb') 
    375 #                       self.master_category_dict = pickle.load(cat_file) 
    376                 self.master_category_dict = json.load(cat_file) 
    377             cat_file.close() 
     369            cat_file = CategoryInstaller.get_user_file() 
     370            self.master_category_dict = {} 
     371            if os.path.isfile(cat_file): 
     372                with open(cat_file, 'rb') as f: 
     373                    self.master_category_dict = json.load(f) 
    378374        except IOError: 
    379             print 'Problem reading in category file. Please review' 
    380  
     375            logging.error('Problem reading in category file.') 
    381376 
    382377        self._regenerate_model_dict() 
  • src/sas/sasgui/guiframe/aboutbox.py

    rd85c194 r49e000b  
    106106        self.bitmap_button_nist = wx.BitmapButton(self, -1, wx.NullBitmap) 
    107107        self.bitmap_button_umd = wx.BitmapButton(self, -1, wx.NullBitmap) 
    108         self.bitmap_button_sns = wx.BitmapButton(self, -1, wx.NullBitmap) 
     108        self.bitmap_button_ornl = wx.BitmapButton(self, -1, wx.NullBitmap) 
     109        #self.bitmap_button_sns = wx.BitmapButton(self, -1, wx.NullBitmap) 
    109110        #self.bitmap_button_nsf = wx.BitmapButton(self, -1, 
    110111        #                                         wx.NullBitmap) 
     
    115116        self.bitmap_button_ess = wx.BitmapButton(self, -1, wx.NullBitmap) 
    116117        self.bitmap_button_ill = wx.BitmapButton(self, -1, wx.NullBitmap) 
     118        self.bitmap_button_ansto = wx.BitmapButton(self, -1, wx.NullBitmap) 
     119        self.bitmap_button_tudelft = wx.BitmapButton(self, -1, wx.NullBitmap) 
    117120         
    118121        self.static_line_3 = wx.StaticLine(self, -1) 
     
    124127        self.Bind(wx.EVT_BUTTON, self.onNistLogo, self.bitmap_button_nist) 
    125128        self.Bind(wx.EVT_BUTTON, self.onUmdLogo, self.bitmap_button_umd) 
    126         self.Bind(wx.EVT_BUTTON, self.onSnsLogo, self.bitmap_button_sns) 
     129        #self.Bind(wx.EVT_BUTTON, self.onSnsLogo, self.bitmap_button_sns) 
     130        self.Bind(wx.EVT_BUTTON, self.onOrnlLogo, self.bitmap_button_ornl) 
    127131        #self.Bind(wx.EVT_BUTTON, self.onNsfLogo, self.bitmap_button_nsf) 
    128132        #self.Bind(wx.EVT_BUTTON, self.onDanseLogo, self.bitmap_button_danse) 
     
    131135        self.Bind(wx.EVT_BUTTON, self.onEssLogo, self.bitmap_button_ess) 
    132136        self.Bind(wx.EVT_BUTTON, self.onIllLogo, self.bitmap_button_ill) 
     137        self.Bind(wx.EVT_BUTTON, self.onAnstoLogo, self.bitmap_button_ansto) 
     138        self.Bind(wx.EVT_BUTTON, self.onTudelftLogo, self.bitmap_button_tudelft) 
    133139        # end wxGlade 
    134140        # fill in acknowledgements 
     
    163169        self.bitmap_button_umd.SetBitmapLabel(logo) 
    164170 
    165          
     171        image = file_dir + "/images/ornl_logo.png" 
     172        if os.path.isfile(config._ornl_logo): 
     173            image = config._ornl_logo 
     174        logo = wx.Bitmap(image)         
     175        self.bitmap_button_ornl.SetBitmapLabel(logo) 
     176 
     177        """ 
    166178        image = file_dir + "/images/sns_logo.png" 
    167179        if os.path.isfile(config._sns_logo): 
     
    170182        self.bitmap_button_sns.SetBitmapLabel(logo) 
    171183         
    172         """ 
    173184        image = file_dir + "/images/nsf_logo.png" 
    174185        if os.path.isfile(config._nsf_logo): 
     
    206217        logo = wx.Bitmap(image) 
    207218        self.bitmap_button_ill.SetBitmapLabel(logo) 
     219         
     220        image = file_dir + "/images/ansto_logo.png" 
     221        if os.path.isfile(config._ansto_logo): 
     222            image = config._ansto_logo 
     223        logo = wx.Bitmap(image) 
     224        self.bitmap_button_ansto.SetBitmapLabel(logo) 
     225         
     226        image = file_dir + "/images/tudelft_logo.png" 
     227        if os.path.isfile(config._tudelft_logo): 
     228            image = config._tudelft_logo 
     229        logo = wx.Bitmap(image) 
     230        self.bitmap_button_tudelft.SetBitmapLabel(logo) 
    208231                 
    209232        # resize dialog window to fit version number nicely 
     
    227250        self.bitmap_button_nist.SetSize(self.bitmap_button_nist.GetBestSize()) 
    228251        self.bitmap_button_umd.SetSize(self.bitmap_button_umd.GetBestSize()) 
    229         self.bitmap_button_sns.SetSize(self.bitmap_button_sns.GetBestSize()) 
     252        self.bitmap_button_ornl.SetSize(self.bitmap_button_ornl.GetBestSize()) 
     253        #self.bitmap_button_sns.SetSize(self.bitmap_button_sns.GetBestSize()) 
    230254        #self.bitmap_button_nsf.SetSize(self.bitmap_button_nsf.GetBestSize()) 
    231255        #self.bitmap_button_danse.SetSize(self.bitmap_button_danse.GetBestSize()) 
     
    234258        self.bitmap_button_ess.SetSize(self.bitmap_button_ess.GetBestSize()) 
    235259        self.bitmap_button_ill.SetSize(self.bitmap_button_ill.GetBestSize()) 
     260        self.bitmap_button_ansto.SetSize(self.bitmap_button_ansto.GetBestSize()) 
     261        self.bitmap_button_tudelft.SetSize(self.bitmap_button_tudelft.GetBestSize()) 
    236262        # end wxGlade 
    237263 
     
    285311        sizer_logos.Add(self.bitmap_button_nist, 0,  
    286312                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
    287         sizer_logos.Add(self.bitmap_button_sns, 0,  
     313        #sizer_logos.Add(self.bitmap_button_sns, 0,  
     314        #                wx.LEFT|wx.ADJUST_MINSIZE, 2) 
     315        sizer_logos.Add(self.bitmap_button_ornl, 0,  
    288316                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
    289317        sizer_logos.Add(self.bitmap_button_isis, 0,  
     
    292320                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
    293321        sizer_logos.Add(self.bitmap_button_ill, 0,  
     322                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
     323        sizer_logos.Add(self.bitmap_button_ansto, 0,  
     324                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
     325        sizer_logos.Add(self.bitmap_button_tudelft, 0,  
    294326                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
    295327                 
     
    321353        event.Skip() 
    322354         
     355    def onOrnlLogo(self, event):  
     356        """ 
     357        """ 
     358        # wxGlade: DialogAbout.<event_handler> 
     359        launchBrowser(config._ornl_url) 
     360        event.Skip() 
     361         
    323362    def onSnsLogo(self, event):  
    324363        """ 
     
    368407        # wxGlade: DialogAbout.<event_handler> 
    369408        launchBrowser(config._ill_url) 
     409        event.Skip() 
     410 
     411    def onAnstoLogo(self, event): 
     412        """ 
     413        """  
     414        # wxGlade: DialogAbout.<event_handler> 
     415        launchBrowser(config._ansto_url) 
     416        event.Skip() 
     417 
     418    def onTudelftLogo(self, event): 
     419        """ 
     420        """  
     421        # wxGlade: DialogAbout.<event_handler> 
     422        launchBrowser(config._tudelft_url) 
    370423        event.Skip() 
    371424 
  • src/sas/sasgui/guiframe/acknowledgebox.py

    rd85c194 rc1fdf84  
    6868        self.preamble.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) 
    6969        self.SetTitle("Acknowledging SasView") 
    70         self.SetSize((525, 225)) 
     70        #Increased size of box from (525, 225), SMK, 04/10/16 
     71        self.SetSize((600, 300)) 
    7172        # end wxGlade 
    7273 
  • src/sas/sasgui/guiframe/customdir.py

    rd85c194 r73cbeec  
    11# Setup and find Custom config dir 
    2 import sys 
    32import os.path 
    43import shutil 
    5 from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 
    64 
    75CONF_DIR = 'config'  
     
    1210    Find and return user/.sasview dir 
    1311    """ 
    14     dir = os.path.join(os.path.expanduser("~"),  
    15                        ("." + APPLICATION_NAME)) 
    16     return dir 
     12    return os.path.join(os.path.expanduser("~"), ("." + APPLICATION_NAME)) 
    1713 
    1814def _find_customconf_dir(): 
     
    2218    """ 
    2319    u_dir = _find_usersasview_dir() 
    24     dir = os.path.join(u_dir, CONF_DIR) 
    25      
    26     return dir 
     20    return os.path.join(u_dir, CONF_DIR) 
    2721 
    2822def _setup_conf_dir(path): 
     
    3024    Setup the custom config dir and cat file 
    3125    """ 
    32     dir = _find_customconf_dir() 
     26    conf_dir = _find_customconf_dir() 
    3327    # If the plugin directory doesn't exist, create it 
    34     if not os.path.isdir(dir): 
    35         os.makedirs(dir) 
    36     file = os.path.join(dir, "custom_config.py") 
    37     cat_file = CategoryInstaller.get_user_file() 
    38     # If the user category file doesn't exist copy the default to 
    39     # the user directory 
    40     if not os.path.isfile(cat_file): 
    41         try: 
    42             default_cat_file = CategoryInstaller.get_default_file() 
    43             if os.path.isfile(default_cat_file): 
    44                 shutil.copyfile(default_cat_file, cat_file) 
    45             else: 
    46                 print "Unable to find/copy default cat file" 
    47         except: 
    48             print "Unable to copy default cat file to the user dir." 
     28    if not os.path.isdir(conf_dir): 
     29        os.makedirs(conf_dir) 
     30    config_file = os.path.join(conf_dir, "custom_config.py") 
    4931 
    5032    # Place example user models as needed 
    5133    try: 
    52         if not os.path.isfile(file): 
    53          shutil.copyfile(os.path.join(path, "custom_config.py"), file) 
     34        if not os.path.isfile(config_file): 
     35            shutil.copyfile(os.path.join(path, "custom_config.py"), config_file) 
     36 
     37        #Adding SAS_OPENCL if it doesn't exist in the config file 
     38        # - to support backcompability 
     39        if not "SAS_OPENCL" in open(config_file).read(): 
     40            open(config_file,"a+").write("SAS_OPENCL = \"None\"\n") 
    5441    except: 
    5542        # Check for data path next to exe/zip file. 
     
    6350            temp_path = os.path.join(f_dir, "custom_config.py") 
    6451            if os.path.isfile(temp_path): 
    65                 shutil.copyfile(temp_path, file) 
     52                shutil.copyfile(temp_path, config_file) 
    6653                is_dir = True 
    6754                break 
    6855        if not is_dir: 
    6956            raise 
    70          
    71     return dir 
    72    
    73          
     57    return conf_dir 
     58 
     59 
    7460class SetupCustom(object): 
    7561    """ 
     
    8167    def setup_dir(self, path): 
    8268        return _setup_conf_dir(path) 
    83      
    84  
    85      
    86      
    87    
  • src/sas/sasgui/guiframe/dataFitting.py

    rd85c194 r345e7e4  
    363363        _str = "%s\n" % LoadData2D.__str__(self) 
    364364        return _str  
    365      
    366     def _validity_check(self, other): 
    367         """ 
    368         Checks that the data lengths are compatible. 
    369         Checks that the x vectors are compatible. 
    370         Returns errors vectors equal to original 
    371         errors vectors if they were present or vectors 
    372         of zeros when none was found. 
    373          
    374         :param other: other data set for operation 
    375          
    376         :return: dy for self, dy for other [numpy arrays] 
    377          
    378         :raise ValueError: when lengths are not compatible 
    379          
    380         """ 
    381         err_other = None 
    382         if isinstance(other, Data2D): 
    383             # Check that data lengths are the same 
    384             if len(self.data) != len(other.data) or \ 
    385                 len(self.qx_data) != len(other.qx_data) or \ 
    386                 len(self.qy_data) != len(other.qy_data): 
    387                 msg = "Unable to perform operation: data length are not equal" 
    388                 raise ValueError, msg 
    389             #if len(self.data) < 1: 
    390             #    msg = "Incompatible data sets: I-values do not match" 
    391             #    raise ValueError, msg  
    392             for ind in range(len(self.data)): 
    393                 if self.qx_data[ind] != other.qx_data[ind]: 
    394                     msg = "Incompatible data sets: qx-values do not match" 
    395                     raise ValueError, msg 
    396                 if self.qy_data[ind] != other.qy_data[ind]: 
    397                     msg = "Incompatible data sets: qy-values do not match" 
    398                     raise ValueError, msg 
    399                     
    400             # Check that the scales match 
    401             err_other = other.err_data 
    402             if other.err_data == None or \ 
    403                 (len(other.err_data) != len(other.data)): 
    404                 err_other = numpy.zeros(len(other.data)) 
    405              
    406         # Check that we have errors, otherwise create zero vector 
    407         err = self.err_data 
    408         if self.err_data == None or \ 
    409             (len(self.err_data) != len(self.data)): 
    410             err = numpy.zeros(len(other.data)) 
    411              
    412         return err, err_other 
    413  
    414     def _validity_check_union(self, other): 
    415         """ 
    416         Checks that the data lengths are compatible. 
    417         Checks that the x vectors are compatible. 
    418         Returns errors vectors equal to original 
    419         errors vectors if they were present or vectors 
    420         of zeros when none was found. 
    421          
    422         :param other: other data set for operation 
    423          
    424         :return: bool 
    425          
    426         :raise ValueError: when data types are not compatible 
    427          
    428         """ 
    429         if not isinstance(other, Data2D): 
    430             msg = "Unable to perform operation: different types of data set" 
    431             raise ValueError, msg    
    432         return True 
    433      
     365 
    434366    def _perform_operation(self, other, operation): 
    435367        """ 
  • src/sas/sasgui/guiframe/data_panel.py

    re767897 rc8e1996  
    11################################################################################ 
    2 #This software was developed by the University of Tennessee as part of the 
    3 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
    4 #project funded by the US National Science Foundation. 
     2# This software was developed by the University of Tennessee as part of the 
     3# Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
     4# project funded by the US National Science Foundation. 
    55# 
    6 #See the license text in license.txt 
     6# See the license text in license.txt 
    77# 
    8 #copyright 2010, University of Tennessee 
     8# copyright 2010, University of Tennessee 
    99################################################################################ 
    1010""" 
     
    1414from wx.build import build_options 
    1515 
    16 # Check version 
    17 toks = str(wx.__version__).split('.') 
    18 if int(toks[1]) < 9: 
    19     if int(toks[2]) < 12: 
    20         wx_version = 811 
    21     else: 
    22         wx_version = 812 
    23 else: 
    24     wx_version = 900 
    2516import sys 
    2617from wx.lib.scrolledpanel import ScrolledPanel 
    27 import  wx.lib.agw.customtreectrl as CT 
     18import wx.lib.agw.customtreectrl as CT 
    2819from sas.sasgui.guiframe.dataFitting import Data1D 
    2920from sas.sasgui.guiframe.dataFitting import Data2D 
     
    3627from sas.sasgui.guiframe.events import NewBatchEvent 
    3728from sas.sascalc.dataloader.loader import Loader 
    38 #from sas.sasgui.guiframe.local_perspectives.plotting.masking \ 
     29# from sas.sasgui.guiframe.local_perspectives.plotting.masking \ 
    3930#    import FloatPanel as QucikPlotDialog 
    40 from sas.sasgui.guiframe.local_perspectives.plotting.SimplePlot import PlotFrame \ 
    41         as QucikPlotDialog 
     31from sas.sasgui.guiframe.local_perspectives.plotting.SimplePlot \ 
     32    import PlotFrame as QucikPlotDialog 
    4233import sas.sasgui.guiframe.config as config 
     34 
     35# Check version 
     36toks = str(wx.__version__).split('.') 
     37if int(toks[1]) < 9: 
     38    if int(toks[2]) < 12: 
     39        wx_version = 811 
     40    else: 
     41        wx_version = 812 
     42else: 
     43    wx_version = 900 
    4344 
    4445extension_list = [] 
     
    4950APPLICATION_WLIST = config.APPLICATION_WLIST 
    5051 
    51 #Control panel width 
     52# Control panel width 
    5253if sys.platform.count("win32") > 0: 
    5354    PANEL_WIDTH = 235 
     
    6566    IS_MAC = True 
    6667 
    67 STYLE_FLAG = wx.RAISED_BORDER|CT.TR_HAS_BUTTONS| CT.TR_HIDE_ROOT|\ 
    68                     wx.WANTS_CHARS|CT.TR_HAS_VARIABLE_ROW_HEIGHT 
     68STYLE_FLAG = wx.RAISED_BORDER | CT.TR_HAS_BUTTONS | CT.TR_HIDE_ROOT |\ 
     69                    wx.WANTS_CHARS | CT.TR_HAS_VARIABLE_ROW_HEIGHT 
    6970 
    7071 
     
    7475    """ 
    7576    def __init__(self, parent, *args, **kwds): 
    76         #agwstyle is introduced in wx.2.8.11 but is not working for mac 
     77        # agwstyle is introduced in wx.2.8.11 but is not working for mac 
    7778        if IS_MAC and wx_version < 812: 
    7879            try: 
     
    114115            return 0 
    115116 
     117 
    116118class DataPanel(ScrolledPanel, PanelBase): 
    117119    """ 
     
    119121    interact with data. 
    120122    """ 
    121     ## Internal name for the AUI manager 
     123    # Internal name for the AUI manager 
    122124    window_name = "Data Panel" 
    123     ## Title to appear on top of the window 
     125    # Title to appear on top of the window 
    124126    window_caption = "Data Explorer" 
    125     #type of window 
     127    # type of window 
    126128    window_type = "Data Panel" 
    127     ## Flag to tell the GUI manager that this panel is not 
     129    # Flag to tell the GUI manager that this panel is not 
    128130    #  tied to any perspective 
    129     #ALWAYS_ON = True 
     131    # ALWAYS_ON = True 
     132 
    130133    def __init__(self, parent, 
    131134                 list=None, 
     
    133136                 id=-1, 
    134137                 list_of_perspective=None, manager=None, *args, **kwds): 
    135         #kwds['size'] = size 
    136         #kwds['style'] = STYLE_FLAG 
     138        # kwds['size'] = size 
     139        # kwds['style'] = STYLE_FLAG 
    137140        ScrolledPanel.__init__(self, parent=parent, id=id, *args, **kwds) 
    138141        PanelBase.__init__(self, parent) 
    139142        self.SetupScrolling() 
    140         #Set window's font size 
     143        # Set window's font size 
    141144        self.SetWindowVariant(variant=FONT_VARIANT) 
    142145        self.loader = Loader() 
    143         #Default location 
     146        # Default location 
    144147        self._default_save_location = None 
    145148        self.all_data1d = True 
     
    159162        self.tree_ctrl_theory = None 
    160163        self.perspective_cbox = None 
    161         ## Create context menu for page 
     164        # Create context menu for page 
    162165        self.data_menu = None 
    163166        self.popUpMenu = None 
     
    165168        self.editmask_id = None 
    166169        # Default attr 
    167         self.vbox  = None 
     170        self.vbox = None 
    168171        self.sizer1 = None 
    169172        self.sizer2 = None 
     
    210213        """ 
    211214        w, h = self.parent.GetSize() 
    212         self.vbox  = wx.BoxSizer(wx.VERTICAL) 
     215        self.vbox = wx.BoxSizer(wx.VERTICAL) 
    213216        self.sizer1 = wx.BoxSizer(wx.VERTICAL) 
    214217        self.sizer1.SetMinSize(wx.Size(w/13, h*2/5)) 
     
    219222        self.sizer5 = wx.BoxSizer(wx.VERTICAL) 
    220223 
    221         self.vbox.Add(self.sizer5, 0, wx.EXPAND|wx.ALL, 1) 
    222         self.vbox.Add(self.sizer1, 1, wx.EXPAND|wx.ALL, 0) 
    223         self.vbox.Add(self.sizer2, 0, wx.EXPAND|wx.ALL, 1) 
    224         self.vbox.Add(self.sizer3, 0, wx.EXPAND|wx.ALL, 10) 
    225         #self.vbox.Add(self.sizer4, 0, wx.EXPAND|wx.ALL,5) 
     224        self.vbox.Add(self.sizer5, 0, wx.EXPAND | wx.ALL, 1) 
     225        self.vbox.Add(self.sizer1, 1, wx.EXPAND | wx.ALL, 0) 
     226        self.vbox.Add(self.sizer2, 0, wx.EXPAND | wx.ALL, 1) 
     227        self.vbox.Add(self.sizer3, 0, wx.EXPAND | wx.ALL, 10) 
     228        # self.vbox.Add(self.sizer4, 0, wx.EXPAND|wx.ALL,5) 
    226229 
    227230        self.SetSizer(self.vbox) 
     
    235238        self.selection_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 
    236239        list_of_options = ['Select all Data', 
    237                             'Unselect all Data', 
     240                           'Unselect all Data', 
    238241                           'Select all Data 1D', 
    239242                           'Unselect all Data 1D', 
    240243                           'Select all Data 2D', 
    241                            'Unselect all Data 2D' ] 
     244                           'Unselect all Data 2D'] 
    242245        for option in list_of_options: 
    243246            self.selection_cbox.Append(str(option)) 
     
    245248        wx.EVT_COMBOBOX(self.selection_cbox, -1, self._on_selection_type) 
    246249        self.sizer5.AddMany([(select_txt, 0, wx.ALL, 5), 
    247                             (self.selection_cbox, 0, wx.ALL,5)]) 
     250                            (self.selection_cbox, 0, wx.ALL, 5)]) 
    248251        self.enable_selection() 
    249  
    250252 
    251253    def _on_selection_type(self, event): 
     
    257259            self.tree_ctrl.CheckItem(data_ctrl, check_value) 
    258260            if data_ctrl.HasChildren(): 
    259                 if check_value == True and not control.IsExpanded(): 
     261                if check_value and not control.IsExpanded(): 
    260262                    # Only select children if control is expanded 
    261263                    # Always deselect children, regardless (see ticket #259) 
     
    299301        Layout widgets related to buttons 
    300302        """ 
    301         #Load Data Button 
     303        # Load Data Button 
    302304        self.bt_add = wx.Button(self, wx.NewId(), "Load Data", 
    303305                                size=(BUTTON_WIDTH, -1)) 
     
    305307        wx.EVT_BUTTON(self, self.bt_add.GetId(), self._load_data) 
    306308 
    307         #Delete Data Button 
     309        # Delete Data Button 
    308310        self.bt_remove = wx.Button(self, wx.NewId(), "Delete Data", 
    309          size=(BUTTON_WIDTH, -1)) 
     311                                   size=(BUTTON_WIDTH, -1)) 
    310312        self.bt_remove.SetToolTipString("Delete data from the application") 
    311313        wx.EVT_BUTTON(self, self.bt_remove.GetId(), self.on_remove) 
    312314 
    313         #Send data to perspective button 
     315        # Send data to perspective button 
    314316        self.bt_import = wx.Button(self, wx.NewId(), "Send To", 
    315                                     size=(BUTTON_WIDTH, -1)) 
     317                                   size=(BUTTON_WIDTH, -1)) 
    316318        self.bt_import.SetToolTipString("Send Data set to active perspective") 
    317319        wx.EVT_BUTTON(self, self.bt_import.GetId(), self.on_import) 
    318320 
    319         #Choose perspective to be send data to combo box 
     321        # Choose perspective to be send data to combo box 
    320322        self.perspective_cbox = wx.ComboBox(self, -1, 
    321                                 style=wx.CB_READONLY) 
     323                                            style=wx.CB_READONLY) 
    322324        if not IS_MAC: 
    323325            self.perspective_cbox.SetMinSize((BUTTON_WIDTH*1.6, -1)) 
     
    325327                        self._on_perspective_selection) 
    326328 
    327         #Append data to current Graph Button 
     329        # Append data to current Graph Button 
    328330        self.bt_append_plot = wx.Button(self, wx.NewId(), "Append Plot To", 
    329331                                        size=(BUTTON_WIDTH, -1)) 
    330         self.bt_append_plot.SetToolTipString( \ 
    331                                 "Plot the selected data in the active panel") 
     332        self.bt_append_plot.SetToolTipString( 
     333            "Plot the selected data in the active panel") 
    332334        wx.EVT_BUTTON(self, self.bt_append_plot.GetId(), self.on_append_plot) 
    333335 
    334         #Create a new graph and send data to that new graph button 
     336        # Create a new graph and send data to that new graph button 
    335337        self.bt_plot = wx.Button(self, wx.NewId(), "New Plot", 
    336338                                 size=(BUTTON_WIDTH, -1)) 
     
    338340        wx.EVT_BUTTON(self, self.bt_plot.GetId(), self.on_plot) 
    339341 
    340         #Freeze current theory button - becomes a data set and stays on graph 
     342        # Freeze current theory button - becomes a data set and stays on graph 
    341343        self.bt_freeze = wx.Button(self, wx.NewId(), "Freeze Theory", 
    342344                                   size=(BUTTON_WIDTH, -1)) 
     
    347349        wx.EVT_BUTTON(self, self.bt_freeze.GetId(), self.on_freeze) 
    348350 
    349         #select plot to send to combo box (blank if no data) 
     351        # select plot to send to combo box (blank if no data) 
    350352        if sys.platform == 'darwin': 
    351353            self.cb_plotpanel = wx.ComboBox(self, -1, 
     
    353355        else: 
    354356            self.cb_plotpanel = wx.ComboBox(self, -1, 
    355                                             style=wx.CB_READONLY|wx.CB_SORT) 
     357                                            style=wx.CB_READONLY | wx.CB_SORT) 
    356358        wx.EVT_COMBOBOX(self.cb_plotpanel, -1, self._on_plot_selection) 
    357359        self.cb_plotpanel.Disable() 
    358360 
    359         #Help button 
     361        # Help button 
    360362        self.bt_help = wx.Button(self, wx.NewId(), "HELP", 
    361363                                 size=(BUTTON_WIDTH, -1)) 
    362364        self.bt_help.SetToolTipString("Help for the Data Explorer.") 
    363         wx.EVT_BUTTON(self,self.bt_help.GetId(), self.on_help) 
     365        wx.EVT_BUTTON(self, self.bt_help.GetId(), self.on_help) 
    364366 
    365367        self.sizer3.AddMany([(self.bt_add), 
     
    373375                             (self.bt_append_plot), 
    374376                             (self.cb_plotpanel, 
    375                               wx.EXPAND|wx.ADJUST_MINSIZE, 5), 
     377                              wx.EXPAND | wx.ADJUST_MINSIZE, 5), 
    376378                             ((5, 5)), 
    377379                             ((5, 5)), 
    378                              (self.bt_import, 0, wx.EXPAND|wx.RIGHT, 5), 
     380                             (self.bt_import, 0, wx.EXPAND | wx.RIGHT, 5), 
    379381                             (self.perspective_cbox, 
    380                               wx.EXPAND|wx.ADJUST_MINSIZE, 5), 
     382                              wx.EXPAND | wx.ADJUST_MINSIZE, 5), 
    381383                             ((10, 10)), 
    382384                             (self.sizer4), 
     
    401403        self.rb_batch_mode = wx.RadioButton(self, -1, 'Batch Mode') 
    402404        self.Bind(wx.EVT_RADIOBUTTON, self.on_single_mode, 
    403                      id=self.rb_single_mode.GetId()) 
     405                  id=self.rb_single_mode.GetId()) 
    404406        self.Bind(wx.EVT_RADIOBUTTON, self.on_batch_mode, 
    405                    id=self.rb_batch_mode.GetId()) 
     407                  id=self.rb_batch_mode.GetId()) 
    406408 
    407409        self.rb_single_mode.SetValue(not self.parent.batch_on) 
     
    433435        """ 
    434436        data = None 
    435         #selection = event.GetSelection() 
     437        # selection = event.GetSelection() 
    436438        id, _, _ = self.FindFocus().GetSelection().GetData() 
    437439        data_list, theory_list = \ 
    438                         self.parent.get_data_manager().get_by_id(id_list=[id]) 
     440            self.parent.get_data_manager().get_by_id(id_list=[id]) 
    439441        if data_list: 
    440442            data = data_list.values()[0] 
    441         if data == None: 
     443        if data is None: 
    442444            data = theory_list.values()[0][0] 
    443445        return data 
     
    461463        data = self._get_data_selection(event) 
    462464        from sas.sasgui.guiframe.local_perspectives.plotting.masking \ 
    463         import FloatPanel as Float3dDialog 
     465            import FloatPanel as Float3dDialog 
    464466 
    465467        panel = Float3dDialog(base=self, data=data, 
     
    476478        else: 
    477479            dimension = 1 
    478         #panel = QucikPlotDialog(base=self, data=data, 
     480        # panel = QucikPlotDialog(base=self, data=data, 
    479481        #                        dimension=dimension, id=wx.NewId()) 
    480482        frame = QucikPlotDialog(self, -1, "Plot " + data.name, 'log_{10}') 
    481483        self.parent.put_icon(frame) 
    482484        frame.add_plot(data) 
    483         #frame.SetTitle(title) 
     485        # frame.SetTitle(title) 
    484486        frame.Show(True) 
    485487        frame.SetFocus() 
    486         #panel.ShowModal() 
     488        # panel.ShowModal() 
    487489 
    488490    def on_data_info(self, event): 
     
    501503        """ 
    502504        data = self._get_data_selection(event) 
    503         #path = None 
     505        # path = None 
    504506        default_name = data.name 
    505507        if default_name.count('.') > 0: 
    506508            default_name = default_name.split('.')[0] 
    507509        default_name += "_out" 
    508         if self.parent != None: 
     510        if self.parent is not None: 
    509511            if issubclass(data.__class__, Data1D): 
    510512                self.parent.save_data1d(data, default_name) 
     
    523525        self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) 
    524526        self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_MENU, self.on_right_click_data) 
    525         ## Create context menu for page 
     527        # Create context menu for page 
    526528        self.data_menu = wx.Menu() 
    527529        id = wx.NewId() 
     
    558560        tree_ctrl_theory_label.SetForegroundColour('blue') 
    559561        self.tree_ctrl_theory = DataTreeCtrl(parent=self, 
    560                                                     style=wx.SUNKEN_BORDER) 
     562                                             style=wx.SUNKEN_BORDER) 
    561563        self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_CHECKING, 
    562                                                     self.on_check_item) 
     564                                   self.on_check_item) 
    563565        self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_MENU, 
    564566                                   self.on_right_click_theory) 
    565567        self.sizer1.Add(tree_ctrl_label, 0, wx.LEFT, 10) 
    566         self.sizer1.Add(self.tree_ctrl, 1, wx.EXPAND|wx.ALL, 10) 
     568        self.sizer1.Add(self.tree_ctrl, 1, wx.EXPAND | wx.ALL, 10) 
    567569        self.sizer1.Add(tree_ctrl_theory_label, 0,  wx.LEFT, 10) 
    568         self.sizer1.Add(self.tree_ctrl_theory, 1, wx.EXPAND|wx.ALL, 10) 
     570        self.sizer1.Add(self.tree_ctrl_theory, 1, wx.EXPAND | wx.ALL, 10) 
    569571 
    570572    def on_right_click_theory(self, event): 
     
    588590        Allow Editing Data 
    589591        """ 
    590         #selection = event.GetSelection() 
     592        # selection = event.GetSelection() 
    591593        is_data = True 
    592594        try: 
    593595            id, data_class_name, _ = self.tree_ctrl.GetSelection().GetData() 
    594596            data_list, _ = \ 
    595                         self.parent.get_data_manager().get_by_id(id_list=[id]) 
     597                self.parent.get_data_manager().get_by_id(id_list=[id]) 
    596598            if not data_list: 
    597599                is_data = False 
     
    610612        """ 
    611613        # Skipping the save state functionality for release 0.9.0 
    612         #return 
     614        # return 
    613615        pos = event.GetPosition() 
    614616        pos = self.ScreenToClient(pos) 
    615617        self.PopupMenu(self.popUpMenu, pos) 
    616  
    617618 
    618619    def on_check_item(self, event): 
     
    636637        if self.parent is None or \ 
    637638            not hasattr(self.parent, "get_current_perspective") or \ 
    638             len(self.list_of_perspective) == 0: 
     639                        len(self.list_of_perspective) == 0: 
    639640            return 
    640         if self.parent is not None and self.perspective_cbox  is not None: 
     641        if self.parent is not None and self.perspective_cbox is not None: 
    641642            for plug in self.list_of_perspective: 
    642643                if plug.get_perspective(): 
     
    666667                    s_path = str(path) 
    667668                    if state_id not in self.list_cb_data: 
    668                         #new state 
     669                        # new state 
    669670                        data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root, 
    670                                         0, data_name, ct_type=1, 
     671                                                           0, data_name, 
     672                                                           ct_type=1, 
    671673                                        data=(data_id, data_class, state_id)) 
    672674                        data_c.Check(True) 
    673675                        d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info') 
    674676                        d_t_c = self.tree_ctrl.AppendItem(d_i_c, 
    675                                                       'Title: %s' % data_title) 
     677                                                          'Title: %s' % 
     678                                                          data_title) 
    676679                        r_n_c = self.tree_ctrl.AppendItem(d_i_c, 
    677                                                       'Run: %s' % data_run) 
     680                                                          'Run: %s' % data_run) 
    678681                        i_c_c = self.tree_ctrl.AppendItem(d_i_c, 
    679                                                       'Type: %s' % data_class) 
     682                                                          'Type: %s' % 
     683                                                          data_class) 
    680684                        p_c_c = self.tree_ctrl.AppendItem(d_i_c, 
    681                                                       "Path: '%s'" % s_path) 
     685                                                          "Path: '%s'" % s_path) 
    682686                        d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process') 
    683687 
    684688                        for process in process_list: 
    685                             process_str = str(process).replace('\n',' ') 
    686                             if len(process_str)>20: 
    687                                 process_str = process_str[:20]+' [...]' 
     689                            process_str = str(process).replace('\n', ' ') 
     690                            if len(process_str) > 20: 
     691                                process_str = process_str[:20] + ' [...]' 
    688692                            self.tree_ctrl.AppendItem(d_p_c, process_str) 
    689693                        theory_child = self.tree_ctrl.AppendItem(data_c, 
     
    698702                                                       theory_child] 
    699703                    else: 
    700                         data_ctrl_list =  self.list_cb_data[state_id] 
    701                         #This state is already display replace it contains 
     704                        data_ctrl_list = self.list_cb_data[state_id] 
     705                        # This state is already display replace it contains 
    702706                        data_c, d_i_c, d_t_c, r_n_c,  i_c_c, p_c_c, d_p_c, _ \ 
    703707                                = data_ctrl_list 
     
    713717                            if not process.is_empty(): 
    714718                                _ = self.tree_ctrl.AppendItem(d_p_c, 
    715                                                               process.single_line_desc()) 
     719                                                    process.single_line_desc()) 
    716720                wx.CallAfter(self.append_theory, state_id, theory_list) 
    717721            # Sort by data name 
     
    757761                                       theory_list=theory_list) 
    758762 
    759  
    760763    def append_theory_helper(self, tree, root, state_id, theory_list): 
    761764        """ 
     
    763766        """ 
    764767        if state_id in self.list_cb_theory.keys(): 
    765             #update current list of theory for this data 
     768            # update current list of theory for this data 
    766769            theory_list_ctrl = self.list_cb_theory[state_id] 
    767770 
     
    777780                    theory_class = theory_data.__class__.__name__ 
    778781                    theory_id = theory_data.id 
    779                     #if theory_state is not None: 
     782                    # if theory_state is not None: 
    780783                    #    name = theory_state.model.name 
    781784                    temp = (theory_id, theory_class, state_id) 
    782785                if theory_id not in theory_list_ctrl: 
    783                     #add new theory 
     786                    # add new theory 
    784787                    t_child = tree.AppendItem(root, 
    785788                                                    name, ct_type=1, data=temp) 
     
    795798                                                   t_p_c] 
    796799                else: 
    797                     #replace theory 
     800                    # replace theory 
    798801                    t_child, i_c_c, t_p_c = theory_list_ctrl[theory_id] 
    799802                    tree.SetItemText(t_child, name) 
     
    805808 
    806809        else: 
    807             #data didn't have a theory associated it before 
     810            # data didn't have a theory associated it before 
    808811            theory_list_ctrl = {} 
    809812            for theory_id, item in theory_list.iteritems(): 
     
    813816                    theory_class = theory_data.__class__.__name__ 
    814817                    theory_id = theory_data.id 
    815                     #if theory_state is not None: 
     818                    # if theory_state is not None: 
    816819                    #    name = theory_state.model.name 
    817820                    temp = (theory_id, theory_class, state_id) 
     
    828831 
    829832                    theory_list_ctrl[theory_id] = [t_child, i_c_c, t_p_c] 
    830                 #self.list_cb_theory[data_id] = theory_list_ctrl 
     833                # self.list_cb_theory[data_id] = theory_list_ctrl 
    831834                self.list_cb_theory[state_id] = theory_list_ctrl 
    832  
    833  
    834835 
    835836    def set_data_helper(self): 
     
    889890            wx.PostEvent(self.parent, NewLoadDataEvent()) 
    890891 
    891  
    892     def on_remove(self, event): 
     892    def on_remove(self, event, prompt=True): 
    893893        """ 
    894894        Get a list of item checked and remove them from the treectrl 
    895895        Ask the parent to remove reference to this item 
    896896        """ 
    897         msg = "This operation will delete the data sets checked " 
    898         msg += "and all the dependents." 
    899         msg_box = wx.MessageDialog(None, msg, 'Warning', wx.OK|wx.CANCEL) 
    900         if msg_box.ShowModal() != wx.ID_OK: 
    901             return 
     897        if prompt: 
     898            msg = "This operation will delete the data sets checked " 
     899            msg += "and all the dependents." 
     900            msg_box = wx.MessageDialog(None, msg, 'Warning', wx.OK|wx.CANCEL) 
     901            if msg_box.ShowModal() != wx.ID_OK: 
     902                return 
    902903 
    903904        data_to_remove, theory_to_remove, _ = self.set_data_helper() 
    904905        data_key = [] 
    905906        theory_key = [] 
    906         #remove  data from treectrl 
     907        # remove  data from treectrl 
    907908        for d_key, item in self.list_cb_data.iteritems(): 
    908909            data_c, _, _, _,  _, _, _, _ = item 
     
    915916        # Remove theory from treectrl 
    916917        for _, theory_dict in self.list_cb_theory.iteritems(): 
    917             for  key, value in theory_dict.iteritems(): 
     918            for key, value in theory_dict.iteritems(): 
    918919                item, _, _ = value 
    919920                if item.IsChecked(): 
     
    924925                    theory_key.append(key) 
    925926 
    926         #Remove data and related theory references 
     927        # Remove data and related theory references 
    927928        for key in data_key: 
    928929            del self.list_cb_data[key] 
    929930            if key in theory_key: 
    930931                del self.list_cb_theory[key] 
    931         #remove theory  references independently of data 
     932        # remove theory  references independently of data 
    932933        for key in theory_key: 
    933934            for _, theory_dict in self.list_cb_theory.iteritems(): 
    934935                if key in theory_dict: 
    935                     for  key, value in theory_dict.iteritems(): 
     936                    for key, value in theory_dict.iteritems(): 
    936937                        item, _, _ = value 
    937938                        if item.IsChecked(): 
     
    942943                    del theory_dict[key] 
    943944 
    944  
    945945        self.parent.remove_data(data_id=data_to_remove, 
    946946                                  theory_id=theory_to_remove) 
     
    953953        Get all select data and set them to the current active perspetive 
    954954        """ 
    955         if event != None: 
     955        if event is not None: 
    956956            event.Skip() 
    957957        data_id, theory_id, state_id = self.set_data_helper() 
     
    985985        On close 
    986986        """ 
    987         if event != None: 
     987        if event is not None: 
    988988            event.Skip() 
    989989        # send parent to update menu with no show nor hide action 
     
    10151015        from the combobox of the current panel 
    10161016        """ 
    1017         #name = event.name 
     1017        # name = event.name 
    10181018        caption = event.caption 
    10191019        if self.cb_plotpanel is not None: 
     
    10331033            if name_plot_panel not in self.cb_plotpanel.GetItems(): 
    10341034                self.cb_plotpanel.Append(name_plot_panel, value) 
    1035             if name != None and name == name_plot_panel: 
     1035            if name is not None and name == name_plot_panel: 
    10361036                self.cb_plotpanel.SetStringSelection(name_plot_panel) 
    10371037                break 
     
    10591059        On source combobox selection 
    10601060        """ 
    1061         if event != None: 
     1061        if event is not None: 
    10621062            combo = event.GetEventObject() 
    10631063            event.Skip() 
     
    11061106        running "file:///...." 
    11071107 
    1108     :param evt: Triggers on clicking the help button 
     1108    :param event: Triggers on clicking the help button 
    11091109    """ 
    11101110 
     
    11551155        """ 
    11561156        n_t = 0 
    1157         if self.tree_ctrl != None: 
     1157        if self.tree_ctrl is not None: 
    11581158            n_t = self.tree_ctrl.GetCount() 
    11591159        if n_t > 0 and len(self.list_of_perspective) > 0: 
     
    11741174        n_t = 0 
    11751175        n_t_t = 0 
    1176         if self.tree_ctrl != None: 
     1176        if self.tree_ctrl is not None: 
    11771177            n_t = self.tree_ctrl.GetCount() 
    1178         if self.tree_ctrl_theory != None: 
     1178        if self.tree_ctrl_theory is not None: 
    11791179            n_t_t = self.tree_ctrl_theory.GetCount() 
    11801180        if n_t + n_t_t <= 0: 
     
    11901190        n_t = 0 
    11911191        n_t_t = 0 
    1192         if self.tree_ctrl != None: 
     1192        if self.tree_ctrl is not None: 
    11931193            n_t = self.tree_ctrl.GetCount() 
    1194         if self.tree_ctrl_theory != None: 
     1194        if self.tree_ctrl_theory is not None: 
    11951195            n_t_t = self.tree_ctrl_theory.GetCount() 
    11961196        if n_t + n_t_t <= 0: 
     
    12141214        n_t_t = 0 
    12151215        n_l = 0 
    1216         if self.tree_ctrl_theory != None: 
     1216        if self.tree_ctrl_theory is not None: 
    12171217            n_t_t = self.tree_ctrl_theory.GetCount() 
    12181218        n_l = len(self.list_cb_theory) 
     
    12281228        n_t = 0 
    12291229        n_t_t = 0 
    1230         if self.tree_ctrl != None: 
     1230        if self.tree_ctrl is not None: 
    12311231            n_t = self.tree_ctrl.GetCount() 
    1232         if self.tree_ctrl_theory != None: 
     1232        if self.tree_ctrl_theory is not None: 
    12331233            n_t_t = self.tree_ctrl_theory.GetCount() 
    1234         if n_t + n_t_t > 0 and self.selection_cbox != None: 
     1234        if n_t + n_t_t > 0 and self.selection_cbox is not None: 
    12351235            self.selection_cbox.Enable() 
    12361236        else: 
     
    12541254            #self.bt_remove.Hide() 
    12551255            self.bt_add.Hide() 
    1256  
    12571256 
    12581257 
     
    12871286        if not data_list or len(data_list) <= 1: 
    12881287            return 
    1289         #add text 
     1288        # add text 
    12901289 
    12911290        text = "Deleting these file reset some panels.\n" 
     
    12951294        iy = 0 
    12961295        ix = 0 
    1297         #data_count = 0 
     1296        # data_count = 0 
    12981297        for (data_name, in_use, sub_menu) in range(len(data_list)): 
    1299             if in_use == True: 
     1298            if in_use: 
    13001299                ctrl_name = wx.StaticBox(self, -1, str(data_name)) 
    13011300                ctrl_in_use = wx.StaticBox(self, -1, " is used by ") 
    13021301                plug_name = str(sub_menu) + "\n" 
    1303                 #ctrl_sub_menu = wx.StaticBox(self, -1, plug_name) 
     1302                # ctrl_sub_menu = wx.StaticBox(self, -1, plug_name) 
    13041303                self.sizer.Add(ctrl_name, (iy, ix), 
    13051304                           (1, 1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     
    13121311            iy += 1 
    13131312        self._panel.SetSizer(self.sizer) 
    1314         #add sizer 
     1313        # add sizer 
    13151314        self._sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    13161315        button_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel") 
     
    13751374 
    13761375 
    1377  
    13781376from sas.sasgui.guiframe.dataFitting import Theory1D 
    13791377from sas.sasgui.guiframe.data_state import DataState 
     1378 
    13801379 
    13811380class State(): 
     
    13911390        return self.msg 
    13921391 
     1392 
    13931393def set_data_state(data=None, path=None, theory=None, state=None): 
    13941394    """ 
     
    14051405    app = wx.App() 
    14061406    try: 
    1407         #list_of_perspective = [('perspective2', False), ('perspective1', True)] 
     1407        # list_of_perspective = [('perspective2', False), ('perspective1', True)] 
    14081408        data_list1 = {} 
    14091409        # state 1 
     
    14201420        state1 = State() 
    14211421        data_list1['1'] = set_data_state(data1, path1, theory1, state1) 
    1422         #state 2 
     1422        # state 2 
    14231423        data1 = Data2D() 
    14241424        data1.name = "data2" 
     
    14281428        theory1.name = "CoreShell 07/24/25" 
    14291429        path1 = "path2" 
    1430         #state3 
     1430        # state3 
    14311431        state1 = State() 
    14321432        data_list1['2'] = set_data_state(data1, path1, theory1, state1) 
     
    14451445        process1.data = "07/22/2010" 
    14461446        data_list1['4'] = set_data_state(data1, path1, theory1, state1) 
    1447         #state 4 
     1447        # state 4 
    14481448        temp_data_list = {} 
    14491449        data1.name = "data5 erasing data2" 
    14501450        temp_data_list['4'] = set_data_state(data1, path1, theory1, state1) 
    1451         #state 5 
     1451        # state 5 
    14521452        data1 = Data2D() 
    14531453        data1.name = "data3" 
     
    14821482        window.load_data_list(list=temp_data_list) 
    14831483    except: 
    1484         #raise 
     1484        # raise 
    14851485        print "error", sys.exc_value 
    14861486 
  • src/sas/sasgui/guiframe/events.py

    rd85c194 r6ffa0dd  
    88# plot Qrange 
    99(PlotQrangeEvent, EVT_PLOT_QRANGE) = wx.lib.newevent.NewEvent() 
     10# set plot limits 
     11(PlotLimitEvent, EVT_PLOT_LIM) = wx.lib.newevent.NewEvent() 
    1012# print the messages on statusbar 
    1113(StatusEvent,  EVT_STATUS)   = wx.lib.newevent.NewEvent() 
    12 #create a panel slicer  
     14#create a panel slicer 
    1315(SlicerPanelEvent, EVT_SLICER_PANEL)   = wx.lib.newevent.NewEvent() 
    14 #print update paramaters for panel slicer  
     16#print update paramaters for panel slicer 
    1517(SlicerParamUpdateEvent, EVT_SLICER_PARS_UPDATE)   = wx.lib.newevent.NewEvent() 
    16 #update the slicer from the panel  
     18#update the slicer from the panel 
    1719(SlicerParameterEvent, EVT_SLICER_PARS)   = wx.lib.newevent.NewEvent() 
    1820#slicer event 
  • src/sas/sasgui/guiframe/gui_manager.py

    rc8a641e8 r73cbeec  
    33""" 
    44################################################################################ 
    5 #This software was developed by the University of Tennessee as part of the 
    6 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
    7 #project funded by the US National Science Foundation. 
     5# This software was developed by the University of Tennessee as part of the 
     6# Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
     7# project funded by the US National Science Foundation. 
    88# 
    9 #See the license text in license.txtz 
     9# See the license text in license.txtz 
    1010# 
    11 #copyright 2008, University of Tennessee 
     11# copyright 2008, University of Tennessee 
    1212################################################################################ 
    1313 
     
    2121import warnings 
    2222import re 
    23 warnings.simplefilter("ignore") 
    2423import logging 
    2524import httplib 
     
    4948from matplotlib import _pylab_helpers 
    5049 
     50warnings.simplefilter("ignore") 
     51 
    5152 
    5253def get_app_dir(): 
     
    8283    return app_path 
    8384 
     85 
    8486def get_user_directory(): 
    8587    """ 
     
    9092        os.makedirs(userdir) 
    9193    return userdir 
     94 
    9295 
    9396def _find_local_config(file, path): 
     
    113116 
    114117# GUI always starts from the App folder 
    115 #os.chdir(PATH_APP) 
     118# os.chdir(PATH_APP) 
    116119# Read in the local config, which can either be with the main 
    117120# application or in the installation directory 
     
    128131    logging.info("found local_config in %s" % PATH_APP) 
    129132 
    130 from sas.sasgui.guiframe.customdir  import SetupCustom 
     133from sas.sasgui.guiframe.customdir import SetupCustom 
    131134c_conf_dir = SetupCustom().setup_dir(PATH_APP) 
    132135custom_config = _find_local_config('custom_config', c_conf_dir) 
     
    141144    logging.info("using custom_config from %s" % c_conf_dir) 
    142145 
    143 #read some constants from config 
     146# read some constants from config 
    144147APPLICATION_STATE_EXTENSION = config.APPLICATION_STATE_EXTENSION 
    145148APPLICATION_NAME = config.__appname__ 
     
    149152SPLASH_SCREEN_HEIGHT = config.SPLASH_SCREEN_HEIGHT 
    150153SS_MAX_DISPLAY_TIME = config.SS_MAX_DISPLAY_TIME 
     154SAS_OPENCL = config.SAS_OPENCL 
    151155if not WELCOME_PANEL_ON: 
    152156    WELCOME_PANEL_SHOW = False 
     
    169173    # custom open_path 
    170174    open_folder = custom_config.DEFAULT_OPEN_FOLDER 
    171     if open_folder != None and os.path.isdir(open_folder): 
     175    if open_folder is not None and os.path.isdir(open_folder): 
    172176        DEFAULT_OPEN_FOLDER = os.path.abspath(open_folder) 
    173177    else: 
    174178        DEFAULT_OPEN_FOLDER = PATH_APP 
     179    SAS_OPENCL = custom_config.SAS_OPENCL 
    175180except: 
    176181    DATALOADER_SHOW = True 
     
    187192    CLEANUP_PLOT = False 
    188193    DEFAULT_OPEN_FOLDER = PATH_APP 
    189  
     194    SAS_OPENCL = None 
    190195DEFAULT_STYLE = config.DEFAULT_STYLE 
    191196 
     
    222227        CHILD_FRAME = wx.Frame 
    223228 
     229#Initiliaze enviromental variable with custom setting but only if variable not set 
     230if SAS_OPENCL and not "SAS_OPENCL" in os.environ: 
     231    os.environ["SAS_OPENCL"] = SAS_OPENCL 
     232 
    224233class ViewerFrame(PARENT_FRAME): 
    225234    """ 
     
    235244        Initialize the Frame object 
    236245        """ 
    237         PARENT_FRAME.__init__(self, parent=parent, title=title, pos=pos, size=size) 
     246        PARENT_FRAME.__init__(self, parent=parent, title=title, 
     247                              pos=pos, size=size) 
    238248        # title 
    239249        self.title = title 
     
    256266        self.path = PATH_APP 
    257267        self.application_name = APPLICATION_NAME 
    258         ## Application manager 
     268        # Application manager 
    259269        self._input_file = None 
    260270        self.app_manager = None 
    261271        self._mgr = None 
    262         #add current perpsective 
     272        # add current perpsective 
    263273        self._current_perspective = None 
    264274        self._plotting_plugin = None 
    265275        self._data_plugin = None 
    266         #Menu bar and item 
     276        # Menu bar and item 
    267277        self._menubar = None 
    268278        self._file_menu = None 
     
    278288        self._toolbar_menu = None 
    279289        self._save_appl_menu = None 
    280         #tool bar 
     290        # tool bar 
    281291        self._toolbar = None 
    282292        # Status bar 
     
    286296        # plot duck cleanup option 
    287297        self.cleanup_plots = CLEANUP_PLOT 
    288         ## Find plug-ins 
     298        # Find plug-ins 
    289299        # Modify this so that we can specify the directory to look into 
    290300        self.plugins = [] 
    291         #add local plugin 
     301        # add local plugin 
    292302        self.plugins += self._get_local_plugins() 
    293303        self.plugins += self._find_plugins() 
    294         ## List of panels 
     304        # List of panels 
    295305        self.panels = {} 
    296306        # List of plot panels 
     
    304314        self.defaultPanel = None 
    305315        self.welcome_panel_class = None 
    306         #panel on focus 
     316        # panel on focus 
    307317        self.panel_on_focus = None 
    308         #control_panel on focus 
     318        # control_panel on focus 
    309319        self.cpanel_on_focus = None 
    310320 
    311321        self.loader = Loader() 
    312         #data manager 
     322        # data manager 
    313323        self.batch_on = False 
    314324        from sas.sasgui.guiframe.data_manager import DataManager 
    315325        self._data_manager = DataManager() 
    316         self._data_panel = None#DataPanel(parent=self) 
     326        self._data_panel = None  # DataPanel(parent=self) 
    317327        if self.panel_on_focus is not None: 
    318             self._data_panel.set_panel_on_focus(self.panel_on_focus.window_caption) 
     328            self._data_panel.set_panel_on_focus( 
     329                self.panel_on_focus.window_caption) 
    319330        # list of plot panels in schedule to full redraw 
    320331        self.schedule = False 
    321         #self.callback = True 
     332        # self.callback = True 
    322333        self._idle_count = 0 
    323334        self.schedule_full_draw_list = [] 
     
    333344        # Register to status events 
    334345        self.Bind(EVT_STATUS, self._on_status_event) 
    335         #Register add extra data on the same panel event on load 
     346        # Register add extra data on the same panel event on load 
    336347        self.Bind(EVT_PANEL_ON_FOCUS, self.set_panel_on_focus) 
    337348        self.Bind(EVT_APPEND_BOOKMARK, self.append_bookmark) 
     
    373384        # Adjust toolbar height 
    374385        toolbar = self.GetToolBar() 
    375         if toolbar != None: 
     386        if toolbar is not None: 
    376387            _, tb_h = toolbar.GetSizeTuple() 
    377388            height -= tb_h 
     
    386397                    fitpanel = item.fit_panel 
    387398 
    388         if fitpanel != None: 
     399        if fitpanel is not None: 
    389400            for i in range(0, fitpanel.GetPageCount()): 
    390401                fitpanel.GetPage(i)._populate_listbox() 
     
    413424        """ 
    414425        Display value of data into the application grid 
    415         :param data: dictionary of string and list of items 
     426        :param data_inputs: dictionary of string and list of items 
     427        :param details: descriptive string 
     428        :param file_name: file name 
     429        :param data_outputs: Data outputs 
    416430        """ 
    417431        self.batch_frame.set_data(data_inputs=data_inputs, 
     
    427441        """ 
    428442        path = None 
    429         if self._default_save_location == None: 
     443        if self._default_save_location is None: 
    430444            self._default_save_location = os.getcwd() 
    431445        wildcard = "(*.csv; *.txt)|*.csv; *.txt" 
     
    469483            line.strip() 
    470484            count = 0 
    471             if separator == None: 
     485            if separator is None: 
    472486                line.replace('\t', ' ') 
    473                 #found the first line containing the label 
     487                # found the first line containing the label 
    474488                col_name_toks = line.split() 
    475489                for item in col_name_toks: 
     
    480494            elif line.find(separator) != -1: 
    481495                if line.count(separator) >= 2: 
    482                     #found the first line containing the label 
     496                    # found the first line containing the label 
    483497                    col_name_toks = line.split(separator) 
    484498                    for item in col_name_toks: 
     
    534548            separator = "," 
    535549        fd.write(str(details)) 
    536         for col_name  in data.keys(): 
     550        for col_name in data.keys(): 
    537551            fd.write(str(col_name)) 
    538552            fd.write(separator) 
     
    597611        Set up custom configuration if exists 
    598612        """ 
    599         if custom_config == None: 
     613        if custom_config is None: 
    600614            return 
    601615 
     
    617631        Set default starting perspective 
    618632        """ 
    619         if custom_config == None: 
     633        if custom_config is None: 
    620634            return 
    621635        for plugin in self.plugins: 
     
    626640                    frame = plugin.get_frame() 
    627641                    frame.Show(True) 
    628                     #break 
     642                    # break 
    629643                else: 
    630644                    frame = plugin.get_frame() 
     
    677691        update edit menu if available 
    678692        """ 
    679         if event != None: 
     693        if event is not None: 
    680694            self.panel_on_focus = event.panel 
    681695        if self.panel_on_focus is not None: 
    682             #Disable save application if the current panel is in batch mode 
    683             flag = self.panel_on_focus.get_save_flag() 
    684             if self._save_appl_menu != None: 
    685                 self._save_appl_menu.Enable(flag) 
    686  
    687             if self.panel_on_focus not in self.plot_panels.values(): 
    688                 for ID in self.panels.keys(): 
    689                     if self.panel_on_focus != self.panels[ID]: 
    690                         self.panels[ID].on_kill_focus(None) 
    691  
    692             if self._data_panel is not None and \ 
    693                             self.panel_on_focus is not None: 
    694                 self.set_panel_on_focus_helper() 
    695                 #update toolbar 
    696                 self._update_toolbar_helper() 
    697                 #update edit menu 
    698                 self.enable_edit_menu() 
     696            # Disable save application if the current panel is in batch mode 
     697            try: 
     698                flag = self.panel_on_focus.get_save_flag() 
     699                if self._save_appl_menu is not None: 
     700                    self._save_appl_menu.Enable(flag) 
     701 
     702                if self.panel_on_focus not in self.plot_panels.values(): 
     703                    for ID in self.panels.keys(): 
     704                        if self.panel_on_focus != self.panels[ID]: 
     705                            self.panels[ID].on_kill_focus(None) 
     706 
     707                if self._data_panel is not None and \ 
     708                                self.panel_on_focus is not None: 
     709                    self.set_panel_on_focus_helper() 
     710                    # update toolbar 
     711                    self._update_toolbar_helper() 
     712                    # update edit menu 
     713                    self.enable_edit_menu() 
     714            except wx._core.PyDeadObjectError: 
     715                pass 
    699716 
    700717    def disable_app_menu(self, p_panel=None): 
     
    708725        Send focusing on ID to data explorer 
    709726        """ 
    710         if self._data_panel != None: 
     727        if self._data_panel is not None: 
    711728            self._data_panel.set_panel_on_focus(name) 
    712729 
     
    717734        caption = self.panel_on_focus.window_caption 
    718735        self.send_focus_to_datapanel(caption) 
    719         #update combo 
     736        # update combo 
    720737        if self.panel_on_focus in self.plot_panels.values(): 
    721738            combo = self._data_panel.cb_plotpanel 
     
    736753        """ 
    737754        cpanel = panel 
    738         if self._toolbar != None and cpanel._bookmark_flag: 
    739             for item in  self._toolbar.get_bookmark_items(): 
     755        if self._toolbar is not None and cpanel._bookmark_flag: 
     756            for item in self._toolbar.get_bookmark_items(): 
    740757                self._toolbar.remove_bookmark_item(item) 
    741758            self._toolbar.add_bookmark_default() 
     
    838855        field = self.sb.get_msg_position() 
    839856        wx.Frame.PushStatusText(self, field=field, 
    840                                 string="FIXME - PushStatusText called without text") 
     857                                string= 
     858                                "FIXME - PushStatusText called without text") 
    841859 
    842860    def add_perspective(self, plugin): 
     
    863881        """ 
    864882        plugins = [] 
    865         #import guiframe local plugins 
    866         #check if the style contain guiframe.dataloader 
     883        # import guiframe local plugins 
     884        # check if the style contain guiframe.dataloader 
    867885        style1 = self.__gui_style & GUIFRAME.DATALOADER_ON 
    868886        style2 = self.__gui_style & GUIFRAME.PLOTTING_ON 
    869887        if style1 == GUIFRAME.DATALOADER_ON: 
    870888            try: 
    871                 from sas.sasgui.guiframe.local_perspectives.data_loader import data_loader 
     889                from sas.sasgui.guiframe.local_perspectives.data_loader \ 
     890                    import data_loader 
    872891                self._data_plugin = data_loader.Plugin() 
    873892                plugins.append(self._data_plugin) 
     
    878897        if style2 == GUIFRAME.PLOTTING_ON: 
    879898            try: 
    880                 from sas.sasgui.guiframe.local_perspectives.plotting import plotting 
     899                from sas.sasgui.guiframe.local_perspectives.plotting \ 
     900                    import plotting 
    881901                self._plotting_plugin = plotting.Plugin() 
    882902                plugins.append(self._plotting_plugin) 
     
    904924            else: 
    905925                file_list = [] 
    906             ## the default panel is the panel is the last plugin added 
     926            # the default panel is the panel is the last plugin added 
    907927            for item in file_list: 
    908928                toks = os.path.splitext(os.path.basename(item)) 
     
    911931                    if toks[1] == '.py' or toks[1] == '': 
    912932                        name = toks[0] 
    913                     #check the validity of the module name parsed 
    914                     #before trying to import it 
     933                    # check the validity of the module name parsed 
     934                    # before trying to import it 
    915935                    if name is None or name.strip() == '': 
    916936                        continue 
     
    938958                        logging.error(msg) 
    939959                    finally: 
    940                         if not file == None: 
     960                        if file is not None: 
    941961                            file.close() 
    942962        except: 
     
    953973        """ 
    954974        self._window_width, self._window_height = self.get_client_size() 
    955         ## Default size 
     975        # Default size 
    956976        if DATAPANEL_WIDTH < 0: 
    957977            panel_width = int(self._window_width * 0.25) 
     
    959979            panel_width = DATAPANEL_WIDTH 
    960980        panel_height = int(self._window_height) 
    961         if self._data_panel is not None  and (p == self._data_panel): 
     981        if self._data_panel is not None and (p == self._data_panel): 
    962982            return panel_width, panel_height 
    963983        if hasattr(p, "CENTER_PANE") and p.CENTER_PANE: 
     
    9911011        if self.welcome_panel_class is not None: 
    9921012            welcome_panel = MDIFrame(self, None, 'None', (100, 200)) 
    993             self.defaultPanel = self.welcome_panel_class(welcome_panel, -1, style=wx.RAISED_BORDER) 
     1013            self.defaultPanel = self.welcome_panel_class(welcome_panel, -1, 
     1014                                                         style=wx.RAISED_BORDER) 
    9941015            welcome_panel.set_panel(self.defaultPanel) 
    9951016            self.defaultPanel.set_frame(welcome_panel) 
     
    10071028                frame.SetPosition((0, mac_pos_y + size_t_bar)) 
    10081029            frame.Show(True) 
    1009         #add data panel 
     1030        # add data panel 
    10101031        win = MDIFrame(self, None, 'None', (100, 200)) 
    10111032        data_panel = DataPanel(parent=win, id=-1) 
     
    10151036        d_panel_width, h = self._get_panels_size(self._data_panel) 
    10161037        win.SetSize((d_panel_width, h)) 
    1017         is_visible = self.__gui_style & GUIFRAME.MANAGER_ON == GUIFRAME.MANAGER_ON 
     1038        is_visible = self.__gui_style & \ 
     1039                     GUIFRAME.MANAGER_ON == GUIFRAME.MANAGER_ON 
    10181040        if IS_WIN: 
    10191041            win.SetPosition((0, 0)) 
     
    10611083        Update the data. 
    10621084        """ 
    1063         prev_id, data_state = self._data_manager.update_data( \ 
     1085        prev_id, data_state = self._data_manager.update_data( 
    10641086                              prev_data=prev_data, new_data=new_data) 
    10651087 
     
    11121134        self._current_perspective.delete_data(data) 
    11131135 
    1114  
    11151136    def get_context_menu(self, plotpanel=None): 
    11161137        """ 
     
    11361157        menu_list = [] 
    11371158        item = self._current_perspective 
    1138         if item != None: 
     1159        if item is not None: 
    11391160            menu_list.extend(item.get_context_menu(plotpanel=plotpanel)) 
    11401161        return menu_list 
     
    11521173                self.delete_panel(ID) 
    11531174                break 
    1154         self.cpanel_on_focus.SetFocus() 
    1155  
     1175        if self.cpanel_on_focus is not None: 
     1176            self.cpanel_on_focus.SetFocus() 
    11561177 
    11571178    def popup_panel(self, p): 
     
    11661187        ID = wx.NewId() 
    11671188        self.panels[str(ID)] = p 
    1168         ## Check and set the size 
     1189        # Check and set the size 
    11691190        if PLOPANEL_WIDTH < 0: 
    11701191            p_panel_width = int(self._window_width * 0.45) 
     
    12051226        # Register for showing/hiding the panel 
    12061227        wx.EVT_MENU(self, ID, self.on_view) 
    1207         if p not in self.plot_panels.values() and p.group_id != None: 
     1228        if p not in self.plot_panels.values() and p.group_id is not None: 
    12081229            self.plot_panels[ID] = p 
    12091230            if len(self.plot_panels) == 1: 
     
    12111232                self.set_panel_on_focus(None) 
    12121233            if self._data_panel is not None and \ 
    1213                 self._plotting_plugin is not None: 
     1234                            self._plotting_plugin is not None: 
    12141235                ind = self