Index: src/sas/perspectives/calculator/resolution_calculator_panel.py
===================================================================
--- src/sas/perspectives/calculator/resolution_calculator_panel.py	(revision 18d58a6e5c2e48e332fb54635f97a99950628cbf)
+++ src/sas/perspectives/calculator/resolution_calculator_panel.py	(revision af6b53cff72d68efc404d40d94571eab886a8e05)
@@ -1,6 +1,7 @@
+# pylint: disable=attribute-defined-outside-init
 """
 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. 
+project funded by the US National Science Foundation.
 
 See the license text in license.txt
@@ -13,4 +14,5 @@
 import matplotlib
 import math
+import logging
 #Use the WxAgg back end. The Wx one takes too long to render
 matplotlib.use('WXAgg')
@@ -23,17 +25,17 @@
 from matplotlib.figure import Figure
 
-#from sas.guicomm.events import StatusEvent  
-from sas.calculator.resolution_calculator import ResolutionCalculator 
-from sas.guiframe.events import StatusEvent  
+#from sas.guicomm.events import StatusEvent
+from sas.calculator.resolution_calculator import ResolutionCalculator
+from sas.guiframe.events import StatusEvent
 from sas.perspectives.calculator.calculator_widgets import OutputTextCtrl
 from sas.perspectives.calculator.calculator_widgets import InputTextCtrl
 from wx.lib.scrolledpanel import ScrolledPanel
 from math import fabs
-from sas.perspectives.calculator import calculator_widgets as widget   
+from sas.perspectives.calculator import calculator_widgets as widget
 from sas.guiframe.documentation_window import DocumentationWindow
 
 _BOX_WIDTH = 100
 _Q_DEFAULT = 0.0
-#Slit length panel size 
+#Slit length panel size
 if sys.platform.count("win32") > 0:
     PANEL_WIDTH = 525
@@ -49,5 +51,5 @@
 _SOURCE_MASS = {'Alpha':6.64465620E-24,
                 'Deuteron':3.34358320E-24,
-                'Neutron':1.67492729E-24, 
+                'Neutron':1.67492729E-24,
                 'Photon': 0.0,
                 'Proton':1.67262137E-24,
@@ -64,6 +66,6 @@
     ## Flag to tell the AUI manager to put this panel in the center pane
     CENTER_PANE = True
-    
-    def __init__(self, parent,  *args, **kwds):
+
+    def __init__(self, parent, *args, **kwds):
         kwds["size"] = (PANEL_WIDTH * 2, PANEL_HEIGHT)
         kwds["style"] = wx.FULL_REPAINT_ON_RESIZE
@@ -71,5 +73,5 @@
         self.SetupScrolling()
         self.parent = parent
-        
+
         # input defaults
         self.qx = []
@@ -87,5 +89,5 @@
         # results of sigmas
         self.sigma_strings = ' '
-        #Font size 
+        #Font size
         self.SetWindowVariant(variant=FONT_VARIANT)
         # Object that receive status event
@@ -110,8 +112,6 @@
         self.vertical_r_sizer = wx.StaticBoxSizer(self.vertical_r_frame,
                                                   wx.VERTICAL)
-        self.box_source = wx.StaticBox(self, -1,
-                                str(self.window_caption))
-        self.boxsizer_source = wx.StaticBoxSizer(self.box_source,
-                                                    wx.VERTICAL)
+        self.box_source = wx.StaticBox(self, -1, str(self.window_caption))
+        self.boxsizer_source = wx.StaticBoxSizer(self.box_source, wx.VERTICAL)
         self.mass_sizer = wx.BoxSizer(wx.HORIZONTAL)
         self.intensity_sizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -125,10 +125,9 @@
         self.detector_size_sizer = wx.BoxSizer(wx.HORIZONTAL)
         self.detector_pix_size_sizer = wx.BoxSizer(wx.HORIZONTAL)
-        #self.detector_offset_sizer = wx.BoxSizer(wx.HORIZONTAL)
         self.input_sizer = wx.BoxSizer(wx.VERTICAL)
         self.output_sizer = wx.BoxSizer(wx.VERTICAL)
         self.hint_sizer = wx.BoxSizer(wx.HORIZONTAL)
         self.button_sizer = wx.BoxSizer(wx.HORIZONTAL)
-        
+
     def _layout_mass(self):
         """
@@ -137,15 +136,13 @@
         # get the mass
         mass_value = str(self.resolution.mass)
-        self.mass_txt = wx.StaticText(self, -1, 
-                                'Source: ')
-        self.mass_hint = "Mass of Neutrons m = %s [g]"\
-                                 % str(self.resolution.mass)
+        self.mass_txt = wx.StaticText(self, -1, 'Source: ')
+        self.mass_hint = "Mass of Neutrons m = %s [g]" % str(self.resolution.mass)
         self.source_cb = wx.ComboBox(self, -1,
-                                style=wx.CB_READONLY,
-                                name = '%s'%mass_value)
+                                     style=wx.CB_READONLY,
+                                     name='%s' % mass_value)
         # Sort source name because wx2.9 on Mac does not support CB_SORT
         # Custom sorting
         source_list = []
-        for key, value in self.source_mass.iteritems():
+        for key, _ in self.source_mass.iteritems():
             name_source = str(key)
             source_list.append(name_source)
@@ -153,17 +150,17 @@
         for idx in range(len(source_list)):
             self.source_cb.Append(source_list[idx], idx)
-        self.source_cb.SetStringSelection("Neutron") 
-        wx.EVT_COMBOBOX(self.source_cb, -1, self._on_source_selection) 
-        
+        self.source_cb.SetStringSelection("Neutron")
+        wx.EVT_COMBOBOX(self.source_cb, -1, self._on_source_selection)
+
         # combo box for color
-        self.wave_color_cb =  wx.ComboBox(self, -1,
-                                style=wx.CB_READONLY,
-                                name = 'color')
+        self.wave_color_cb = wx.ComboBox(self, -1,
+                                         style=wx.CB_READONLY,
+                                         name='color')
         # two choices
         self.wave_color_cb.Append('Monochromatic')
         self.wave_color_cb.Append('TOF')
-        self.wave_color_cb.SetStringSelection("Monochromatic") 
-        wx.EVT_COMBOBOX(self.wave_color_cb, -1, self._on_source_color) 
-        
+        self.wave_color_cb.SetStringSelection("Monochromatic")
+        wx.EVT_COMBOBOX(self.wave_color_cb, -1, self._on_source_color)
+
         source_hint = "Source Selection: Affect on"
         source_hint += " the gravitational contribution.\n"
@@ -172,7 +169,7 @@
         self.mass_txt.SetToolTipString(source_hint)
         self.mass_sizer.AddMany([(self.mass_txt, 0, wx.LEFT, 15),
-                                    (self.source_cb, 0, wx.LEFT, 15),
-                                    (self.wave_color_cb, 0, wx.LEFT, 15)])   
-        
+                                 (self.source_cb, 0, wx.LEFT, 15),
+                                 (self.wave_color_cb, 0, wx.LEFT, 15)])
+
     def _layout_intensity(self):
         """
@@ -182,16 +179,15 @@
         intensity_value = str(self.resolution.intensity)
         intensity_unit_txt = wx.StaticText(self, -1, '[counts/s]')
-        intensity_txt = wx.StaticText(self, -1, 
-                                'Intensity: ')
-        self.intensity_tcl = InputTextCtrl(self, -1, 
-                                        size=(_BOX_WIDTH,-1))
+        intensity_txt = wx.StaticText(self, -1, 'Intensity: ')
+        self.intensity_tcl = InputTextCtrl(self, -1,
+                                           size=(_BOX_WIDTH, -1))
         intensity_hint = "Intensity of Neutrons"
         self.intensity_tcl.SetValue(intensity_value)
         self.intensity_tcl.SetToolTipString(intensity_hint)
         self.intensity_sizer.AddMany([(intensity_txt, 0, wx.LEFT, 15),
-                                    (self.intensity_tcl, 0, wx.LEFT, 15),
-                                    (intensity_unit_txt,0, wx.LEFT, 10)])   
-
-        
+                                      (self.intensity_tcl, 0, wx.LEFT, 15),
+                                      (intensity_unit_txt, 0, wx.LEFT, 10)])
+
+
     def _layout_wavelength(self):
         """
@@ -201,8 +197,7 @@
         wavelength_value = str(self.resolution.get_wavelength())
         wavelength_unit_txt = wx.StaticText(self, -1, '[A]')
-        wavelength_txt = wx.StaticText(self, -1, 
-                                'Wavelength: ')
-        self.wavelength_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH,-1))
+        wavelength_txt = wx.StaticText(self, -1, 'Wavelength: ')
+        self.wavelength_tcl = InputTextCtrl(self, -1,
+                                            size=(_BOX_WIDTH, -1))
         wavelength_hint = "Wavelength of Neutrons"
         self.wavelength_tcl.SetValue(wavelength_value)
@@ -213,26 +208,24 @@
         self.spectrum_dic['Add new'] = ''
         self.spectrum_dic['Flat'] = spectrum_value
-        
-        self.spectrum_txt = wx.StaticText(self, -1, 
-                                'Spectrum: ')
+
+        self.spectrum_txt = wx.StaticText(self, -1, 'Spectrum: ')
         self.spectrum_cb = wx.ComboBox(self, -1,
-                                style=wx.CB_READONLY,
-                                size=(_BOX_WIDTH,-1),
-                                name = 'spectrum')
+                                       style=wx.CB_READONLY,
+                                       size=(_BOX_WIDTH, -1),
+                                       name='spectrum')
         self.spectrum_cb.Append('Add new')
         self.spectrum_cb.Append('Flat')
-        wx.EVT_COMBOBOX(self.spectrum_cb, -1, self._on_spectrum_cb) 
+        wx.EVT_COMBOBOX(self.spectrum_cb, -1, self._on_spectrum_cb)
         spectrum_hint = "Wavelength Spectrum: Intensity vs. wavelength"
-        #self.spectrum_cb.SetValue(spectrum_value)
-        self.spectrum_cb.SetStringSelection('Flat') 
+        self.spectrum_cb.SetStringSelection('Flat')
         self.spectrum_cb.SetToolTipString(spectrum_hint)
         self.wavelength_sizer.AddMany([(wavelength_txt, 0, wx.LEFT, 15),
-                                    (self.wavelength_tcl, 0, wx.LEFT, 5),
-                                    (wavelength_unit_txt,0, wx.LEFT, 5),
-                                    (self.spectrum_txt, 0, wx.LEFT, 20),
-                                    (self.spectrum_cb, 0, wx.LEFT, 5)])   
+                                       (self.wavelength_tcl, 0, wx.LEFT, 5),
+                                       (wavelength_unit_txt, 0, wx.LEFT, 5),
+                                       (self.spectrum_txt, 0, wx.LEFT, 20),
+                                       (self.spectrum_cb, 0, wx.LEFT, 5)])
         self.spectrum_txt.Show(False)
         self.spectrum_cb.Show(False)
-        
+
     def _layout_wavelength_spread(self):
         """
@@ -242,17 +235,15 @@
         wavelength_spread_value = str(self.resolution.get_wavelength_spread())
         wavelength_spread_unit_txt = wx.StaticText(self, -1, '')
-        wavelength_spread_txt = wx.StaticText(self, -1, 
-                                'Wavelength Spread: ')
-        self.wavelength_spread_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH,-1))
+        wavelength_spread_txt = wx.StaticText(self, -1, 'Wavelength Spread: ')
+        self.wavelength_spread_tcl = InputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
         wavelength_spread_hint = "Wavelength  Spread of Neutrons"
         self.wavelength_spread_tcl.SetValue(wavelength_spread_value)
         self.wavelength_spread_tcl.SetToolTipString(wavelength_spread_hint)
-        self.wavelength_spread_sizer.AddMany([(wavelength_spread_txt, 0, 
+        self.wavelength_spread_sizer.AddMany([(wavelength_spread_txt, 0,
                                                wx.LEFT, 15),
-                                (self.wavelength_spread_tcl, 0, wx.LEFT, 15),
-                                (wavelength_spread_unit_txt,0, wx.LEFT, 10)])      
-         
-        
+                                              (self.wavelength_spread_tcl, 0, wx.LEFT, 15),
+                                              (wavelength_spread_unit_txt, 0, wx.LEFT, 10)])
+
+
     def _layout_source_aperture(self):
         """
@@ -261,22 +252,17 @@
         # get the wavelength
         source_aperture_value = str(self.resolution.source_aperture_size[0])
-        if len(self.resolution.source_aperture_size)>1:
+        if len(self.resolution.source_aperture_size) > 1:
             source_aperture_value += ", "
-            source_aperture_value += str(\
-                                    self.resolution.source_aperture_size[1])
+            source_aperture_value += str(self.resolution.source_aperture_size[1])
         source_aperture_unit_txt = wx.StaticText(self, -1, '[cm]')
-        source_aperture_txt = wx.StaticText(self, -1, 
-                                'Source Aperture Size: ')
-        self.source_aperture_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH,-1))
+        source_aperture_txt = wx.StaticText(self, -1, 'Source Aperture Size: ')
+        self.source_aperture_tcl = InputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
         source_aperture_hint = "Source Aperture Size"
         self.source_aperture_tcl.SetValue(source_aperture_value)
         self.source_aperture_tcl.SetToolTipString(source_aperture_hint)
-        self.source_aperture_sizer.AddMany([(source_aperture_txt, 0, 
-                                               wx.LEFT, 15),
-                                (self.source_aperture_tcl, 0, wx.LEFT, 15),
-                                (source_aperture_unit_txt, 0, wx.LEFT, 10)])  
-
-        
+        self.source_aperture_sizer.AddMany([(source_aperture_txt, 0, wx.LEFT, 15),
+                                            (self.source_aperture_tcl, 0, wx.LEFT, 15),
+                                            (source_aperture_unit_txt, 0, wx.LEFT, 10)])
+
     def _layout_sample_aperture(self):
         """
@@ -285,21 +271,16 @@
         # get the wavelength
         sample_aperture_value = str(self.resolution.sample_aperture_size[0])
-        if len(self.resolution.sample_aperture_size)>1:
+        if len(self.resolution.sample_aperture_size) > 1:
             sample_aperture_value += ", "
-            sample_aperture_value += str(\
-                                    self.resolution.sample_aperture_size[1])
+            sample_aperture_value += str(self.resolution.sample_aperture_size[1])
         sample_aperture_unit_txt = wx.StaticText(self, -1, '[cm]')
-        sample_aperture_txt = wx.StaticText(self, -1, 
-                                'Sample Aperture Size: ')
-        self.sample_aperture_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH,-1))
+        sample_aperture_txt = wx.StaticText(self, -1, 'Sample Aperture Size: ')
+        self.sample_aperture_tcl = InputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
         sample_aperture_hint = "Sample Aperture Size"
         self.sample_aperture_tcl.SetValue(sample_aperture_value)
         self.sample_aperture_tcl.SetToolTipString(sample_aperture_hint)
-        self.sample_aperture_sizer.AddMany([(sample_aperture_txt, 0, 
-                                               wx.LEFT, 15),
-                                (self.sample_aperture_tcl, 0, wx.LEFT, 15),
-                                (sample_aperture_unit_txt, 0, wx.LEFT, 10)])  
-
+        self.sample_aperture_sizer.AddMany([(sample_aperture_txt, 0, wx.LEFT, 15),
+                                            (self.sample_aperture_tcl, 0, wx.LEFT, 15),
+                                            (sample_aperture_unit_txt, 0, wx.LEFT, 10)])
 
     def _layout_source2sample_distance(self):
@@ -308,20 +289,16 @@
         """
         # get the wavelength
-        source2sample_distance_value = str(\
-                                    self.resolution.source2sample_distance[0])
+        source2sample_distance_value = str(self.resolution.source2sample_distance[0])
 
         source2sample_distance_unit_txt = wx.StaticText(self, -1, '[cm]')
-        source2sample_distance_txt = wx.StaticText(self, -1, 
-                                'Source to Sample Aperture Distance: ')
-        self.source2sample_distance_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH,-1))
+        source2sample_distance_txt = wx.StaticText(self, -1,
+                                                   'Source to Sample Aperture Distance: ')
+        self.source2sample_distance_tcl = InputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
         source2sample_distance_hint = "Source to Sample Aperture Distance"
         self.source2sample_distance_tcl.SetValue(source2sample_distance_value)
-        self.source2sample_distance_tcl.SetToolTipString(\
-                                                source2sample_distance_hint)
-        self.source2sample_distance_sizer.AddMany([(source2sample_distance_txt, 
-                                               0, wx.LEFT, 15),
-                            (self.source2sample_distance_tcl, 0, wx.LEFT, 15),
-                            (source2sample_distance_unit_txt,0, wx.LEFT, 10)])  
+        self.source2sample_distance_tcl.SetToolTipString(source2sample_distance_hint)
+        self.source2sample_distance_sizer.AddMany([(source2sample_distance_txt, 0, wx.LEFT, 15),
+                                                   (self.source2sample_distance_tcl, 0, wx.LEFT, 15),
+                                                   (source2sample_distance_unit_txt, 0, wx.LEFT, 10)])
 
     def _layout_sample2sample_distance(self):
@@ -330,22 +307,15 @@
         """
         # get the distance
-        sample2sample_distance_value = str(\
-                                    self.resolution.sample2sample_distance[0])
+        sample2sample_distance_value = str(self.resolution.sample2sample_distance[0])
 
         sample2sample_distance_unit_txt = wx.StaticText(self, -1, '[cm]')
-        sample2sample_distance_txt = wx.StaticText(self, -1, 
-                                'Sample Offset: ')
-        self.sample2sample_distance_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH,-1))
+        sample2sample_distance_txt = wx.StaticText(self, -1, 'Sample Offset: ')
+        self.sample2sample_distance_tcl = InputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
         sample2sample_distance_hint = "Sample Aperture to Sample Distance"
         self.sample2sample_distance_tcl.SetValue(sample2sample_distance_value)
-        self.sample2sample_distance_tcl.SetToolTipString(\
-                                                sample2sample_distance_hint)
-        self.sample2sample_distance_sizer.AddMany([(sample2sample_distance_txt, 
-                                               0, wx.LEFT, 15),
-                            (self.sample2sample_distance_tcl, 0, wx.LEFT, 15),
-                            (sample2sample_distance_unit_txt,0, wx.LEFT, 10)])  
-
-
+        self.sample2sample_distance_tcl.SetToolTipString(sample2sample_distance_hint)
+        self.sample2sample_distance_sizer.AddMany([(sample2sample_distance_txt, 0, wx.LEFT, 15),
+                                                   (self.sample2sample_distance_tcl, 0, wx.LEFT, 15),
+                                                   (sample2sample_distance_unit_txt, 0, wx.LEFT, 10)])
 
     def _layout_sample2detector_distance(self):
@@ -354,23 +324,18 @@
         """
         # get the wavelength
-        sample2detector_distance_value = str(\
-                                    self.resolution.sample2detector_distance[0])
+        sample2detector_distance_value = str(self.resolution.sample2detector_distance[0])
 
         sample2detector_distance_unit_txt = wx.StaticText(self, -1, '[cm]')
-        sample2detector_distance_txt = wx.StaticText(self, -1, 
-                                'Sample Aperture to Detector Distance: ')
-        self.sample2detector_distance_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH,-1))
-        sample2detector_distance_hint = \
-                                "Sample Aperture to Detector Distance"
-        self.sample2detector_distance_tcl.SetValue(\
-                                                sample2detector_distance_value)
-        self.sample2detector_distance_tcl.SetToolTipString(\
-                                                sample2detector_distance_hint)
+        sample2detector_distance_txt = wx.StaticText(self, -1,
+                                                     'Sample Aperture to Detector Distance: ')
+        self.sample2detector_distance_tcl = InputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
+        sample2detector_distance_hint = "Sample Aperture to Detector Distance"
+        self.sample2detector_distance_tcl.SetValue(sample2detector_distance_value)
+        self.sample2detector_distance_tcl.SetToolTipString(sample2detector_distance_hint)
         self.sample2detector_distance_sizer.AddMany([\
-                        (sample2detector_distance_txt, 0, wx.LEFT, 15),        
+                        (sample2detector_distance_txt, 0, wx.LEFT, 15),
                         (self.sample2detector_distance_tcl, 0, wx.LEFT, 15),
-                        (sample2detector_distance_unit_txt,0, wx.LEFT, 10)])  
-        
+                        (sample2detector_distance_unit_txt, 0, wx.LEFT, 10)])
+
     def _layout_detector_size(self):
         """
@@ -379,21 +344,17 @@
         # get the wavelength
         detector_size_value = str(self.resolution.detector_size[0])
-        if len(self.resolution.detector_size)>1:
+        if len(self.resolution.detector_size) > 1:
             detector_size_value += ", "
             detector_size_value += str(self.resolution.detector_size[1])
         detector_size_unit_txt = wx.StaticText(self, -1, '')
-        detector_size_txt = wx.StaticText(self, -1, 
-                                'Number of Pixels on Detector: ')
-        self.detector_size_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH,-1))
+        detector_size_txt = wx.StaticText(self, -1, 'Number of Pixels on Detector: ')
+        self.detector_size_tcl = InputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
         detector_size_hint = "Number of Pixels on Detector"
         self.detector_size_tcl.SetValue(detector_size_value)
         self.detector_size_tcl.SetToolTipString(detector_size_hint)
-        self.detector_size_sizer.AddMany([(detector_size_txt, 0, 
-                                               wx.LEFT, 15),
-                                (self.detector_size_tcl, 0, wx.LEFT, 15),
-                                    (detector_size_unit_txt,0, wx.LEFT, 10)])  
-
-        
+        self.detector_size_sizer.AddMany([(detector_size_txt, 0, wx.LEFT, 15),
+                                          (self.detector_size_tcl, 0, wx.LEFT, 15),
+                                          (detector_size_unit_txt, 0, wx.LEFT, 10)])
+
     def _layout_detector_pix_size(self):
         """
@@ -402,27 +363,23 @@
         # get the detector_pix_size
         detector_pix_size_value = str(self.resolution.detector_pix_size[0])
-        if len(self.resolution.detector_pix_size)>1:
+        if len(self.resolution.detector_pix_size) > 1:
             detector_pix_size_value += ", "
             detector_pix_size_value += str(self.resolution.detector_pix_size[1])
         detector_pix_size_unit_txt = wx.StaticText(self, -1, '[cm]')
-        detector_pix_size_txt = wx.StaticText(self, -1, 
-                                'Detector Pixel Size: ')
-        self.detector_pix_size_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH,-1))
+        detector_pix_size_txt = wx.StaticText(self, -1, 'Detector Pixel Size: ')
+        self.detector_pix_size_tcl = InputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
         detector_pix_size_hint = "Detector Pixel Size"
         self.detector_pix_size_tcl.SetValue(detector_pix_size_value)
         self.detector_pix_size_tcl.SetToolTipString(detector_pix_size_hint)
-        self.detector_pix_size_sizer.AddMany([(detector_pix_size_txt, 0, 
-                                               wx.LEFT, 15),
-                                (self.detector_pix_size_tcl, 0, wx.LEFT, 15),
-                                (detector_pix_size_unit_txt,0, wx.LEFT, 10)])
-        
+        self.detector_pix_size_sizer.AddMany([(detector_pix_size_txt, 0, wx.LEFT, 15),
+                                              (self.detector_pix_size_tcl, 0, wx.LEFT, 15),
+                                              (detector_pix_size_unit_txt, 0, wx.LEFT, 10)])
+
     def _layout_input(self):
         """
         Fill the sizer containing inputs; qx, qy
         """
-        
-        q_title = wx.StaticText(self, -1, 
-                            "[Q Location of the Estimation]:")
+
+        q_title = wx.StaticText(self, -1, "[Q Location of the Estimation]:")
         # sizers for inputs
         inputQx_sizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -433,12 +390,8 @@
         qx_unit_txt = wx.StaticText(self, -1, '[1/A]  ')
         qy_unit_txt = wx.StaticText(self, -1, '[1/A]  ')
-        qx_name_txt = wx.StaticText(self, -1, 
-                                'Qx: ')
-        qy_name_txt = wx.StaticText(self, -1, 
-                                'Qy: ')
-        self.qx_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH*3,-1))
-        self.qy_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH*3,-1))
+        qx_name_txt = wx.StaticText(self, -1, 'Qx: ')
+        qy_name_txt = wx.StaticText(self, -1, 'Qy: ')
+        self.qx_tcl = InputTextCtrl(self, -1, size=(_BOX_WIDTH * 3, -1))
+        self.qy_tcl = InputTextCtrl(self, -1, size=(_BOX_WIDTH * 3, -1))
         qx_hint = "Type the Qx value."
         qy_hint = "Type the Qy value."
@@ -448,45 +401,37 @@
         self.qy_tcl.SetToolTipString(qy_hint)
         inputQx_sizer.AddMany([(qx_name_txt, 0, wx.LEFT, 15),
-                                    (self.qx_tcl, 0, wx.LEFT, 15),
-                                    (qx_unit_txt, 0, wx.LEFT, 15)])
+                               (self.qx_tcl, 0, wx.LEFT, 15),
+                               (qx_unit_txt, 0, wx.LEFT, 15)])
         inputQy_sizer.AddMany([(qy_name_txt, 0, wx.LEFT, 15),
-                                    (self.qy_tcl, 0, wx.LEFT, 15),
-                                    (qy_unit_txt, 0, wx.LEFT, 15)])
-        self.input_sizer.AddMany([(q_title, 0, wx.LEFT, 15), 
-                                    (inputQx_sizer, 0,
-                                     wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
-                                    (inputQy_sizer, 0, 
-                                     wx.EXPAND|wx.TOP|wx.BOTTOM, 5)])
-                                #(self.compute_button, 0, wx.LEFT, 30)])
-        
+                               (self.qy_tcl, 0, wx.LEFT, 15),
+                               (qy_unit_txt, 0, wx.LEFT, 15)])
+        self.input_sizer.AddMany([(q_title, 0, wx.LEFT, 15),
+                                  (inputQx_sizer, 0,
+                                   wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
+                                  (inputQy_sizer, 0,
+                                   wx.EXPAND | wx.TOP | wx.BOTTOM, 5)])
+
     def _layout_output(self):
         """
         Fill the sizer containing dQ|| and dQ+
         """
-        sigma_title = wx.StaticText(self, -1, 
-                        "[Standard Deviation of the Resolution Distribution]:")
-         # sizers for inputs
+        sigma_title = wx.StaticText(self, -1,
+                                    "[Standard Deviation of the Resolution Distribution]:")
+        # sizers for inputs
         outputQxy_sizer = wx.BoxSizer(wx.HORIZONTAL)
         outputQ_sizer = wx.BoxSizer(wx.HORIZONTAL)
-        sigma_unit = '['+'1/A' +']'
-        self.sigma_r_txt = wx.StaticText(self, -1, 
-                                           'Sigma_x:   ')
-        self.sigma_r_tcl = OutputTextCtrl(self, -1, 
-                                                 size=(_BOX_WIDTH*0.8,-1))
-        self.sigma_phi_txt = wx.StaticText(self, -1, 
-                                           'Sigma_y:')
-        self.sigma_phi_tcl = OutputTextCtrl(self, -1, 
-                                                 size=(_BOX_WIDTH*0.8,-1))
-        self.sigma_lamd_txt = wx.StaticText(self, -1, 
-                                           'Sigma_lamd:')
-        self.sigma_lamd_tcl = OutputTextCtrl(self, -1, 
-                                                 size=(_BOX_WIDTH*0.7,-1))
+        sigma_unit = '[' + '1/A' + ']'
+        self.sigma_r_txt = wx.StaticText(self, -1, 'Sigma_x:   ')
+        self.sigma_r_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH * 0.8, -1))
+        self.sigma_phi_txt = wx.StaticText(self, -1, 'Sigma_y:')
+        self.sigma_phi_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH * 0.8, -1))
+        self.sigma_lamd_txt = wx.StaticText(self, -1, 'Sigma_lamd:')
+        self.sigma_lamd_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH * 0.7, -1))
         sigma_1d_txt = wx.StaticText(self, -1, '( 1D:   Sigma:')
-        self.sigma_1d_tcl = OutputTextCtrl(self, -1, 
-                                                 size=(_BOX_WIDTH*0.7,-1))
+        self.sigma_1d_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH * 0.7, -1))
         sigmax_hint = " The x component of the geometric resolution,"
-        sigmax_hint +=  " excluding sigma_lamda."
+        sigmax_hint += " excluding sigma_lamda."
         sigmay_hint = " The y component of the geometric resolution,"
-        sigmay_hint +=  " excluding sigma_lamda."
+        sigmay_hint += " excluding sigma_lamda."
         sigma_hint_lamd = " The wavelength contribution in the radial direction"
         sigma_hint_lamd += ".\n Note: The phi component is always zero."
@@ -499,27 +444,26 @@
         sigma_phi_unit_txt = wx.StaticText(self, -1, sigma_unit)
         sigma_lamd_unit_txt = wx.StaticText(self, -1, sigma_unit)
-        sigma_1d_unit_txt = wx.StaticText(self, -1, sigma_unit+' )')
+        sigma_1d_unit_txt = wx.StaticText(self, -1, sigma_unit + ' )')
         outputQxy_sizer.AddMany([(self.sigma_r_txt, 0, wx.LEFT, 15),
-                                    (self.sigma_r_tcl, 0, wx.LEFT, 15),
-                                    (sigma_r_unit_txt, 0, wx.LEFT, 15),
-                                    (self.sigma_phi_txt, 0, wx.LEFT, 15),
-                                    (self.sigma_phi_tcl, 0, wx.LEFT, 15),
-                                    (sigma_phi_unit_txt, 0, wx.LEFT, 15)])
+                                 (self.sigma_r_tcl, 0, wx.LEFT, 15),
+                                 (sigma_r_unit_txt, 0, wx.LEFT, 15),
+                                 (self.sigma_phi_txt, 0, wx.LEFT, 15),
+                                 (self.sigma_phi_tcl, 0, wx.LEFT, 15),
+                                 (sigma_phi_unit_txt, 0, wx.LEFT, 15)])
         outputQ_sizer.AddMany([(self.sigma_lamd_txt, 0, wx.LEFT, 15),
-                                    (self.sigma_lamd_tcl, 0, wx.LEFT, 15),
-                                    (sigma_lamd_unit_txt, 0, wx.LEFT, 15),
-                                    (sigma_1d_txt, 0, wx.LEFT, 15),
-                                    (self.sigma_1d_tcl, 0, wx.LEFT, 15),
-                                    (sigma_1d_unit_txt, 0, wx.LEFT, 15)])
-        self.output_sizer.AddMany([(sigma_title, 0, wx.LEFT, 15), 
-                                    (outputQxy_sizer, 0,
-                                     wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
-                                    (outputQ_sizer, 0, 
-                                     wx.EXPAND|wx.TOP|wx.BOTTOM, 5)])
-        
-    
+                               (self.sigma_lamd_tcl, 0, wx.LEFT, 15),
+                               (sigma_lamd_unit_txt, 0, wx.LEFT, 15),
+                               (sigma_1d_txt, 0, wx.LEFT, 15),
+                               (self.sigma_1d_tcl, 0, wx.LEFT, 15),
+                               (sigma_1d_unit_txt, 0, wx.LEFT, 15)])
+        self.output_sizer.AddMany([(sigma_title, 0, wx.LEFT, 15),
+                                   (outputQxy_sizer, 0,
+                                    wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
+                                   (outputQ_sizer, 0,
+                                    wx.EXPAND | wx.TOP | wx.BOTTOM, 5)])
+
     def _layout_hint(self):
         """
-        Fill the sizer containing hint 
+        Fill the sizer containing hint
         """
         hint_msg = ""
@@ -529,29 +473,29 @@
         self.hint_txt = wx.StaticText(self, -1, hint_msg)
         self.hint_sizer.AddMany([(self.hint_txt, 0, wx.LEFT, 15)])
-    
-    def _layout_button(self):  
+
+    def _layout_button(self):
         """
         Do the layout for the button widgets
-        """ 
-
-        id = wx.NewId()
-        self.reset_button = wx.Button(self, id, "Reset")
+        """
+
+        wx_id = wx.NewId()
+        self.reset_button = wx.Button(self, wx_id, "Reset")
         hint_on_reset = "..."
         self.reset_button.SetToolTipString(hint_on_reset)
-        self.Bind(wx.EVT_BUTTON, self.on_reset, id=id)
+        self.Bind(wx.EVT_BUTTON, self.on_reset, id=wx_id)
         #compute button
-        id = wx.NewId()
-        self.compute_button = wx.Button(self, id, "Compute")
+        wx_id = wx.NewId()
+        self.compute_button = wx.Button(self, wx_id, "Compute")
         hint_on_compute = "Compute... Please wait until finished."
         self.compute_button.SetToolTipString(hint_on_compute)
-        self.Bind(wx.EVT_BUTTON, self.on_compute, id=id)
+        self.Bind(wx.EVT_BUTTON, self.on_compute, id=wx_id)
         #help button
-        id = wx.NewId()
-        self.help_button = wx.Button(self, id, "HELP")
+        wx_id = wx.NewId()
+        self.help_button = wx.Button(self, wx_id, "HELP")
         hint_on_help = "Help on using the Resolution Calculator"
         self.help_button.SetToolTipString(hint_on_help)
-        self.Bind(wx.EVT_BUTTON, self.on_help, id=id)
+        self.Bind(wx.EVT_BUTTON, self.on_help, id=wx_id)
         # close button
-        self.bt_close = wx.Button(self, wx.ID_CANCEL,'Close')
+        self.bt_close = wx.Button(self, wx.ID_CANCEL, 'Close')
         self.bt_close.Bind(wx.EVT_BUTTON, self.on_close)
         self.bt_close.SetToolTipString("Close this window.")
@@ -563,16 +507,14 @@
                                    (self.bt_close, 0, wx.LEFT, 15)])
         self.compute_button.SetFocus()
-        
+
     def _layout_image(self):
         """
         Layout for image plot
         """
-        color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND)
-
         # Contribution by James C.
         # Instantiate a figure object that will contain our plots.
         # Make the fig a little smaller than the default
-        self.figure = Figure(figsize=(6.5, 6), facecolor = 'white')
-        
+        self.figure = Figure(figsize=(6.5, 6), facecolor='white')
+
         # Initialize the figure canvas, mapping the figure object to the plot
         # engine backend.
@@ -588,5 +530,5 @@
         self.fm = FigureManagerBase(self.canvas, 1)
         _pylab_helpers.Gcf.set_active(self.fm)
-        
+
         # Instantiate the matplotlib navigation toolbar and explicitly show it.
         mpl_toolbar = Toolbar(self.canvas)
@@ -599,5 +541,5 @@
         # Compute before adding the canvas to the sizer
         self.on_compute()
-        
+
         # Fill up the sizer
         if IS_WIN:
@@ -605,15 +547,11 @@
         else:
             gap = 13
-        self.vertical_r_sizer.Add(self.canvas, 0, 
-                                       wx.ALL|wx.EXPAND, 2) 
-        self.vertical_r_spacer.Add((0, gap)) 
-        self.vertical_r_spacer.Add(self.vertical_r_sizer, 0, 
-                                       wx.ALL|wx.EXPAND, 2)
-        self.vertical_r_spacer.Add((0, gap)) 
-        self.vertical_r_spacer.Add(wx.StaticLine(self), 0, 
-                                       wx.ALL|wx.EXPAND, 2)
-        self.vertical_r_spacer.Add(mpl_toolbar, 0,  wx.ALL|wx.EXPAND, 2)
-
-        
+        self.vertical_r_sizer.Add(self.canvas, 0, wx.ALL | wx.EXPAND, 2)
+        self.vertical_r_spacer.Add((0, gap))
+        self.vertical_r_spacer.Add(self.vertical_r_sizer, 0, wx.ALL | wx.EXPAND, 2)
+        self.vertical_r_spacer.Add((0, gap))
+        self.vertical_r_spacer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 2)
+        self.vertical_r_spacer.Add(mpl_toolbar, 0, wx.ALL | wx.EXPAND, 2)
+
     def _do_layout(self):
         """
@@ -621,10 +559,8 @@
         """
         #  Title of parameters
-        instrument_txt = wx.StaticText(self, -1, 
-                                '[Instrumental Parameters]:')
+        instrument_txt = wx.StaticText(self, -1, '[Instrumental Parameters]:')
         # Build individual layouts
         self._define_structure()
         self._layout_mass()
-        #self._layout_intensity()
         self._layout_wavelength()
         self._layout_wavelength_spread()
@@ -642,71 +578,68 @@
         # Fill the sizers
         self.boxsizer_source.AddMany([(instrument_txt, 0,
-                                       wx.EXPAND|wx.LEFT, 15),
+                                       wx.EXPAND | wx.LEFT, 15),
                                       (self.mass_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
-                                      #(self.intensity_sizer, 0,
-                                      #wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
                                       (self.wavelength_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
                                       (self.wavelength_spread_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
                                       (self.source_aperture_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
                                       (self.sample_aperture_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
                                       (self.source2sample_distance_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
                                       (self.sample2detector_distance_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
                                       (self.sample2sample_distance_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
                                       (self.detector_size_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
                                       (self.detector_pix_size_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
-                                      (wx.StaticLine(self), 0, 
-                                       wx.ALL|wx.EXPAND, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
+                                      (wx.StaticLine(self), 0,
+                                       wx.ALL | wx.EXPAND, 5),
                                       (self.input_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5),
-                                      (wx.StaticLine(self), 0, 
-                                       wx.ALL|wx.EXPAND, 5),
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5),
+                                      (wx.StaticLine(self), 0,
+                                       wx.ALL | wx.EXPAND, 5),
                                       (self.output_sizer, 0,
-                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5)])
+                                       wx.EXPAND | wx.TOP | wx.BOTTOM, 5)])
         self.vertical_l_sizer.AddMany([(self.boxsizer_source, 0, wx.ALL, 10),
-                                       (wx.StaticLine(self), 0, 
-                                       wx.ALL|wx.EXPAND, 5),
-                                  (self.button_sizer, 0,
-                                    wx.EXPAND|wx.TOP|wx.BOTTOM, 5)])
+                                       (wx.StaticLine(self), 0,
+                                        wx.ALL | wx.EXPAND, 5),
+                                       (self.button_sizer, 0,
+                                        wx.EXPAND | wx.TOP | wx.BOTTOM, 5)])
         self.main_sizer.Add(self.vertical_l_sizer, 0, wx.ALL, 10)
-        
-        # Build image plot layout                     
+
+        # Build image plot layout
         self._layout_image()
         # Add a vertical static line
-        self.main_sizer.Add( wx.StaticLine(self, -1, (2, 2), 
-                            (2,PANEL_HEIGHT * 0.94), style = wx.LI_VERTICAL))
+        self.main_sizer.Add(wx.StaticLine(self, -1, (2, 2),
+                                          (2, PANEL_HEIGHT * 0.94), style=wx.LI_VERTICAL))
         # Add the plot to main sizer
         self.main_sizer.Add(self.vertical_r_spacer, 0, wx.ALL, 10)
         self.SetSizer(self.main_sizer)
         self.SetAutoLayout(True)
-        
-
-    def on_help(self, event):    
+
+    def on_help(self, event):
         """
         Bring up the Resolution calculator Documentation whenever
-        the HELP button is clicked. 
-        
+        the HELP button is clicked.
+
         Calls DocumentationWindow with the path of the location within the
-        documentation tree (after /doc/ ....".  Note that when using old 
-        versions of Wx (before 2.9) and thus not the release version of 
-        installers, the help comes up at the top level of the file as 
+        documentation tree (after /doc/ ....".  Note that when using old
+        versions of Wx (before 2.9) and thus not the release version of
+        installers, the help comes up at the top level of the file as
         webbrowser does not pass anything past the # to the browser when it is
         running "file:///...."
-    
+
     :param evt: Triggers on clicking the help button
     """
-                
+
         _TreeLocation = "user/perspectives/calculator/resolution_calculator_help.html"
-        _doc_viewer = DocumentationWindow(self, -1, \
-             _TreeLocation,"Resolution Calculator Help")
+        _doc_viewer = DocumentationWindow(self, -1,
+                                          _TreeLocation, "Resolution Calculator Help")
 
     def on_close(self, event):
@@ -724,12 +657,11 @@
         # Close panel
         self.parent.OnClose(None)
-        
-    
-    def on_compute(self, event = None):  
+
+    def on_compute(self, event=None):
         """
         Execute the computation of resolution
         """
         wx.CallAfter(self.on_compute_call, event)
-        
+
     def on_compute_call(self, event=None):
         """
@@ -743,14 +675,14 @@
 
         # message
-        status_type = 'progress' 
+        status_type = 'progress'
         msg = 'Calculating...'
         self._status_info(msg, status_type)
 
-        status_type = 'stop'           
+        status_type = 'stop'
         # Q min max list default
-        qx_min = []   
-        qx_max = [] 
-        qy_min = [] 
-        qy_max = [] 
+        qx_min = []
+        qx_max = []
+        qy_min = []
+        qy_max = []
         # possible max qrange
         self.resolution.qxmin_limit = 0
@@ -773,8 +705,6 @@
             if wave_input != None:
                 wavelength, wavelength_spread = wave_input
-    
-            #self.resolution.set_wave(float(wavelength))
+
             self.resolution.set_wave(wavelength)
-            #self.resolution.set_wave_spread(float(wavelength_spread))
             self.resolution.set_wave_spread(wavelength_spread)
             source_aperture_size = self.source_aperture_tcl.GetValue()
@@ -804,6 +734,5 @@
             self.qx = self._string2inputlist(self.qx_tcl.GetValue())
             self.qy = self._string2inputlist(self.qy_tcl.GetValue())
-            
-            
+
             # Find min max of qs
             xmin = min(self.qx)
@@ -825,13 +754,13 @@
         if q_input != None:
             self.qx, self.qy = q_input
-        
+
         # Make list of q min max for mapping
-        for length in range(len(self.qx)):
+        for i in range(len(self.qx)):
             qx_min.append(xmin)
             qx_max.append(xmax)
-        for length in range(len(self.qy)):
+        for i in range(len(self.qy)):
             qy_min.append(ymin)
             qy_max.append(ymax)
-        
+
         # Compute the resolution
         if self.image != None:
@@ -845,32 +774,28 @@
         # Compute and get the image plot
         try:
-            from sas.perspectives.calculator.resolcal_thread \
-                                                import CalcRes as thread
+            from sas.perspectives.calculator.resolcal_thread import CalcRes as thread
             self.sigma_strings = '\nResolution: Computation is finished. \n'
-            cal_res = thread(func = self._map_func,
-                         qx = self.qx,
-                         qy = self.qy,
-                         qx_min = qx_min,
-                         qx_max = qx_max,
-                         qy_min = qy_min,
-                         qy_max = qy_max,
-                         image = self.image,
-                         completefn = self.complete)
-            #self.image = map(self._map_func, self.qx, self.qy, 
-            #                 qx_min, qx_max, qy_min, qy_max)[0]
+            cal_res = thread(func=self._map_func,
+                             qx=self.qx,
+                             qy=self.qy,
+                             qx_min=qx_min,
+                             qx_max=qx_max,
+                             qy_min=qy_min,
+                             qy_max=qy_max,
+                             image=self.image,
+                             completefn=self.complete)
             cal_res.queue()
             msg = "Computation is in progress..."
-            #msg = "Finished the resolution computation..."
             status_type = 'progress'
             self._status_info(msg, status_type)
         except:
             raise
-            
+
     def complete(self, image, elapsed=None):
         """
         Callafter complete: wx call after needed for stable output
         """
-        wx.CallAfter(self.complete_cal, image, elapsed)   
-        
+        wx.CallAfter(self.complete_cal, image, elapsed)
+
     def complete_cal(self, image, elapsed=None):
         """
@@ -881,5 +806,5 @@
         wave_list, _ = self.resolution.get_wave_list()
         if len(wave_list) > 1 and wave_list[-1] == max(wave_list):
-            # draw a green rectangle(limit for the longest wavelength 
+            # draw a green rectangle(limit for the longest wavelength
             # to be involved) for tof inputs
             self._draw_lines(self.image, color='g')
@@ -887,13 +812,12 @@
         # Draw image
         self.image.draw()
-        #self.vertical_r_sizer.Layout()
-        
-        # Get and format the sigmas 
+
+        # Get and format the sigmas
         sigma_r = self.format_number(self.resolution.sigma_1)
         sigma_phi = self.format_number(self.resolution.sigma_2)
         sigma_lamd = self.format_number(self.resolution.sigma_lamd)
-        sigma_1d =  self.format_number(self.resolution.sigma_1d)
-
-        # Set output values 
+        sigma_1d = self.format_number(self.resolution.sigma_1d)
+
+        # Set output values
         self.sigma_r_tcl.SetValue(str(sigma_r))
         self.sigma_phi_tcl.SetValue(str(sigma_phi))
@@ -904,5 +828,5 @@
         status_type = 'stop'
         self._status_info(msg, status_type)
-        
+
     def _draw_lines(self, image=None, color='r'):
         """
@@ -935,8 +859,8 @@
         # Draw zero axis lines
         if qy_min < 0 and qy_max >= 0:
-            image.axhline(linewidth = 1)
+            image.axhline(linewidth=1)
         if qx_min < 0 and qx_max >= 0:
-            image.axvline(linewidth = 1)
-            
+            image.axvline(linewidth=1)
+
         # Find x and y ratio values to draw the detector outline
         x_min = fabs(detector_qx_min - qx_min) / (qx_max - qx_min)
@@ -947,23 +871,19 @@
         # Draw Detector outline
         if detector_qy_min >= qy_min:
-            image.axhline(y = detector_qy_min + 0.0002,
-                               xmin = x_min,
-                               xmax = x_max, 
-                               linewidth = 2, color=color)
+            image.axhline(y=detector_qy_min + 0.0002,
+                          xmin=x_min, xmax=x_max,
+                          linewidth=2, color=color)
         if detector_qy_max <= qy_max:
-            image.axhline(y = detector_qy_max - 0.0002, 
-                               xmin = x_min, 
-                               xmax = x_max, 
-                               linewidth = 2, color=color)
+            image.axhline(y=detector_qy_max - 0.0002,
+                          xmin=x_min, xmax=x_max,
+                          linewidth=2, color=color)
         if detector_qx_min >= qx_min:
-            image.axvline(x = detector_qx_min + 0.0002, 
-                               ymin = y_min, 
-                               ymax = y_max, 
-                               linewidth = 2, color=color)
+            image.axvline(x=detector_qx_min + 0.0002,
+                          ymin=y_min, ymax=y_max,
+                          linewidth=2, color=color)
         if detector_qx_max <= qx_max:
-            image.axvline(x = detector_qx_max - 0.0002, 
-                               ymin = y_min, 
-                               ymax = y_max, 
-                               linewidth = 2, color=color)
+            image.axvline(x=detector_qx_max - 0.0002,
+                          ymin=y_min, ymax=y_max,
+                          linewidth=2, color=color)
         xmin = min(self.qx)
         xmax = max(self.qx)
@@ -974,21 +894,21 @@
                         ymin < detector_qy_min or ymax > detector_qy_max:
                 # message
-                status_type = 'stop' 
+                status_type = 'stop'
                 msg = 'At least one q value located out side of\n'
                 msg += " the detector range (%s < qx < %s, %s < qy < %s),\n" % \
-                        (self.format_number(detector_qx_min), 
+                        (self.format_number(detector_qx_min),
                          self.format_number(detector_qx_max),
-                         self.format_number(detector_qy_min), 
+                         self.format_number(detector_qy_min),
                          self.format_number(detector_qy_max))
                 msg += " is ignored in computation.\n"
-                
+
                 self._status_info(msg, status_type)
                 wx.MessageBox(msg, 'Warning')
-        
-    def _map_func(self, qx, qy, qx_min, qx_max, qy_min, qy_max):    
+
+    def _map_func(self, qx, qy, qx_min, qx_max, qy_min, qy_max):
         """
         Prepare the Mapping for the computation
         : params qx, qy, qx_min, qx_max, qy_min, qy_max:
-        
+
         : return: image (pylab)
         """
@@ -999,11 +919,12 @@
             raise
         # calculate 2D resolution distribution image
-        image = self.resolution.compute_and_plot(qx_value, qy_value, 
-                                 qx_min, qx_max, qy_min, qy_max, 
-                                 self.det_coordinate)
+        image = self.resolution.compute_and_plot(qx_value, qy_value,
+                                                 qx_min, qx_max, qy_min, qy_max,
+                                                 self.det_coordinate)
         # record sigmas
-        self.sigma_strings += " At Qx = %s, Qy = %s; \n"% (qx_value, qy_value)
+        self.sigma_strings += " At Qx = %s, Qy = %s; \n" % (qx_value, qy_value)
         self._sigma_strings()
         return image
+
     def _sigma_strings(self):
         """
@@ -1013,17 +934,17 @@
         sigma_phi = self.format_number(self.resolution.sigma_2)
         sigma_lamd = self.format_number(self.resolution.sigma_lamd)
-        sigma_1d =  self.format_number(self.resolution.sigma_1d)
-        # Set output values 
-        self.sigma_strings += "   sigma_x = %s\n"% sigma_r
-        self.sigma_strings += "   sigma_y = %s\n"% sigma_phi
-        self.sigma_strings += "   sigma_lamd = %s\n"% sigma_lamd
-        self.sigma_strings += "   sigma_1D = %s\n"% sigma_1d
-    
-    def _validate_q_input(self, qx, qy):    
+        sigma_1d = self.format_number(self.resolution.sigma_1d)
+        # Set output values
+        self.sigma_strings += "   sigma_x = %s\n" % sigma_r
+        self.sigma_strings += "   sigma_y = %s\n" % sigma_phi
+        self.sigma_strings += "   sigma_lamd = %s\n" % sigma_lamd
+        self.sigma_strings += "   sigma_1D = %s\n" % sigma_1d
+
+    def _validate_q_input(self, qx, qy):
         """
         Check if q inputs are valid
         : params qx:  qx as a list
         : params qy:  qy as a list
-        
+
         : return: True/False
         """
@@ -1031,5 +952,5 @@
         if qx.__class__.__name__ != 'list':
             return None
-        if qy.__class__.__name__ != 'list' :
+        if qy.__class__.__name__ != 'list':
             return None
         if len(qx) < 1:
@@ -1049,6 +970,6 @@
         if qx == None or qy == None:
             return None
-        return qx, qy 
-     
+        return qx, qy
+
     def on_reset(self, event):
         """
@@ -1057,5 +978,5 @@
         # skip for another event
         if event != None:
-            event.Skip()  
+            event.Skip()
         # init resolution_calculator
         self.resolution = ResolutionCalculator()
@@ -1073,5 +994,5 @@
         self.spectrum_cb.Show(False)
         source_aperture_value = str(self.resolution.source_aperture_size[0])
-        if len(self.resolution.source_aperture_size)>1:
+        if len(self.resolution.source_aperture_size) > 1:
             source_aperture_value += ", "
             source_aperture_value += \
@@ -1079,5 +1000,5 @@
         self.source_aperture_tcl.SetValue(str(source_aperture_value))
         sample_aperture_value = str(self.resolution.sample_aperture_size[0])
-        if len(self.resolution.sample_aperture_size)>1:
+        if len(self.resolution.sample_aperture_size) > 1:
             sample_aperture_value += ", "
             sample_aperture_value += \
@@ -1095,10 +1016,10 @@
                                             sample2detector_distance_value)
         detector_size_value = str(self.resolution.detector_size[0])
-        if len(self.resolution.detector_size)>1:
+        if len(self.resolution.detector_size) > 1:
             detector_size_value += ", "
             detector_size_value += str(self.resolution.detector_size[1])
         self.detector_size_tcl.SetValue(detector_size_value)
         detector_pix_size_value = str(self.resolution.detector_pix_size[0])
-        if len(self.resolution.detector_pix_size)>1:
+        if len(self.resolution.detector_pix_size) > 1:
             detector_pix_size_value += ", "
             detector_pix_size_value += str(self.resolution.detector_pix_size[1])
@@ -1120,10 +1041,10 @@
         msg = " Finished the resetting..."
         self._status_info(msg, 'stop')
-        
+
     def format_number(self, value=None):
         """
-        Return a float in a standardized, human-readable formatted string 
-        """
-        try: 
+        Return a float in a standardized, human-readable formatted string
+        """
+        try:
             value = float(value)
         except:
@@ -1132,6 +1053,6 @@
 
         output = "%-7.4g" % value
-        return output.lstrip().rstrip()  
-     
+        return output.lstrip().rstrip()
+
     def _string2list(self, string):
         """
@@ -1139,9 +1060,8 @@
         """
         new_string = []
-        # check the number of floats 
+        # check the number of floats
         try:
             strg = float(string)
             new_string.append(strg)
-            #new_string.append(0)
         except:
             string_split = string.split(',')
@@ -1160,9 +1080,9 @@
 
         return new_string
-    
+
     def _string2inputlist(self, string):
         """
         Change NNN, NNN,... to list,ie. [NNN, NNN,...] where NNN is a number
-        
+
         : return new_string: string like list
         """
@@ -1175,15 +1095,14 @@
                 new_string.append(value)
             except:
-                pass
-        
+                logging.error(sys.exc_value)
+
         return new_string
-    
+
     def _str2longlist(self, string):
         """
         Change NNN, NNN,... to list, NNN - NNN ; NNN to list, or float to list
-        
+
         : return new_string: string like list
         """
-        #new_string = []
         msg = "Wrong format of intputs."
         try:
@@ -1196,5 +1115,5 @@
             else:
                 try:
-                    # has a '-' 
+                    # has a '-'
                     if string.count('-') > 0:
                         value = string.split('-')
@@ -1202,15 +1121,15 @@
                             # has a ';'
                             last_list = value[1].split(';')
-                            num =  math.ceil(float(last_list[1]))
-                            max = float(last_list[0])
+                            num = math.ceil(float(last_list[1]))
+                            max_value = float(last_list[0])
                             self.num_wave = num
                         else:
                             # default num
                             num = self.num_wave
-                            max = float(value[1])
-                        min = float(value[0])
+                            max_value = float(value[1])
+                        min_value = float(value[0])
                         # make a list
-                        bin_size = math.fabs(max - min) / (num - 1)
-                        out = [min + bin_size * bnum for bnum in range(num)]
+                        bin_size = math.fabs(max_value - min_value) / (num - 1)
+                        out = [min_value + bin_size * bnum for bnum in range(num)]
                         return out
                     if string.count(',') > 0:
@@ -1218,6 +1137,5 @@
                         return out
                 except:
-                    pass
-                #    wx.MessageBox(msg, 'Warning')
+                    logging.error(sys.exc_value)
 
     def _on_xy_coordinate(self, event=None):
@@ -1226,11 +1144,11 @@
         """
         if event != None:
-            event.Skip()        
-        # Set the coordinate in Cartesian       
+            event.Skip()
+        # Set the coordinate in Cartesian
         self.det_coordinate = 'cartesian'
         self.sigma_r_txt.SetLabel('Sigma_x:')
         self.sigma_phi_txt.SetLabel('Sigma_y:')
         self._onparamEnter()
-        
+
     def _on_rp_coordinate(self, event=None):
         """
@@ -1238,12 +1156,12 @@
         """
         if event != None:
-            event.Skip()        
-        # Set the coordinate in polar            
+            event.Skip()
+        # Set the coordinate in polar
         self.det_coordinate = 'polar'
         self.sigma_r_txt.SetLabel('Sigma_r:   ')
         self.sigma_phi_txt.SetLabel('Sigma_phi:')
         self._onparamEnter()
-        
-    def _status_info(self, msg = '', type = "update"):
+
+    def _status_info(self, msg='', type="update"):
         """
         Status msg
@@ -1252,5 +1170,5 @@
             label = "Compute"
             able = True
-        else:   
+        else:
             label = "Wait..."
             able = False
@@ -1259,15 +1177,15 @@
         self.compute_button.SetToolTipString(label)
         if self.parent.parent != None:
-            wx.PostEvent(self.parent.parent, 
-                             StatusEvent(status = msg, type = type ))
-
-
-    def _onparamEnter(self, event = None):
+            wx.PostEvent(self.parent.parent,
+                         StatusEvent(status=msg, type=type))
+
+
+    def _onparamEnter(self, event=None):
         """
         On Text_enter_callback, perform compute
         """
         self.on_compute()
-        
-    def _on_source_selection(self, event = None):
+
+    def _on_source_selection(self, event=None):
         """
         On source combobox selection
@@ -1280,5 +1198,5 @@
         selection = combo.GetValue()
         mass = self.source_mass[selection]
-        self.resolution.set_neutron_mass(mass)   
+        self.resolution.set_neutron_mass(mass)
         source_hint = "Source Selection: Affect on"
         source_hint += " the gravitational contribution.\n"
@@ -1287,6 +1205,6 @@
         #source_tip.SetTip(source_hint)
         self.mass_txt.ToolTip.SetTip(source_hint)
-        
-    def _on_source_color(self, event = None):
+
+    def _on_source_color(self, event=None):
         """
         On source color combobox selection
@@ -1314,5 +1232,5 @@
             self.spectrum_txt.Show(True)
             self.spectrum_cb.Show(True)
-          
+
         else:
             wavelength = self.resolution.get_wavelength()
@@ -1323,7 +1241,7 @@
             self.spectrum_txt.Show(False)
             self.spectrum_cb.Show(False)
-        self.wavelength_sizer.Layout() 
+        self.wavelength_sizer.Layout()
         self.Layout()
-        
+
     def _on_spectrum_cb(self, event=None):
         """
@@ -1345,5 +1263,5 @@
                 return
             try:
-                basename  = os.path.basename(path)
+                basename = os.path.basename(path)
                 if basename not in self.spectrum_dic.keys():
                     self.spectrum_cb.Append(basename)
@@ -1354,15 +1272,14 @@
             except:
                 raise
-        
+
         self.resolution.set_spectrum(self.spectrum_dic[selection])
-                             
+
     def _selectDlg(self):
         """
         open a dialog file to select a customized spectrum
         """
-        dlg = wx.FileDialog(self, 
-                "Choose a wavelength spectrum file: Intensity vs. wavelength",
-                self.parent.parent.get_save_location() , "", 
-                "*.*", wx.OPEN)
+        dlg = wx.FileDialog(self,
+                            "Choose a wavelength spectrum file: Intensity vs. wavelength",
+                            self.parent.parent.get_save_location() , "", "*.*", wx.OPEN)
         path = None
         if dlg.ShowModal() == wx.ID_OK:
@@ -1370,21 +1287,21 @@
         dlg.Destroy()
         return path
-        
+
     def _read_file(self, path):
         """
         Read two columns file as tuples of numpy array
-        
+
         :param path: the path to the file to read
-        
+
         """
         try:
             if path == None:
                 wx.PostEvent(self.parent.parent, StatusEvent(status=\
-                            " Selected Distribution was not loaded: %s"%path))
+                            " Selected Distribution was not loaded: %s" % path))
                 return None, None
             input_f = open(path, 'r')
             buff = input_f.read()
             lines = buff.split('\n')
-            
+
             wavelength = []
             intensity = []
@@ -1398,16 +1315,16 @@
                 except:
                     # Skip non-data lines
-                    pass
-                
+                    logging.error(sys.exc_value)
+
             return [wavelength, intensity]
         except:
-            raise 
-        
+            raise
+
 class ResolutionWindow(widget.CHILD_FRAME):
     """
     Resolution Window
     """
-    def __init__(self, parent = None, manager=None, 
-                 title = "SAS Resolution Estimator",
+    def __init__(self, parent=None, manager=None,
+                 title="SAS Resolution Estimator",
                  size=(PANEL_WIDTH * 2, PANEL_HEIGHT), *args, **kwds):
         kwds['title'] = title
@@ -1420,6 +1337,6 @@
         self.SetPosition((25, 10))
         self.Show(True)
-    
-    def OnClose(self, event):  
+
+    def OnClose(self, event):
         """
         On close event
@@ -1428,11 +1345,11 @@
         if self.manager != None:
             self.manager.cal_res_frame = None
-        self.Destroy() 
-
-        
-if __name__ == "__main__": 
+        self.Destroy()
+
+
+if __name__ == "__main__":
     app = wx.PySimpleApp()
     widget.CHILD_FRAME = wx.Frame
-    frame = ResolutionWindow()    
+    frame = ResolutionWindow()
     frame.Show(True)
-    app.MainLoop()     
+    app.MainLoop()
