Skip to content

Instantly share code, notes, and snippets.

@bjlittle
Created March 5, 2015 09:22
Show Gist options
  • Select an option

  • Save bjlittle/5954427ae8093ac0f508 to your computer and use it in GitHub Desktop.

Select an option

Save bjlittle/5954427ae8093ac0f508 to your computer and use it in GitHub Desktop.
pointillism
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": "",
"signature": "sha256:ce21ebb5d35edea705809ed4e5674a408cf01b916c55a7df6f3f64d459164083"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"<font color=\"green\">What's the point-illism?</font>"
]
},
{
"cell_type": "heading",
"level": 4,
"metadata": {},
"source": [
"So, what the heck is [pointillism](http://en.wikipedia.org/wiki/Pointillism) anyways ... "
]
},
{
"cell_type": "heading",
"level": 4,
"metadata": {},
"source": [
"Okay, well let's use this as a <font color=\"green\">tenuous</font> narrative to explore the capabilities offered by [Celery](http://www.celeryproject.org/), [RabbitMQ](http://www.rabbitmq.com/) and [AMQP](http://www.amqp.org/)!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"----"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from itertools import product\n",
"from matplotlib.colors import ColorConverter\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib.ticker import NullLocator\n",
"import numpy as np\n",
"import os"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"to_rgba = ColorConverter().to_rgba\n",
"figsize = (12, 10)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 4,
"metadata": {},
"source": [
"Let's define a simple convenience function for plotting an image ..."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def show_image(img):\n",
" plt.figure(figsize=figsize)\n",
" \n",
" ax = plt.gca()\n",
" ax.spines['top'].set_visible(False)\n",
" ax.spines['right'].set_visible(False)\n",
" ax.spines['bottom'].set_visible(False)\n",
" ax.spines['left'].set_visible(False)\n",
" ax.xaxis.set_major_locator(NullLocator())\n",
" ax.yaxis.set_major_locator(NullLocator())\n",
" \n",
" plt.imshow(img)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 4,
"metadata": {},
"source": [
"So we need a <font color=\"green\">suitable subject</font> for our attempts to emulate the great <font color=\"green\">Georges Seurat</font>! ..."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"fname = os.path.join(os.getcwd(), '100_6500.JPG')\n",
"\n",
"img = plt.imread(fname)\n",
"show_image(img)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment