示例#1
0
 def ipython_ui(self):
     from IPython.terminal.ipapp import TerminalIPythonApp
     import automate
     self.system.namespace.allow_overwrite.extend(['_', '__', '___', '_i', '_ii', '_iii', 'quit'])
     self.system.namespace.update({k: v for k, v in list(automate.__dict__.items()) if k not in self.system.namespace})
     term = TerminalIPythonApp(user_ns=self.system.namespace)
     self.system.namespace['term'] = term
     term.initialize([])
     term.start()
示例#2
0
 def ipython_ui(self):
     from IPython.terminal.ipapp import TerminalIPythonApp
     import automate
     self.system.namespace.allow_overwrite.extend(
         ['_', '__', '___', '_i', '_ii', '_iii', 'quit'])
     self.system.namespace.update({
         k: v
         for k, v in list(automate.__dict__.items())
         if k not in self.system.namespace
     })
     term = TerminalIPythonApp(user_ns=self.system.namespace)
     self.system.namespace['term'] = term
     term.initialize([])
     term.start()
示例#3
0
    def run(self, pipe, no_ipython, no_bpython):
        if pipe:
            # User is attempting to pipe in script through stdin.
            text = sys.stdin.read()
            exec(text, None, _make_context())
            return

        # Try IPython (with autoreload)
        try:
            from IPython.terminal.ipapp import TerminalIPythonApp
            app = TerminalIPythonApp(user_ns=self.get_context())
            config_file = path.join(
                path.dirname(alchemist.__file__), "ipython_startup.ipy")
            app.init_shell()
            app.shell.banner = self.banner
            app.initialize(argv=["-i", config_file])
            app.start()
            return
        except ImportError:
            pass

        # Fallback to normal cycle.
        super(Shell, self).run(no_ipython=no_ipython, no_bpython=no_bpython)
示例#4
0
    def run(self, pipe, no_ipython, no_bpython):
        if pipe:
            # User is attempting to pipe in script through stdin.
            text = sys.stdin.read()
            exec(text, None, _make_context())
            return

        # Try IPython (with autoreload)
        try:
            from IPython.terminal.ipapp import TerminalIPythonApp
            app = TerminalIPythonApp(user_ns=self.get_context())
            config_file = path.join(path.dirname(alchemist.__file__),
                                    "ipython_startup.ipy")
            app.init_shell()
            app.shell.banner = self.banner
            app.initialize(argv=["-i", config_file])
            app.start()
            return
        except ImportError:
            pass

        # Fallback to normal cycle.
        super(Shell, self).run(no_ipython=no_ipython, no_bpython=no_bpython)
示例#5
0
文件: faout.py 项目: pwuertz/faout
            raise ValueError("dac_index out of bounds")
        return self._write_reg(value, ADDR_DAC, dac_index)

    def interp_write(self, index, value, steps):
        if index < 0 or index >= 6:
            raise ValueError("dac_index out of bounds")
        self._write_reg(steps, ADDR_INTERP, index+6)
        self._write_reg(value, ADDR_INTERP, index)

    def interp_read(self, index):
        if index < 0 or index >= 6:
            raise ValueError("dac_index out of bounds")
        steps = self._read_reg(ADDR_INTERP, index+6)
        value = self._read_reg(ADDR_INTERP, index)
        return value, steps


if __name__ == "__main__":
    fpga = FPGA_USB_Interface()
    dct = {"fpga": fpga}

    from IPython.terminal.ipapp import TerminalIPythonApp
    TerminalIPythonApp.display_banner = True
    app = TerminalIPythonApp()
    app.initialize(argv=[])
    app.shell.push(dct)
    app.shell.write("\nBuilt-in objects: %s\n" % str(dct))
    app.start()
    del app, fpga, dct

示例#6
0
        if dac_index < 0 or dac_index >= 6:
            raise ValueError("dac_index out of bounds")
        return self._write_reg(value, ADDR_DAC, dac_index)

    def interp_write(self, index, value, steps):
        if index < 0 or index >= 6:
            raise ValueError("dac_index out of bounds")
        self._write_reg(steps, ADDR_INTERP, index + 6)
        self._write_reg(value, ADDR_INTERP, index)

    def interp_read(self, index):
        if index < 0 or index >= 6:
            raise ValueError("dac_index out of bounds")
        steps = self._read_reg(ADDR_INTERP, index + 6)
        value = self._read_reg(ADDR_INTERP, index)
        return value, steps


if __name__ == "__main__":
    fpga = FPGA_USB_Interface()
    dct = {"fpga": fpga}

    from IPython.terminal.ipapp import TerminalIPythonApp
    TerminalIPythonApp.display_banner = True
    app = TerminalIPythonApp()
    app.initialize(argv=[])
    app.shell.push(dct)
    app.shell.write("\nBuilt-in objects: %s\n" % str(dct))
    app.start()
    del app, fpga, dct