Skip to content

Instantly share code, notes, and snippets.

@pierre-haessig
pierre-haessig / logit_scale.ipynb
Created October 8, 2014 13:34
Logit scale, for plotting cumulated probability distributions (matplotlib implementation). Better visualization of the tails
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierre-haessig
pierre-haessig / selenium_2048.py
Created May 20, 2014 17:54
A simple code to interact in Python with the "real" 2048 game in web browser.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Pierre Haessig — May 2014
"""A simple code to interact in Python with the "real" 2048 game in web browser.
"""
from __future__ import print_function
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
@pierre-haessig
pierre-haessig / second order process.ipynb
Created May 7, 2014 11:14
Study of 2nd order autoregressive process (AR(2))
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
# Original source : https://gist.github.com/iMichka/9901318
# Change : use a timer
import sys
import numpy
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
from matplotlib.collections import PolyCollection
@pierre-haessig
pierre-haessig / traitsui_mpl_qt.py
Last active January 18, 2019 22:05
Matplotlib integration with Enthought's traitsui, using Qt toolkit (instead of wx)
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Pierre Haessig — March 2014
"""
Qt adaptation of Gael Varoquaux's tutorial to integrate Matplotlib
http://docs.enthought.com/traitsui/tutorials/traits_ui_scientific_app.html#extending-traitsui-adding-a-matplotlib-figure-to-our-application
based on Qt-based code shared by Didrik Pinte, May 2012
http://markmail.org/message/z3hnoqruk56g2bje
@pierre-haessig
pierre-haessig / opt_robot_traj.ipynb
Created March 27, 2014 14:14
Optimal pick-and-place trajectory for a robot : attempt to find it on a Fourier basis
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierre-haessig
pierre-haessig / mpl_background.ipynb
Created March 26, 2014 09:53
change the background color of a Matplotlib plot
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierre-haessig
pierre-haessig / sympy_interactive_plot.ipynb
Created March 20, 2014 16:02
Interactive plot of a SymPy expression (using Traits)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierre-haessig
pierre-haessig / tictoc.py
Created January 9, 2014 15:38
TicToc timing class 1st time an instance is called, it sets a timestamp (time.time()) 2nd time, it computes and returns the difference (in seconds, float).
class TicToc(object):
'''Timing class
1st time an instance is called, it sets a timestamp (time.time())
2nd time, it computes and returns the difference (in seconds, float).
Examples
--------
>>> t = TicToc()
>>> t() # returns time.time()
@pierre-haessig
pierre-haessig / index.html
Created January 3, 2014 20:22
Energy storage animation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Storage animation</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style>
body { font-family: sans-serif;}