Пример #1
0
def main():
    # create measurement manager
    thoth = Thoth()

    # get list of files in example dir
    chdir('example')
    filenames = listdir('.')

    # open all the files
    thoth.open(filenames)

    # get the average, take smoothed derivative
    # smooth result, display it and try to fit bcs
    average = thoth.get_average()

    class Param:
        num_points = 8
        poly_degree = 4
        diff_order = 1

    param = Param()
    didv = average.compute_savitzky(param, interactive=False)
    didv_smoothed = didv.compute_wiener()

    if PREVIEW:
        thoth.create_window(didv_smoothed)
        thoth.create_window(average)
    fit = didv_smoothed.fit_bcs()
    print fit.get_values()
Пример #2
0
def main():
    # create measurement manager
    thoth = Thoth()

    # get list of files in example dir
    chdir('example')
    filenames = listdir('.')

    # open all the files
    thoth.open(filenames)

    # get the average, take smoothed derivative
    # smooth result, display it and try to fit bcs
    average = thoth.get_average()

    class Param:
        num_points = 8
        poly_degree = 4
        diff_order = 1
    param = Param()
    didv = average.compute_savitzky(param, interactive=False)
    didv_smoothed = didv.compute_wiener()

    if PREVIEW:
        thoth.create_window(didv_smoothed)
        thoth.create_window(average)
    fit = didv_smoothed.fit_bcs()
    print fit.get_values()
Пример #3
0
def main():
    # create measurement manager
    thoth = Thoth()

    # get list of files in example dir
    chdir('example')
    filenames = listdir('.')

    # open all the files
    thoth.open(filenames)

    # get the average, take smoothed derivative
    # smooth result, display it and try to fit bcs
    average = thoth.get_average()
    didv = average.compute_savitzky()
    didv_smoothed = didv.compute_wiener()
    thoth.create_window(didv_smoothed)
    didv_smoothed.fit_bcs()
Пример #4
0
def main():
    # create measurement manager
    thoth = Thoth()

    # get list of files in example dir
    chdir('example')
    filenames = listdir('.')

    # open all the files
    thoth.open(filenames)

    # get the average, take smoothed derivative
    # smooth result, display it and try to fit bcs
    average = thoth.get_average()
    didv = average.compute_savitzky()
    didv_smoothed = didv.compute_wiener()
    thoth.create_window(didv_smoothed)
    didv_smoothed.fit_bcs()
Пример #5
0
def main():
    # create measurement manager
    thoth = Thoth()

    items = []
    for path in sys.argv[1:]:
        
        # get list of files in example dir
        try:
            filenames = listdir(path)
        except OSError:
            print "Unable to find folder, ignore."
            continue

        # open all the files
        chdir(path)
        thoth.open(filenames)

        # get the average, take smoothed derivative
        # smooth result, display it and try to fit bcs
        average = thoth.get_average()

        smoothed = average.compute_gaussian(interactive=False)

        class Param:
            num_points = 4
            poly_degree = 3
            diff_order = 1
        param = Param()
        didv = smoothed.compute_savitzky(param, interactive=False)
        thoth.create_window(didv)
        if PREVIEW:
            thoth.create_window(average)
            didv_smoothed = didv.compute_wiener()
            thoth.create_window(didv_smoothed)
            thoth.create_window(didv.compute_gaussian(interactive=False))
            thoth.create_window(smoothed.compute_derivative())
            thoth.create_window(smoothed)

        items.append(didv)
Пример #6
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.thoth = Thoth()
     self._setup()
     self.file_menu_action = []
     self.console = None
Пример #7
0
class ThothMainWindow(QMainWindow):

    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)
        self.thoth = Thoth()
        self._setup()
        self.file_menu_action = []
        self.console = None

    def closeEvent(self, event):
        if self.console is not None:
            self.console.exit_interpreter()
        event.accept()

    def _setup(self):
        self.setWindowTitle(_('Thoth – Scanning Probe Analysis Tool'))
        self.create_menus()
        self.create_main_frame()
        self.create_status_bar()
        self.create_list_dock()
        self.create_info_dock()
        self.create_internal_console()
        self.connect_thoth()
        self.show()

        if DEMO:
            self.thoth.open('testfiles/flatfile/topo.flat')
            self.thoth.open('testfiles/flatfile/iv.flat')
            self.thoth.open('testfiles/flatfile/grid.flat')

    def connect_thoth(self):
        QObject.connect(self.thoth, SIGNAL("item_registred"),
                        self.thoth.create_window)
        #QObject.connect(self.thoth, SIGNAL("window_registred(QWidget)"), self.mdi_area.addSubWindow)
        QObject.connect(self.thoth, SIGNAL("window_registred"),
                        self.add_sub_window)

    def add_sub_window(self, window):
        self.mdi_area.addSubWindow(window)
        self.list_widget.addItem(window.windowTitle())
        window.show()

    def create_internal_console(self):
        if DockableConsole is None:
            self.console = None
        else:
            import time, scipy.signal as sps, scipy.ndimage as spi
            import sys, os
            import numpy as np
            ns = {'thoth': self.thoth,
                  'np': np, 'sps': sps, 'spi': spi,
                  'os': os, 'sys': sys, 'time': time}
            msg = "Example: thoth.get_items()[0]\n"\
                  "Modules imported at startup: "\
                  "os, sys, os.path as osp, time, "\
                  "numpy as np, scipy.signal as sps, scipy.ndimage as spi"
            self.console = DockableConsole(self, namespace=ns, message=msg)
            console_dock = QDockWidget(_('Console'))
            self.addDockWidget(Qt.BottomDockWidgetArea, console_dock)
            console_dock.setWidget(self.console)
            #self.connect(self.console.interpreter.widget_proxy,
                         #SIGNAL("new_prompt(QString)"),
                         #lambda txt: self.refresh_lists())

    def about(self):
        QMessageBox.about( self, _("About ")+APP_NAME,
              """<b>%s</b> v%s<br>%s<p>
              <br>Copyright © François Bianco, University of Geneva
              <br>[email protected]
              <br>Distributed under the GNU GPL License v.3
              """ % \
              (APP_NAME, VERSION, APP_DESC))

    def create_main_frame(self):
        self.mdi_area = QMdiArea()
        self.connect( self.mdi_area,
            SIGNAL("subWindowActivated(QMdiSubWindow)"),
            self.update_info)
        self.setCentralWidget(self.mdi_area)

    def update_info(self, window):
        self.info_widget.clear()
        self.info_widget.addItem(window.windowTitle())

    def create_list_dock(self) :
        list_dock = QDockWidget(_('Files'))
        self.addDockWidget(Qt.RightDockWidgetArea, list_dock)
        self.list_widget = QListWidget()
        self.connect(self.list_widget,
            SIGNAL( "currentItemChanged( QListWidgetItem, QListWidgetItem)" ),
            self.change_selection)
        list_dock.setWidget(self.list_widget)

    def change_selection(self, current, previous):
        pass

    def create_info_dock(self):
        info_dock = QDockWidget(_('Info'))
        self.addDockWidget(Qt.RightDockWidgetArea, info_dock)
        self.info_widget = QListWidget()
        info_dock.setWidget(self.info_widget)

    def create_status_bar(self):
        self.statusBar().showMessage(_("Open a file"))

    def create_menus(self):
        file_menu = self.menuBar().addMenu(_("&File"))

        open_file_action = create_action(self, _("&Open File"),
                                    shortcut="Ctrl+O",
                                    triggered=self.thoth.open,
                                    tip=_("Open a measurement file"))
        #save_plot_action = create_action(self,"&Save all the plots",
            #shortcut="Ctrl+S", triggered=self.save_plots,
            #tip="Save all the plots")
        quit_action = create_action(self, _("&Quit"), triggered=self.close,
            shortcut="Ctrl+Q", tip=_("Close the application"))

        add_actions(file_menu, (open_file_action, None, quit_action))

        help_menu = self.menuBar().addMenu("&Help")
        about_action = create_action(self, _("&About"),
                                     shortcut='F1', triggered=self.about,
                                     tip=_('About Thoth'))

        add_actions(help_menu, (about_action,))
Пример #8
0
 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.thoth = Thoth()
     self._setup()
     self.file_menu_action = []
     self.console = None
Пример #9
0
class ThothMainWindow(QMainWindow):
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)
        self.thoth = Thoth()
        self._setup()
        self.file_menu_action = []
        self.console = None

    def closeEvent(self, event):
        if self.console is not None:
            self.console.exit_interpreter()
        event.accept()

    def _setup(self):
        self.setWindowTitle(_('Thoth – Scanning Probe Analysis Tool'))
        self.create_menus()
        self.create_main_frame()
        self.create_status_bar()
        self.create_list_dock()
        self.create_info_dock()
        self.create_internal_console()
        self.connect_thoth()
        self.show()

        if DEMO:
            self.thoth.open('testfiles/flatfile/topo.flat')
            self.thoth.open('testfiles/flatfile/iv.flat')
            self.thoth.open('testfiles/flatfile/grid.flat')

    def connect_thoth(self):
        QObject.connect(self.thoth, SIGNAL("item_registred"),
                        self.thoth.create_window)
        #QObject.connect(self.thoth, SIGNAL("window_registred(QWidget)"), self.mdi_area.addSubWindow)
        QObject.connect(self.thoth, SIGNAL("window_registred"),
                        self.add_sub_window)

    def add_sub_window(self, window):
        self.mdi_area.addSubWindow(window)
        self.list_widget.addItem(window.windowTitle())
        window.show()

    def create_internal_console(self):
        if DockableConsole is None:
            self.console = None
        else:
            import time, scipy.signal as sps, scipy.ndimage as spi
            import sys, os
            import numpy as np
            ns = {
                'thoth': self.thoth,
                'np': np,
                'sps': sps,
                'spi': spi,
                'os': os,
                'sys': sys,
                'time': time
            }
            msg = "Example: thoth.get_items()[0]\n"\
                  "Modules imported at startup: "\
                  "os, sys, os.path as osp, time, "\
                  "numpy as np, scipy.signal as sps, scipy.ndimage as spi"
            self.console = DockableConsole(self, namespace=ns, message=msg)
            console_dock = QDockWidget(_('Console'))
            self.addDockWidget(Qt.BottomDockWidgetArea, console_dock)
            console_dock.setWidget(self.console)
            #self.connect(self.console.interpreter.widget_proxy,
            #SIGNAL("new_prompt(QString)"),
            #lambda txt: self.refresh_lists())

    def about(self):
        QMessageBox.about( self, _("About ")+APP_NAME,
              """<b>%s</b> v%s<br>%s<p>
              <br>Copyright © François Bianco, University of Geneva
              <br>[email protected]
              <br>Distributed under the GNU GPL License v.3
              """ % \
              (APP_NAME, VERSION, APP_DESC))

    def create_main_frame(self):
        self.mdi_area = QMdiArea()
        self.connect(self.mdi_area,
                     SIGNAL("subWindowActivated(QMdiSubWindow)"),
                     self.update_info)
        self.setCentralWidget(self.mdi_area)

    def update_info(self, window):
        self.info_widget.clear()
        self.info_widget.addItem(window.windowTitle())

    def create_list_dock(self):
        list_dock = QDockWidget(_('Files'))
        self.addDockWidget(Qt.RightDockWidgetArea, list_dock)
        self.list_widget = QListWidget()
        self.connect(
            self.list_widget,
            SIGNAL("currentItemChanged( QListWidgetItem, QListWidgetItem)"),
            self.change_selection)
        list_dock.setWidget(self.list_widget)

    def change_selection(self, current, previous):
        pass

    def create_info_dock(self):
        info_dock = QDockWidget(_('Info'))
        self.addDockWidget(Qt.RightDockWidgetArea, info_dock)
        self.info_widget = QListWidget()
        info_dock.setWidget(self.info_widget)

    def create_status_bar(self):
        self.statusBar().showMessage(_("Open a file"))

    def create_menus(self):
        file_menu = self.menuBar().addMenu(_("&File"))

        open_file_action = create_action(self,
                                         _("&Open File"),
                                         shortcut="Ctrl+O",
                                         triggered=self.thoth.open,
                                         tip=_("Open a measurement file"))
        #save_plot_action = create_action(self,"&Save all the plots",
        #shortcut="Ctrl+S", triggered=self.save_plots,
        #tip="Save all the plots")
        quit_action = create_action(self,
                                    _("&Quit"),
                                    triggered=self.close,
                                    shortcut="Ctrl+Q",
                                    tip=_("Close the application"))

        add_actions(file_menu, (open_file_action, None, quit_action))

        help_menu = self.menuBar().addMenu("&Help")
        about_action = create_action(self,
                                     _("&About"),
                                     shortcut='F1',
                                     triggered=self.about,
                                     tip=_('About Thoth'))

        add_actions(help_menu, (about_action, ))