(autopeak.py) prints measurements before AND after choosing peaks
[hooke.git] / hooke_cli.py
index d5aa3104d62082f1e95d379a414d78741040ad25..a822042a4b0de5b522e0cccfdf3888af491b78b3 100755 (executable)
@@ -121,6 +121,8 @@ class HookeCli(cmd.Cmd):
             except ImportError:
                 pass
 
+        #load default list, if possible
+        self.do_loadlist(self.config['defaultlist'])
         
 #HELPER FUNCTIONS
 #Everything sending an event should be here
@@ -165,6 +167,16 @@ class HookeCli(cmd.Cmd):
         '''
         return self.plotmanip[self.config['plotmanips'].index(name)]
     
+    def _clickize(self, xvector, yvector, index):
+        '''
+        returns a ClickedPoint() object from an index and vectors of x, y coordinates       
+        '''
+        point=ClickedPoint()
+        point.index=index
+        point.absolute_coords=xvector[index],yvector[index]
+        point.find_graph_coords(xvector,yvector)
+        return point
+    
 #HERE COMMANDS BEGIN
     
     def help_set(self):
@@ -715,7 +727,7 @@ Syntax: txt [filename] {plot to export}
             print self.current_list[self.pointer].notes
         else:
             if self.notes_filename == None:
-                self.notes_filename=raw_input('Filename? ')
+                self.notes_filename=raw_input('Notebook filename? ')
                 title_line='Notes taken at '+time.asctime()+'\n'
                 f=open(self.notes_filename,'w')
                 f.write(title_line)
@@ -787,12 +799,11 @@ Syntax copylog [directory]
             if len(item.notes)>0:
                 try:
                     shutil.copy(item.path, mydir)
-                except OSError:
-                    print 'OSError. Cannot copy file. Perhaps you gave me a wrong directory?'
+                except (OSError, IOError):
+                    print 'Cannot copy file. '+item.path+' Perhaps you gave me a wrong directory?'
 
 #OUTLET management
-
-
+#-----------------
     def do_outlet_show(self,args):
         '''OUTLET_SHOW
         ---------
@@ -818,10 +829,6 @@ Syntax copylog [directory]
         else:
             self.outlet.delete(args)
 
-
-
-
-
 #OS INTERACTION COMMANDS
 #-----------------    
     def help_dir(self):
@@ -896,6 +903,20 @@ Syntax: current
     def do_current(self,args):
         print self.current.path
         
+    def do_info(self,args):
+        '''
+        INFO
+        ----
+        Returns informations about the current curve.
+        '''
+        print 'Path: ',self.current.path
+        print 'Experiment: ',self.current.curve.experiment
+        print 'Filetype: ',self.current.curve.filetype
+        for plot in self.current.curve.default_plots():
+            for set in plot.vectors:
+                lengths=[len(item) for item in set]
+                print 'Data set size: ',lengths
+        
     def do_version(self,args):
         '''
         VERSION