diff --git a/talks/packages/packages.ipynb b/talks/packages/packages.ipynb index 7d179c45853dd11b13d627e75635edd65bdb0bb3..934f6f349dccf77eb0880897bace5048fd20eb41 100644 --- a/talks/packages/packages.ipynb +++ b/talks/packages/packages.ipynb @@ -78,6 +78,9 @@ "source": [ "Tutorials for all sub-packages can be found [here](https://docs.scipy.org/doc/scipy-1.0.0/reference/).\n", "\n", + "Alternative for `scipy.ndimage`:\n", + "- [Scikit-image](http://scikit-image.org/docs/stable/auto_examples/) for image manipulation/segmentation/feature detection\n", + "\n", "## [Matplotlib](https://matplotlib.org/): Main plotting library" ] }, @@ -865,50 +868,15 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Alternative: [pystan](https://pystan.readthedocs.io/en/latest/): wrapper around the [Stan](http://mc-stan.org/users/) probabilistic programming language.\n", + "Alternatives:\n", + "- [pystan](https://pystan.readthedocs.io/en/latest/): wrapper around the [Stan](http://mc-stan.org/users/) probabilistic programming language.\n", + "- [emcee](http://dfm.io/emcee/current/): if you just want MCMC\n", "\n", "\n", "## [Pycuda](https://documen.tician.de/pycuda/): Programming the GPU\n", "Wrapper around [Cuda](https://developer.nvidia.com/cuda-zone).\n", - "The alternative [Pyopencl](https://documen.tician.de/pyopencl/) provides a very similar wrapper around [OpenCL](https://www.khronos.org/opencl/)." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import pycuda.autoinit\n", - "import pycuda.driver as drv\n", - "\n", - "from pycuda.compiler import SourceModule\n", - "mod = SourceModule(\"\"\"\n", - "__global__ void multiply_them(double *dest, double *a, double *b)\n", - "{\n", - " const int i = threadIdx.x;\n", - " dest[i] = a[i] * b[i];\n", - "}\n", - "\"\"\")\n", - "\n", - "multiply_them = mod.get_function(\"multiply_them\")\n", - "\n", - "a = np.random.randn(400)\n", - "b = np.random.randn(400)\n", - "\n", - "dest = np.zeros_like(a)\n", - "multiply_them(\n", - " drv.Out(dest), drv.In(a), drv.In(b),\n", - " block=(400,1,1), grid=(1,1))\n", - "\n", - "print(dest-a*b)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Also see [pyopenGL](http://pyopengl.sourceforge.net/): graphics programming in python (used in FSLeyes)\n", + "- The alternative [Pyopencl](https://documen.tician.de/pyopencl/) provides a very similar wrapper around [OpenCL](https://www.khronos.org/opencl/).\n", + "- Also see [pyopenGL](http://pyopengl.sourceforge.net/): graphics programming in python (used in FSLeyes)\n", "## Testing\n", "- [unittest](https://docs.python.org/3.6/library/unittest.html): python built-in testing" ] @@ -1079,6 +1047,7 @@ "- [trimesh](https://github.com/mikedh/trimesh): Triangular mesh algorithms\n", "- [Pillow](https://pillow.readthedocs.io/en/latest/): Read/write/manipulate a wide variety of images (png, jpg, tiff, etc.)\n", "- [psychopy](http://www.psychopy.org/): equivalent of psychtoolbox (workshop coming up in April in Nottingham)\n", + "- [Sphinx](http://www.sphinx-doc.org/en/master/): documentation generator\n", "- [Buit-in libraries](https://docs.python.org/3/py-modindex.html)\n", " - [collections](https://docs.python.org/3.6/library/collections.html): deque, OrderedDict, namedtuple, and more\n", " - [datetime](https://docs.python.org/3/library/datetime.html): Basic date and time types\n", @@ -1093,29 +1062,9 @@ " - [shutil](https://docs.python.org/3/library/shutil.html): copy/move files\n", " - [subprocess](https://docs.python.org/3/library/subprocess.html): call shell commands\n", " - [time](https://docs.python.org/3/library/time.html)/[timeit](https://docs.python.org/3/library/timeit.html): Timing your code\n", - " - [turtle](https://docs.python.org/3/library/turtle.html#module-turtle): teach python to your kids!\n", " - [warnings](https://docs.python.org/3/library/warnings.html#module-warnings): tell people they are not using your code properly" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from turtle import *\n", - "color('red', 'yellow')\n", - "begin_fill()\n", - "speed(10)\n", - "while True:\n", - " forward(200)\n", - " left(170)\n", - " if abs(pos()) < 1:\n", - " break\n", - "end_fill()\n", - "done()" - ] - }, { "cell_type": "code", "execution_count": null, diff --git a/talks/packages/packages.md b/talks/packages/packages.md index e72e5bd61d1cf83e986677d09fbf08276c22d64e..4a2471b7ebbb4ab9a30f4c6fc4c5fb55e36c4156 100644 --- a/talks/packages/packages.md +++ b/talks/packages/packages.md @@ -39,6 +39,9 @@ optimize.minimize(costfunc, x0=[0], method='l-bfgs-b') Tutorials for all sub-packages can be found [here](https://docs.scipy.org/doc/scipy-1.0.0/reference/). +Alternative for `scipy.ndimage`: +- [Scikit-image](http://scikit-image.org/docs/stable/auto_examples/) for image manipulation/segmentation/feature detection + ## [Matplotlib](https://matplotlib.org/): Main plotting library ``` import matplotlib as mpl @@ -552,39 +555,15 @@ _ = pm.traceplot(trace) pm.summary(trace) ``` -Alternative: [pystan](https://pystan.readthedocs.io/en/latest/): wrapper around the [Stan](http://mc-stan.org/users/) probabilistic programming language. +Alternatives: +- [pystan](https://pystan.readthedocs.io/en/latest/): wrapper around the [Stan](http://mc-stan.org/users/) probabilistic programming language. +- [emcee](http://dfm.io/emcee/current/): if you just want MCMC ## [Pycuda](https://documen.tician.de/pycuda/): Programming the GPU Wrapper around [Cuda](https://developer.nvidia.com/cuda-zone). -The alternative [Pyopencl](https://documen.tician.de/pyopencl/) provides a very similar wrapper around [OpenCL](https://www.khronos.org/opencl/). -``` -import pycuda.autoinit -import pycuda.driver as drv - -from pycuda.compiler import SourceModule -mod = SourceModule(""" -__global__ void multiply_them(double *dest, double *a, double *b) -{ - const int i = threadIdx.x; - dest[i] = a[i] * b[i]; -} -""") - -multiply_them = mod.get_function("multiply_them") - -a = np.random.randn(400) -b = np.random.randn(400) - -dest = np.zeros_like(a) -multiply_them( - drv.Out(dest), drv.In(a), drv.In(b), - block=(400,1,1), grid=(1,1)) - -print(dest-a*b) -``` - -Also see [pyopenGL](http://pyopengl.sourceforge.net/): graphics programming in python (used in FSLeyes) +- The alternative [Pyopencl](https://documen.tician.de/pyopencl/) provides a very similar wrapper around [OpenCL](https://www.khronos.org/opencl/). +- Also see [pyopenGL](http://pyopengl.sourceforge.net/): graphics programming in python (used in FSLeyes) ## Testing - [unittest](https://docs.python.org/3.6/library/unittest.html): python built-in testing ``` @@ -710,37 +689,18 @@ There are also many, many libraries to interact with databases, but you will hav - [trimesh](https://github.com/mikedh/trimesh): Triangular mesh algorithms - [Pillow](https://pillow.readthedocs.io/en/latest/): Read/write/manipulate a wide variety of images (png, jpg, tiff, etc.) - [psychopy](http://www.psychopy.org/): equivalent of psychtoolbox (workshop coming up in April in Nottingham) +- [Sphinx](http://www.sphinx-doc.org/en/master/): documentation generator - [Buit-in libraries](https://docs.python.org/3/py-modindex.html) - - [collections](https://docs.python.org/3.6/library/collections.html): deque, OrderedDict, namedtuple, and more - - [datetime](https://docs.python.org/3/library/datetime.html): Basic date and time types - [functools](https://docs.python.org/3/library/functools.html): caching, decorators, and support for functional programming - [json](https://docs.python.org/3/library/json.html)/[ipaddress](https://docs.python.org/3/library/ipaddress.html)/[xml](https://docs.python.org/3/library/xml.html#module-xml): parsing/writing - - [itertools](https://docs.python.org/3/library/itertools.html): more tools to loop over sequences - [logging](https://docs.python.org/3/library/logging.htm): log your output to stdout or a file (more flexible than print statements) - [multiprocessing](https://docs.python.org/3/library/multiprocessing.html) - [os](https://docs.python.org/3/library/os.html#module-os)/[sys](https://docs.python.org/3/library/sys.html): Miscellaneous operating system interfaces - [os.path](https://docs.python.org/3/library/os.path.html)/[pathlib](https://docs.python.org/3/library/pathlib.html): utilities to deal with filesystem paths (latter provides an object-oriented interface) - [pickle](https://docs.python.org/3/library/pickle.html): Store/load any python object - - [shutil](https://docs.python.org/3/library/shutil.html): copy/move files - [subprocess](https://docs.python.org/3/library/subprocess.html): call shell commands - - [time](https://docs.python.org/3/library/time.html)/[timeit](https://docs.python.org/3/library/timeit.html): Timing your code - - [turtle](https://docs.python.org/3/library/turtle.html#module-turtle): teach python to your kids! - [warnings](https://docs.python.org/3/library/warnings.html#module-warnings): tell people they are not using your code properly -``` -from turtle import * -color('red', 'yellow') -begin_fill() -speed(10) -while True: - forward(200) - left(170) - if abs(pos()) < 1: - break -end_fill() -done() -``` - ``` import this ```