Index: .gitignore
===================================================================
--- .gitignore	(revision aaad4c950340dd661ea6ea88902bb2c1a895de57)
+++ .gitignore	(revision ecdd1329f3d08a5aa572dbfe37b8bff1e161f9d3)
@@ -58,4 +58,5 @@
 /test/sasdataloader/test/isis_1_1_write_test.xml
 /test/sasdataloader/test/write_test.xml
+/test/fileconverter/test/export2d.h5
 test*log
 
Index: Vagrantfile
===================================================================
--- Vagrantfile	(revision 601b93d4f5d0df9b804d41b2f5cd81359a7dd583)
+++ Vagrantfile	(revision 0657b10d26d720ba2d37ccc2fd170a453a83b49d)
@@ -2,8 +2,8 @@
 # vi: set ft=ruby :
 
-# This allows you to build sasview using vagrant 
+# This allows you to build sasview using vagrant
 # for the moment you can build Ubuntu on any platform supported by vagrant
 # (Linux, Mac, Windows)
-# You will need VirtualBox as well. 
+# You will need VirtualBox as well.
 # Download pages:
 # http://www.vagrantup.com/downloads
@@ -21,5 +21,5 @@
   # Every Vagrant development environment requires a box. You can search for
   # boxes at https://atlas.hashicorp.com/search.
-  config.vm.box = "ubuntu/trusty64"
+  config.vm.box = "ubuntu/xenial64"
   #config.vm.box = "fedora19"
   #config.vm.box_url = "https://dl.dropboxusercontent.com/u/86066173/fedora-19.box"
@@ -40,4 +40,8 @@
   end
   #
+  config.vm.synced_folder ".", "/vagrant", disabled: true
+  config.vm.synced_folder ".", "/sasview-docs-test/sasview", disabled: false
+  config.vm.synced_folder "../sasmodels", "/sasview-docs-test/sasmodels", disabled: false
+
   config.vm.provision :shell, :path => "Vagrantprovision.sh"
 end
Index: Vagrantprovision.sh
===================================================================
--- Vagrantprovision.sh	(revision 795ea6a20bf45d14eaee0e6d2129d2019ac16563)
+++ Vagrantprovision.sh	(revision 0657b10d26d720ba2d37ccc2fd170a453a83b49d)
@@ -7,5 +7,5 @@
 pip install bumps comtypes periodictable 
 
-cat >> ~vagrant/.bashrc <<EOF
+cat >> ~/.bashrc <<EOF
 export LANG=en_US.UTF-8
 export LC_ALL=en_US.UTF-8
Index: docs/sphinx-docs/build_sphinx.py
===================================================================
--- docs/sphinx-docs/build_sphinx.py	(revision 751f4bdb1383a4267910b9a189f51206749158e0)
+++ docs/sphinx-docs/build_sphinx.py	(revision 01f1e174e9a9bcc2a3ecebc3d6448a75d9028016)
@@ -6,4 +6,6 @@
 http://sphinx-doc.org/invocation.html
 """
+from __future__ import print_function
+
 import subprocess
 import os
@@ -12,6 +14,6 @@
 import shutil
 import imp
+
 from glob import glob
-
 from distutils.dir_util import copy_tree
 from distutils.util import get_platform
@@ -55,19 +57,4 @@
 SASMODELS_DEST_BUILDIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "models", "img")
 
-#if os.path.exists(SASMODELS_SOURCE_PROLOG):
-#    print "Found models prolog folder at ", SASMODELS_SOURCE_PROLOG
-#if os.path.exists(SASMODELS_SOURCE_REF_MODELS):
-#    print "Found models ref folder at ", SASMODELS_SOURCE_REF_MODELS
-#if os.path.exists(SASMODELS_SOURCE_MODELS):
-#    print "Found models folder at ", SASMODELS_SOURCE_MODELS
-#if os.path.exists(SASMODELS_SOURCE_IMG):
-#    print "Found img folder at ", SASMODELS_SOURCE_IMG
-#if os.path.exists(SASMODELS_DEST_REF_MODELS):
-#    print "Found models ref folder at ", SASMODELS_DEST_REF_MODELS
-#if os.path.exists(SASMODELS_DEST_MODELS):
-#    print "Found models folder at ", SASMODELS_DEST_MODELS
-#if os.path.exists(SASMODELS_DEST_IMG):
-#    print "Found img folder at ", SASMODELS_DEST_IMG
-#sys.exit()
 
 SPHINX_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build")
@@ -88,5 +75,5 @@
         s=open(filename).read()
         if old_string in s:
-                print 'Changing "{old_string}" to "{new_string}"'.format(**locals())
+                print('Changing "{old_string}" to "{new_string}"'.format(**locals()))
                 s=s.replace(old_string, new_string)
                 f=open(filename, 'w')
@@ -95,10 +82,10 @@
                 f.close()
         else:
-                print 'No occurences of "{old_string}" found.'.format(**locals())
+                print('No occurences of "{old_string}" found.'.format(**locals()))
 
 def _remove_dir(dir_path):
     """Removes the given directory."""
     if os.path.isdir(dir_path):
-        print "Removing \"%s\"... " % dir_path
+        print("Removing \"%s\"... " % dir_path)
         shutil.rmtree(dir_path)
 
@@ -107,5 +94,5 @@
     Clean the sphinx build directory.
     """
-    print "=== Cleaning Sphinx Build ==="
+    print("=== Cleaning Sphinx Build ===")
     _remove_dir(SASVIEW_DOCS)
     _remove_dir(SPHINX_BUILD)
@@ -120,7 +107,7 @@
     Copy the source toctrees to new folder for assembling the sphinx-docs
     """
-    print "=== Copying Source toctrees ==="
+    print("=== Copying Source toctrees ===")
     if os.path.exists(SASVIEW_TOC_SOURCE):
-       print "Found docs folder at ", SASVIEW_TOC_SOURCE
+       print("Found docs folder at", SASVIEW_TOC_SOURCE)
        shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE)
 
@@ -141,5 +128,5 @@
     so that Sphinx may pick it up when generating the documentation.
     """
-    print "=== Retrieve User Docs ==="
+    print("=== Retrieve User Docs ===")
 
     # Copy documentation files from their "source" to their "destination".
@@ -148,5 +135,5 @@
 
             docs = os.path.abspath(os.path.join(root, dirname))
-            print "Found docs folder at \"%s\"." % docs
+            print("Found docs folder at \"%s\"." % docs)
 
             dest_dir_part = os.path.dirname(os.path.relpath(docs, SASVIEW_SRC))
@@ -158,47 +145,48 @@
 
     # Now pickup testdata_help.rst
-#    print os.path.abspath(SASVIEW_TEST)
-#    print os.path.abspath(SPHINX_SOURCE_TEST)
-    print "=== Including Test Data Docs ==="
+    print("=== Including Test Data Docs ===")
     if os.path.exists(SASVIEW_TEST):
-       print "Found docs folder at ", SASVIEW_TEST
+       print("Found docs folder at", SASVIEW_TEST)
        shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST)
 
-    print "=== And the Sasmodels Docs ==="
+    print("=== And the Sasmodels Docs ===")
     # Make sure we have the relevant images for the new sasmodels documentation
     # First(!) we'll make a local reference copy for SasView (/new-models will be cleaned each build)
     if os.path.exists(SASMODELS_SOURCE_IMG):
-        print "Found img  folder SASMODELS_SOURCE_IMG    at ", SASMODELS_SOURCE_IMG
+        print("Found img folder SASMODELS_SOURCE_IMG at", SASMODELS_SOURCE_IMG)
         if not os.path.exists(SASMODELS_DEST_IMG):
-            print "Missing docs folder SASMODELS_DEST_IMG at ", SASMODELS_DEST_IMG
+            print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG)
             os.makedirs(SASMODELS_DEST_IMG)
-            print "created SASMODELS_DEST_BUILDIMG at ", SASMODELS_DEST_BUILDIMG
-        else: print "Found img  folder SASMODELS_DEST_IMG      at ", SASMODELS_DEST_IMG
-        print "Copying sasmodels model image files..."
+            print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG)
+        else:
+            print("Found img folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG)
+        print("Copying sasmodels model image files...")
         for files in os.listdir(SASMODELS_SOURCE_IMG):
             fromhere=os.path.join(SASMODELS_SOURCE_IMG,files)
             tohere=os.path.join(SASMODELS_DEST_IMG,files)
             shutil.copy(fromhere,tohere)
-    else: print "cannot find SASMODELS_SOURCE_IMG", SASMODELS_SOURCE_IMG
+    else:
+        print("no source directory",SASMODELS_SOURCE_IMG,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_AUTOIMG):
-        print "Found img  folder SASMODELS_SOURCE_AUTOIMG    at ", SASMODELS_SOURCE_AUTOIMG
+        print("Found img folder SASMODELS_SOURCE_AUTOIMG at", SASMODELS_SOURCE_AUTOIMG)
         if not os.path.exists(SASMODELS_DEST_IMG):
-            print "Missing docs folder SASMODELS_DEST_IMG at ", SASMODELS_DEST_IMG
+            print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG)
             os.makedirs(SASMODELS_DEST_BUILDIMG)
-            print "created SASMODELS_DEST_BUILDIMG at ", SASMODELS_DEST_BUILDIMG
-        print "Copying sasmodels model auto-generated image files..."
+            print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG)
+        print("Copying sasmodels model auto-generated image files...")
         for files in os.listdir(SASMODELS_SOURCE_AUTOIMG):
             fromhere=os.path.join(SASMODELS_SOURCE_AUTOIMG,files)
             tohere=os.path.join(SASMODELS_DEST_IMG,files)
             shutil.copy(fromhere,tohere)
-    else: print "no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found"
+    else:
+        print("no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found")
 
     # And the rst prolog with the unit substitutions
     if os.path.exists(SASMODELS_SOURCE_PROLOG):
-        print "Found prolog folder SASMODELS_SOURCE_PROLOG at ", SASMODELS_SOURCE_PROLOG
+        print("Found prolog folder SASMODELS_SOURCE_PROLOG at", SASMODELS_SOURCE_PROLOG)
         if os.path.exists(SASMODELS_DEST_PROLOG):
-            print "Found docs folder SASMODELS_DEST_PROLOG   at ", SASMODELS_DEST_PROLOG
-            print "Copying sasmodels rst_prolog file..."
+            print("Found docs folder SASMODELS_DEST_PROLOG at", SASMODELS_DEST_PROLOG)
+            print("Copying sasmodels rst_prolog file...")
             for files in os.listdir(SASMODELS_SOURCE_PROLOG):
                 if files.startswith("rst"):
@@ -206,10 +194,12 @@
                     tohere=os.path.join(SASMODELS_DEST_PROLOG,files)
                     shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_PROLOG, "was found")
 
     if os.path.exists(SASMODELS_SOURCE_GPU):
-        print "Found docs folder SASMODELS_SOURCE_GPU at ", SASMODELS_SOURCE_GPU
+        print("Found docs folder SASMODELS_SOURCE_GPU at", SASMODELS_SOURCE_GPU)
         if os.path.exists(SPHINX_SOURCE_USER):
-            print "Found docs folder SPHINX_SOURCE_USER      at ", SPHINX_SOURCE_USER
-            print "Copying sasmodels gpu files..."
+            print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER)
+            print("Copying sasmodels gpu files...")
             for files in os.listdir(SASMODELS_SOURCE_GPU):
                 if files.endswith(".rst"):
@@ -217,10 +207,12 @@
                     tohere=os.path.join(SPHINX_SOURCE_USER,files)
                     shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_GPU,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_SESANS):
-        print "Found docs folder SASMODELS_SOURCE_SESANS at ", SASMODELS_SOURCE_SESANS
+        print("Found docs folder SASMODELS_SOURCE_SESANS at", SASMODELS_SOURCE_SESANS)
         if os.path.exists(SPHINX_SOURCE_USER):
-            print "Found docs folder SPHINX_SOURCE_USER      at ", SPHINX_SOURCE_USER
-            print "Copying sasmodels sesans files..."
+            print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER)
+            print("Copying sasmodels sesans files...")
             for files in os.listdir(SASMODELS_SOURCE_SESANS):
                 if files.endswith(".rst"):
@@ -228,10 +220,12 @@
                     tohere=os.path.join(SPHINX_SOURCE_USER,files)
                     shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_SESANS,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_MAGNETISM):
-        print "Found docs folder SASMODELS_SOURCE_MAGNETISM at ", SASMODELS_SOURCE_MAGNETISM
+        print("Found docs folder SASMODELS_SOURCE_MAGNETISM at", SASMODELS_SOURCE_MAGNETISM)
         if os.path.exists(SASMODELS_DEST_REF_MODELS):
-            print "Found docs folder SASMODELS_DEST_REF_MODELS   at ", SASMODELS_DEST_REF_MODELS
-            print "Copying sasmodels model toctree files..."
+            print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS)
+            print("Copying sasmodels model toctree files...")
             for files in os.listdir(SASMODELS_SOURCE_MAGNETISM):
                 if files.endswith(".rst"):
@@ -239,36 +233,40 @@
                     tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files)
                     shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_MAGNETISM,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_MAGIMG):
-        print "Found img folder SASMODELS_SOURCE_MAGIMG   at ", SASMODELS_SOURCE_MAGIMG
+        print("Found img folder SASMODELS_SOURCE_MAGIMG   at", SASMODELS_SOURCE_MAGIMG)
         if not os.path.exists(SASMODELS_DEST_MAGIMG):
-            print "Missing img folder SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG
+            print("Missing img folder SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG)
             os.makedirs(SASMODELS_DEST_MAGIMG)
-            print "created SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG
-        print "Copying sasmodels mag image files..."
+            print("created SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG)
+        print("Copying sasmodels mag image files...")
         for files in os.listdir(SASMODELS_SOURCE_MAGIMG):
             fromhere=os.path.join(SASMODELS_SOURCE_MAGIMG,files)
             tohere=os.path.join(SASMODELS_DEST_MAGIMG,files)
             shutil.copy(fromhere,tohere)
-    else: print "no source directory",SASMODELS_SOURCE_MAGIMG ,"was found"
+    else:
+        print("no source directory",SASMODELS_SOURCE_MAGIMG ,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_SESANSIMG):
-        print "Found img folder SASMODELS_SOURCE_SESANSIMG   at ", SASMODELS_SOURCE_SESANSIMG
+        print("Found img folder SASMODELS_SOURCE_SESANSIMG at", SASMODELS_SOURCE_SESANSIMG)
         if not os.path.exists(SASMODELS_DEST_SESANSIMG):
-            print "Missing img folder SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG
+            print("Missing img folder SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG)
             os.makedirs(SASMODELS_DEST_SESANSIMG)
-            print "created SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG
-        print "Copying sasmodels sesans image files..."
+            print("created SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG)
+        print("Copying sasmodels sesans image files...")
         for files in os.listdir(SASMODELS_SOURCE_SESANSIMG):
             fromhere=os.path.join(SASMODELS_SOURCE_SESANSIMG,files)
             tohere=os.path.join(SASMODELS_DEST_SESANSIMG,files)
             shutil.copy(fromhere,tohere)
-    else: print "no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found"
+    else:
+        print("no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_REF_MODELS):
-        print "Found docs folder SASMODELS_SOURCE_REF_MODELS at ", SASMODELS_SOURCE_REF_MODELS
+        print("Found docs folder SASMODELS_SOURCE_REF_MODELS at", SASMODELS_SOURCE_REF_MODELS)
         if os.path.exists(SASMODELS_DEST_REF_MODELS):
-            print "Found docs folder SASMODELS_DEST_REF_MODELS   at ", SASMODELS_DEST_REF_MODELS
-            print "Copying sasmodels model toctree files..."
+            print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS)
+            print("Copying sasmodels model toctree files...")
             for files in os.listdir(SASMODELS_SOURCE_REF_MODELS):
                 if files.endswith(".rst"):
@@ -276,25 +274,27 @@
                     tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files)
                     shutil.copy(fromhere,tohere)
-    # But need to change the path to the model docs in the tocs
-    for files in os.listdir(SASMODELS_DEST_REF_MODELS):
-#        print files
-        if files.startswith("shape"):
-            print "Changing toc paths in", files
-            inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
-        if files.startswith("sphere"):
-            print "Changing toc paths in", files
-            inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
-        if files.startswith("custom"):
-            print "Changing toc paths in", files
-            inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
-        if files.startswith("structure"):
-            print "Changing toc paths in", files
-            inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
+            # But need to change the path to the model docs in the tocs
+            for files in os.listdir(SASMODELS_DEST_REF_MODELS):
+        #        print files
+                if files.startswith("shape"):
+                    print("Changing toc paths in", files)
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
+                if files.startswith("sphere"):
+                    print("Changing toc paths in", files)
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
+                if files.startswith("custom"):
+                    print("Changing toc paths in", files)
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
+                if files.startswith("structure"):
+                    print("Changing toc paths in", files)
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
+    else:
+        print("no source directory",SASMODELS_SOURCE_REF_MODELS," was found")
 
     if os.path.exists(SASMODELS_SOURCE_MODELS):
-        print "Found docs folder SASMODELS_SOURCE_MODELS at ", SASMODELS_SOURCE_MODELS
+        print("Found docs folder SASMODELS_SOURCE_MODELS at", SASMODELS_SOURCE_MODELS)
         if os.path.exists(SASMODELS_DEST_MODELS):
-            print "Found docs folder SASMODELS_DEST_MODELS   at ", SASMODELS_DEST_MODELS
-            print "Copying sasmodels model files..."
+            print("Found docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
+            print("Copying sasmodels model files...")
             for files in os.listdir(SASMODELS_SOURCE_MODELS):
                 if files.endswith(".rst"):
@@ -303,10 +303,10 @@
                     shutil.copy(fromhere,tohere)
         else:
-            print "Missing docs folder SASMODELS_DEST_MODELS at ", SASMODELS_DEST_MODELS
+            print("Missing docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
             os.makedirs(SASMODELS_DEST_MODELS)
             if not os.path.exists(SASMODELS_DEST_BUILDIMG):
                 os.makedirs(SASMODELS_DEST_BUILDIMG)
-            print "Created docs folder SASMODELS_DEST_MODELS at ", SASMODELS_DEST_MODELS
-            print "Copying model files for build..."
+            print("Created docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
+            print("Copying model files for build...")
             for files in os.listdir(SASMODELS_SOURCE_MODELS):
                 if files.endswith(".rst"):
@@ -315,9 +315,12 @@
                     shutil.copy(fromhere,tohere)
             # No choice but to do this because model files are all coded for images in /models/img
-            print "Copying image files for build..."
+            print("Copying image files for build...")
             for files in os.listdir(SASMODELS_DEST_IMG):
                 fromhere=os.path.join(SASMODELS_DEST_IMG,files)
                 tohere=os.path.join(SASMODELS_DEST_BUILDIMG,files)
                 shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_MODELS,"was found.")
+        print("!!!!NO MODEL DOCS WILL BE BUILT!!!!")
 
 
@@ -327,19 +330,18 @@
     """
     if os.path.exists(BUMPS_DOCS):
-        print "=== Retrieve BUMPS Docs ==="
+        print("=== Retrieve BUMPS Docs ===")
         filenames = [os.path.join(BUMPS_DOCS, "optimizer.rst")]
         filenames += glob(os.path.join(BUMPS_DOCS, "dream-*.png"))
         filenames += glob(os.path.join(BUMPS_DOCS, "fit-*.png"))
         for f in filenames:
-            print "Copying file", f
+            print("Copying file", f)
             shutil.copy(f, BUMPS_TARGET)
     else:
-        print """
-*** Error *** missing directory %s
+        print("""
+======= Error =======
+missing directory %s
 The documentation will not include the optimizer selection section.
 Checkout the bumps source tree and rebuild the docs.
-
-
-""" % BUMPS_DOCS
+""" % BUMPS_DOCS)
 
 def apidoc():
@@ -348,5 +350,5 @@
     in the SasView build directory.
     """
-    print "=== Generate API Rest Files ==="
+    print("=== Generate API Rest Files ===")
 
     # Clean directory before generating a new version.
@@ -362,5 +364,5 @@
     Runs sphinx-build.  Reads in all .rst files and spits out the final html.
     """
-    print "=== Build HTML Docs from Rest Files ==="
+    print("=== Build HTML Docs from Rest Files ===")
     subprocess.call(["sphinx-build",
                      "-b", "html", # Builder name. TODO: accept as arg to setup.py.
@@ -369,5 +371,5 @@
                      os.path.join(SPHINX_BUILD, "html")])
 
-    print "=== Copy HTML Docs to Build Directory ==="
+    print("=== Copy HTML Docs to Build Directory ===")
     html = os.path.join(SPHINX_BUILD, "html")
     copy_tree(html, SASVIEW_DOCS)
@@ -381,5 +383,5 @@
     build()
 
-    print "=== Done ==="
+    print("=== Done ===")
 
 if __name__ == "__main__":
Index: docs/sphinx-docs/source/user/tutorial.rst
===================================================================
--- docs/sphinx-docs/source/user/tutorial.rst	(revision 959eb0181ad06828a748f04512f953aad5b31659)
+++ docs/sphinx-docs/source/user/tutorial.rst	(revision 461a917085638bceaabfa22752ae08830bd03274)
@@ -3,8 +3,10 @@
 .. _tutorial:
 
-Tutorial
-========
+Tutorials
+=========
 
 .. note:: In Windows use [Alt]-[Cursor left] to return to the previous page
 
-:download:`Tutorial <../../../../sasview/media/Tutorial.pdf>`
+:download:`Getting Started with Sasview <../../../../sasview/media/getting_started_with_sasview.pdf>`
+
+:download:`Old Tutorial <../../../../sasview/media/Tutorial.pdf>`
Index: docs/sphinx-docs/source/user/working.rst
===================================================================
--- docs/sphinx-docs/source/user/working.rst	(revision 959eb0181ad06828a748f04512f953aad5b31659)
+++ docs/sphinx-docs/source/user/working.rst	(revision 8cc39d692a9ec93915b6320953059d50e5afbd77)
@@ -15,5 +15,5 @@
    Test Data <../test/testdata_help.rst>
       
-   Tutorial <tutorial.rst>
+   Tutorials <tutorial.rst>
    
    Writing a Plugin Model <sasgui/perspectives/fitting/plugin.rst>
Index: run.py
===================================================================
--- run.py	(revision 64ca561b6b264f63b4d7d09a6582f1f3330ae720)
+++ run.py	(revision f36e01fa1b9b521d3f7496b637e33bed18626df2)
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
 #!/usr/bin/env python
+
 """
 Run sasview in place.  This allows sasview to use the python
@@ -14,27 +16,12 @@
 """
 
+import imp
 import os
 import sys
-import imp
-import logging
-import logging.config
-
 from contextlib import contextmanager
-from os.path import abspath, dirname, join as joinpath
+from os.path import join as joinpath
+from os.path import abspath, dirname
 
 
-LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sasview/logging.ini')
-logging.config.fileConfig(LOGGER_CONFIG_FILE, disable_existing_loggers=True)
-logger = logging.getLogger(__name__)
-
-def update_all_logs_to_debug(logger):
-    '''
-    This updates all loggers and respective handlers to DEBUG
-    '''
-    for handler in logger.handlers or logger.parent.handlers:
-        handler.setLevel(logging.DEBUG)
-    for name,_ in logging.Logger.manager.loggerDict.items():
-        logging.getLogger(name).setLevel(logging.DEBUG)
-        
 def addpath(path):
     """
@@ -50,4 +37,5 @@
     sys.path.insert(0, path)
 
+
 @contextmanager
 def cd(path):
@@ -60,10 +48,12 @@
     os.chdir(old_dir)
 
+
 def import_package(modname, path):
     """Import a package into a particular point in the python namespace"""
-    mod = imp.load_source(modname, abspath(joinpath(path,'__init__.py')))
+    mod = imp.load_source(modname, abspath(joinpath(path, '__init__.py')))
     sys.modules[modname] = mod
     mod.__path__ = [abspath(path)]
     return mod
+
 
 def import_dll(modname, build_path):
@@ -72,7 +62,8 @@
     ext = sysconfig.get_config_var('SO')
     # build_path comes from context
-    path = joinpath(build_path, *modname.split('.'))+ext
-    #print "importing", modname, "from", path
+    path = joinpath(build_path, *modname.split('.')) + ext
+    # print "importing", modname, "from", path
     return imp.load_dynamic(modname, path)
+
 
 def prepare():
@@ -86,6 +77,6 @@
     from distutils.util import get_platform
     root = abspath(dirname(__file__))
-    platform = '%s-%s'%(get_platform(),sys.version[:3])
-    build_path = joinpath(root, 'build','lib.'+platform)
+    platform = '%s-%s' % (get_platform(), sys.version[:3])
+    build_path = joinpath(root, 'build', 'lib.' + platform)
 
     # Notify the help menu that the Sphinx documentation is in a different
@@ -98,13 +89,17 @@
     #if not os.path.exists(mplconfig): os.mkdir(mplconfig)
     #import matplotlib
-    #matplotlib.use('Agg')
-    #print matplotlib.__file__
+    # matplotlib.use('Agg')
+    # print matplotlib.__file__
     #import pylab; pylab.hold(False)
     # add periodictable to the path
-    try: import periodictable
-    except: addpath(joinpath(root, '..','periodictable'))
+    try:
+        import periodictable
+    except:
+        addpath(joinpath(root, '..', 'periodictable'))
 
-    try: import bumps
-    except: addpath(joinpath(root, '..','bumps'))
+    try:
+        import bumps
+    except:
+        addpath(joinpath(root, '..', 'bumps'))
 
     # select wx version
@@ -126,5 +121,5 @@
     # be better to just store the package in src/sas/sasview.
     import sas
-    sas.sasview = import_package('sas.sasview', joinpath(root,'sasview'))
+    sas.sasview = import_package('sas.sasview', joinpath(root, 'sasview'))
 
     # The sas.models package Compiled Model files should be pulled in from the build directory even though
@@ -135,5 +130,5 @@
     import sas.sascalc.pr
     sas.sascalc.pr.core = import_package('sas.sascalc.pr.core',
-                                  joinpath(build_path, 'sas', 'sascalc', 'pr', 'core'))
+                                         joinpath(build_path, 'sas', 'sascalc', 'pr', 'core'))
 
     # Compiled modules need to be pulled from the build directory.
@@ -141,5 +136,5 @@
     import sas.sascalc.file_converter
     sas.sascalc.file_converter.core = import_package('sas.sascalc.file_converter.core',
-                                  joinpath(build_path, 'sas', 'sascalc', 'file_converter', 'core'))                    
+                                                     joinpath(build_path, 'sas', 'sascalc', 'file_converter', 'core'))
 
     # Compiled modules need to be pulled from the build directory.
@@ -147,14 +142,22 @@
     import sas.sascalc.calculator
     sas.sascalc.calculator.core = import_package('sas.sascalc.calculator.core',
-                                  joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core'))
+                                                 joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core'))
 
     sys.path.append(build_path)
 
-    #print "\n".join(sys.path)
+    # print "\n".join(sys.path)
+
 
 if __name__ == "__main__":
-    update_all_logs_to_debug(logger)
+    # Need to add absolute path before actual prepare call,
+    # so logging can be done during initialization process too
+    root = abspath(dirname(__file__))
+    addpath(joinpath(root, 'sasview'))
+    from logger_config import SetupLogger
+    logger = SetupLogger(__name__).config_development()
+
+    logger.debug("Starting SASVIEW in debug mode.")
     prepare()
     from sas.sasview.sasview import run
     run()
-    
+    logger.debug("Ending SASVIEW in debug mode.")
Index: sasview/logger_config.py
===================================================================
--- sasview/logger_config.py	(revision f36e01fa1b9b521d3f7496b637e33bed18626df2)
+++ sasview/logger_config.py	(revision f36e01fa1b9b521d3f7496b637e33bed18626df2)
@@ -0,0 +1,83 @@
+from __future__ import print_function
+
+import logging
+import logging.config
+import os
+import os.path
+
+import pkg_resources
+
+
+'''
+Module that manages the global logging
+'''
+
+
+class SetupLogger(object):
+    '''
+    Called at the beginning of run.py or sasview.py
+    '''
+
+    def __init__(self, logger_name):
+        self._find_config_file()
+        self.name = logger_name
+
+    def config_production(self):
+        logger = logging.getLogger(self.name)
+        if not logger.root.handlers:
+            self._read_config_file()
+            logging.captureWarnings(True)
+            logger = logging.getLogger(self.name)
+        return logger
+
+    def config_development(self):
+        '''
+        '''
+        self._read_config_file()
+        logger = logging.getLogger(self.name)
+        self._update_all_logs_to_debug(logger)
+        logging.captureWarnings(True)
+        return logger
+
+    def _read_config_file(self):
+        if self.config_file is not None:
+            logging.config.fileConfig(self.config_file)
+
+    def _update_all_logs_to_debug(self, logger):
+        '''
+        This updates all loggers and respective handlers to DEBUG
+        '''
+        for handler in logger.handlers or logger.parent.handlers:
+            handler.setLevel(logging.DEBUG)
+        for name, _ in logging.Logger.manager.loggerDict.items():
+            logging.getLogger(name).setLevel(logging.DEBUG)
+
+    def _find_config_file(self, filename="logging.ini"):
+        '''
+        The config file is in:
+        Debug ./sasview/
+        Packaging: sas/sasview/
+        Packaging / production does not work well with absolute paths
+        thus the multiple paths below
+        '''
+        places_to_look_for_conf_file = [
+            os.path.join(os.path.abspath(os.path.dirname(__file__)), filename),
+            filename,
+            os.path.join("sas", "sasview", filename),
+            os.path.join(os.getcwd(), "sas", "sasview", filename),
+        ]
+
+        # To avoid the exception in OSx
+        # NotImplementedError: resource_filename() only supported for .egg, not .zip
+        try:
+            places_to_look_for_conf_file.append(
+                pkg_resources.resource_filename(__name__, filename))
+        except NotImplementedError:
+            pass
+
+        for filepath in places_to_look_for_conf_file:
+            if os.path.exists(filepath):
+                self.config_file = filepath
+                return
+        print("ERROR: Logging.ini not found...")
+        self.config_file = None
Index: sasview/logging.ini
===================================================================
--- sasview/logging.ini	(revision 64ca561b6b264f63b4d7d09a6582f1f3330ae720)
+++ sasview/logging.ini	(revision fc22533c01ad2a6c8b1c6b4a0fb67c15c527405d)
@@ -16,5 +16,6 @@
 
 [formatter_detailed]
-format=%(asctime)s:%(name)s:%(levelname)s: %(lineno)d: %(message)s
+#format=%(asctime)s : %(levelname)s : %(name)s: %(lineno)d: %(message)s
+format=%(asctime)s : %(levelname)s : %(name)s (%(filename)s:%(lineno)s) :: %(message)s
 
 ###############################################################################
@@ -27,10 +28,10 @@
 class=logging.StreamHandler
 formatter=simple
-level=INFO
+level=WARNING
 args=tuple()
 
 [handler_log_file]
 class=logging.FileHandler
-level=INFO
+level=DEBUG
 formatter=detailed
 args=(os.path.join(os.path.expanduser("~"),'sasview.log'),"a")
@@ -43,5 +44,5 @@
 
 [logger_root]
-level=INFO
+level=DEBUG
 formatter=default
 handlers=console,log_file
@@ -60,5 +61,5 @@
 
 [logger_sasgui]
-level=INFO
+level=DEBUG
 qualname=sas.sasgui
 handlers=console,log_file
Index: sasview/media/README.txt
===================================================================
--- sasview/media/README.txt	(revision 643dcd93773c48e06cd96864545e5a12a9f775e1)
+++ sasview/media/README.txt	(revision 5fa99237de58afe37b6ac2cfcb48e1b2393a34d7)
@@ -3,2 +3,4 @@
 
 The source files are in: /sasview/docs/sasview
+
+The getting_started_with_sasview.pdf has been manually added here until the auto-generated LibreOffice doc build is up and running.
Index: sasview/sasview.py
===================================================================
--- sasview/sasview.py	(revision 3608cd114aaf5142818c85b33f8f32323c34e481)
+++ sasview/sasview.py	(revision f36e01fa1b9b521d3f7496b637e33bed18626df2)
@@ -1,25 +1,24 @@
+# -*- coding: utf-8 -*-
 """
 Base module for loading and running the main SasView application.
 """
 ################################################################################
-#This software was developed by the University of Tennessee as part of the
-#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-#project funded by the US National Science Foundation.
+# This software was developed by the University of Tennessee as part of the
+# Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+# project funded by the US National Science Foundation.
 #
-#See the license text in license.txt
+# See the license text in license.txt
 #
-#copyright 2009, University of Tennessee
+# copyright 2009, University of Tennessee
 ################################################################################
 import os
+import os.path
 import sys
-import logging
-import logging.config
 import traceback
 
-logger = logging.getLogger(__name__)
-if not logger.root.handlers:
-    LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'logging.ini')
-    logging.config.fileConfig(LOGGER_CONFIG_FILE, disable_existing_loggers=False)
-    logging.captureWarnings(True)
+from sas.sasview.logger_config import SetupLogger
+
+logger = SetupLogger(__name__).config_production()
+
 
 # Log the start of the session
@@ -55,9 +54,9 @@
 import wxcruft
 wxcruft.call_later_fix()
-#wxcruft.trace_new_id()
+# wxcruft.trace_new_id()
 
-#Always use private .matplotlib setup to avoid conflicts with other
-#uses of matplotlib
-#Have to check if .sasview exists first
+# Always use private .matplotlib setup to avoid conflicts with other
+# uses of matplotlib
+# Have to check if .sasview exists first
 sasdir = os.path.join(os.path.expanduser("~"),'.sasview')
 if not os.path.exists(sasdir):
@@ -72,6 +71,5 @@
 from sas.sasgui.guiframe.gui_style import GUIFRAME
 from welcome_panel import WelcomePanel
-# For py2exe, import config here
-import local_config
+
 PLUGIN_MODEL_DIR = 'plugin_models'
 APP_NAME = 'SasView'
@@ -87,5 +85,5 @@
         """
         """
-        #from gui_manager import ViewApp
+        # from gui_manager import ViewApp
         self.gui = gui_manager.SasViewApp(0)
         # Set the application manager for the GUI
@@ -116,5 +114,5 @@
             logger.error(traceback.format_exc())
 
-        #Invariant perspective
+        # Invariant perspective
         try:
             import sas.sasgui.perspectives.invariant as module
@@ -134,5 +132,5 @@
             logger.error("Unable to load corfunc module")
 
-        #Calculator perspective
+        # Calculator perspective
         try:
             import sas.sasgui.perspectives.calculator as module
@@ -153,5 +151,4 @@
                                                         APP_NAME)
             logger.error(traceback.format_exc())
-
 
         # Add welcome page
@@ -174,5 +171,5 @@
     if len(sys.argv) > 1:
         ## Run sasview as an interactive python interpreter
-        #if sys.argv[1] == "-i":
+        # if sys.argv[1] == "-i":
         #    sys.argv = ["ipython", "--pylab"]
         #    from IPython import start_ipython
@@ -188,4 +185,5 @@
         SasView()
 
+
 if __name__ == "__main__":
     run()
Index: sasview/setup_exe.py
===================================================================
--- sasview/setup_exe.py	(revision 8b645cc3cea24d016ee884edc83b7654f8f0470b)
+++ sasview/setup_exe.py	(revision f36e01fa1b9b521d3f7496b637e33bed18626df2)
@@ -62,6 +62,6 @@
         sys.argv.remove('--extrapath')
 except:
-    print "Error processing extra python path needed to build SasView\n  %s" % \
-                sys.exc_value
+    print("Error processing extra python path needed to build SasView\n  %s" % \
+                sys.exc_value)
 
 
@@ -83,12 +83,11 @@
         modulefinder.AddPackagePath(win32_folder, p)
     for extra in ["win32com.shell", "win32com.adsi", "win32com.axcontrol",
-                    "win32com.axscript", "win32com.bits", "win32com.ifilter",
-                    "win32com.internet", "win32com.mapi", "win32com.propsys",
-                    "win32com.taskscheduler"]:
-        
-            __import__(extra)
-            m = sys.modules[extra]
-            for p in m.__path__[1:]:
-                modulefinder.AddPackagePath(extra, p)
+                  "win32com.axscript", "win32com.bits", "win32com.ifilter",
+                  "win32com.internet", "win32com.mapi", "win32com.propsys",
+                  "win32com.taskscheduler"]:
+        __import__(extra)
+        m = sys.modules[extra]
+        for p in m.__path__[1:]:
+            modulefinder.AddPackagePath(extra, p)
 
 except ImportError:
@@ -167,5 +166,5 @@
         self.copyright = "copyright 2009 - 2016"
         self.name = "SasView"
-        
+
 #
 # Adapted from http://www.py2exe.org/index.cgi/MatPlotLib
@@ -236,4 +235,8 @@
     data_files.append(('config', [f]))
 f = 'local_config.py'
+if os.path.isfile(f):
+    data_files.append(('.', [f]))
+
+f = 'logging.ini'
 if os.path.isfile(f):
     data_files.append(('.', [f]))
@@ -337,5 +340,5 @@
     ])
 packages.append('periodictable.core') # not found automatically
-#packages.append('IPython')
+# packages.append('IPython')
 includes = ['site', 'lxml._elementpath', 'lxml.etree']
 
@@ -370,5 +373,5 @@
     other_resources = [(24, 1, manifest)],
     dest_base = "SasView"
-    )
+)
 
 # bundle_option = 2
Index: sasview/setup_mac.py
===================================================================
--- sasview/setup_mac.py	(revision 235f514ba93b57fa63e44309f182acef0b98bb55)
+++ sasview/setup_mac.py	(revision cfa88eef20961bfc7dcff1169b6743d6c13b2451)
@@ -50,4 +50,6 @@
 #CANSAxml reader data files
 RESOURCES_FILES.append(os.path.join(sas.sascalc.dataloader.readers.get_data_path(),'defaults.json'))
+
+DATA_FILES.append('logging.ini')
 
 # Locate libxml2 library
Index: setup.py
===================================================================
--- setup.py	(revision f3bf622b821c651bb6e946100b07e15cd59331fe)
+++ setup.py	(revision 14bb7a4559442ca97cf523eddca7216d6be1e931)
@@ -1,16 +1,23 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+
 """
     Setup for SasView
-    #TODO: Add checks to see that all the dependencies are on the system
+    TODO: Add checks to see that all the dependencies are on the system
 """
+
+import os
+import subprocess
+import shutil
 import sys
-import os
-import shutil
-from setuptools import setup, Extension
 from distutils.command.build_ext import build_ext
 from distutils.core import Command
+
 import numpy as np
+from setuptools import Extension, setup
 
 # Manage version number ######################################
 import sasview
+
 VERSION = sasview.__version__
 ##############################################################
@@ -25,5 +32,5 @@
 # except when there is no such file
 # Todo : make this list generic
-#plugin_model_list = ['polynominal5.py', 'sph_bessel_jn.py',
+# plugin_model_list = ['polynominal5.py', 'sph_bessel_jn.py',
 #                      'sum_Ap1_1_Ap2.py', 'sum_p1_p2.py',
 #                      'testmodel_2.py', 'testmodel.py',
@@ -35,5 +42,5 @@
 SASVIEW_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build")
 
-sas_dir = os.path.join(os.path.expanduser("~"),'.sasview')
+sas_dir = os.path.join(os.path.expanduser("~"), '.sasview')
 if os.path.isdir(sas_dir):
     f_path = os.path.join(sas_dir, "sasview.log")
@@ -47,5 +54,5 @@
         os.remove(f_path)
     #f_path = os.path.join(sas_dir, 'plugin_models')
-    #if os.path.isdir(f_path):
+    # if os.path.isdir(f_path):
     #     for f in os.listdir(f_path):
     #         if f in plugin_model_list:
@@ -53,5 +60,6 @@
     #             os.remove(file_path)
     if os.path.exists(SASVIEW_BUILD):
-        print("Removing existing build directory", SASVIEW_BUILD, "for a clean build")
+        print("Removing existing build directory",
+              SASVIEW_BUILD, "for a clean build")
         shutil.rmtree(SASVIEW_BUILD)
 
@@ -63,5 +71,5 @@
 enable_openmp = False
 
-if sys.platform =='darwin':
+if sys.platform == 'darwin':
     if not is_64bits:
         # Disable OpenMP
@@ -77,23 +85,25 @@
 
 # Options to enable OpenMP
-copt =  {'msvc': ['/openmp'],
-         'mingw32' : ['-fopenmp'],
-         'unix' : ['-fopenmp']}
-lopt =  {'msvc': ['/MANIFEST'],
-         'mingw32' : ['-fopenmp'],
-         'unix' : ['-lgomp']}
+copt = {'msvc': ['/openmp'],
+        'mingw32': ['-fopenmp'],
+        'unix': ['-fopenmp']}
+lopt = {'msvc': ['/MANIFEST'],
+        'mingw32': ['-fopenmp'],
+        'unix': ['-lgomp']}
 
 # Platform-specific link options
-platform_lopt = {'msvc' : ['/MANIFEST']}
+platform_lopt = {'msvc': ['/MANIFEST']}
 platform_copt = {}
 
 # Set copts to get compile working on OS X >= 10.9 using clang
-if sys.platform =='darwin':
+if sys.platform == 'darwin':
     try:
         darwin_ver = int(os.uname()[2].split('.')[0])
         if darwin_ver >= 13 and darwin_ver < 14:
-            platform_copt = {'unix' : ['-Wno-error=unused-command-line-argument-hard-error-in-future']}
+            platform_copt = {
+                'unix': ['-Wno-error=unused-command-line-argument-hard-error-in-future']}
     except:
         print("PROBLEM determining Darwin version")
+
 
 class DisableOpenMPCommand(Command):
@@ -114,5 +124,6 @@
         pass
 
-class build_ext_subclass( build_ext ):
+
+class build_ext_subclass(build_ext):
     def build_extensions(self):
         # Get 64-bitness
@@ -124,20 +135,20 @@
             if c in copt:
                 for e in self.extensions:
-                    e.extra_compile_args = copt[ c ]
+                    e.extra_compile_args = copt[c]
             if c in lopt:
                 for e in self.extensions:
-                    e.extra_link_args = lopt[ c ]
+                    e.extra_link_args = lopt[c]
 
         # Platform-specific build options
         if c in platform_lopt:
             for e in self.extensions:
-                e.extra_link_args = platform_lopt[ c ]
+                e.extra_link_args = platform_lopt[c]
 
         if c in platform_copt:
             for e in self.extensions:
-                e.extra_compile_args = platform_copt[ c ]
-
+                e.extra_compile_args = platform_copt[c]
 
         build_ext.build_extensions(self)
+
 
 class BuildSphinxCommand(Command):
@@ -152,8 +163,26 @@
 
     def run(self):
+        ''' First builds the sasmodels documentation if the directory
+        is present. Then builds the sasview docs.
+        '''
+        ### AJJ - Add code for building sasmodels docs here:
+        # check for doc path
+        SASMODELS_DOCPATH = os.path.abspath(os.path.join(os.getcwd(), '..', 'sasmodels', 'doc'))
+        print("========= check for sasmodels at", SASMODELS_DOCPATH, "============")
+        if os.path.exists(SASMODELS_DOCPATH):
+            if os.path.isdir(SASMODELS_DOCPATH):
+                # if available, build sasmodels docs
+                print("============= Building sasmodels model documentation ===============")
+                smdocbuild = subprocess.call(["make", "-C", SASMODELS_DOCPATH, "html"])
+        else:
+            # if not available warning message
+            print("== !!WARNING!! sasmodels directory not found. Cannot build model docs. ==")
+
+        #Now build sasview (+sasmodels) docs
         sys.path.append("docs/sphinx-docs")
         import build_sphinx
         build_sphinx.rebuild()
 
+
 # sas module
 package_dir["sas"] = os.path.join("src", "sas")
@@ -169,5 +198,6 @@
 
 # sas.sascalc.invariant
-package_dir["sas.sascalc.invariant"] = os.path.join("src", "sas", "sascalc", "invariant")
+package_dir["sas.sascalc.invariant"] = os.path.join(
+    "src", "sas", "sascalc", "invariant")
 packages.extend(["sas.sascalc.invariant"])
 
@@ -175,59 +205,72 @@
 guiframe_path = os.path.join("src", "sas", "sasgui", "guiframe")
 package_dir["sas.sasgui.guiframe"] = guiframe_path
-package_dir["sas.sasgui.guiframe.local_perspectives"] = os.path.join(os.path.join(guiframe_path, "local_perspectives"))
+package_dir["sas.sasgui.guiframe.local_perspectives"] = os.path.join(
+    os.path.join(guiframe_path, "local_perspectives"))
 package_data["sas.sasgui.guiframe"] = ['images/*', 'media/*']
-packages.extend(["sas.sasgui.guiframe", "sas.sasgui.guiframe.local_perspectives"])
+packages.extend(
+    ["sas.sasgui.guiframe", "sas.sasgui.guiframe.local_perspectives"])
 # build local plugin
 for d in os.listdir(os.path.join(guiframe_path, "local_perspectives")):
-    if d not in ['.svn','__init__.py', '__init__.pyc']:
+    if d not in ['.svn', '__init__.py', '__init__.pyc']:
         package_name = "sas.sasgui.guiframe.local_perspectives." + d
         packages.append(package_name)
-        package_dir[package_name] = os.path.join(guiframe_path, "local_perspectives", d)
+        package_dir[package_name] = os.path.join(
+            guiframe_path, "local_perspectives", d)
 
 # sas.sascalc.dataloader
-package_dir["sas.sascalc.dataloader"] = os.path.join("src", "sas", "sascalc", "dataloader")
-package_data["sas.sascalc.dataloader.readers"] = ['defaults.json','schema/*.xsd']
-packages.extend(["sas.sascalc.dataloader","sas.sascalc.dataloader.readers","sas.sascalc.dataloader.readers.schema"])
+package_dir["sas.sascalc.dataloader"] = os.path.join(
+    "src", "sas", "sascalc", "dataloader")
+package_data["sas.sascalc.dataloader.readers"] = [
+    'defaults.json', 'schema/*.xsd']
+packages.extend(["sas.sascalc.dataloader", "sas.sascalc.dataloader.readers",
+                 "sas.sascalc.dataloader.readers.schema"])
+
 
 # sas.sascalc.calculator
 gen_dir = os.path.join("src", "sas", "sascalc", "calculator", "c_extensions")
 package_dir["sas.sascalc.calculator.core"] = gen_dir
-package_dir["sas.sascalc.calculator"] = os.path.join("src", "sas", "sascalc", "calculator")
-packages.extend(["sas.sascalc.calculator","sas.sascalc.calculator.core"])
-ext_modules.append( Extension("sas.sascalc.calculator.core.sld2i",
-        sources = [
-            os.path.join(gen_dir, "sld2i_module.cpp"),
-            os.path.join(gen_dir, "sld2i.cpp"),
-            os.path.join(gen_dir, "libfunc.c"),
-            os.path.join(gen_dir, "librefl.c"),
-        ],
-        include_dirs=[gen_dir],
-    )
-)
+package_dir["sas.sascalc.calculator"] = os.path.join(
+    "src", "sas", "sascalc", "calculator")
+packages.extend(["sas.sascalc.calculator", "sas.sascalc.calculator.core"])
+ext_modules.append(Extension("sas.sascalc.calculator.core.sld2i",
+                             sources=[
+                                 os.path.join(gen_dir, "sld2i_module.cpp"),
+                                 os.path.join(gen_dir, "sld2i.cpp"),
+                                 os.path.join(gen_dir, "libfunc.c"),
+                                 os.path.join(gen_dir, "librefl.c"),
+                             ],
+                             include_dirs=[gen_dir],
+                             )
+                   )
 
 # sas.sascalc.pr
-srcdir  = os.path.join("src", "sas", "sascalc", "pr", "c_extensions")
+srcdir = os.path.join("src", "sas", "sascalc", "pr", "c_extensions")
 package_dir["sas.sascalc.pr.core"] = srcdir
-package_dir["sas.sascalc.pr"] = os.path.join("src","sas", "sascalc", "pr")
-packages.extend(["sas.sascalc.pr","sas.sascalc.pr.core"])
-ext_modules.append( Extension("sas.sascalc.pr.core.pr_inversion",
-                              sources = [os.path.join(srcdir, "Cinvertor.c"),
-                                         os.path.join(srcdir, "invertor.c"),
-                                         ],
-                              include_dirs=[],
-                              ) )
+package_dir["sas.sascalc.pr"] = os.path.join("src", "sas", "sascalc", "pr")
+packages.extend(["sas.sascalc.pr", "sas.sascalc.pr.core"])
+ext_modules.append(Extension("sas.sascalc.pr.core.pr_inversion",
+                             sources=[os.path.join(srcdir, "Cinvertor.c"),
+                                      os.path.join(srcdir, "invertor.c"),
+                                      ],
+                             include_dirs=[],
+                             ))
+
 
 # sas.sascalc.file_converter
 mydir = os.path.join("src", "sas", "sascalc", "file_converter", "c_ext")
 package_dir["sas.sascalc.file_converter.core"] = mydir
-package_dir["sas.sascalc.file_converter"] = os.path.join("src","sas", "sascalc", "file_converter")
-packages.extend(["sas.sascalc.file_converter","sas.sascalc.file_converter.core"])
-ext_modules.append( Extension("sas.sascalc.file_converter.core.bsl_loader",
-                              sources = [os.path.join(mydir, "bsl_loader.c")],
-                              include_dirs=[np.get_include()],
-                              ) )
-
-#sas.sascalc.corfunc
-package_dir["sas.sascalc.corfunc"] = os.path.join("src", "sas", "sascalc", "corfunc")
+package_dir["sas.sascalc.file_converter"] = os.path.join(
+    "src", "sas", "sascalc", "file_converter")
+packages.extend(["sas.sascalc.file_converter",
+                 "sas.sascalc.file_converter.core"])
+ext_modules.append(Extension("sas.sascalc.file_converter.core.bsl_loader",
+                             sources=[os.path.join(mydir, "bsl_loader.c")],
+                             include_dirs=[np.get_include()],
+                             ))
+
+# sas.sascalc.corfunc
+package_dir["sas.sascalc.corfunc"] = os.path.join(
+    "src", "sas", "sascalc", "corfunc")
+
 packages.extend(["sas.sascalc.corfunc"])
 
@@ -237,35 +280,48 @@
 
 # Perspectives
-package_dir["sas.sasgui.perspectives"] = os.path.join("src", "sas", "sasgui", "perspectives")
-package_dir["sas.sasgui.perspectives.pr"] = os.path.join("src", "sas", "sasgui", "perspectives", "pr")
-packages.extend(["sas.sasgui.perspectives","sas.sasgui.perspectives.pr"])
+package_dir["sas.sasgui.perspectives"] = os.path.join(
+    "src", "sas", "sasgui", "perspectives")
+package_dir["sas.sasgui.perspectives.pr"] = os.path.join(
+    "src", "sas", "sasgui", "perspectives", "pr")
+packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.pr"])
 package_data["sas.sasgui.perspectives.pr"] = ['media/*']
 
-package_dir["sas.sasgui.perspectives.invariant"] = os.path.join("src", "sas", "sasgui", "perspectives", "invariant")
+package_dir["sas.sasgui.perspectives.invariant"] = os.path.join(
+    "src", "sas", "sasgui", "perspectives", "invariant")
 packages.extend(["sas.sasgui.perspectives.invariant"])
-package_data['sas.sasgui.perspectives.invariant'] = [os.path.join("media",'*')]
-
-package_dir["sas.sasgui.perspectives.fitting"] = os.path.join("src", "sas", "sasgui", "perspectives", "fitting")
-package_dir["sas.sasgui.perspectives.fitting.plugin_models"] = os.path.join("src", "sas", "sasgui", "perspectives", "fitting", "plugin_models")
-packages.extend(["sas.sasgui.perspectives.fitting", "sas.sasgui.perspectives.fitting.plugin_models"])
-package_data['sas.sasgui.perspectives.fitting'] = ['media/*', 'plugin_models/*']
-
-packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.calculator"])
+package_data['sas.sasgui.perspectives.invariant'] = [
+    os.path.join("media", '*')]
+
+package_dir["sas.sasgui.perspectives.fitting"] = os.path.join(
+    "src", "sas", "sasgui", "perspectives", "fitting")
+package_dir["sas.sasgui.perspectives.fitting.plugin_models"] = os.path.join(
+    "src", "sas", "sasgui", "perspectives", "fitting", "plugin_models")
+packages.extend(["sas.sasgui.perspectives.fitting",
+                 "sas.sasgui.perspectives.fitting.plugin_models"])
+package_data['sas.sasgui.perspectives.fitting'] = [
+    'media/*', 'plugin_models/*']
+
+packages.extend(["sas.sasgui.perspectives",
+                 "sas.sasgui.perspectives.calculator"])
 package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*']
 
-package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join("src", "sas", "sasgui", "perspectives", "corfunc")
+package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join(
+    "src", "sas", "sasgui", "perspectives", "corfunc")
 packages.extend(["sas.sasgui.perspectives.corfunc"])
 package_data['sas.sasgui.perspectives.corfunc'] = ['media/*']
 
-package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join("src", "sas", "sasgui", "perspectives", "file_converter")
+package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join(
+    "src", "sas", "sasgui", "perspectives", "file_converter")
 packages.extend(["sas.sasgui.perspectives.file_converter"])
 package_data['sas.sasgui.perspectives.file_converter'] = ['media/*']
 
 # Data util
-package_dir["sas.sascalc.data_util"] = os.path.join("src", "sas", "sascalc", "data_util")
+package_dir["sas.sascalc.data_util"] = os.path.join(
+    "src", "sas", "sascalc", "data_util")
 packages.append("sas.sascalc.data_util")
 
 # Plottools
-package_dir["sas.sasgui.plottools"] = os.path.join("src", "sas", "sasgui", "plottools")
+package_dir["sas.sasgui.plottools"] = os.path.join(
+    "src", "sas", "sasgui", "plottools")
 packages.append("sas.sasgui.plottools")
 
@@ -275,4 +331,5 @@
 
 EXTENSIONS = [".c", ".cpp"]
+
 
 def append_file(file_list, dir_path):
@@ -294,10 +351,11 @@
                         file_list.append(os.path.join(sub_dir, new_f))
 
+
 # Comment out the following to avoid rebuilding all the models
 file_sources = []
 append_file(file_sources, gen_dir)
 
-#Wojtek's hacky way to add doc files while bundling egg
-#def add_doc_files(directory):
+# Wojtek's hacky way to add doc files while bundling egg
+# def add_doc_files(directory):
 #    paths = []
 #    for (path, directories, filenames) in os.walk(directory):
@@ -312,4 +370,5 @@
 package_data['sas.sasview'] = ['images/*',
                                'media/*',
+                               'logging.ini',
                                'test/*.txt',
                                'test/1d_data/*',
@@ -331,11 +390,11 @@
     'lxml', 'h5py',
 
-    ## The following dependecies won't install automatically, so assume them
-    ## The numbers should be bumped up for matplotlib and wxPython as well.
+    # The following dependecies won't install automatically, so assume them
+    # The numbers should be bumped up for matplotlib and wxPython as well.
     # 'numpy>=1.4.1', 'scipy>=0.7.2', 'matplotlib>=0.99.1.1',
     # 'wxPython>=2.8.11', 'pil',
-    ]
-
-if os.name=='nt':
+]
+
+if os.name == 'nt':
     required.extend(['html5lib', 'reportlab'])
 else:
@@ -346,25 +405,25 @@
 setup(
     name="sasview",
-    version = VERSION,
-    description = "SasView application",
-    author = "SasView Team",
-    author_email = "developers@sasview.org",
-    url = "http://sasview.org",
-    license = "PSF",
-    keywords = "small-angle x-ray and neutron scattering analysis",
-    download_url = "https://github.com/SasView/sasview.git",
-    package_dir = package_dir,
-    packages = packages,
-    package_data = package_data,
-    ext_modules = ext_modules,
-    install_requires = required,
-    zip_safe = False,
-    entry_points = {
-                    'console_scripts':[
-                                       "sasview = sas.sasview.sasview:run",
-                                       ]
-                    },
-    cmdclass = {'build_ext': build_ext_subclass,
-                'docs': BuildSphinxCommand,
-                'disable_openmp': DisableOpenMPCommand}
-    )
+    version=VERSION,
+    description="SasView application",
+    author="SasView Team",
+    author_email="developers@sasview.org",
+    url="http://sasview.org",
+    license="PSF",
+    keywords="small-angle x-ray and neutron scattering analysis",
+    download_url="https://github.com/SasView/sasview.git",
+    package_dir=package_dir,
+    packages=packages,
+    package_data=package_data,
+    ext_modules=ext_modules,
+    install_requires=required,
+    zip_safe=False,
+    entry_points={
+        'console_scripts': [
+            "sasview = sas.sasview.sasview:run",
+        ]
+    },
+    cmdclass={'build_ext': build_ext_subclass,
+              'docs': BuildSphinxCommand,
+              'disable_openmp': DisableOpenMPCommand}
+)
Index: src/sas/sasgui/guiframe/gui_manager.py
===================================================================
--- src/sas/sasgui/guiframe/gui_manager.py	(revision 49165488dcf1dbf657666bc78e3d4b4904d1c094)
+++ src/sas/sasgui/guiframe/gui_manager.py	(revision 38beeabb5ee27ed084d34cff146a43b594e5192f)
@@ -77,9 +77,9 @@
     # clean all these module variables and put them into a config class
     # that can be passed by sasview.py.
-    logger.info(sys.executable)
-    logger.info(str(sys.argv))
+    logger.debug(sys.executable)
+    logger.debug(str(sys.argv))
     from sas import sasview as sasview
     app_path = os.path.dirname(sasview.__file__)
-    logger.info("Using application path: %s", app_path)
+    logger.debug("Using application path: %s", app_path)
     return app_path
 
@@ -109,5 +109,5 @@
         if fObj is not None:
             fObj.close()
-    logger.info("GuiManager loaded %s/%s" % (path, file))
+    logger.debug("GuiManager loaded %s/%s" % (path, file))
     return config_module
 
@@ -126,9 +126,9 @@
         # Didn't find local config, load the default
         import sas.sasgui.guiframe.config as config
-        logger.info("using default local_config")
+        logger.debug("using default local_config")
     else:
-        logger.info("found local_config in %s" % os.getcwd())
+        logger.debug("found local_config in %s" % os.getcwd())
 else:
-    logger.info("found local_config in %s" % PATH_APP)
+    logger.debug("found local_config in %s" % PATH_APP)
 
 from sas.sasgui.guiframe.customdir import SetupCustom
@@ -139,9 +139,9 @@
     if custom_config is None:
         msgConfig = "Custom_config file was not imported"
-        logger.info(msgConfig)
+        logger.debug(msgConfig)
     else:
-        logger.info("using custom_config in %s" % os.getcwd())
+        logger.debug("using custom_config in %s" % os.getcwd())
 else:
-    logger.info("using custom_config from %s" % c_conf_dir)
+    logger.debug("using custom_config from %s" % c_conf_dir)
 
 # read some constants from config
@@ -2156,8 +2156,6 @@
         if response is not None:
             try:
-                # 
                 content = response.read().strip()
-                logger.info("Connected to www.sasview.org. Latest version: %s"
-                             % (content))
+                logger.info("Connected to www.sasview.org. Latest version: %s", content)
                 version_info = json.loads(content)
             except:
Index: src/sas/sasgui/perspectives/calculator/sld_panel.py
===================================================================
--- src/sas/sasgui/perspectives/calculator/sld_panel.py	(revision 7432acb919f4013119ca918a73350297e0d4c93f)
+++ src/sas/sasgui/perspectives/calculator/sld_panel.py	(revision fe09e9bb0ad6caa9284d13a5c7dfdfc420d0c28b)
@@ -60,5 +60,6 @@
         # Object that receive status event
         self.base = base
-        self.wavelength = WAVELENGTH
+        self.neutron_wavelength = WAVELENGTH
+        self.xray_source_input = WAVELENGTH
         self.parent = parent
         #layout attribute
@@ -67,19 +68,21 @@
         self.compound = ""
         self.density = ""
-        self.wavelength_ctl = None
+        self.neutron_wavelength_ctl = None
+        self.xray_source_input_ctl = None
+        self.xray_cbox = None
         self.neutron_sld_real_ctl = None
         self.neutron_sld_im_ctl = None
-        self.mo_ka_sld_real_ctl = None
-        self.mo_ka_sld_im_ctl = None
-        self.cu_ka_sld_real_ctl = None
-        self.cu_ka_sld_im_ctl = None
+        self.xray_sld_real_ctl = None
+        self.xray_sld_im_ctl = None
         self.neutron_abs_ctl = None
         self.neutron_inc_ctl = None
         self.neutron_length_ctl = None
         self.button_calculate = None
+        self.xray_source = None
         #Draw the panel
         self._do_layout()
         self.SetAutoLayout(True)
         self.Layout()
+        self.fill_xray_cbox()
 
     def _do_layout(self):
@@ -108,8 +111,17 @@
         self.density_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1))
         unit_density_txt = wx.StaticText(self, -1, unit_density)
-        wavelength_txt = wx.StaticText(self, -1, 'Wavelength ')
-        self.wavelength_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1))
-        self.wavelength_ctl.SetValue(str(self.wavelength))
-        unit_a_txt = wx.StaticText(self, -1, unit_a)
+        neutron_wavelength_txt = wx.StaticText(self, -1, 'Neutron wavelength')
+        self.neutron_wavelength_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1))
+        self.neutron_wavelength_ctl.SetValue(str(self.neutron_wavelength))
+        self.xray_source_input_txt = wx.StaticText(self, -1, 'X-ray wavelength')
+        self.xray_source_input_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1))
+        self.xray_source_input_ctl.SetValue(str(self.xray_source_input))
+        neutron_unit_a_txt = wx.StaticText(self, -1, unit_a)
+
+        self.xray_cbox = wx.ComboBox(self, -1, size=(70, 20), style=wx.CB_READONLY)
+        xray_cbox_tip = "Select an element, wavelength or energy"
+        self.xray_cbox.SetToolTipString(xray_cbox_tip)
+        wx.EVT_COMBOBOX(self.xray_cbox, -1, self.on_select_xray)
+
         iy = 0
         ix = 0
@@ -131,11 +143,21 @@
         iy += 1
         ix = 0
-        sizer_input.Add(wavelength_txt, (iy, ix), (1, 1),
-                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
-        ix += 1
-        sizer_input.Add(self.wavelength_ctl, (iy, ix), (1, 1),
-                            wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-        ix += 1
-        sizer_input.Add(unit_a_txt, (iy, ix), (1, 1),
+        sizer_input.Add(neutron_wavelength_txt, (iy, ix), (1, 1),
+                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        sizer_input.Add(self.neutron_wavelength_ctl, (iy, ix), (1, 1),
+                            wx.EXPAND | wx.ADJUST_MINSIZE, 0)
+        ix += 1
+        sizer_input.Add(neutron_unit_a_txt, (iy, ix), (1, 1),
+                            wx.EXPAND | wx.ADJUST_MINSIZE, 0)
+        iy += 1
+        ix = 0
+        sizer_input.Add(self.xray_source_input_txt, (iy, ix), (1, 1),
+                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        sizer_input.Add(self.xray_source_input_ctl, (iy, ix), (1, 1),
+                            wx.EXPAND | wx.ADJUST_MINSIZE, 0)
+        ix += 1
+        sizer_input.Add(self.xray_cbox, (iy, ix), (1, 1),
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         boxsizer1.Add(sizer_input)
@@ -151,32 +173,21 @@
                                                  size=(_BOX_WIDTH, -1))
         self.neutron_sld_real_ctl.SetEditable(False)
-        self.neutron_sld_real_ctl.SetToolTipString("Neutron SLD real.")
+        self.neutron_sld_real_ctl.SetToolTipString("Neutron SLD real")
         self.neutron_sld_im_ctl = wx.TextCtrl(self, -1,
                                               size=(_BOX_WIDTH, -1))
         self.neutron_sld_im_ctl.SetEditable(False)
-        self.neutron_sld_im_ctl.SetToolTipString("Neutron SLD imaginary.")
+        self.neutron_sld_im_ctl.SetToolTipString("Neutron SLD imaginary")
         neutron_sld_units_txt = wx.StaticText(self, -1, unit_sld)
 
-        cu_ka_sld_txt = wx.StaticText(self, -1, 'Cu Ka SLD')
-        self.cu_ka_sld_real_ctl = wx.TextCtrl(self, -1,
+        xray_sld_txt = wx.StaticText(self, -1, 'X-ray SLD')
+        self.xray_sld_real_ctl = wx.TextCtrl(self, -1,
                                                size=(_BOX_WIDTH, -1))
-        self.cu_ka_sld_real_ctl.SetEditable(False)
-        self.cu_ka_sld_real_ctl.SetToolTipString("Cu Ka SLD real.")
-        self.cu_ka_sld_im_ctl = wx.TextCtrl(self, -1,
+        self.xray_sld_real_ctl.SetEditable(False)
+        self.xray_sld_real_ctl.SetToolTipString("X-ray SLD real")
+        self.xray_sld_im_ctl = wx.TextCtrl(self, -1,
                                             size=(_BOX_WIDTH, -1))
-        self.cu_ka_sld_im_ctl.SetEditable(False)
-        self.cu_ka_sld_im_ctl.SetToolTipString("Cu Ka SLD imaginary.")
-        cu_ka_sld_units_txt = wx.StaticText(self, -1, unit_sld)
-
-        mo_ka_sld_txt = wx.StaticText(self, -1, 'Mo Ka SLD')
-        self.mo_ka_sld_real_ctl = wx.TextCtrl(self, -1,
-                                               size=(_BOX_WIDTH, -1))
-        self.mo_ka_sld_real_ctl.SetEditable(False)
-        self.mo_ka_sld_real_ctl.SetToolTipString("Mo Ka SLD real.")
-        self.mo_ka_sld_im_ctl = wx.TextCtrl(self, -1,
-                                             size=(_BOX_WIDTH, -1))
-        self.mo_ka_sld_im_ctl.SetEditable(False)
-        self.mo_ka_sld_im_ctl.SetToolTipString("Mo Ka SLD imaginary.")
-        mo_ka_sld_units_txt = wx.StaticText(self, -1, unit_sld)
+        self.xray_sld_im_ctl.SetEditable(False)
+        self.xray_sld_im_ctl.SetToolTipString("X-ray SLD imaginary")
+        xray_sld_units_txt = wx.StaticText(self, -1, unit_sld)
 
         neutron_inc_txt = wx.StaticText(self, -1, 'Neutron Inc. Xs')
@@ -219,8 +230,8 @@
         iy += 1
         ix = 0
-        sizer_output.Add(cu_ka_sld_txt, (iy, ix), (1, 1),
-                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
-        ix += 1
-        sizer_output.Add(self.cu_ka_sld_real_ctl, (iy, ix), (1, 1),
+        sizer_output.Add(xray_sld_txt, (iy, ix), (1, 1),
+                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        sizer_output.Add(self.xray_sld_real_ctl, (iy, ix), (1, 1),
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         ix += 1
@@ -228,24 +239,8 @@
                          (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         ix += 1
-        sizer_output.Add(self.cu_ka_sld_im_ctl,
+        sizer_output.Add(self.xray_sld_im_ctl,
                          (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         ix += 1
-        sizer_output.Add(cu_ka_sld_units_txt,
-                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-        iy += 1
-        ix = 0
-        sizer_output.Add(mo_ka_sld_txt, (iy, ix), (1, 1),
-                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
-        ix += 1
-        sizer_output.Add(self.mo_ka_sld_real_ctl, (iy, ix), (1, 1),
-                            wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-        ix += 1
-        sizer_output.Add(wx.StaticText(self, -1, i_complex),
-                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-        ix += 1
-        sizer_output.Add(self.mo_ka_sld_im_ctl,
-                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
-        ix += 1
-        sizer_output.Add(mo_ka_sld_units_txt,
+        sizer_output.Add(xray_sld_units_txt,
                          (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         iy += 1
@@ -310,4 +305,29 @@
         self.SetSizer(vbox)
 
+    def fill_xray_cbox(self):
+        """
+        fill the x-ray combobox with the sources
+        """
+        source_list = ['[A]', '[keV]', 'Element']
+        for source in source_list:
+            pos = self.xray_cbox.Append(str(source))
+            self.xray_cbox.SetClientData(pos, str(source.strip()))
+        self.xray_cbox.SetSelection(0)
+        self.xray_source = source_list[0]
+
+    def on_select_xray(self, event=None):
+        """
+        On Selecting a source
+        """
+        item = event.GetEventObject()
+        self.xray_source = item.GetValue().strip()
+
+        if self.xray_source == "[A]":
+            self.xray_source_input_txt.SetLabel("X-ray wavelength")
+        elif self.xray_source == "[keV]":
+            self.xray_source_input_txt.SetLabel("X-ray energy")
+        elif self.xray_source == "Element":
+            self.xray_source_input_txt.SetLabel("X-ray source")
+
     def on_help(self, event):
         """
@@ -363,17 +383,42 @@
             msg += "Error for Density value :expect float"
 
-        self.wavelength = self.wavelength_ctl.GetValue()
-        if str(self.wavelength).lstrip().rstrip() == "":
-            self.wavelength = WAVELENGTH
-            self.wavelength_ctl.SetValue(str(WAVELENGTH))
-            self.wavelength_ctl.SetBackgroundColour(wx.WHITE)
-            self.wavelength_ctl.Refresh()
+        self.neutron_wavelength = self.neutron_wavelength_ctl.GetValue()
+        self.xray_source_input = self.xray_source_input_ctl.GetValue()
+
+        if str(self.neutron_wavelength).lstrip().rstrip() == "":
+            self.neutron_wavelength = WAVELENGTH
+            self.neutron_wavelength_ctl.SetValue(str(WAVELENGTH))
+            self.neutron_wavelength_ctl.SetBackgroundColour(wx.WHITE)
+            self.neutron_wavelength_ctl.Refresh()
             msg += "Default value for wavelength is 6.0"
         else:
-            if check_float(self.wavelength_ctl):
-                self.wavelength = float(self.wavelength)
+            if check_float(self.neutron_wavelength_ctl):
+                self.neutron_wavelength = float(self.neutron_wavelength)
             else:
                 flag = False
                 msg += "Error for wavelength value :expect float"
+
+        if str(self.xray_source_input).lstrip().rstrip() == "":
+            self.xray_source_input = WAVELENGTH
+            self.xray_source_input_ctl.SetValue(str(WAVELENGTH))
+            self.xray_source_input_ctl.SetBackgroundColour(wx.WHITE)
+            self.xray_source_input_ctl.Refresh()
+            msg += "Default value for wavelength is 6.0"
+        else:
+            if (self.xray_source == '[A]') or (self.xray_source == '[keV]'):
+                if check_float(self.xray_source_input_ctl):
+                    self.xray_source_input = float(self.xray_source_input)
+                else:
+                    flag = False
+                    msg += "Error for wavelength value :expect float"
+            elif (self.xray_source == 'Element'):
+                try:
+                    import periodictable
+                    exec("periodictable." + self.xray_source_input)
+                except AttributeError:
+                    flag = False
+                    msg += "X-ray element supplied isn't in the database"
+
+
 
         self.compound = self.compound_ctl.GetValue().lstrip().rstrip()
@@ -410,5 +455,4 @@
         return xray_sld_from_atoms(atom, density=density, energy=energy)
 
-
     def calculateSld(self, event):
         """
@@ -430,11 +474,18 @@
                         length = neutron_scattering(compound=self.compound,
                                    density=self.density,
-                                   wavelength=self.wavelength)
-            cu_real, cu_im = self.calculate_sld_helper(element="Cu",
-                                                 density=self.density,
-                                        molecule_formula=self.sld_formula)
-            mo_real, mo_im = self.calculate_sld_helper(element="Mo",
-                                                       density=self.density,
-                                     molecule_formula=self.sld_formula)
+                                   wavelength=self.neutron_wavelength)
+            if self.xray_source == "[A]":
+                energy = xray_energy(self.xray_source_input)
+                xray_real, xray_im = xray_sld_from_atoms(self.sld_formula.atoms,
+                                                         density=self.density,
+                                                         energy=energy)
+            elif self.xray_source == "[keV]":
+                xray_real, xray_im = xray_sld_from_atoms(self.sld_formula.atoms,
+                                                         density=self.density,
+                                                         energy=self.xray_source_input)
+            elif self.xray_source == "Element":
+                xray_real, xray_im = self.calculate_sld_helper(element=self.xray_source_input,
+                                                               density=self.density,
+                                                               molecule_formula=self.sld_formula)
             # set neutron sld values
             val = format_number(sld_real * _SCALE)
@@ -443,11 +494,7 @@
             self.neutron_sld_im_ctl.SetValue(val)
             # Compute the Cu SLD
-            self.cu_ka_sld_real_ctl.SetValue(format_number(cu_real * _SCALE))
-            val = format_number(math.fabs(cu_im) * _SCALE)
-            self.cu_ka_sld_im_ctl.SetValue(val)
-            # Compute the Mo SLD
-            self.mo_ka_sld_real_ctl.SetValue(format_number(mo_real * _SCALE))
-            val = format_number(math.fabs(mo_im) * _SCALE)
-            self.mo_ka_sld_im_ctl.SetValue(val)
+            self.xray_sld_real_ctl.SetValue(format_number(xray_real * _SCALE))
+            val = format_number(math.fabs(xray_im) * _SCALE)
+            self.xray_sld_im_ctl.SetValue(val)
             # set incoherence and absorption
             self.neutron_inc_ctl.SetValue(format_number(incoh))
@@ -456,5 +503,6 @@
             self.neutron_length_ctl.SetValue(format_number(length))
             # display wavelength
-            self.wavelength_ctl.SetValue(str(self.wavelength))
+            #self.wavelength_ctl.SetValue(str(self.wavelength))
+            #self.wavelength_ctl.SetValue(str(self.wavelength))
         except:
             if self.base is not None:
@@ -470,8 +518,6 @@
         self.neutron_sld_real_ctl.SetValue("")
         self.neutron_sld_im_ctl.SetValue("")
-        self.mo_ka_sld_real_ctl.SetValue("")
-        self.mo_ka_sld_im_ctl.SetValue("")
-        self.cu_ka_sld_real_ctl.SetValue("")
-        self.cu_ka_sld_im_ctl.SetValue("")
+        self.xray_sld_real_ctl.SetValue("")
+        self.xray_sld_im_ctl.SetValue("")
         self.neutron_abs_ctl.SetValue("")
         self.neutron_inc_ctl.SetValue("")
