Archives

  • Evil Instance Method Alternatives in Python

    An evil way to exploit and abuse Python for fun and profit. I have no idea if this belongs in any real code, but if nothing else, call it an introduction to such neat Python features as metaclasses and decorators. The idea is to create a class which allows specification of an instance-specific bound method […]

    Comments Off on Evil Instance Method Alternatives in Python
    Feb 20th, 2013 | Filed under Uncategorized
    Tags: ,
  • Modular Command Interface in Python

    Adolphus implements a neat little interactive command interface in Python. It grew rather organically, so for all I know it’s a bizarre way of doing something available in some library. In any case, it’s pretty light and does what I need, so maybe you’ll find it useful too. The commands module first defines an empty […]

    Comments Off on Modular Command Interface in Python
    Aug 16th, 2012 | Filed under Uncategorized
  • Rise of the Quaternions

    Adolphus finally quit messing around and started using a quaternion representation for rotations internally! The quaternion class itself is simple, and conversion to and from rotation matrix and axis-angle representations is fairly straightforward. The magic happens in converting from Euler angles — all twelve valid conventions! By solving the conversion to quaternion for all twelve […]

    Comments Off on Rise of the Quaternions
    Oct 18th, 2010 | Filed under Uncategorized
  • Axes of Evil

    A quick and dirty set of 3D axes for Visual: from visual import arrow, cylinder   def visual_axes( scale ): """\ Display a set of 3D axes.   @param scale: The scale of the axis set. @type scale: C{float} """ for axis in [ tuple( [ i == j and scale * 5 or 0 […]

    Comments Off on Axes of Evil
    Mar 22nd, 2010 | Filed under Uncategorized
    Tags: ,
  • Loggerhead Init Script for Gentoo

    I just set up a Bazaar repository server at work. Gentoo has no official ebuild for Loggerhead, so I installed it from Mark Lee‘s Bazaar overlay. Unfortunately, this does not ship with an init script for serve-branches, so I wrote one. The script is /etc/init.d/loggerhead (mode 755): #!/sbin/runscript # Copyright 1999-2009 Gentoo Foundation # Distributed […]

    Nov 12th, 2009 | Filed under Uncategorized
  • Thoughts in Kaoss

    Yesterday, I spent the afternoon implementing the KMod hack on my Kaossilator thanks to a most excellent set of instructions. I used a DE-9 male connector, so I actually have 2 pins free for potential future additions (I wonder if I can cram something in there to output a MIDI-compatible tempo clock signal based on […]

    Comments Off on Thoughts in Kaoss
    Jul 18th, 2009 | Filed under Uncategorized
  • How Random

    A Python function that returns a random subset of size n from set s. from random import randint   def random_subset( s, n ): if len( s ) < n: raise ValueError, ( "Subset larger than input set" ) l = list( s ) r = set() for i in range( n ): r.add( l.pop( […]

    Comments Off on How Random
    May 5th, 2009 | Filed under Uncategorized
    Tags: ,
  • Free Software in Vision

    My research area at school is distributed smart cameras, a field which is primarily rooted in computer vision. Despite having access to a range of expensive proprietary software libraries by virtue of having purchased the equipment, most of my computer vision work uses a stack of free software running on Gentoo Linux. For interfacing to […]

    Comments Off on Free Software in Vision
    Mar 12th, 2009 | Filed under Uncategorized
  • Python Conquers the Universe

    While testing the Thousand Parsec single player mode on Gentoo the other day, I came across something strange. The wxPython client, when run from a Git working directory, wants to use development versions of libtpproto-py and libtpclient-py. It does this by prepending ‘.’ to sys.path. For some reason, though, import tp.* was still finding the […]

    Comments Off on Python Conquers the Universe
    Feb 26th, 2009 | Filed under Uncategorized
    Tags: , , ,
  • PyDSSCC Release

    I recently cranked out a usable release of PyDSSCC, the Python implementation of my distributed smart stereo camera network calibration scheme. Version 0.3 is a world better than what I tacked onto my M.A.Sc. thesis as an appendix. Notably, it’s packaged as a Python module now. Also notably, it now generates the bin ranges for […]

    Comments Off on PyDSSCC Release
    Nov 14th, 2008 | Filed under Uncategorized
Posts Tagged ‘python’