From 5ebe08d608dbb708aaad5595d70563c251861652 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 23 Jan 2016 06:03:09 -0600 Subject: Add example file, update readme --- .gitignore | 1 + README.rst | 13 ++-- scilab_kernel.ipynb | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 174 insertions(+), 6 deletions(-) create mode 100644 scilab_kernel.ipynb diff --git a/.gitignore b/.gitignore index ccb463d..750d554 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build/ dist/ MANIFEST *.egg-info/ +.ipynb_checkpoints/ diff --git a/README.rst b/README.rst index abac0e1..6d4435c 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,7 @@ A Jupyter kernel for Scilab +This requires `Jupyter Notebook `_, and `Scilab `_. + To install:: pip install scilab_kernel @@ -14,12 +16,11 @@ To use it, run one of: ipython qtconsole --kernel scilab ipython console --kernel scilab -See the installation instructions for `scilab2py `_ and `Jupyter Notebook `_, which are dependencies. +This is based on `MetaKernel `_, +which means it features a standard set of magics. -You should have a `Scilab` entry under "New" on the Jupyter Notebook dashboard. +A sample notebook is available online_. -It supports command history, the ``?`` help magic and calltips, -plotting, and completion. You can toggle inline plotting using ``%inline``. +You can specify the path to your Octave executable by creating a `SCILAB_EXECUTABLE` environmental variable. -For details of how this works, see Jupyters's docs on `wrapper kernels -`_. +.. _online: http://nbviewer.ipython.org/github/blink1073/scilab_kernel/blob/master/scilab_kernel.ipynb diff --git a/scilab_kernel.ipynb b/scilab_kernel.ipynb new file mode 100644 index 0000000..c159efe --- /dev/null +++ b/scilab_kernel.ipynb @@ -0,0 +1,166 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Jupyter Scilab Kernel\n", + "============\n", + "\n", + "Interact with Scilab in the Notebook. All commands are interpreted by Scilab. Since this is a [MetaKernel](https://github.com/Calysto/metakernel), a standard set of magics are available. Help on commands is available using the `%help` magic or using `?` with a command." + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "01002040608010305070900-11-0.8-0.6-0.4-0.20.20.40.60.8" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "t = linspace(0,6*%pi,100);\n", + "plot(sin(t))\n", + "plot(cos(t), 'r')" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "01002040608010305070902040302224262832343638" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "b = 10*cos(t)+30; plot(b);" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1. 2. 3.\n" + ] + } + ], + "source": [ + "a = [1,2,3]" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "b = a + 3;" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4. 5. 6.\n" + ] + } + ], + "source": [ + "disp(b)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Available line magics:\n", + "%activity %cd %connect_info %dot %download %edit %get %help %html %include %install %install_magic %javascript %jigsaw %kernel %kx %latex %load %ls %lsmagic %macro %magic %parallel %plot %pmap %px %python %reload_magics %restart %run %set %shell\n", + "\n", + "Available cell magics:\n", + "%%activity %%brain %%debug %%dot %%file %%help %%html %%javascript %%kx %%latex %%macro %%processing %%px %%python %%shell %%show %%time %%tutor\n" + ] + } + ], + "source": [ + "%lsmagic" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "codemirror_mode": "Octave", + "file_extension": ".sci", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "name": "scilab", + "version": "0.6.0" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} -- cgit