Skip to content

Instantly share code, notes, and snippets.

@pv
pv / lol.txt
Created July 8, 2013 19:53
Restructured lol
.. |lol1| replace:: lol
.. |lol2| replace:: |lol1| |lol1| |lol1| |lol1| |lol1| |lol1| |lol1| |lol1| |lol1| |lol1| |lol1|
.. |lol3| replace:: |lol2| |lol2| |lol2| |lol2| |lol2| |lol2| |lol2| |lol2| |lol2| |lol2| |lol2|
.. |lol4| replace:: |lol3| |lol3| |lol3| |lol3| |lol3| |lol3| |lol3| |lol3| |lol3| |lol3| |lol3|
.. |lol5| replace:: |lol4| |lol4| |lol4| |lol4| |lol4| |lol4| |lol4| |lol4| |lol4| |lol4| |lol4|
.. |lol6| replace:: |lol5| |lol5| |lol5| |lol5| |lol5| |lol5| |lol5| |lol5| |lol5| |lol5| |lol5|
.. |lol7| replace:: |lol6| |lol6| |lol6| |lol6| |lol6| |lol6| |lol6| |lol6| |lol6| |lol6| |lol6|
.. |lol8| replace:: |lol6| |lol7| |lol7| |lol7| |lol7| |lol7| |lol7| |lol7| |lol7| |lol7| |lol7|
.. |lol9| replace:: |lol6| |lol8| |lol8| |lol8| |lol8| |lol8| |lol8| |lol8| |lol8| |lol8| |lol8|
.. |lol| replace:: |lol9|
Building, see build.log...
Build OK
Running unit tests for scipy.sparse.linalg
NumPy version 1.7.1
NumPy is installed in /usr/lib/python2.7/dist-packages/numpy
SciPy version 0.14.0.dev-d226bd4
SciPy is installed in /home/pauli/prj/scipy/scipy/build/testenv/lib/python2.7/site-packages/scipy
Python version 2.7.4 (default, Apr 19 2013, 18:28:01) [GCC 4.7.3]
nose version 1.3.0
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
@pv
pv / bentobug.log
Last active December 23, 2015 13:29
$ pwd
/home/pauli/prj/scipy/scipy
$ git show
commit 5ef4bd2a7935bab620ddb38ab35194b46954452c
$ LC_ALL=C ../bento/bentomaker build -v
/usr/lib/python2.7/dist-packages/pygments/plugin.py:39: UserWarning: Module six was already imported from /home/pauli/prj/scipy/bento/bento/private/_six/six.pyc, but /home/pauli/.local/lib/python2.7/site-packages is being added to sys.path
import pkg_resources
Running from scipy source directory.
Checking for 'c_bgxlc' (c compiler) : not found
Checking for 'gcc' (c compiler) : /usr/bin/gcc
Starting program: /usr/bin/python numpytest.py
Reading symbols for shared libraries ++.....................bfd_mach_o_scan_read_symtab_symbol: symbol "_bzero" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memccpy" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memchr" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memcmp" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memcpy" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memmove" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_memset" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_symbol: symbol "_strchr" is unsupported 'indirect' reference: setting to undefined
bfd_mach_o_scan_read_symtab_
@pv
pv / colorized_voronoi.py
Last active July 16, 2025 04:11
Colorized Voronoi diagram with Scipy, in 2D, including infinite regions
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Voronoi
def voronoi_finite_polygons_2d(vor, radius=None):
"""
Reconstruct infinite voronoi regions in a 2D diagram to finite
regions.
Parameters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Building, see build.log...
... build in progress
Build OK
Running unit tests for numpy
NumPy version 1.9.0.dev-fe762a0
NumPy is installed in /Users/pv/prj/numpy/build/testenv/lib/python2.7/site-packages/numpy
Python version 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
nose version 1.2.1
...
#
# This program prints '90' on OSX, and '12' on Linux on Python 2.7,
# and '12' and '12 on Python 3.3.
#
# Issue seems to be that FILE* streams in r+b mode require seeks
# between reads and writes.
#
f = open('foo.dat', 'wb')
f.write(b'\0'*80)
@pv
pv / gist:8625842
Created January 26, 2014 00:05
Benchmark results for scipy/gh-3233
BEFORE (scipy/8ad48cd62c9e0) AFTER (scipy/ea86d51ef8ce)
Sparse Matrix fancy __setitem__ Sparse Matrix fancy __setitem__
========================================================== ==========================================================
N | s.patt. | csr | csc | lil | dok | N | s.patt. | csr | csc | lil | dok |
---------------------------------------------------------- ----------------------------------------------------------
1 | change | 0.19ms | 0.16ms | 0.01ms | 0.00ms 1 | change | 0.32ms | 0.32ms | 0.04ms | 0.01ms
1 | same | 0.13ms | 0.13ms | 0.06ms | 0.00ms 1 | same | 0.10ms | 0.10ms | 0.06ms | 0.00ms
10 | change | 1.16ms | 1.15ms | 0.08ms | 0.93ms 10 | change | 0.53ms | 0.47ms | 0.09ms | 0.99ms
@pv
pv / cmp2.txt
Last active January 4, 2016 14:39
More scipy.sparse benchmarks
BEFORE AFTER
(without gh-3233, gh-3244) (with gh-3233, gh-3244)
Sparse Matrix __getitem__(int, slice); times in ms Sparse Matrix __getitem__(int, slice); times in ms
======================================================================== ========================================================================
N | s.patt. | dens. | csr | csc | lil | dok | N | s.patt. | dens. | csr | csc | lil | dok |
------------------------------------------------------------------------ ------------------------------------------------------------------------
1 | same | 1e-05 | 0.055 | 0.12 | 0.2 | 0.06 1 | same | 1e-05 | 0.055 | 0.12 | 0.21 | 0.077
10 | change | 1e-05 | 0.0