Added modular directory structure.
authorW. Trevor King <wking@drexel.edu>
Tue, 4 May 2010 06:41:19 +0000 (02:41 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 4 May 2010 06:41:19 +0000 (02:41 -0400)
Also some import and other cleanups to convince myself that the
reorganization was mostly working.

37 files changed:
CHANGELOG [changed mode: 0755->0644]
bin/hooke [new file with mode: 0755]
conf/hooke.conf [changed mode: 0755->0644]
conf/macro.conf [new file with mode: 0644]
doc/USAGE
doc/hooke.jpg [changed mode: 0755->0644]
hooke/__init__.py [new file with mode: 0644]
hooke/driver/__init__.py [new file with mode: 0644]
hooke/driver/csvdriver.py
hooke/driver/hemingclamp.py [changed mode: 0755->0644]
hooke/driver/jpk.py
hooke/driver/mcs.py
hooke/driver/mfp1dexport.py
hooke/driver/picoforce.py [changed mode: 0755->0644]
hooke/driver/picoforcealt.py
hooke/driver/tutorialdriver.py
hooke/hooke.py [changed mode: 0755->0644]
hooke/hooke_cli.py [changed mode: 0755->0644]
hooke/libhooke.py [changed mode: 0755->0644]
hooke/libhookecurve.py [changed mode: 0755->0644]
hooke/libviewer.py
hooke/plugin/__init__.py [new file with mode: 0644]
hooke/plugin/autopeak.py
hooke/plugin/fit.py [changed mode: 0755->0644]
hooke/plugin/flatfilts.py [changed mode: 0755->0644]
hooke/plugin/generalclamp.py
hooke/plugin/generalvclamp.py
hooke/plugin/macro.py
hooke/plugin/massanalysis.py
hooke/plugin/multidistance.py
hooke/plugin/pcluster.py
hooke/plugin/procplots.py [changed mode: 0755->0644]
hooke/plugin/superimpose.py
hooke/plugin/tutorial.py [changed mode: 0755->0644]
hooke/plugin/viewer.py
hooke/test/default.000 [changed mode: 0755->0644]
hooke/test/test.hkp

old mode 100755 (executable)
new mode 100644 (file)
diff --git a/bin/hooke b/bin/hooke
new file mode 100755 (executable)
index 0000000..5a57baa
--- /dev/null
+++ b/bin/hooke
@@ -0,0 +1,5 @@
+#!/usr/bin/python
+
+import hooke.hooke
+
+hooke.hooke.main()
old mode 100755 (executable)
new mode 100644 (file)
index 75a31f9..c1d8d7b
@@ -1,26 +1,59 @@
 <?xml version="1.0" ?>\r
 <!-- To comment something, put dashes and ! like here -->\r
 <config>\r
-<!-- Internal variabls. -->\r
-    <display ext="1" colour_ext="None" ret="1" colour_ret="None" correct="1" colour_correct="None" contact_point="0" medfilt="0" xaxes="0" yaxes="0" flatten="1" fit_function="wlc" temperature="301" auto_fit_points="50" auto_slope_span="20" auto_delta_force="10" auto_fit_nm="5" auto_min_p="0.005" auto_max_p="10" baseline_clicks="0" auto_left_baseline="20" auto_right_baseline="20" force_multiplier="1" fc_showphase="0" fc_showimposed="0" fc_interesting="0" tccd_threshold="0" tccd_coincident="0"/>\r
 \r
-<!-- \r
-The following section defines your own work directory. Substitute your work directory.\r
-     -->\r
-<workdir>\r
-    insert directory\r
-</workdir>\r
+\r
+<!--\r
+This section defines the Hooke installation.  confpath is hardcoded,\r
+since it's to find the config file(s) before your read them.\r
+    -->\r
+<install>\r
+    <docpath>\r
+        ./doc/\r
+    </docpath>\r
+</install>\r
+\r
+<!-- Internal variables. -->\r
+<display\r
+    ext="1"\r
+    colour_ext="None"\r
+    ret="1"\r
+    colour_ret="None"\r
+    correct="1"\r
+    colour_correct="None"\r
+    contact_point="0"\r
+    medfilt="0"\r
+    xaxes="0"\r
+    yaxes="0"\r
+    flatten="1"\r
+    fit_function="wlc"\r
+    temperature="301"\r
+    auto_fit_points="50"\r
+    auto_slope_span="20"\r
+    auto_delta_force="10"\r
+    auto_fit_nm="5"\r
+    auto_min_p="0.005"\r
+    auto_max_p="10"\r
+    baseline_clicks="0"\r
+    auto_left_baseline="20"\r
+    auto_right_baseline="20"\r
+    force_multiplier="1"\r
+    fc_showphase="0"\r
+    fc_showimposed="0"\r
+    fc_interesting="0"\r
+    tccd_threshold="0"\r
+    tccd_coincident="0"/>\r
 \r
 <!--\r
 The following section defines the default playlist to load at startup.\r
--->\r
+    -->\r
 <defaultlist>\r
-    test.hkp\r
+    ./hooke/test/test.hkp\r
 </defaultlist>\r
 \r
 <!--\r
 This section defines which plugins have to be loaded by Hooke.\r
-    -->\r
+     -->\r
 <plugins>\r
     <fit/>\r
     <procplots/>\r
@@ -69,4 +102,3 @@ and -IMPORTANTLY- their order.
 </plotmanips>\r
 \r
 </config>\r
-\r
diff --git a/conf/macro.conf b/conf/macro.conf
new file mode 100644 (file)
index 0000000..b197e36
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" ?>
+<config>
+
+<!-- Set the location of your macros directory (for the macro plugin) -->
+<macrodir path="~/.hooke/macros" />
+</config>
index 785f47d9f55117d52f6bb2f93f1b122e87ff0356..eed629a676202583ea98fb3354c9114f49d6b9b0 100644 (file)
--- a/doc/USAGE
+++ b/doc/USAGE
@@ -2,9 +2,9 @@ Starting Hooke
 ==============
 
 Open a terminal, go to the directory Hooke is installed and type
-python hooke/hooke.py (You may need to give the full path for Python
-on Windows systems).  If everything is OK, Hooke displays a nice
-splashscreen and starts.
+  python bin/hooke
+(You may need to give the full path for Python on Windows systems).
+If everything is OK, Hooke displays a nice splashscreen and starts.
 
 Once Hooke is launched from the terminal window, you see a text like
 the following:
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/hooke/__init__.py b/hooke/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/hooke/driver/__init__.py b/hooke/driver/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
index fb465ee2c0083a6a0b251c9dc9da5f6464fc326e..1d05e232532eb67c9ecb1528dffa98f28550d179 100644 (file)
@@ -12,8 +12,8 @@ If the number of columns is odd, the last column is ignored.
 (c)Massimo Sandal, 2008
 '''
 
-import libhookecurve as lhc
-import libhooke as lh
+from .. import libhookecurve as lhc
+from .. import libhooke as lh
 import csv
 
 class csvdriverDriver(lhc.Driver):
old mode 100755 (executable)
new mode 100644 (file)
index 41e721a..3145404
@@ -14,7 +14,7 @@ __changelog__='''
 2007_02_07: Initial implementation
 '''
 import string
-import libhookecurve as lhc
+from .. import libhookecurve as lhc
 
 class DataChunk(list):
     '''Dummy class to provide ext and ret methods to the data list.
index 5fd5f5dae342ab591c0855c807ad603e5d9f3a10..090b09a25e30bf6e0badfe58e796a401f3eb6fe5 100644 (file)
@@ -1,5 +1,5 @@
 import string
-import libhookecurve as lhc
+from .. import libhookecurve as lhc
 
 class DataChunk(list):
     #Dummy class to provide ext and ret methods to the data list.
index 48836f2fb4b558506d89279b5342623957e7db3c..6562d90d1040510c80d7852005fd41aa7f3af86e 100644 (file)
@@ -6,8 +6,8 @@ driver for mcs fluorescence files
 Massimo Sandal, Allen Chen (c) 2009
 '''
 
-import libhookecurve as lhc
-import libhooke as lh
+from .. import libhookecurve as lhc
+from .. import libhooke as lh
 import struct
 
 class mcsDriver(lhc.Driver):
index 5cc18e53f7b25f10d2e3cb84c98bc57e7aa4f3ff..37af7df8e6fd022b61e026ad4e478b9252588a64 100644 (file)
@@ -6,8 +6,8 @@ Driver for text-exported MFP 1D files
 Massimo Sandal (c) 2009
 '''
 
-import libhookecurve as lhc
-import libhooke as lh
+from .. import libhookecurve as lhc
+from .. import libhooke as lh
 
 class mfp1dexportDriver(lhc.Driver):
 
old mode 100755 (executable)
new mode 100644 (file)
index e7df889..c60e57c
@@ -11,7 +11,7 @@ This program is released under the GNU General Public License version 2.
 import re, struct
 from scipy import arange
 
-import libhookecurve as lhc
+from .. import libhookecurve as lhc
 
 __version__='0.0.0.20080404'
 
index ec69118ecfd2d46217e82a3250438ec4d191b7cf..836fb4561cf89b0dc84a72516ed03bb02f7df332 100644 (file)
@@ -12,7 +12,7 @@ This program is released under the GNU General Public License version 2.
 import re, struct
 from scipy import arange
 
-import libhookecurve as lhc
+from .. import libhookecurve as lhc
 
 __version__='0.0.0.20081706'
 
index 9d38c476e9d9cf7ab78e5074b13dc800d5e81e58..8644eef97a8250c0e78cf9b423df989757337eac 100644 (file)
@@ -45,7 +45,7 @@ END
 that is, two plots with two datasets each.
 '''
 
-import libhookecurve as lhc #We need to import this library to define some essential data types
+from .. import libhookecurve as lhc #We need to import this library to define some essential data types
 
 class tutorialdriverDriver(lhc.Driver):
     '''
old mode 100755 (executable)
new mode 100644 (file)
index 55f23b1..75cc7d9
@@ -10,8 +10,7 @@ Copyright (C) 2008 Massimo Sandal (University of Bologna, Italy).
 This program is released under the GNU General Public License version 2.\r
 '''\r
 \r
-from libhooke import HOOKE_VERSION\r
-from libhooke import WX_GOOD\r
+from .libhooke import HOOKE_VERSION, WX_GOOD\r
 \r
 import os\r
 \r
@@ -24,12 +23,12 @@ from wx.lib.newevent import NewEvent
 import matplotlib.numerix as nx\r
 import scipy as sp\r
 \r
-from threading import *\r
+from threading import Thread\r
 import Queue\r
 \r
-from hooke_cli import HookeCli\r
-from libhooke import *\r
-import libhookecurve as lhc\r
+from .hooke_cli import HookeCli\r
+from .libhooke import HookeConfig, ClickedPoint\r
+from . import libhookecurve as lhc\r
 \r
 #import file versions, just to know with what we're working...\r
 from hooke_cli import __version__ as hookecli_version\r
@@ -64,15 +63,20 @@ plugin_commands_namespaces=[]
 plugin_gui_namespaces=[]\r
 for plugin_name in config['plugins']:\r
     try:\r
-        plugin=__import__(plugin_name)\r
+        hooke_module=__import__('hooke.plugin.'+plugin_name)\r
+        plugin = getattr(hooke_module.plugin, plugin_name)\r
         try:\r
-            eval('CLI_PLUGINS.append(plugin.'+plugin_name+'Commands)') #take Command plugin classes\r
-            plugin_commands_namespaces.append(dir(eval('plugin.'+plugin_name+'Commands')))\r
+            #take Command plugin classes\r
+            commands = getattr(plugin, plugin_name+'Commands')\r
+            CLI_PLUGINS.append(commands)\r
+            plugin_commands_namespaces.append(dir(commands))\r
         except:\r
             pass\r
         try:\r
-            eval('GUI_PLUGINS.append(plugin.'+plugin_name+'Gui)') #take Gui plugin classes\r
-            plugin_gui_namespaces.append(dir(eval('plugin.'+plugin_name+'Gui')))\r
+            #take Gui plugin classes\r
+            gui = getattr(plugin, plugin_name+'Gui')\r
+            GUI_PLUGINS.append(gui)\r
+            plugin_gui_namespaces.append(dir(gui))\r
         except:\r
             pass\r
     except ImportError:\r
@@ -82,8 +86,11 @@ for plugin_name in config['plugins']:
         print 'Imported plugin ',plugin_name\r
 \r
 #eliminate names common to all namespaces\r
-for i in range(len(plugin_commands_namespaces)):\r
-    plugin_commands_namespaces[i]=[item for item in plugin_commands_namespaces[i] if (item != '__doc__' and item != '__module__' and item != '_plug_init')]\r
+for i,namespace in enumerate(plugin_commands_namespaces):\r
+    plugin_commands_namespaces[i] = \\r
+        filter(lambda item : not (item.startswith('__')\r
+                                  or item == '_plug_init'),\r
+               namespace)\r
 #check for conflicts in namespaces between plugins\r
 #FIXME: only in commands now, because I don't have Gui plugins to check\r
 #FIXME: how to check for plugin-defined variables (self.stuff) ??\r
@@ -94,7 +101,8 @@ for namespace,plugin_name in zip(plugin_commands_namespaces, config['plugins']):
     for item in namespace:\r
         if item in plugin_commands_names:\r
             i=plugin_commands_names.index(item) #we exploit the fact index gives the *first* occurrence of a name...\r
-            print 'Error. Plugin ',plugin_name,' defines a function already defined by ',whatplugin_defines[i],'!'\r
+            print 'Error. Plugin %s defines a function %s already defined by %s!' \\r
+                % (plugin_name, item, whatplugin_defines[i])\r
             print 'This should not happen. Please disable one or both plugins and contact the plugin authors to solve the conflict.'\r
             print 'Hooke cannot continue.'\r
             exit()\r
@@ -110,9 +118,10 @@ FILE_DRIVERS=[]
 LOADED_DRIVERS=[]\r
 for driver_name in config['drivers']:\r
     try:\r
-        driver=__import__(driver_name)\r
+        hooke_module=__import__('hooke.driver.'+driver_name)\r
+        driver = getattr(hooke_module.driver, driver_name)\r
         try:\r
-            eval('FILE_DRIVERS.append(driver.'+driver_name+'Driver)')\r
+            FILE_DRIVERS.append(getattr(driver, driver_name+'Driver'))\r
         except:\r
             pass\r
     except ImportError:\r
@@ -353,7 +362,8 @@ class MainWindow(wx.Frame):
         #make sure we execute _plug_init() for every command line plugin we import\r
         for plugin_name in config['plugins']:\r
             try:\r
-                plugin=__import__(plugin_name)\r
+                hooke_module=__import__('hooke.plugin.'+plugin_name)\r
+                plugin = getattr(hooke_module.plugin, plugin_name)\r
                 try:\r
                     eval('plugin.'+plugin_name+'Gui._plug_init(self)')\r
                     pass\r
@@ -760,7 +770,9 @@ class MySplashScreen(wx.SplashScreen):
         # This is a recipe to a the screen.\r
         # Modify the following variables as necessary.\r
         #aBitmap = wx.Image(name = "wxPyWiki.jpg").ConvertToBitmap()\r
-        aBitmap=wx.Image(name='hooke.jpg').ConvertToBitmap()\r
+        aBitmap=wx.Image(name=os.path.join(\r
+                config['install']['docpath'],\r
+                'hooke.jpg')).ConvertToBitmap()\r
         splashStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT\r
         splashDuration = 2000 # milliseconds\r
         splashCallback = None\r
@@ -783,16 +795,6 @@ class MySplashScreen(wx.SplashScreen):
 #------------------------------------------------------------------------------\r
 \r
 def main():\r
-\r
-    #save the directory where Hooke is located\r
-    config['hookedir']=os.getcwd()\r
-\r
-    #now change to the working directory.\r
-    try:\r
-        os.chdir(config['workdir'])\r
-    except OSError:\r
-        print "Warning: Invalid work directory."\r
-\r
     app=wx.PySimpleApp()\r
 \r
     def make_gui_class(*bases):\r
@@ -808,7 +810,6 @@ def main():
     my_cmdline=CliThread(main_frame, list_of_events)\r
     my_cmdline.start()\r
 \r
-\r
     app.MainLoop()\r
 \r
 if __name__ == '__main__':\r
old mode 100755 (executable)
new mode 100644 (file)
index fc0cee3..886563b
@@ -10,14 +10,7 @@ Copyright (C) 2006 Massimo Sandal (University of Bologna, Italy).
 This program is released under the GNU General Public License version 2.
 '''
 
-from libhooke import * #FIXME
-import libhookecurve as lhc
-
-import libinput as linp
-import liboutlet as lout
-
-from libhooke import WX_GOOD
-from libhooke import HOOKE_VERSION
+from .libhooke import HOOKE_VERSION, WX_GOOD
 
 import wxversion
 wxversion.select(WX_GOOD)
@@ -47,17 +40,19 @@ from numpy import __version__ as numpy_version
 from sys import version as python_version
 import platform
 
+from .libhooke import PlaylistXML
+from . import libhookecurve as lhc
+from . import libinput as linp
+from . import liboutlet as lout
+
 
-class HookeCli(cmd.Cmd):
+class HookeCli(cmd.Cmd, object):
 
     def __init__(self,frame,list_of_events,events_from_gui,config,drivers):
         cmd.Cmd.__init__(self)
 
         self.prompt = 'hooke: '
-
-
         self.current_list=[] #the playlist we're using
-
         self.current=None    #the current curve under analysis.
         self.plots=None
         '''
@@ -71,8 +66,6 @@ class HookeCli(cmd.Cmd):
         then undergoes modifications by the plotmanip
         modifier functions. The modified plot is saved in self.plots and used if needed by other functions.
         '''
-
-
         self.pointer=0       #a pointer to navigate the current list
 
         #Things that come from outside
@@ -239,10 +232,11 @@ Syntax: loadlist [playlist file]
             self.current_list, self.playlist_generics=playxml.load(play_to_load)
             self.current_playxml=playxml
         except IOError:
-            print 'File not found.'
+            print 'File not found.', play_to_load
             return
 
-        print 'Loaded %s curves' %len(self.current_list)
+        print 'Loaded %s curves from %s' \
+            % (len(self.current_list), play_to_load)
 
         if 'pointer' in self.playlist_generics.keys():
             self.pointer=int(self.playlist_generics['pointer'])
@@ -514,8 +508,8 @@ Plots the current force curve
 Syntax: plot
         '''
     def do_plot(self,args):
-
-        self.current.identify(self.drivers)
+        if self.current.identify(self.drivers) == False:
+            return
         self.plots=self.current.curve.default_plots()
         try:
             self.plots=self.current.curve.default_plots()
old mode 100755 (executable)
new mode 100644 (file)
index 73534f2..05c9837
@@ -10,8 +10,6 @@ With algorithms contributed by Francesco Musiani (University of Bologna, Italy)
 This program is released under the GNU General Public License version 2.
 '''
 
-import libhookecurve as lhc
-
 import scipy
 import numpy
 import xml.dom.minidom
@@ -20,6 +18,8 @@ import os.path
 import string
 import csv
 
+from . import libhookecurve as lhc
+
 HOOKE_VERSION=['0.8.3_devel', 'Seinei', '2008-04-16']
 WX_GOOD=['2.6','2.8']
 
@@ -106,8 +106,13 @@ class PlaylistXML(object):
                 new_playlist=[]
                 for myfile in list_of_files:
                     #rebuild a data structure from the xml attributes
-                    the_curve=lhc.HookeCurve(myfile.getAttribute('path'))
-                    for attribute in myfile.attributes.keys(): #extract attributes for the single curve
+                    the_curve=lhc.HookeCurve(
+                        os.path.join(os.path.dirname(self.playpath),
+                                     myfile.getAttribute('path')))
+                    for attribute in myfile.attributes.keys():
+                        #extract attributes for the single curve
+                        if attribute == 'path':
+                            continue # we already added this attribute
                         the_curve.__dict__[attribute]=myfile.getAttribute(attribute)
                     new_playlist.append(the_curve)
 
@@ -129,6 +134,11 @@ class PlaylistXML(object):
             self.playlist.writexml(outfile,indent='\n')
             outfile.close()
 
+def config_file_path(filename, config_dir=None):
+    if config_dir == None:
+        config_dir = os.path.abspath(
+            os.path.join(os.path.dirname(os.path.dirname(__file__)), 'conf'))
+    return os.path.join(config_dir, filename)
 
 class HookeConfig(object):
     '''
@@ -142,18 +152,14 @@ class HookeConfig(object):
 
     def __init__(self, config_dir=None):
         self.config={}
+        self.config['install']={}
         self.config['plugins']=[]
         self.config['drivers']=[]
         self.config['plotmanips']=[]
         self.config_dir = config_dir
-       if self.config_dir == None:
-            self.config_dir = os.path.abspath(
-               os.path.join(os.path.dirname(os.path.dirname(__file__)),
-                            'conf'))
 
     def load_config(self, filename):
-        print 'loading config file', os.path.join(self.config_dir, filename)
-        myconfig=file(os.path.join(self.config_dir, filename))
+        myconfig=file(config_file_path(filename, config_dir=self.config_dir))
 
         #the following 3 lines are needed to strip newlines. otherwise, since newlines
         #are XML elements too, the parser would read them (and re-save them, multiplying
@@ -175,19 +181,27 @@ class HookeConfig(object):
             return rc
 
         def handleConfig(config):
+            install_elements=config.getElementsByTagName("install")
             display_elements=config.getElementsByTagName("display")
             plugins_elements=config.getElementsByTagName("plugins")
             drivers_elements=config.getElementsByTagName("drivers")
-            workdir_elements=config.getElementsByTagName("workdir")
             defaultlist_elements=config.getElementsByTagName("defaultlist")
             plotmanip_elements=config.getElementsByTagName("plotmanips")
+            handleInstall(install_elements)
             handleDisplay(display_elements)
             handlePlugins(plugins_elements)
             handleDrivers(drivers_elements)
-            handleWorkdir(workdir_elements)
             handleDefaultlist(defaultlist_elements)
             handlePlotmanip(plotmanip_elements)
 
+        def handleInstall(install_elements):
+            for install in install_elements:
+                for node in install.childNodes:
+                    if node.nodeType == node.TEXT_NODE:
+                        continue
+                    path = os.path.abspath(getText(node.childNodes).strip())
+                    self.config['install'][str(node.tagName)] = path
+
         def handleDisplay(display_elements):
             for element in display_elements:
                 for attribute in element.attributes.keys():
@@ -214,13 +228,6 @@ class HookeConfig(object):
                 except: #if we allow fancy formatting of xml, there is a text node, so tagName fails for it...
                     pass
 
-        def handleWorkdir(workdir):
-            '''
-            default working directory
-            '''
-            wdir=getText(workdir[0].childNodes)
-            self.config['workdir']=wdir.strip()
-
         def handleDefaultlist(defaultlist):
             '''
             default playlist
old mode 100755 (executable)
new mode 100644 (file)
index 0bb4a49..44dc9d6
@@ -15,10 +15,8 @@ class HookeCurve(object):
                 #bring on all the driver, with his load of methods etc.
                 #so we can access the whole of it.
                 self.curve=tempcurve
-                del tempcurve
                 return True
-
-        print 'Not a recognizable curve format.'
+        print 'Not a recognizable curve format: ', self.path
         return False
 
 
index 5397a6e84cdd0edf1df9aec57346535edab8c698..f56160dc70cfaa4553c8aaf4024a8181e86e0eaa 100644 (file)
@@ -19,8 +19,8 @@ and process it. Just a wrapper call for the specific one of each
 viewer. 
 '''
 
-import liboutlet as lout
-import libinput as linput
+from . import liboutlet as lout
+from . import libinput as linput
 
 
 class Viewer(object):
diff --git a/hooke/plugin/__init__.py b/hooke/plugin/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
index 17a30ed3120df8e21814f82fb336fa9cbdc451d3..bbea952e34cc5761b730f119dfdb919ca3b9b460 100644 (file)
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
-from libhooke import WX_GOOD, ClickedPoint
+from hooke.libhooke import WX_GOOD, ClickedPoint
+
 import wxversion
 wxversion.select(WX_GOOD)
 from wx import PostEvent
old mode 100755 (executable)
new mode 100644 (file)
index 7ab6037..4b6ba7d
@@ -7,13 +7,15 @@ Licensed under the GNU GPL version 2
 Non-standard Dependencies:
 procplots.py (plot processing plugin)
 '''
-from libhooke import WX_GOOD, ClickedPoint
+from hooke.libhooke import WX_GOOD, ClickedPoint
+
 import wxversion
 wxversion.select(WX_GOOD)
 #from wx import PostEvent
 #from wx.lib.newevent import NewEvent
 import scipy
 import scipy.odr
+import scipy.stats
 import numpy as np
 import copy
 import Queue
old mode 100755 (executable)
new mode 100644 (file)
index 09dc3db..47eab59
@@ -7,21 +7,20 @@ Licensed under the GNU LGPL version 2
 Other plugin dependencies:
 procplots.py (plot processing plugin)
 '''
-from libhooke import WX_GOOD
+
+from hooke.libhooke import WX_GOOD
+
 import wxversion
 wxversion.select(WX_GOOD)
-
 import xml.dom.minidom
-
 import wx
 import scipy
 import numpy
 from numpy import diff
-
 #import pickle
 
-import libpeakspot as lps
-import libhookecurve as lhc
+from .. import libpeakspot as lps
+from .. import libhookecurve as lhc
 
 
 class flatfiltsCommands(object):
@@ -29,14 +28,7 @@ class flatfiltsCommands(object):
     def _plug_init(self):
         #configurate convfilt variables
         convfilt_configurator=ConvfiltConfig()
-
-        #different OSes have different path conventions
-        if self.config['hookedir'][0]=='/':
-            slash='/' #a Unix or Unix-like system
-        else:
-            slash='\\' #it's a drive letter, we assume it's Windows
-
-        self.convfilt_config=convfilt_configurator.load_config(self.config['hookedir']+slash+'convfilt.conf')
+        self.convfilt_config=convfilt_configurator.load_config('convfilt.conf')
 
     def do_flatfilt(self,args):
         '''
index e3c6fe1c2e3fc05fa9dcaa8ab5139b0e12c660dc..2777f499e8cb1605630fb330a1d98a390411f574 100644 (file)
@@ -3,12 +3,15 @@ GENERALCLAMP.py
 
 Plugin regarding general force clamp measurements
 '''
-from libhooke import WX_GOOD, ClickedPoint
+from hooke.libhooke import WX_GOOD, ClickedPoint
+
 import wxversion
-import libhookecurve as lhc
 wxversion.select(WX_GOOD)
 from wx import PostEvent
 
+from .. import libhookecurve as lhc
+
+
 class generalclampCommands(object):
 
     def plotmanip_clamp(self, plot, current, customvalue=False):
index 28131503c3c96c3b400a8b72dd2010cec9385064..45cfa2c41d18e3199eb6cc8388aef02ce6a2fa13 100644 (file)
@@ -4,7 +4,7 @@ generalvclamp.py
 Plugin regarding general velocity clamp measurements
 '''
 
-from libhooke import WX_GOOD, ClickedPoint
+from hooke.libhooke import WX_GOOD, ClickedPoint
 import wxversion
 wxversion.select(WX_GOOD)
 from wx import PostEvent
index 88d13a50b654adba3e7b1c01f6a9f7987182c204..2a1ca997aea3c1b6a8dad635d7168d6779990b27 100644 (file)
@@ -5,17 +5,18 @@ Records, saves and executes batches of commands
 (c)Alberto Gomez-Casado 2008
 '''
 
-import libhookecurve as lhc
-import libinput as linput
 import os.path
 import string
 
+from .. import libhookecurve as lhc
+from .. import libinput as linput
+
 class macroCommands(object):
 
        currentmacro=[]
        pause=0
        auxprompt=[]
-       macrodir=[]
+       macrodir=None
        
 
        def _plug_init(self):
index 0a36657ff996a4c7d1678b02d84babe242cd6d58..a9ea6155361c4c102964f1c67cd99150e3f8e23a 100644 (file)
@@ -8,14 +8,13 @@ libpeakspot.py
 flatfilts.py
 '''
 
-
-import libpeakspot as lps
-import libhookecurve as lhc
-import libhooke as lh
 import numpy as np
-
 import csv
 
+from .. import libpeakspot as lps
+from .. import libhookecurve as lhc
+from .. import libhooke as lh
+
 class massanalysisCommands(object):
 
     def _plug_init(self):
index 517a286ad638aa66b5379ec3c7571b019c3883f7..9db5f5dc969c2dd657389f2bb00b0ef9f4231d6f 100644 (file)
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
-from libhooke import WX_GOOD, ClickedPoint
+from hooke.libhooke import WX_GOOD, ClickedPoint
+
 import wxversion
 wxversion.select(WX_GOOD)
 from wx import PostEvent
index 2e166201dbf13f051e40e21fa846f09bafde2388..eb1770a564815bde3ed10ff1ad4c579e90cc72b5 100644 (file)
@@ -1,5 +1,6 @@
+from ..libhooke import WX_GOOD, ClickedPoint, config_file_path
+
 from mdp import pca
-from libhooke import WX_GOOD, ClickedPoint
 import wxversion
 wxversion.select(WX_GOOD)
 from wx import PostEvent
@@ -8,9 +9,11 @@ import scipy as sp
 import copy
 import os.path
 import time
-import libhookecurve as lhc
 import pylab as pyl
 
+from .. import libhookecurve as lhc
+
+
 import warnings
 warnings.simplefilter('ignore',np.RankWarning)
 
@@ -28,13 +31,9 @@ class pclusterCommands(object):
         Automatically measures peaks and extracts informations for further clustering
         (c)Paolo Pancaldi, Massimo Sandal 2009
         '''
-        if self.config['hookedir'][0]=='/':
-            slash='/' #a Unix or Unix-like system
-        else:
-            slash='\\'
         blindw = str(self.convfilt_config['blindwindow'])
         pclus_dir = "pCluster_blind"+blindw+"_"+time.strftime("%Y%m%d_%H%M")
-        self.my_work_dir = os.getcwd()+slash+pclus_dir+slash
+        self.my_work_dir = os.path.join(os.getcwd(), pclus_dir)
         self.my_curr_dir = os.path.basename(os.getcwd())
         os.mkdir(self.my_work_dir)
 
@@ -343,14 +342,7 @@ class pclusterCommands(object):
         '''
 
         # reads the columns of pca
-        if self.config['hookedir'][0]=='/':
-            slash='/' #a Unix or Unix-like system
-        else:
-            slash='\\'
-        self.my_hooke_dir = self.config['hookedir']+slash
-        #self.my_work_dir = os.getcwd()+slash+"pCluster_"+time.strftime("%Y%m%d_%H%M")+slash
-        #self.my_curr_dir = os.path.basename(os.getcwd())
-        conf=open(self.my_hooke_dir+"pca_config.txt")
+        conf=open(config_file_path("pca_config.txt"), 'r')
         config = conf.readlines()
         conf.close()
 
old mode 100755 (executable)
new mode 100644 (file)
index 612ae0b..b8baa15
@@ -4,17 +4,19 @@ Processed plots plugin for force curves.
 
 Licensed under the GNU GPL version 2
 '''
-from libhooke import WX_GOOD
+from ..libhooke import WX_GOOD
 import wxversion
 wxversion.select(WX_GOOD)
 
 import wx
-import libhookecurve as lhc
 import numpy as np
 import scipy as sp
 import scipy.signal
 import copy
 
+from .. import libhookecurve as lhc
+
+
 class procplotsCommands(object):
 
     def _plug_init(self):
index 41083f68651f0f9a03d7fd16b856d19e6c950759..448ded342d687a2563ee1456c32449b00cb0dd0b 100644 (file)
@@ -1,11 +1,11 @@
-from libhooke import WX_GOOD
+from ..libhooke import WX_GOOD
 import wxversion
 wxversion.select(WX_GOOD)
 from wx import PostEvent
-
-import libhookecurve as lhc
 from numpy import arange, mean
 
+from .. import libhookecurve as lhc
+
 class superimposeCommands(object):
 
     def _plug_init(self):
old mode 100755 (executable)
new mode 100644 (file)
index 50a0d78..61461f6
@@ -6,10 +6,10 @@ internals.
 (c)Massimo Sandal 2007
 '''
 
-import libhookecurve as lhc
-
 import numpy as np
 
+from .. import libhookecurve as lhc
+
 '''
 SYNTAX OF DATA TYPE DECLARATION:
     type = type of object
index 7a6881dd25e4c7a81adb3322e705090a389ebf64..43f74aee2d5404201818586ce8ca7b32f463e4f2 100644 (file)
@@ -7,8 +7,8 @@ This program is released under the GNU General Public License version 2.
 '''
 
 
-import libviewer as lview
-import libinput as linput
+from .. import libviewer as lview
+from .. import libinput as linput
 
 class viewerCommands(object):
        
old mode 100755 (executable)
new mode 100644 (file)
index da648f4f031df7e7cdfaa0343502d04214c7aa7d..883d5976e0fa12a4dd26a74199630167d28fa037 100644 (file)
@@ -2,4 +2,4 @@
 <playlist>
 <generics pointer="0"/>
 <element notes="" path="default.000"/>
-</playlist>
\ No newline at end of file
+</playlist>