Index: guiframe/data_loader.py
===================================================================
--- guiframe/data_loader.py	(revision de9483d529d2bf845915c544acd4e1d0947dc424)
+++ guiframe/data_loader.py	(revision fc2b91afc6076aae125fc1d951a13724406f7f90)
@@ -19,14 +19,17 @@
         Load a 1D ascii file, with errors
     """
-        
+    import numpy
     if path and os.path.isfile(path):
     
-        file_x = []
-        file_y = []
-        file_dy = []
+        file_x = numpy.zeros(0)
+        file_y = numpy.zeros(0)
+        file_dy = numpy.zeros(0)
         
         input_f = open(path,'r')
         buff = input_f.read()
         lines = buff.split('\n')
+        
+        has_dy = False
+        
         for line in lines:
             try:
@@ -35,13 +38,35 @@
                 y = float(toks[1])
                 if len(toks)==3:
+                    has_dy = True
                     err = float(toks[2])
                 else:
                     err = 0.0
-                file_x.append(x)
-                file_y.append(y)
-                file_dy.append(err)
+                file_x  = numpy.append(file_x, x)
+                file_y  = numpy.append(file_y, y)
+                file_dy = numpy.append(file_dy, err)
             except:
                 print "READ ERROR", line
     
+        if has_dy==False:
+            file_dy = None
+            
         return file_x, file_y, file_dy
     return None, None, None
+
+def plot_data(parent, path, name="Loaded Data"):
+    from sans.guicomm.events import NewPlotEvent
+    from sans.guitools.plottables import Data1D, Theory1D
+    x, y, dy = load_ascii_1D(path)
+    
+    if dy==None:
+        new_plot = Theory1D(x, y)
+    else:
+        new_plot = Data1D(x, y, dy=dy)
+    new_plot.name = name
+    new_plot.interactive = True
+    
+    # If the data file does not tell us what the axes are, just assume...
+    new_plot.xaxis("\\rm{Q}", 'A^{-1}')
+    new_plot.yaxis("\\rm{Intensity} ","cm^{-1}")
+        
+    wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title="Loaded data"))
Index: guiframe/gui_manager.py
===================================================================
--- guiframe/gui_manager.py	(revision 2310d69f4bfb6d756945e6d42d495f5c3d34ed0e)
+++ guiframe/gui_manager.py	(revision fc2b91afc6076aae125fc1d951a13724406f7f90)
@@ -31,4 +31,5 @@
 warnings.simplefilter("ignore")
 
+import logging
 
 class ViewerFrame(wx.Frame):
@@ -42,4 +43,10 @@
         from local_perspectives.plotting import plotting
         wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, size=(1000, 1000))
+        
+        # Logging info
+        logging.basicConfig(level=logging.DEBUG,
+                    format='%(asctime)s %(levelname)s %(message)s',
+                    filename='sans_app.log',
+                    filemode='w')        
         
         path = os.path.dirname(__file__)
@@ -310,5 +317,12 @@
         # File menu
         filemenu = wx.Menu()
-        filemenu.Append(101,'&Quit', 'Exit') 
+        
+        id = wx.NewId()
+        filemenu.Append(id, '&Open', 'Open a file')
+        wx.EVT_MENU(self, id, self._on_open)
+        
+        id = wx.NewId()
+        filemenu.Append(id,'&Quit', 'Exit') 
+        wx.EVT_MENU(self, id, self.Close)
         
         # Add sub menus
@@ -396,6 +410,5 @@
         self.SetMenuBar(menubar)
         
-        # Bind handlers       
-        wx.EVT_MENU(self, 101, self.Close)
+        
         
     def _on_status_event(self, evt):
@@ -430,5 +443,13 @@
             self._mgr.Update()
         
-
+    def _on_open(self, event):
+        from data_loader import plot_data
+        path = self.choose_file()
+            
+        if path and os.path.isfile(path):
+            plot_data(self, path)
+                
+        
+        
     def _onClose(self, event):
         import sys
Index: guiframe/local_perspectives/plotting/plotting.py
===================================================================
--- guiframe/local_perspectives/plotting/plotting.py	(revision 96f13a9c9857cd4deba0bb5b87181ea59278d814)
+++ guiframe/local_perspectives/plotting/plotting.py	(revision fc2b91afc6076aae125fc1d951a13724406f7f90)
@@ -18,8 +18,11 @@
 class PanelMenu(wx.Menu):
     plots = None
+    graph = None
     
     def set_plots(self, plots):
         self.plots = plots
     
+    def set_graph(self, graph):
+        self.graph = graph
 
 class View1DPanel(PlotPanel):
@@ -71,5 +74,9 @@
         is_new = True
         if event.plot.name in self.plots.keys():
-            is_new = False
+            # Check whether the class of plottable changed
+            if not event.plot.__class__==self.plots[event.plot.name].__class__:
+                self.graph.delete(self.plots[event.plot.name])
+            else:
+                is_new = False
         
         if is_new:
@@ -103,7 +110,11 @@
         slicerpop = PanelMenu()
         slicerpop.set_plots(self.plots)
+        slicerpop.set_graph(self.graph)
                 
         # Option to save the data displayed
-        for plot in self.graph.plottables:
+        
+        #for plot in self.graph.plottables:
+        if self.graph.selected_plottable in self.plots:
+            plot = self.plots[self.graph.selected_plottable]
             id = wx.NewId()
             name = plot.name
@@ -117,15 +128,16 @@
         wx.EVT_MENU(self, id, self.onSaveImage)
         
-        slicerpop.AppendSeparator()
+        
         item_list = self.parent.get_context_menu(self.graph)
-        if not item_list==None:
-            for item in item_list:
-                try:
-                    id = wx.NewId()
-                    slicerpop.Append(id, item[0], item[1])
-                    wx.EVT_MENU(self, id, item[2])
-                except:
-                    print sys.exc_value
-                    print RuntimeError, "View1DPanel.onContextMenu: bad menu item"
+        if (not item_list==None) and (not len(item_list)==0):
+                slicerpop.AppendSeparator()
+                for item in item_list:
+                    try:
+                        id = wx.NewId()
+                        slicerpop.Append(id, item[0], item[1])
+                        wx.EVT_MENU(self, id, item[2])
+                    except:
+                        print sys.exc_value
+                        print RuntimeError, "View1DPanel.onContextMenu: bad menu item"
         
         slicerpop.AppendSeparator()
@@ -135,4 +147,10 @@
         #wx.EVT_MENU(self, id, self._onToggleScale)
 
+        if self.graph.selected_plottable in self.plots:
+            if self.plots[self.graph.selected_plottable].__class__.__name__=="Theory1D":
+                id = wx.NewId()
+                slicerpop.Append(id, '&Add errors to data')
+                wx.EVT_MENU(self, id, self._on_add_errors)
+
         id = wx.NewId()
         slicerpop.Append(id, '&Change scale')
@@ -140,5 +158,5 @@
         
         id = wx.NewId()
-        slicerpop.AppendSeparator()
+        #slicerpop.AppendSeparator()
         slicerpop.Append(id, '&Reset Graph')
         wx.EVT_MENU(self, id, self.onResetGraph)        
@@ -147,4 +165,37 @@
         pos = self.ScreenToClient(pos)
         self.PopupMenu(slicerpop, pos)
+    
+    def _on_add_errors(self, evt):
+        """
+            Compute reasonable errors for a data set without 
+            errors and transorm the plottable to a Data1D
+        """
+        import math
+        import numpy
+        from sans.guitools.plottables import Data1D
+        
+        if not self.graph.selected_plottable == None:
+            length = len(self.plots[self.graph.selected_plottable].x)
+            dy = numpy.zeros(length)
+            for i in range(length):
+                dy[i] = math.sqrt(self.plots[self.graph.selected_plottable].y[i])
+                
+            new_plot = Data1D(self.plots[self.graph.selected_plottable].x,
+                              self.plots[self.graph.selected_plottable].y,
+                              dy=dy)
+            new_plot.interactive = True
+            new_plot.name = self.plots[self.graph.selected_plottable].name
+            label, unit = self.plots[self.graph.selected_plottable].get_xaxis()
+            new_plot.xaxis(label, unit)
+            label, unit = self.plots[self.graph.selected_plottable].get_yaxis()
+            new_plot.yaxis(label, unit)
+            
+            self.graph.delete(self.plots[self.graph.selected_plottable])
+            
+            self.graph.add(new_plot)
+            self.plots[self.graph.selected_plottable]=new_plot
+            
+            self.graph.render(self)
+            self.subplot.figure.canvas.draw_idle()    
     
     def _onSave(self, evt):
