This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
class HtmlDocument( object ): | |
TAGS = ['html', 'head', 'body', 'div', 'link', 'script', | |
'title', 'meta', 'p', 'a', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', | |
'ul', 'li', 'ol', 'pre', 'code', 'footer', 'article', 'canvas', 'img', 'text' ] | |
def __init__( self ): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# this is a genetic algorithms tutorial by krista <3 | |
# <[email protected]> | |
# Richard Dawkins is the inventor of this example ("METHINKS IT IS LIKE A WEASEL.") | |
# example is done with Python (works with versions 2.6 and 2.7) | |
# and to be more specific, we'll use elitistic evolution | |
# (== only fittest 10% will survive to the next population and rest will die. | |
# 50% of the best creatures will mate and make pretty babies to the next population <3 ) | |
# 26.11.2011 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def JDplot(data, ax, N, resolution=None, white=False, alpha=1.0, stagger=0.0, fill_color=None, fg_color=None): | |
"""Make a sliced histogram plot in the style of Joy Division's album cover. | |
- `data`, a 1D numpy array containing values. | |
- `ax`, the matplotlib Axes to draw onto. | |
- `N`, the number of histogram slices. | |
- `resolution`, the number of bins. Defaults to `N`. | |
- `white`, boolean. Sets black-on-white colour scheme instead default. |