Index: calculatorview/license.txt
===================================================================
--- calculatorview/license.txt	(revision be6e99a22b75fabe8bc1f73e57dad1b73dbeb279)
+++ calculatorview/license.txt	(revision be6e99a22b75fabe8bc1f73e57dad1b73dbeb279)
@@ -0,0 +1,13 @@
+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. 
+
+If you use DANSE applications to do scientific research that leads to publication, 
+we ask that you acknowledge the use of the software with the following sentence:
+
+"This work benefited from DANSE software developed under NSF award DMR-0520547." 
+
+See the DANSE project web site for license information:
+http://wiki.cacr.caltech.edu/danse/index.php/Main_Page
+
+copyright 2009, University of Tennessee for the DANSE project
Index: calculatorview/perspectives/calculator/resolution_calculator_panel.py
===================================================================
--- calculatorview/perspectives/calculator/resolution_calculator_panel.py	(revision c83a5afa3896540ff531890e044ae7d6e85aeba1)
+++ calculatorview/perspectives/calculator/resolution_calculator_panel.py	(revision be6e99a22b75fabe8bc1f73e57dad1b73dbeb279)
@@ -32,5 +32,5 @@
 #Slit length panel size 
 if sys.platform.count("win32") > 0:
-    PANEL_WIDTH = 535
+    PANEL_WIDTH = 525
     PANEL_HEIGHT = 653
     FONT_VARIANT = 0
@@ -39,5 +39,12 @@
     PANEL_HEIGHT = 692
     FONT_VARIANT = 1
- 
+
+_SOURCE_MASS = {'Alpha':6.64465620E-24,
+                'Deuteron':3.34358320E-24,
+                'Neutron':1.67492729E-24, 
+                'Photon': 0.0,
+                'Proton':1.67262137E-24,
+                'Triton':5.00826667E-24}
+
 class ResolutionCalculatorPanel(ScrolledPanel):
     """
@@ -71,9 +78,10 @@
         # Object that receive status event
         self.resolution = ResolutionCalculator()
-     
+        # Source selection dic
+        self.source_mass = _SOURCE_MASS
         #layout attribute
         self.hint_sizer = None
         # detector coordinate of estimation of sigmas
-        self.det_coordinate = 'polar'
+        self.det_coordinate = 'cartesian'
 
         self._do_layout()
@@ -116,15 +124,23 @@
         # get the mass
         mass_value = str(self.resolution.mass)
-        mass_unit_txt = wx.StaticText(self, -1, '[g]')
-        mass_txt = wx.StaticText(self, -1, 
-                                'Mass: ')
-        self.mass_tcl = InputTextCtrl(self, -1, 
-                                         size=(_BOX_WIDTH,-1))
-        mass_hint = "Mass of Neutrons"
-        self.mass_tcl.SetValue(mass_value)
-        self.mass_tcl.SetToolTipString(mass_hint)
-        self.mass_sizer.AddMany([(mass_txt, 0, wx.LEFT, 15),
-                                    (self.mass_tcl, 0, wx.LEFT, 15),
-                                    (mass_unit_txt,0, wx.LEFT, 10)])   
+        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|wx.CB_SORT,
+                                name = '%s'%mass_value)
+        for key, value in self.source_mass.iteritems():
+            name_source = str(key)
+            self.source_cb.Append(name_source, name_source)
+            self.source_cb.SetStringSelection("Neutron") 
+        wx.EVT_COMBOBOX(self.source_cb,-1, self._on_source_selection)      
+        source_hint = "Source Selection: Affect on"
+        source_hint += " the gravitational contribution.\n"
+        source_hint += "Mass of %s: m = %s [g]" % \
+                            ('Neutron', str(self.resolution.mass))
+        self.mass_txt.SetToolTipString(source_hint)
+        self.mass_sizer.AddMany([(self.mass_txt, 0, wx.LEFT, 15),
+                                    (self.source_cb, 0, wx.LEFT, 15)])   
         
     def _layout_intensity(self):
@@ -402,21 +418,32 @@
         sigma_unit = '['+'1/A' +']'
         self.sigma_r_txt = wx.StaticText(self, -1, 
-                                           'Sigma_r:   ')
+                                           'Sigma_x:   ')
         self.sigma_r_tcl = OutputTextCtrl(self, -1, 
-                                                 size=(_BOX_WIDTH,-1))
+                                                 size=(_BOX_WIDTH*0.8,-1))
         self.sigma_phi_txt = wx.StaticText(self, -1, 
-                                           'Sigma_phi:')
+                                           'Sigma_y:')
         self.sigma_phi_tcl = OutputTextCtrl(self, -1, 
-                                                 size=(_BOX_WIDTH,-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,-1))
-        sigma_hint = " dQ_r or dQ_x, and dQ_phi or dQ_y"
-        sigma_hint_1d = " dQ for 1-dimension"
-        self.sigma_r_tcl.SetToolTipString(sigma_hint)
-        self.sigma_phi_tcl.SetToolTipString(sigma_hint)
+                                                 size=(_BOX_WIDTH*0.7,-1))
+        sigmax_hint = " The x component of the geometric resolution,"
+        sigmax_hint +=  " excluding sigma_lamda."
+        sigmay_hint = " The y component of the geometric resolution,"
+        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."
+        sigma_hint_1d = " Resolution in 1-dimension (for 1D data)."
+        self.sigma_r_tcl.SetToolTipString(sigmax_hint)
+        self.sigma_phi_tcl.SetToolTipString(sigmay_hint)
+        self.sigma_lamd_tcl.SetToolTipString(sigma_hint_lamd)
         self.sigma_1d_tcl.SetToolTipString(sigma_hint_1d)
         sigma_r_unit_txt = wx.StaticText(self, -1, sigma_unit)
         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+' )')
         outputQxy_sizer.AddMany([(self.sigma_r_txt, 0, wx.LEFT, 15),
@@ -426,5 +453,8 @@
                                     (self.sigma_phi_tcl, 0, wx.LEFT, 15),
                                     (sigma_phi_unit_txt, 0, wx.LEFT, 15)])
-        outputQ_sizer.AddMany([(sigma_1d_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)])
@@ -452,11 +482,11 @@
         """ 
         #outerbox_txt = wx.StaticText(self, -1, 'Outer Box')
-        self.x_y_rb = wx.RadioButton(self, -1,"Cartesian")
-        self.Bind(wx.EVT_RADIOBUTTON,
-                  self._on_xy_coordinate, id=self.x_y_rb.GetId())
-        self.r_phi_rb = wx.RadioButton(self, -1,"Polar")
-        self.Bind(wx.EVT_RADIOBUTTON,
-                  self._on_rp_coordinate, id=self.r_phi_rb.GetId())
-        self.r_phi_rb.SetValue(True)
+        #self.x_y_rb = wx.RadioButton(self, -1,"Cartesian")
+        #self.Bind(wx.EVT_RADIOBUTTON,
+        #          self._on_xy_coordinate, id=self.x_y_rb.GetId())
+        #self.r_phi_rb = wx.RadioButton(self, -1,"Polar")
+        #self.Bind(wx.EVT_RADIOBUTTON,
+        #          self._on_rp_coordinate, id=self.r_phi_rb.GetId())
+        #self.r_phi_rb.SetValue(True)
         #reset button
         id = wx.NewId()
@@ -475,4 +505,5 @@
         self.bt_close.Bind(wx.EVT_BUTTON, self.on_close)
         self.bt_close.SetToolTipString("Close this window.")
+        """
         self.button_sizer.AddMany([(self.r_phi_rb,  0, wx.LEFT, 15),
                                    (self.x_y_rb,  0, wx.LEFT, 15),
@@ -480,4 +511,9 @@
                                    (self.compute_button, 0, wx.LEFT, 15),
                                    (self.bt_close, 0, wx.LEFT, 15)])#370)])
+        """
+        self.button_sizer.Add((110, -1))
+        self.button_sizer.AddMany([(self.reset_button, 0, wx.LEFT, 50),
+                                   (self.compute_button, 0, wx.LEFT, 15),
+                                   (self.bt_close, 0, wx.LEFT, 15)])
         self.compute_button.SetFocus()
         
@@ -644,5 +680,6 @@
         wavelength = self.wavelength_tcl.GetValue()
         self.resolution.set_wavelength(float(wavelength))
-        mass = self.mass_tcl.GetValue()
+        source = self.source_cb.GetValue()
+        mass = self.source_mass[str(source)]
         self.resolution.set_neutron_mass(float(mass))
         wavelength_spread = self.wavelength_spread_tcl.GetValue()
@@ -672,9 +709,15 @@
         self.qy = self._string2inputlist(self.qy_tcl.GetValue())
         
-        # Find min max of qs
-        xmin = min(self.qx)
-        xmax = max(self.qx)
-        ymin = min(self.qy)
-        ymax = max(self.qy)
+        try:
+            # Find min max of qs
+            xmin = min(self.qx)
+            xmax = max(self.qx)
+            ymin = min(self.qy)
+            ymax = max(self.qy)
+        except:
+            msg = "An error occured during the resolution computation."
+            msg += "Please check your inputs..."
+            self._status_info(msg, status_type)
+            raise ValueError, "Invalid Q Input..."
 
         # Validate the q inputs
@@ -719,4 +762,5 @@
         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)
 
@@ -724,4 +768,5 @@
         self.sigma_r_tcl.SetValue(str(sigma_r))
         self.sigma_phi_tcl.SetValue(str(sigma_phi))
+        self.sigma_lamd_tcl.SetValue(str(sigma_lamd))
         self.sigma_1d_tcl.SetValue(str(sigma_1d))
         
@@ -835,5 +880,6 @@
         self.resolution.get_all_instrument_params()
         # reset all param values
-        self.mass_tcl.SetValue(str(self.resolution.mass))
+        self.source_cb.SetValue('Neutron')
+        self._on_source_selection(None)
         #self.intensity_tcl.SetValue(str(self.resolution.intensity))
         self.wavelength_tcl.SetValue(str(self.resolution.wavelength))
@@ -882,6 +928,5 @@
         self.sigma_1d_tcl.SetValue('')
         # reset radio button
-        self.det_coordinate = 'polar'
-        self.r_phi_rb.SetValue(True)
+        #self.r_phi_rb.SetValue(True)
         # Finally re-compute
         self.on_compute()
@@ -987,4 +1032,22 @@
         self.on_compute()
         
+    def _on_source_selection(self, event = None):
+        """
+        On source combobox selection
+        """
+        if event != None:
+            combo = event.GetEventObject()
+            event.Skip()
+        else:
+            combo = self.source_cb
+        selection = combo.GetValue()
+        mass = self.source_mass[selection]
+        self.resolution.set_neutron_mass(mass)   
+        source_hint = "Source Selection: Affect on"
+        source_hint += " the gravitational contribution.\n"
+        source_hint += "Mass of %s: m = %s [g]" % \
+                            (selection, str(self.resolution.get_neutron_mass()))
+        #source_tip.SetTip(source_hint)
+        self.mass_txt.ToolTip.SetTip(source_hint)
         
 class ResolutionWindow(wx.Frame):
