Index: sansview/perspectives/fitting/basepage.py
===================================================================
--- sansview/perspectives/fitting/basepage.py	(revision 484faf7a3c6b0aab49f1aa6b612e0ff0a7c03010)
+++ sansview/perspectives/fitting/basepage.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
@@ -1236,5 +1236,7 @@
                                     qstep= float(self.num_points),
                                     enable2D=self.enable2D) 
-        
+        print "_draw_model"
+        for name in self.model.getParamList():
+            print name , self.model.getParam(name)
         
     def _set_model_sizer(self,sizer, box_sizer, title="", object=None):
Index: sansview/perspectives/fitting/fitpage.py
===================================================================
--- sansview/perspectives/fitting/fitpage.py	(revision 66c488b10987c681f716e066389d9385b7b81fab)
+++ sansview/perspectives/fitting/fitpage.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
@@ -20,5 +20,5 @@
 (FitStopEvent, EVT_FIT_STOP)   = wx.lib.newevent.NewEvent()
 _BOX_WIDTH = 76
-
+_DATA_BOX_WIDTH = 300
 import basepage
 from basepage import BasicPage
@@ -197,54 +197,61 @@
             fill sizer 0 with data info
         """
-        self.sizer0.Clear(True)
         ## no loaded data , don't fill the sizer
-        if self.data== None:
-            self.sizer0.Layout()
-            return
+        if self.data is None:
+            data_min = ""
+            data_max = ""
+            data_name = ""
+        else:
+            data_name = self.data.name
+            #set maximum range for x in linear scale
+            if not hasattr(self.data,"data"): #Display only for 1D data fit
+                # Minimum value of data   
+                data_min = min(self.data.x)
+                # Maximum value of data  
+                data_max = max(self.data.x)
+            else:
+                ## Minimum value of data 
+                data_min = 0
+                x = max(math.fabs(self.data.xmin), math.fabs(self.data.xmax)) 
+                y = max(math.fabs(self.data.ymin), math.fabs(self.data.ymax))
+                ## Maximum value of data  
+                data_max = math.sqrt(x*x + y*y)
         
         box_description= wx.StaticBox(self, -1, 'Data')
         boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         #----------------------------------------------------------
-        sizer_data = wx.GridSizer(3, 3,5, 5)
+        sizer_data = wx.BoxSizer(wx.HORIZONTAL)
         #Filling the sizer containing data related fields
-        DataSource  =wx.StaticText(self, -1,str(self.data.name))
-
+        #self.dataSource = wx.StaticText(self, -1,str(self.data.name))
+        self.dataSource = wx.TextCtrl(self, -1)
+        self.dataSource.SetValue(str(data_name))
+        self.dataSource.SetEditable(False)
+        self.dataSource.SetMinSize((_DATA_BOX_WIDTH, -1))
         sizer_data.Add(wx.StaticText(self, -1, 'Source Name : '))
-        sizer_data.Add(DataSource )
+        sizer_data.Add(self.dataSource )
         sizer_data.Add( (0,5) )
         
         #---------sizer 2 draw--------------------------------
-        #set maximum range for x in linear scale
-        if not hasattr(self.data,"data"): #Display only for 1D data fit
-            # Minimum value of data   
-            data_min = min(self.data.x)
-            # Maximum value of data  
-            data_max = max(self.data.x)
-            text4_3 = wx.StaticText(self, -1, 'Total Q Range (1/A)',
-                                     style=wx.ALIGN_LEFT)
-            sizer_data.Add( text4_3 )
-            sizer_data.Add(wx.StaticText(self, -1, "Min : %s"%str(data_min)))
-            sizer_data.Add(wx.StaticText(self, -1, "Max : %s"%str(data_max)))
-            
-        else:
-            ## Minimum value of data 
-            data_min= 0
-            x= max(math.fabs(self.data.xmin), math.fabs(self.data.xmax)) 
-            y= max(math.fabs(self.data.ymin), math.fabs(self.data.ymax))
-            ## Maximum value of data  
-            data_max = math.sqrt(x*x + y*y)
-          
-            #For qmin and qmax, do not use format_number
-            #.(If do, qmin and max could be different from what is in the data.)
-            text4_3 = wx.StaticText(self, -1, "Total Q Range (1/A)",
-                                     style=wx.ALIGN_LEFT)
-            sizer_data.Add( text4_3 )
-            sizer_data.Add(wx.StaticText(self, -1, "Min : %s"%str(data_min)))
-            sizer_data.Add(wx.StaticText(self, -1, "Max : %s"%str(data_max)))
+        text4_3 = wx.StaticText(self, -1, 'Total Q Range (1/A)',
+                                 style=wx.ALIGN_LEFT)
+        sizer_range = wx.BoxSizer(wx.HORIZONTAL)
+        sizer_range.Add( text4_3 ,0, wx.RIGHT, 10)
+        self.minimum_q = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20))
+        self.minimum_q.SetValue(str(data_min))
+        self.minimum_q.SetEditable(False)
+        self.maximum_q = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.maximum_q.SetValue(str(data_max))
+        self.maximum_q.SetEditable(False)
+        sizer_range.Add(wx.StaticText(self, -1, "Min: "),0, wx.LEFT, 10)
+        sizer_range.Add(self.minimum_q,0, wx.LEFT, 10)
+        sizer_range.Add(wx.StaticText(self, -1, "Max: "),0, wx.LEFT, 10)
+        sizer_range.Add(self.maximum_q,0, wx.LEFT, 10)
+
         ## set q range to plot
-        self.qmin_x= data_min
-        self.qmax_x= data_max
-
-        boxsizer1.Add(sizer_data)
+        self.qmin_x = data_min
+        self.qmax_x = data_max
+
+        boxsizer1.Add(sizer_data,0, wx.ALL, 10)
+        boxsizer1.Add(sizer_range, 0 , wx.LEFT, 10)
         #------------------------------------------------------------
         self.sizer0.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10)
@@ -633,5 +640,5 @@
         except:
             pass
-        if self.model !=None:
+        if self.model != None:
             try:
                 temp_smear= None
@@ -642,6 +649,7 @@
                 ## error occured on chisqr computation
                 pass
-            ## set smearing value whether or not the data contain the smearing info
-            self.manager.set_smearer(smearer=temp_smear, qmin= float(self.qmin_x),
+            if self.data is not None:
+                ## set smearing value whether or not the data contain the smearing info
+                self.manager.set_smearer(smearer=temp_smear, qmin= float(self.qmin_x),
                                      qmax= float(self.qmax_x)) 
             evt = ModelEventbox(model=self.model)
@@ -828,13 +836,36 @@
                 
         
-    def set_data(self, data ):
+    def set_data(self, data):
         """
             reset the current data 
         """
-        if data ==None:
-            return 
-        self.data =data
-        self.state.data= data 
-        self._fill_datainfo_sizer()
+        self.data = data
+        if self.data is None:
+            data_min = ""
+            data_max = ""
+            data_name = ""
+        else:
+            data_name = self.data.name
+            #set maximum range for x in linear scale
+            if not hasattr(self.data,"data"): #Display only for 1D data fit
+                # Minimum value of data   
+                data_min = min(self.data.x)
+                # Maximum value of data  
+                data_max = max(self.data.x)
+            else:
+                ## Minimum value of data 
+                data_min = 0
+                x = max(math.fabs(self.data.xmin), math.fabs(self.data.xmax)) 
+                y = max(math.fabs(self.data.ymin), math.fabs(self.data.ymax))
+                ## Maximum value of data  
+                data_max = math.sqrt(x*x + y*y)
+        
+        self.dataSource.SetValue(data_name)
+        self.minimum_q.SetValue(str(data_min))
+        self.maximum_q.SetValue(str(data_max))
+        self.qmin_x = data_min
+        self.qmax_x = data_max
+        self.state.data = data, data_max
+        print "set_data",data_min
         
     def reset_page(self, state,first=False):
@@ -1023,5 +1054,5 @@
         self._lay_out()      
         #PostStatusEvent     
-        msg="Fit completed! "
+        msg = "Fit completed! "
         wx.PostEvent(self.manager.parent, StatusEvent(status=msg))
       
Index: sansview/perspectives/fitting/fitpanel.py
===================================================================
--- sansview/perspectives/fitting/fitpanel.py	(revision 09ef7d2213f93fea48ac902d365f774d55a60da3)
+++ sansview/perspectives/fitting/fitpanel.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
@@ -167,5 +167,9 @@
         self.Bind(basepage.EVT_PREVIOUS_STATE, self._onUndo)
         self.Bind(basepage.EVT_NEXT_STATE, self._onRedo)
-       
+        
+        #add default page
+        from hint_fitpage import HintFitPage
+        panel = HintFitPage(self) 
+        self.AddPage(page=panel, caption="Hint")
         # increment number for model name
         self.count=0
Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision 1a2dc103043a3dc580dd5a99ba1cf72a1f72d1a6)
+++ sansview/perspectives/fitting/fitting.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
@@ -261,6 +261,5 @@
         """
         self.parent.set_perspective(self.perspective)
-    
-    
+   
     def post_init(self):
         """
@@ -272,5 +271,12 @@
         pass
 
-
+    def get_tools(self):
+        """
+            Returns a set of menu entries for tools
+        """
+        id = wx.NewId()
+        sld_help = "Provides computation related to Scattering Length density"
+        return [("SLD Calculator", sld_help, self.on_calculate_sld)]
+        
     def copy_data(self, item, dy=None):
         """
@@ -510,4 +516,14 @@
             time.sleep(0.4)
              
+    def on_calculate_sld(self, event):
+        """
+            Compute the scattering length density of molecula
+        """  
+       
+        import  sld_panel 
+        frame = sld_panel.SldWindow(base=self.parent)
+        frame.Show(True) 
+      
+          
     def _onEVT_SLICER_PANEL(self, event):
         """
@@ -524,5 +540,4 @@
         self.parent._mgr.Update()
                
-  
     def _compute_invariant(self, event):    
         """
@@ -534,17 +549,9 @@
             if plottable.name == self.panel.graph.selected_plottable:
                 data = self.copy_data(item= plottable, dy=plottable.dy)
-                
-                print "_compute_invariant",data._yaxis
-                print "_compute_invariant" ,data._yunit
+               
                 from invariant_panel import InvariantWindow
                 frame = InvariantWindow(base=self.parent, data=plottable, graph=self.panel.graph)   
                 frame.Show(True)
-                #from invariant_panel import InvariantDialog
-                #self.invariant_dlg = InvariantDialog(base=self.parent,
-                #                                     data=plottable)
-                #if self.invariant_dlg.ShowModal() == wx.ID_OK:
-                #    pass
-                #self.invariant_dlg.Destroy()
-                
+              
     def _closed_fitpage(self, event):   
         """
@@ -553,5 +560,4 @@
         """    
         self.fit_panel._close_fitpage(event.data) 
-        
         
     def _add_page_onmenu(self, name,fitproblem=None):
@@ -712,6 +718,7 @@
                 try:
                     page = self.fit_panel.add_fit_page(data)
+                    page.set_data(data)
                     # add data associated to the page created
-                    if page !=None:   
+                    if page != None:   
                         #create a fitproblem storing all link to data,model,page creation
                         if not page in self.page_finder.keys():
@@ -767,16 +774,5 @@
 
             cpage.onsetValues(result.fitness,param_name, result.pvec,result.stderr)
-            """
-            ## plot the current model with new param
-            metadata =  self.page_finder[cpage].get_fit_data()
-            model = self.page_finder[cpage].get_model()
-            qmin, qmax= self.page_finder[cpage].get_range()
-            smearer =self.page_finder[cpage].get_smearer()
-            #Replot models
-            msg= "Single Fit completed. plotting... %s:"%model.name
-            wx.PostEvent(self.parent, StatusEvent(status="%s " % msg))
-            self.draw_model( model=model, data= metadata, smearer= smearer,
-                             qmin= qmin, qmax= qmax)
-            """
+           
         except:
             raise
@@ -939,5 +935,5 @@
         model = evt.model
         
-        if model ==None:
+        if model == None:
             return
         model.origin_name = model.name
Index: sansview/perspectives/fitting/hint_fitpage.py
===================================================================
--- sansview/perspectives/fitting/hint_fitpage.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
+++ sansview/perspectives/fitting/hint_fitpage.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
@@ -0,0 +1,52 @@
+import wx
+
+
+class HintFitPage(wx.ScrolledWindow):
+    """
+        This class provide general structure of  fitpanel page
+    """
+     ## Internal name for the AUI manager
+    window_name = "Hint Page"
+    ## Title to appear on top of the window
+    window_caption = "Hint page "
+    
+    def __init__(self, parent):
+        wx.ScrolledWindow.__init__(self, parent,
+                 style= wx.FULL_REPAINT_ON_RESIZE )
+        
+        msg = "right click on the data when it is highlighted "
+        msg += "the select option to fit for futher options"
+        self.do_layout()
+        
+    def do_layout(self):
+        """
+            Draw the page 
+        """
+        name="Hint"
+        box_description= wx.StaticBox(self, -1,name)
+        boxsizer = wx.StaticBoxSizer(box_description, wx.VERTICAL)
+        msg = "Load data, then right click on the data, when highlighted,\n"
+        msg += "select option to fit for further analysis"
+        self.hint_txt = wx.StaticText(self, -1, msg, style=wx.ALIGN_LEFT)
+        boxsizer.Add(self.hint_txt, wx.ALL|wx.EXPAND, 20)
+        self.vbox = wx.BoxSizer(wx.VERTICAL)
+        self.vbox.Add(boxsizer )
+        self.vbox.Layout()
+        self.vbox.Fit(self) 
+        self.SetSizer(self.vbox)
+        self.SetScrollbars(20,20,25,65)
+        self.Layout()
+        
+class HelpWindow(wx.Frame):
+    def __init__(self, parent, id, title):
+        wx.Frame.__init__(self, parent, id, title, size=(570, 400))
+       
+        self.page = HintFitPage(self) 
+        self.Centre()
+        self.Show(True)
+ 
+if __name__=="__main__":
+    app = wx.App()
+    HelpWindow(None, -1, 'HelpWindow')
+    app.MainLoop()
+                
Index: sansview/perspectives/fitting/invariant_panel.py
===================================================================
--- sansview/perspectives/fitting/invariant_panel.py	(revision 1a2dc103043a3dc580dd5a99ba1cf72a1f72d1a6)
+++ sansview/perspectives/fitting/invariant_panel.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
@@ -137,5 +137,5 @@
             #Compute qstar extrapolated to low q range
             #Clear the previous extrapolated plot
-       
+            print "low_q, high_q",low_q, high_q
             if low_q:
                 try: 
@@ -218,7 +218,9 @@
             @param name: Data's name to use for the legend
         """
+        print "went here "
         plottable = self.graph.get_plottable(name=name)
         if plottable is not None:
             self.graph.delete(plottable)
+        print "name--->",name
         # Create a plottable data
         new_plot = Data1D(x=[], y=[], dx=None, dy=None)
Index: sansview/perspectives/fitting/sld_panel.py
===================================================================
--- sansview/perspectives/fitting/sld_panel.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
+++ sansview/perspectives/fitting/sld_panel.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
@@ -0,0 +1,366 @@
+"""
+    This module provide GUI for the neutron scattering length density calculator
+    @author: Gervaise B. Alina
+"""
+
+import wx
+import sys
+
+from sans.guiframe.utils import format_number, check_float
+from sans.guicomm.events import StatusEvent  
+from sans.calculator.sld_calculator import SldCalculator
+
+_BOX_WIDTH = 76
+_STATICBOX_WIDTH = 350
+_SCALE = 1e-6
+
+#SLD panel size 
+if sys.platform.count("win32")>0:
+    _STATICBOX_WIDTH = 350
+    PANEL_SIZE = 400
+    FONT_VARIANT = 0
+else:
+    _STATICBOX_WIDTH = 380
+    PANEL_SIZE = 430
+    FONT_VARIANT = 1
+    
+class SldPanel(wx.Panel):
+    """
+        Provides the SLD calculator GUI.
+    """
+    ## Internal nickname for the window, used by the AUI manager
+    window_name = "SLD Calculator"
+    ## Name to appear on the window title bar
+    window_caption = "SLD Calculator"
+    ## Flag to tell the AUI manager to put this panel in the center pane
+    CENTER_PANE = True
+    def __init__(self, parent,base=None, id = -1):
+        wx.Panel.__init__(self, parent, id = id)
+        #Font size 
+        self.SetWindowVariant(variant=FONT_VARIANT)
+        
+        # Object that receive status event
+        self.base = base
+        self.calculator = SldCalculator()
+        self.wavelength = self.calculator.wavelength
+        
+        self._do_layout()
+        self.SetAutoLayout(True)
+        self.Layout()
+       
+
+    def _do_layout(self):
+        """
+            Draw window content
+        """
+        unit_a = '[A]'
+        unit_density = '[g/cm^(3)]'
+        unit_sld = '[1/A^(2)]'
+        unit_cm1 ='[1/cm]'
+        unit_cm ='[cm]'
+        sizer_input = wx.GridBagSizer(5,5)
+        sizer_output = wx.GridBagSizer(5,5)
+        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
+        sizer1 = wx.BoxSizer(wx.HORIZONTAL)
+        sizer2 = wx.BoxSizer(wx.HORIZONTAL)
+        sizer3 = wx.BoxSizer(wx.HORIZONTAL)
+        #---------inputs----------------
+        inputbox = wx.StaticBox(self, -1, "Input")
+        boxsizer1 = wx.StaticBoxSizer(inputbox, wx.VERTICAL)
+        boxsizer1.SetMinSize((_STATICBOX_WIDTH,-1))
+        
+        compound_txt = wx.StaticText(self, -1, 'Compound ')
+        self.compound_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1))
+        density_txt = wx.StaticText(self, -1, 'Density ')
+        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)
+        iy = 0
+        ix = 0
+        sizer_input.Add(compound_txt,(iy, ix),(1,1),\
+                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix +=1
+        sizer_input.Add(self.compound_ctl,(iy, ix),(1,1),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        iy += 1
+        ix = 0
+        sizer_input.Add(density_txt,(iy, ix),(1,1),\
+                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        sizer_input.Add(self.density_ctl, (iy, ix), (1,1),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        ix +=1
+        sizer_input.Add(unit_density_txt,(iy, ix),(1,1),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        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),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        boxsizer1.Add( sizer_input )
+        sizer1.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10)
+        #---------Outputs sizer--------
+        outputbox = wx.StaticBox(self, -1, "Output")
+        boxsizer2 = wx.StaticBoxSizer(outputbox, wx.VERTICAL)
+        boxsizer2.SetMinSize((_STATICBOX_WIDTH,-1))
+        
+        i_complex = '+ i'
+        neutron_sld_txt = wx.StaticText(self, -1, 'Neutron SLD')
+        self.neutron_sld_reel_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1))
+        self.neutron_sld_reel_ctl.SetEditable(False)
+        self.neutron_sld_reel_ctl.SetToolTipString("Neutron SLD reel.")
+        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.")
+        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_reel_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1))
+        self.cu_ka_sld_reel_ctl.SetEditable(False)
+        self.cu_ka_sld_reel_ctl.SetToolTipString("Cu Ka SLD reel.")
+        self.cu_ka_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_reel_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1))
+        self.mo_ka_sld_reel_ctl.SetEditable(False)
+        self.mo_ka_sld_reel_ctl.SetToolTipString("Mo Ka SLD reel.")
+        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 reel.")
+        mo_ka_sld_units_txt = wx.StaticText(self, -1, unit_sld)
+        
+        neutron_inc_txt = wx.StaticText(self, -1, 'Neutron Inc. Xs')
+        self.neutron_inc_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1))
+        self.neutron_inc_ctl.SetEditable(False)
+        self.neutron_inc_ctl.SetToolTipString("Neutron Inc. Xs")
+        neutron_inc_units_txt = wx.StaticText(self, -1,  unit_cm1)
+        
+        neutron_abs_txt = wx.StaticText(self, -1, 'Neutron Abs. Xs')
+        self.neutron_abs_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1))
+        self.neutron_abs_ctl.SetEditable(False)
+        self.neutron_abs_ctl.SetToolTipString("Neutron Abs. Xs")
+        neutron_abs_units_txt = wx.StaticText(self, -1,  unit_cm1)
+        
+        neutron_length_txt = wx.StaticText(self, -1, 'Neutron 1/e length')
+        self.neutron_length_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1))
+        self.neutron_length_ctl.SetEditable(False)
+        self.neutron_length_ctl.SetToolTipString("Neutron 1/e length")
+        neutron_length_units_txt = wx.StaticText(self, -1,  unit_cm)
+        iy = 0
+        ix = 0
+        sizer_output.Add(neutron_sld_txt,(iy, ix),(1,1),
+                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        sizer_output.Add(self.neutron_sld_reel_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.neutron_sld_im_ctl
+                         ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        ix +=1
+        sizer_output.Add(neutron_sld_units_txt
+                         ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        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_reel_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.cu_ka_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_reel_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
+                         ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        iy += 1
+        ix = 0
+        sizer_output.Add(neutron_inc_txt,(iy, ix),(1,1),
+                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        sizer_output.Add(self.neutron_inc_ctl,(iy, ix),(1,1),
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        ix += 2
+        sizer_output.Add(neutron_inc_units_txt,(iy, ix),(1,1),
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        iy += 1
+        ix = 0
+        sizer_output.Add(neutron_abs_txt, (iy, ix), (1,1),
+                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        sizer_output.Add(self.neutron_abs_ctl, (iy, ix), (1,1),
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        ix +=2
+        sizer_output.Add(neutron_abs_units_txt, (iy, ix), (1,1),
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        iy += 1
+        ix = 0
+        sizer_output.Add(neutron_length_txt, (iy, ix), (1,1),
+                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix +=1
+        sizer_output.Add(self.neutron_length_ctl, (iy, ix), (1,1),
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        ix += 2
+        sizer_output.Add(neutron_length_units_txt, (iy, ix), (1,1),
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
+        boxsizer2.Add( sizer_output )
+        sizer2.Add(boxsizer2,0, wx.EXPAND|wx.ALL, 10)
+        #-----Button  sizer------------
+    
+        id = wx.NewId()
+        button_calculate = wx.Button(self, id, "Compute")
+        button_calculate.SetToolTipString("Compute SlD of neutrons.")
+        self.Bind(wx.EVT_BUTTON, self.calculateSld, id = id)   
+        
+        sizer_button.Add((250, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        sizer_button.Add(button_calculate, 0, wx.RIGHT|wx.ADJUST_MINSIZE,20)
+        sizer3.Add(sizer_button)
+        #---------layout----------------
+        vbox  = wx.BoxSizer(wx.VERTICAL)
+        vbox.Add(sizer1)
+        vbox.Add(sizer2)
+        vbox.Add(sizer3)
+        vbox.Fit(self) 
+        self.SetSizer(vbox)
+        
+        
+    def check_inputs(self):
+        """Check validity user inputs"""
+        flag = True
+       
+        if check_float(self.density_ctl):
+            self.density = float(self.density_ctl.GetValue())
+        else:
+            flag = False
+            raise ValueError,"Error for Density value :expect float"
+    
+        self.wavelength = self.wavelength_ctl.GetValue()
+        if self.wavelength.lstrip().rstrip() == "":
+            self.wavelength = self.calculator.wavelength
+        else:
+            if check_float(self.wavelength_ctl):
+                self.wavelength = float(self.wavelength)
+            else:
+                flag = False
+                raise ValueError,"Error for wavelenth value :expect float"
+                
+        self.formulata_text = self.compound_ctl.GetValue().lstrip().rstrip()
+        if self.formulata_text != "":
+            self.compound_ctl.SetBackgroundColour(wx.WHITE)
+            self.compound_ctl.Refresh()
+        else:
+            self.compound_ctl.SetBackgroundColour("pink")
+            self.compound_ctl.Refresh()
+            flag = False
+            raise ValueError, "Enter a formula"
+        return flag 
+        
+    def calculateSld(self, event):
+        """
+            Calculate the neutron scattering density length of a molecule
+        """
+        try:
+            #Check validity user inputs
+            if self.check_inputs():
+                #get ready to compute
+                try:
+                    self.calculator.set_value(self.formulata_text,
+                                              self.density, self.wavelength)
+                except:
+                    if self.base is not None:
+                        msg = "SLD Calculator: %s" %(sys.exc_value)
+                        wx.PostEvent(self.base, StatusEvent(status=msg))
+                    else:
+                        raise
+                    return
+                
+                # Compute the Cu SLD
+                Cu_reel, Cu_im = self.calculator.calculate_xray_sld( "Cu")
+                self.cu_ka_sld_reel_ctl.SetValue(format_number(Cu_reel *_SCALE))
+                self.cu_ka_sld_im_ctl.SetValue(format_number(Cu_im * _SCALE))
+                
+                # Compute the Mo SLD
+                Mo_reel, Mo_im = self.calculator.calculate_xray_sld( "Mo")
+                self.mo_ka_sld_reel_ctl.SetValue(format_number(Mo_reel *_SCALE))
+                self.mo_ka_sld_im_ctl.SetValue(format_number(Mo_im * _SCALE))
+               
+                coh,absorp,inc = self.calculator.calculate_neutron_sld()
+                im = self.calculator.calculate_coherence_im()
+                length = self.calculator.calculate_length()
+                # Neutron SLD
+                self.neutron_sld_reel_ctl.SetValue(format_number(coh * _SCALE))
+                self.neutron_sld_im_ctl.SetValue(format_number(im * _SCALE))
+                self.neutron_inc_ctl.SetValue(format_number(inc))
+                self.neutron_abs_ctl.SetValue(format_number(absorp))
+                # Neutron length
+                self.neutron_length_ctl.SetValue(format_number(length))
+                # display wavelength
+                self.wavelength_ctl.SetValue(str(self.wavelength))
+        except:
+            if self.base is not None:
+                  msg = "SLD Calculator: %s"%(sys.exc_value)
+                  wx.PostEvent(self.base, StatusEvent(status=msg))
+            else:
+                raise
+            return   
+
+   
+        
+  
+    
+   
+ 
+        
+               
+class SldWindow(wx.Frame):
+    def __init__(self, parent=None, id=1, title="SLD Calculator",base=None):
+        wx.Frame.__init__(self, parent, id, title, size=( PANEL_SIZE,  PANEL_SIZE))
+        
+        self.panel = SldPanel(self, base=base)
+        self.Centre()
+        self.Show(True)
+        
+class ViewApp(wx.App):
+    def OnInit(self):
+        frame = SldWindow(None, -1, 'SLD Calculator')    
+        frame.Show(True)
+        self.SetTopWindow(frame)
+        
+        return True
+        
+
+if __name__ == "__main__": 
+    app = ViewApp(0)
+    app.MainLoop()     
