<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4151181583264905232</id><updated>2011-07-30T11:59:35.424-07:00</updated><category term='shares'/><category term='GLbase'/><category term='business'/><category term='introduction'/><category term='stocks'/><category term='Industry'/><category term='programming'/><category term='microarrays'/><category term='investment'/><category term='singapore'/><category term='Chip-seq'/><category term='Renvy'/><category term='biotech'/><category term='exchange'/><category term='oAxiom'/><category term='biocondutor'/><category term='bonds'/><category term='R'/><category term='indeces'/><category term='money'/><category term='Docks'/><title type='text'>oAxiom - Biotech,</title><subtitle type='html'>oAxiom - Biotech, Business, Economics, Python, Biology.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-3432492476152427445</id><published>2011-04-08T07:01:00.000-07:00</published><updated>2011-04-08T07:11:35.056-07:00</updated><title type='text'>Reimplemntation of specrend.c in Python</title><content type='html'>Reimplementation of Specrend.c in Python.&lt;br /&gt;&lt;br /&gt;This, (broadly) converts Temperature into and r, g, b value. Or, it gets you close enough that the rest is trivial and is left as an exercise to the reader.&lt;br /&gt;&lt;br /&gt;The original is taken from:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.fourmilab.ch/documents/specrend/specrend.c"&gt;specrend.c&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And the original website is:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.fourmilab.ch/"&gt;www.fourmilab.ch&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here's some Python:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;                Colour Rendering of Spectra&lt;br /&gt;&lt;br /&gt;                       by John Walker&lt;br /&gt;                  http://www.fourmilab.ch/&lt;br /&gt;          &lt;br /&gt;         Last updated: March 9, 2003&lt;br /&gt;&lt;br /&gt;    Converted to Python by Andrew Hutchins, sometime in early&lt;br /&gt;    2011.&lt;br /&gt;&lt;br /&gt;           This program is in the public domain.&lt;br /&gt;           The modifications are also public domain. (AH)&lt;br /&gt;&lt;br /&gt;    For complete information about the techniques employed in&lt;br /&gt;    this program, see the World-Wide Web document:&lt;br /&gt;&lt;br /&gt;             http://www.fourmilab.ch/documents/specrend/&lt;br /&gt;         &lt;br /&gt;    The xyz_to_rgb() function, which was wrong in the original&lt;br /&gt;    version of this program, was corrected by:&lt;br /&gt;    &lt;br /&gt;        Andrew J. S. Hamilton 21 May 1999&lt;br /&gt;        Andrew.Hamilton@Colorado.EDU&lt;br /&gt;        http://casa.colorado.edu/~ajsh/&lt;br /&gt;&lt;br /&gt;    who also added the gamma correction facilities and&lt;br /&gt;    modified constrain_rgb() to work by desaturating the&lt;br /&gt;    colour by adding white.&lt;br /&gt;    &lt;br /&gt;    A program which uses these functions to plot CIE&lt;br /&gt;    &amp;quot;tongue&amp;quot; diagrams called &amp;quot;ppmcie&amp;quot; is included in&lt;br /&gt;    the Netpbm graphics toolkit:&lt;br /&gt;        http://netpbm.sourceforge.net/&lt;br /&gt;    (The program was called cietoppm in earlier&lt;br /&gt;    versions of Netpbm.)&lt;br /&gt;&lt;br /&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;import math&lt;br /&gt;&lt;br /&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;/* A colour system is defined by the CIE x and y coordinates of&lt;br /&gt;   its three primary illuminants and the x and y coordinates of&lt;br /&gt;   the white point. */&lt;br /&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;GAMMA_REC709 = 0&lt;br /&gt;&lt;br /&gt;NTSCsystem  =  {&amp;quot;name&amp;quot;: &amp;quot;NTSC&amp;quot;, &lt;br /&gt;    &amp;quot;xRed&amp;quot;: 0.67, &amp;quot;yRed&amp;quot;: 0.33, &lt;br /&gt;    &amp;quot;xGreen&amp;quot;: 0.21, &amp;quot;yGreen&amp;quot;: 0.71, &lt;br /&gt;    &amp;quot;xBlue&amp;quot;: 0.14, &amp;quot;yBlue&amp;quot;: 0.08, &lt;br /&gt;    &amp;quot;xWhite&amp;quot;: 0.3101, &amp;quot;yWhite&amp;quot;: 0.3163, &amp;quot;gamma&amp;quot;: GAMMA_REC709}&lt;br /&gt;EBUsystem  =  {&amp;quot;name&amp;quot;: &amp;quot;SUBU (PAL/SECAM)&amp;quot;, &lt;br /&gt;    &amp;quot;xRed&amp;quot;: 0.64, &amp;quot;yRed&amp;quot;: 0.33, &lt;br /&gt;    &amp;quot;xGreen&amp;quot;: 0.29, &amp;quot;yGreen&amp;quot;: 0.60, &lt;br /&gt;    &amp;quot;xBlue&amp;quot;: 0.15, &amp;quot;yBlue&amp;quot;: 0.06, &lt;br /&gt;    &amp;quot;xWhite&amp;quot;: 0.3127, &amp;quot;yWhite&amp;quot;: 0.3291, &amp;quot;gamma&amp;quot;: GAMMA_REC709 }&lt;br /&gt;SMPTEsystem  =  {&amp;quot;name&amp;quot;: &amp;quot;SMPTE&amp;quot;, &lt;br /&gt;    &amp;quot;xRed&amp;quot;: 0.63, &amp;quot;yRed&amp;quot;: 0.34, &lt;br /&gt;    &amp;quot;xGreen&amp;quot;: 0.31, &amp;quot;yGreen&amp;quot;: 0.595, &lt;br /&gt;    &amp;quot;xBlue&amp;quot;: 0.155, &amp;quot;yBlue&amp;quot;: 0.07, &lt;br /&gt;    &amp;quot;xWhite&amp;quot;: 0.3127, &amp;quot;yWhite&amp;quot;: 0.3291, &amp;quot;gamma&amp;quot;: GAMMA_REC709 }&lt;br /&gt;HDTVsystem  =  {&amp;quot;name&amp;quot;: &amp;quot;HDTV&amp;quot;, &lt;br /&gt;    &amp;quot;xRed&amp;quot;: 0.67, &amp;quot;yRed&amp;quot;: 0.33, &lt;br /&gt;    &amp;quot;xGreen&amp;quot;: 0.21, &amp;quot;yGreen&amp;quot;: 0.71, &lt;br /&gt;    &amp;quot;xBlue&amp;quot;: 0.15, &amp;quot;yBlue&amp;quot;: 0.06, &lt;br /&gt;    &amp;quot;xWhite&amp;quot;: 0.3127, &amp;quot;yWhite&amp;quot;: 0.3291, &amp;quot;gamma&amp;quot;: GAMMA_REC709 }&lt;br /&gt;CIEsystem  =  {&amp;quot;name&amp;quot;: &amp;quot;CIE&amp;quot;, &lt;br /&gt;    &amp;quot;xRed&amp;quot;: 0.7355, &amp;quot;yRed&amp;quot;: 0.2645, &lt;br /&gt;    &amp;quot;xGreen&amp;quot;: 0.2658, &amp;quot;yGreen&amp;quot;: 0.7243, &lt;br /&gt;    &amp;quot;xBlue&amp;quot;: 0.1669, &amp;quot;yBlue&amp;quot;: 0.0085, &lt;br /&gt;    &amp;quot;xWhite&amp;quot;: 0.3333333333, &amp;quot;yWhite&amp;quot;: 0.3333333333, &amp;quot;gamma&amp;quot;: GAMMA_REC709 }&lt;br /&gt;Rec709system  =  {&amp;quot;name&amp;quot;: &amp;quot;CIE REC709&amp;quot;, &lt;br /&gt;    &amp;quot;xRed&amp;quot;: 0.64, &amp;quot;yRed&amp;quot;: 0.33, &lt;br /&gt;    &amp;quot;xGreen&amp;quot;: 0.30, &amp;quot;yGreen&amp;quot;: 0.60, &lt;br /&gt;    &amp;quot;xBlue&amp;quot;: 0.15, &amp;quot;yBlue&amp;quot;: 0.06, &lt;br /&gt;    &amp;quot;xWhite&amp;quot;: 0.3127, &amp;quot;yWhite&amp;quot;: 0.3291, &amp;quot;gamma&amp;quot;: GAMMA_REC709 }&lt;br /&gt;&lt;br /&gt;def upvp_to_xy(up, vp):&lt;br /&gt;    xc = (9 * up) / ((6 * up) - (16 * vp) + 12)&lt;br /&gt;    yc = (4 * vp) / ((6 * up) - (16 * vp) + 12)&lt;br /&gt;    return(xc, yc)&lt;br /&gt;&lt;br /&gt;def xy_toupvp(xc, yc):&lt;br /&gt;    up = (4 * xc) / ((-2 * xc) + (12 * yc) + 3);&lt;br /&gt;    vp = (9 * yc) / ((-2 * xc) + (12 * yc) + 3);  &lt;br /&gt;    return(up, vp)&lt;br /&gt;&lt;br /&gt;def xyz_to_rgb(cs, xc, yc, zc):&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;    Given an additive tricolour system CS, defined by the CIE x&lt;br /&gt;    and y chromaticities of its three primaries (z is derived&lt;br /&gt;    trivially as 1-(x+y)), and a desired chromaticity (XC, YC,&lt;br /&gt;    ZC) in CIE space, determine the contribution of each&lt;br /&gt;    primary in a linear combination which sums to the desired&lt;br /&gt;    chromaticity.  If the  requested chromaticity falls outside&lt;br /&gt;    the Maxwell  triangle (colour gamut) formed by the three&lt;br /&gt;    primaries, one of the r, g, or b weights will be negative. &lt;br /&gt;&lt;br /&gt;    Caller can use constrain_rgb() to desaturate an&lt;br /&gt;    outside-gamut colour to the closest representation within&lt;br /&gt;    the available gamut and/or norm_rgb to normalise the RGB&lt;br /&gt;    components so the largest nonzero component has value 1.&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;&lt;br /&gt;    xr = cs[&amp;quot;xRed&amp;quot;]&lt;br /&gt;    yr = cs[&amp;quot;yRed&amp;quot;]&lt;br /&gt;    zr = 1 - (xr + yr)&lt;br /&gt;    xg = cs[&amp;quot;xGreen&amp;quot;]&lt;br /&gt;    yg = cs[&amp;quot;yGreen&amp;quot;]&lt;br /&gt;    zg = 1 - (xg + yg)&lt;br /&gt;    xb = cs[&amp;quot;xBlue&amp;quot;]&lt;br /&gt;    yb = cs[&amp;quot;yBlue&amp;quot;]&lt;br /&gt;    zb = 1 - (xb + yb)&lt;br /&gt;    xw = cs[&amp;quot;xWhite&amp;quot;]&lt;br /&gt;    yw = cs[&amp;quot;yWhite&amp;quot;]&lt;br /&gt;    zw = 1 - (xw + yw)&lt;br /&gt;    &lt;br /&gt;    rx = (yg * zb) - (yb * zg)  &lt;br /&gt;    ry = (xb * zg) - (xg * zb)  &lt;br /&gt;    rz = (xg * yb) - (xb * yg)&lt;br /&gt;    gx = (yb * zr) - (yr * zb)  &lt;br /&gt;    gy = (xr * zb) - (xb * zr)  &lt;br /&gt;    gz = (xb * yr) - (xr * yb)&lt;br /&gt;    bx = (yr * zg) - (yg * zr)  &lt;br /&gt;    by = (xg * zr) - (xr * zg)  &lt;br /&gt;    bz = (xr * yg) - (xg * yr)&lt;br /&gt;       &lt;br /&gt;    rw = ((rx * xw) + (ry * yw) + (rz * zw)) / yw&lt;br /&gt;    gw = ((gx * xw) + (gy * yw) + (gz * zw)) / yw&lt;br /&gt;    bw = ((bx * xw) + (by * yw) + (bz * zw)) / yw&lt;br /&gt;    &lt;br /&gt;    rx = rx / rw;  ry = ry / rw;  rz = rz / rw&lt;br /&gt;    gx = gx / gw;  gy = gy / gw;  gz = gz / gw&lt;br /&gt;    bx = bx / bw;  by = by / bw;  bz = bz / bw&lt;br /&gt;    &lt;br /&gt;    r = (rx * xc) + (ry * yc) + (rz * zc)&lt;br /&gt;    g = (gx * xc) + (gy * yc) + (gz * zc)&lt;br /&gt;    b = (bx * xc) + (by * yc) + (bz * zc)&lt;br /&gt;    return(r,g,b)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def inside_gamut(r, g, b):&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;     Test whether a requested colour is within the gamut&lt;br /&gt;     achievable with the primaries of the current colour&lt;br /&gt;     system.  This amounts simply to testing whether all the&lt;br /&gt;     primary weights are non-negative. */&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;    &lt;br /&gt;    return (r &amp;gt;= 0) and (g &amp;gt;= 0) and (b &amp;gt;= 0)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def constrain_rgb(r, g, b):&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;    If the requested RGB shade contains a negative weight for&lt;br /&gt;    one of the primaries, it lies outside the colour gamut &lt;br /&gt;    accessible from the given triple of primaries.  Desaturate&lt;br /&gt;    it by adding white, equal quantities of R, G, and B, enough&lt;br /&gt;    to make RGB all positive.  The function returns 1 if the&lt;br /&gt;    components were modified, zero otherwise.&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;    # Amount of white needed is w = - min(0, *r, *g, *b)&lt;br /&gt;    w = -min([0, r, g, b]) # I think?&lt;br /&gt;&lt;br /&gt;    # Add just enough white to make r, g, b all positive.&lt;br /&gt;    if w &amp;gt; 0:&lt;br /&gt;        r += w&lt;br /&gt;        g += w&lt;br /&gt;        b += w&lt;br /&gt;    return(r,g,b)&lt;br /&gt;&lt;br /&gt;def gamma_correct(cs, c):&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;    Transform linear RGB values to nonlinear RGB values. Rec.&lt;br /&gt;    709 is ITU-R Recommendation BT. 709 (1990) ``Basic&lt;br /&gt;    Parameter Values for the HDTV Standard for the Studio and&lt;br /&gt;    for International Programme Exchange'', formerly CCIR Rec.&lt;br /&gt;    709. For details see&lt;br /&gt;    &lt;br /&gt;       http://www.poynton.com/ColorFAQ.html&lt;br /&gt;       http://www.poynton.com/GammaFAQ.html&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;    gamma = cs.gamma&lt;br /&gt;    &lt;br /&gt;    if gamma == GAMMA_REC709:&lt;br /&gt;        cc = 0.018&lt;br /&gt;        if c &amp;lt; cc:&lt;br /&gt;            c = ((1.099 * math.pow(cc, 0.45)) - 0.099) / cc&lt;br /&gt;        else:&lt;br /&gt;            c = (1.099 * math.pow(c, 0.45)) - 0.099&lt;br /&gt;    else:&lt;br /&gt;        c = math.pow(c, 1.0 / gamma)&lt;br /&gt;    return(c)&lt;br /&gt;&lt;br /&gt;def gamma_correct_rgb(cs, r, g, b):&lt;br /&gt;    r = gamma_correct(cs, r)&lt;br /&gt;    g = gamma_correct(cs, g)&lt;br /&gt;    b = gamma_correct(cs, b)&lt;br /&gt;    return(r,g,b)&lt;br /&gt;&lt;br /&gt;def norm_rgb(r, g, b):&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;    Normalise RGB components so the most intense (unless all&lt;br /&gt;    are zero) has a value of 1.&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;    greatest = max([r, g, b])&lt;br /&gt;    &lt;br /&gt;    if greatest &amp;gt; 0:&lt;br /&gt;        r /= greatest&lt;br /&gt;        g /= greatest&lt;br /&gt;        b /= greatest&lt;br /&gt;    return(r, g, b)&lt;br /&gt;    &lt;br /&gt;def spectrum_to_xyz(spec_intens, temp): #spec_intens is a function&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;    Calculate the CIE X, Y, and Z coordinates corresponding to&lt;br /&gt;    a light source with spectral distribution given by  the&lt;br /&gt;    function SPEC_INTENS, which is called with a series of&lt;br /&gt;    wavelengths between 380 and 780 nm (the argument is &lt;br /&gt;    expressed in meters), which returns emittance at  that&lt;br /&gt;    wavelength in arbitrary units.  The chromaticity&lt;br /&gt;    coordinates of the spectrum are returned in the x, y, and z&lt;br /&gt;    arguments which respect the identity:&lt;br /&gt;&lt;br /&gt;            x + y + z = 1.&lt;br /&gt;    &lt;br /&gt;    CIE colour matching functions xBar, yBar, and zBar for&lt;br /&gt;       wavelengths from 380 through 780 nanometers, every 5&lt;br /&gt;       nanometers.  For a wavelength lambda in this range:&lt;br /&gt;&lt;br /&gt;            cie_colour_match[(lambda - 380) / 5][0] = xBar&lt;br /&gt;            cie_colour_match[(lambda - 380) / 5][1] = yBar&lt;br /&gt;            cie_colour_match[(lambda - 380) / 5][2] = zBar&lt;br /&gt;&lt;br /&gt;    AH Note 2011: This next bit is kind of irrelevant on modern &lt;br /&gt;    hardware. Unless you are desperate for speed.&lt;br /&gt;    In which case don't use the Python version!&lt;br /&gt;    &lt;br /&gt;    To save memory, this table can be declared as floats&lt;br /&gt;    rather than doubles; (IEEE) float has enough &lt;br /&gt;    significant bits to represent the values. It's declared&lt;br /&gt;    as a double here to avoid warnings about &amp;quot;conversion&lt;br /&gt;    between floating-point types&amp;quot; from certain persnickety&lt;br /&gt;    compilers. */&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;&lt;br /&gt;    cie_colour_match = [&lt;br /&gt;        [0.0014,0.0000,0.0065], [0.0022,0.0001,0.0105], [0.0042,0.0001,0.0201],&lt;br /&gt;        [0.0076,0.0002,0.0362], [0.0143,0.0004,0.0679], [0.0232,0.0006,0.1102],&lt;br /&gt;        [0.0435,0.0012,0.2074], [0.0776,0.0022,0.3713], [0.1344,0.0040,0.6456],&lt;br /&gt;        [0.2148,0.0073,1.0391], [0.2839,0.0116,1.3856], [0.3285,0.0168,1.6230],&lt;br /&gt;        [0.3483,0.0230,1.7471], [0.3481,0.0298,1.7826], [0.3362,0.0380,1.7721],&lt;br /&gt;        [0.3187,0.0480,1.7441], [0.2908,0.0600,1.6692], [0.2511,0.0739,1.5281],&lt;br /&gt;        [0.1954,0.0910,1.2876], [0.1421,0.1126,1.0419], [0.0956,0.1390,0.8130],&lt;br /&gt;        [0.0580,0.1693,0.6162], [0.0320,0.2080,0.4652], [0.0147,0.2586,0.3533],&lt;br /&gt;        [0.0049,0.3230,0.2720], [0.0024,0.4073,0.2123], [0.0093,0.5030,0.1582],&lt;br /&gt;        [0.0291,0.6082,0.1117], [0.0633,0.7100,0.0782], [0.1096,0.7932,0.0573],&lt;br /&gt;        [0.1655,0.8620,0.0422], [0.2257,0.9149,0.0298], [0.2904,0.9540,0.0203],&lt;br /&gt;        [0.3597,0.9803,0.0134], [0.4334,0.9950,0.0087], [0.5121,1.0000,0.0057],&lt;br /&gt;        [0.5945,0.9950,0.0039], [0.6784,0.9786,0.0027], [0.7621,0.9520,0.0021],&lt;br /&gt;        [0.8425,0.9154,0.0018], [0.9163,0.8700,0.0017], [0.9786,0.8163,0.0014],&lt;br /&gt;        [1.0263,0.7570,0.0011], [1.0567,0.6949,0.0010], [1.0622,0.6310,0.0008],&lt;br /&gt;        [1.0456,0.5668,0.0006], [1.0026,0.5030,0.0003], [0.9384,0.4412,0.0002],&lt;br /&gt;        [0.8544,0.3810,0.0002], [0.7514,0.3210,0.0001], [0.6424,0.2650,0.0000],&lt;br /&gt;        [0.5419,0.2170,0.0000], [0.4479,0.1750,0.0000], [0.3608,0.1382,0.0000],&lt;br /&gt;        [0.2835,0.1070,0.0000], [0.2187,0.0816,0.0000], [0.1649,0.0610,0.0000],&lt;br /&gt;        [0.1212,0.0446,0.0000], [0.0874,0.0320,0.0000], [0.0636,0.0232,0.0000],&lt;br /&gt;        [0.0468,0.0170,0.0000], [0.0329,0.0119,0.0000], [0.0227,0.0082,0.0000],&lt;br /&gt;        [0.0158,0.0057,0.0000], [0.0114,0.0041,0.0000], [0.0081,0.0029,0.0000],&lt;br /&gt;        [0.0058,0.0021,0.0000], [0.0041,0.0015,0.0000], [0.0029,0.0010,0.0000],&lt;br /&gt;        [0.0020,0.0007,0.0000], [0.0014,0.0005,0.0000], [0.0010,0.0004,0.0000],&lt;br /&gt;        [0.0007,0.0002,0.0000], [0.0005,0.0002,0.0000], [0.0003,0.0001,0.0000],&lt;br /&gt;        [0.0002,0.0001,0.0000], [0.0002,0.0001,0.0000], [0.0001,0.0000,0.0000],&lt;br /&gt;        [0.0001,0.0000,0.0000], [0.0001,0.0000,0.0000], [0.0000,0.0000,0.0000]]&lt;br /&gt;&lt;br /&gt;    X = 0&lt;br /&gt;    Y = 0&lt;br /&gt;    Z = 0&lt;br /&gt;    for i, lamb in enumerate(range(380, 780, 5)): #lambda = 380; lambda &amp;lt; 780.1; i++, lambda += 5) {&lt;br /&gt;        Me = spec_intens(lamb, temp);&lt;br /&gt;        X += Me * cie_colour_match[i][0]&lt;br /&gt;        Y += Me * cie_colour_match[i][1]&lt;br /&gt;        Z += Me * cie_colour_match[i][2]&lt;br /&gt;    XYZ = (X + Y + Z)&lt;br /&gt;    x = X / XYZ;&lt;br /&gt;    y = Y / XYZ;&lt;br /&gt;    z = Z / XYZ;&lt;br /&gt;    return(x, y, z)&lt;br /&gt;&lt;br /&gt;def bb_spectrum(wavelength, bbTemp=5000):&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;    Calculate, by Planck's radiation law, the emittance of a black body&lt;br /&gt;    of temperature bbTemp at the given wavelength (in metres).  */&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;    wlm = wavelength * 1e-9 # Convert to metres &lt;br /&gt;    return (3.74183e-16 * math.pow(wlm, -5.0)) / (math.exp(1.4388e-2 / (wlm * bbTemp)) - 1.0)&lt;br /&gt;&lt;br /&gt;    &amp;quot;&amp;quot;&amp;quot;  Built-in test program which displays the x, y, and Z and RGB&lt;br /&gt;    values for black body spectra from 1000 to 10000 degrees kelvin.&lt;br /&gt;    When run, this program should produce the following output:&lt;br /&gt;&lt;br /&gt;    Temperature       x      y      z       R     G     B&lt;br /&gt;    -----------    ------ ------ ------   ----- ----- -----&lt;br /&gt;       1000 K      0.6528 0.3444 0.0028   1.000 0.007 0.000 (Approximation)&lt;br /&gt;       1500 K      0.5857 0.3931 0.0212   1.000 0.126 0.000 (Approximation)&lt;br /&gt;       2000 K      0.5267 0.4133 0.0600   1.000 0.234 0.010&lt;br /&gt;       2500 K      0.4770 0.4137 0.1093   1.000 0.349 0.067&lt;br /&gt;       3000 K      0.4369 0.4041 0.1590   1.000 0.454 0.151&lt;br /&gt;       3500 K      0.4053 0.3907 0.2040   1.000 0.549 0.254&lt;br /&gt;       4000 K      0.3805 0.3768 0.2428   1.000 0.635 0.370&lt;br /&gt;       4500 K      0.3608 0.3636 0.2756   1.000 0.710 0.493&lt;br /&gt;       5000 K      0.3451 0.3516 0.3032   1.000 0.778 0.620&lt;br /&gt;       5500 K      0.3325 0.3411 0.3265   1.000 0.837 0.746&lt;br /&gt;       6000 K      0.3221 0.3318 0.3461   1.000 0.890 0.869&lt;br /&gt;       6500 K      0.3135 0.3237 0.3628   1.000 0.937 0.988&lt;br /&gt;       7000 K      0.3064 0.3166 0.3770   0.907 0.888 1.000&lt;br /&gt;       7500 K      0.3004 0.3103 0.3893   0.827 0.839 1.000&lt;br /&gt;       8000 K      0.2952 0.3048 0.4000   0.762 0.800 1.000&lt;br /&gt;       8500 K      0.2908 0.3000 0.4093   0.711 0.766 1.000&lt;br /&gt;       9000 K      0.2869 0.2956 0.4174   0.668 0.738 1.000&lt;br /&gt;       9500 K      0.2836 0.2918 0.4246   0.632 0.714 1.000&lt;br /&gt;      10000 K      0.2807 0.2884 0.4310   0.602 0.693 1.000&lt;br /&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;&lt;br /&gt;if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;    print &amp;quot;Temperature       x      y      z       R     G     B\n&amp;quot;&lt;br /&gt;    print &amp;quot;-----------    ------ ------ ------   ----- ----- -----\n&amp;quot;&lt;br /&gt;    &lt;br /&gt;    for t in range(1000, 10000, 500):  # (t = 1000; t &amp;lt;= 10000; t+= 500) {&lt;br /&gt;        x, y, z = spectrum_to_xyz(bb_spectrum, t)&lt;br /&gt;        &lt;br /&gt;        r, g, b = xyz_to_rgb(SMPTEsystem, x, y, z)&lt;br /&gt;        &lt;br /&gt;        print &amp;quot;  %5.0f K      %.4f %.4f %.4f   &amp;quot; % (t, x, y, z),&lt;br /&gt;        &lt;br /&gt;        r, g, b = constrain_rgb(r, g, b) # I omit the approximation bit here.&lt;br /&gt;        r, g, b = norm_rgb(r, g, b) &lt;br /&gt;        print &amp;quot;%.3f %.3f %.3f&amp;quot; % (r, g, b)&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-3432492476152427445?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/3432492476152427445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2011/04/reimplemntation-of-specrendc-in-python.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/3432492476152427445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/3432492476152427445'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2011/04/reimplemntation-of-specrendc-in-python.html' title='Reimplemntation of specrend.c in Python'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-8712933663204881008</id><published>2009-12-16T04:25:00.001-08:00</published><updated>2009-12-16T04:25:00.899-08:00</updated><title type='text'>Drip drip drip</title><content type='html'>&lt;div style="text-align: left; padding: 3px;"&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/4190212886/" title="photo sharing"&gt;&lt;img src="http://farm3.static.flickr.com/2633/4190212886_e9e132003c.jpg" style="border: solid 2px #000000;" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.8em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/4190212886/"&gt;Drip drip drip&lt;/a&gt;, originally uploaded by &lt;a href="http://www.flickr.com/people/afflictedmonkey/"&gt;afflictedmonkey&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;p&gt;Saline bag in the hospital. Not mine luckily.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-8712933663204881008?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/8712933663204881008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/12/drip-drip-drip.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/8712933663204881008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/8712933663204881008'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/12/drip-drip-drip.html' title='Drip drip drip'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2633/4190212886_e9e132003c_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-6050673899413338899</id><published>2009-12-16T04:19:00.001-08:00</published><updated>2009-12-16T04:19:20.756-08:00</updated><title type='text'>By The Shipyard</title><content type='html'>&lt;div style="text-align: left; padding: 3px;"&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/4189444771/" title="photo sharing"&gt;&lt;img src="http://farm3.static.flickr.com/2621/4189444771_6c728c8c8b.jpg" style="border: solid 2px #000000;" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.8em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/4189444771/"&gt;By The Shipyard&lt;/a&gt;, originally uploaded by &lt;a href="http://www.flickr.com/people/afflictedmonkey/"&gt;afflictedmonkey&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;p&gt;Perhaps the last pictures of the docks didn't do full justice. This is the docks/ship fit out works on West Coast park in Singapore. It's a neat place, and I was lucky to be there when the sun went down.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-6050673899413338899?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/6050673899413338899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/12/by-shipyard.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/6050673899413338899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/6050673899413338899'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/12/by-shipyard.html' title='By The Shipyard'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2621/4189444771_6c728c8c8b_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-6040732996892401445</id><published>2009-09-27T00:06:00.000-07:00</published><updated>2009-09-27T00:12:03.481-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='singapore'/><category scheme='http://www.blogger.com/atom/ns#' term='Industry'/><category scheme='http://www.blogger.com/atom/ns#' term='Docks'/><title type='text'>Singapore's natural resources.</title><content type='html'>It's a common refrain in Singapore that the country has no natural resources. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/3956986907/" title="Industry4 by afflictedmonkey, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3517/3956986907_8bd4caaef1.jpg" width="500" height="330" alt="Industry4" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is not true, and has never been true. Singapore has several natural resources, but the one that occupies prime position is the docks. Singapore has one of the finest deep-water docks in the world. Often taking the busiest port in the world title. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/3956986903/" title="Industry3 by afflictedmonkey, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3448/3956986903_918df92c44.jpg" width="500" height="330" alt="Industry3" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/3956986889/" title="Industry by afflictedmonkey, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2574/3956986889_62d0517767.jpg" width="500" height="262" alt="Industry" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/3956986897/" title="Industry2 by afflictedmonkey, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2494/3956986897_3559092f92.jpg" width="330" height="500" alt="Industry2" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-6040732996892401445?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/6040732996892401445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/09/singapores-natural-resources.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/6040732996892401445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/6040732996892401445'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/09/singapores-natural-resources.html' title='Singapore&apos;s natural resources.'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3517/3956986907_8bd4caaef1_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-4086469657391519946</id><published>2009-09-18T06:17:00.001-07:00</published><updated>2009-09-18T06:18:54.785-07:00</updated><title type='text'>Google is fast</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_zn5PXxCvZWY/SrOIlqSZsxI/AAAAAAAAACs/yK_S5ULgc3A/s1600-h/gruzbumble.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 60px;" src="http://1.bp.blogspot.com/_zn5PXxCvZWY/SrOIlqSZsxI/AAAAAAAAACs/yK_S5ULgc3A/s400/gruzbumble.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5382796160225882898" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;45 minutes to index and report. Possibly less - that's just the first time I checked.&lt;br /&gt;&lt;br /&gt;(See the previous entry for details)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-4086469657391519946?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/4086469657391519946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/09/google-is-fast.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/4086469657391519946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/4086469657391519946'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/09/google-is-fast.html' title='Google is fast'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_zn5PXxCvZWY/SrOIlqSZsxI/AAAAAAAAACs/yK_S5ULgc3A/s72-c/gruzbumble.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-8814792512118981183</id><published>2009-09-18T05:31:00.000-07:00</published><updated>2009-09-18T06:13:18.449-07:00</updated><title type='text'>Chinese Country Names</title><content type='html'>Chinese, of course, doesn't have an alphabet, instead it uses ideograms each one unique and represents some sort of meaning. There are several tens of thousands of characters. Although for every day speech and to be considered fluent you need to be conversant in about 3000 characters (which seems some sort of magic number, about 3000 English words gets you to fluent, 5000 you are learned and educated whereas 10,000 and you are a smart arse).&lt;br /&gt;&lt;br /&gt;But, this poses something of a problem. In English when you need a word you just stitch together a bunch of Latin or root words or, hell, you just make it up (gruzbumble - there, a new word for you, 0 hits in google, it means "a bumble bee who's really pissed off"). But what do you do in Chinese? Well, you can actually transliterate - converting the sound, from say, English, into a set of Chinese characters. This works quite okay, although the pronunciation can be quite a bit off it's usually recognisable. &lt;br /&gt;&lt;br /&gt;However, that new transliterated word will be made up of characters that are separate from the new word - they have their own inherent meaning. &lt;br /&gt;&lt;br /&gt;So (and this is a round about way of getting to my point), for example, when China makes up a name for a country, what do they do? Well they transliterate the sound, but they inadvertently (and some times, uh, vertantly) leave behind a meaning in the characters, for example:&lt;br /&gt;&lt;br /&gt;英国, pronounced 'ying guo' means literally 'hero country' = United Kingdom&lt;br /&gt;美国 = meiguo = beautiful country = USA.&lt;br /&gt;法国 = Fa guo = Law Country = France&lt;br /&gt;泰国 = Tai Guo = Lucky Country = Thailand&lt;br /&gt;&lt;br /&gt;But some times ironic or silly meanings can be left behind, one example:&lt;br /&gt;&lt;br /&gt;德国 = De Guo = Moral Country = Germany&lt;br /&gt;日本 = Ri ben = Sunny book = Japan&lt;br /&gt;黑山 = Hei Shan = Black Mountain = Montenegro&lt;br /&gt;&lt;br /&gt;But then sometimes, by accident really silly stuff gets left behind in the characters:&lt;br /&gt;&lt;br /&gt;匈牙利 = Xiong ya li = Hungary = Fearsome Teeth Are sharp!&lt;br /&gt;柬埔寨 = Jian Pu Jia = Cambodia = Crappy Village (Okay, this is a pun, actually)&lt;br /&gt;马来西亚 = Ma Lai Xi Ya = Malaysia = Horse comes to West Asia (?!?!)&lt;br /&gt;葡萄牙 = Pu Tao Ya = Portugal = Grape Teeth (?!?!!)&lt;br /&gt;马里 = ma li = Mali = Horse Inside (?)&lt;br /&gt;索马里 = Suo Ma li = Somalia = Search for horse Inside&lt;br /&gt;多哥 = Duo Ge = Togo = Many brothers&lt;br /&gt;&lt;br /&gt;Heh, sometimes it also goes wrong with other things. My home town (Northampton) is transliterated as Bei am dun, the 'bei' means literally 'North'. There are two major problems with this name - Northampton is not in the North, it's in the middle, (the midlands, to  be exact, the home of rugby, but little else). And crucially, the 'North' in Northampton doesn't mean 'North'. It means 'Norse' as in Norse hampton = Norse town = People from Scandinavia live here in a town.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-8814792512118981183?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/8814792512118981183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/09/chinese-country-names.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/8814792512118981183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/8814792512118981183'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/09/chinese-country-names.html' title='Chinese Country Names'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-2400116345729656081</id><published>2009-09-14T04:36:00.001-07:00</published><updated>2009-09-14T04:36:32.788-07:00</updated><title type='text'>It only stops when you get to Bangkok</title><content type='html'>&lt;div style="text-align: left; padding: 3px;"&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/3919449308/" title="photo sharing"&gt;&lt;img src="http://farm3.static.flickr.com/2462/3919449308_622e3e554b.jpg" style="border: solid 2px #000000;" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.8em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/3919449308/"&gt;It only stops when you get to Bangkok&lt;/a&gt;, originally uploaded by &lt;a href="http://www.flickr.com/people/afflictedmonkey/"&gt;afflictedmonkey&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;p&gt;Railway line near Buona Vista. It's technically part of Malaysia so I suppose I was trespassing.&lt;br /&gt;&lt;br /&gt;There's a ruined building just to the right of the picture, and occasionally trains traveling at about 20 mph go by. Embarrassingly I nearly got run over by one once! (It's the fastest way to Colbar)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-2400116345729656081?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/2400116345729656081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/09/it-only-stops-when-you-get-to-bangkok.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/2400116345729656081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/2400116345729656081'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/09/it-only-stops-when-you-get-to-bangkok.html' title='It only stops when you get to Bangkok'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2462/3919449308_622e3e554b_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-523827180372341852</id><published>2009-09-09T06:27:00.001-07:00</published><updated>2009-09-09T06:27:14.057-07:00</updated><title type='text'>Cat on the Path</title><content type='html'>&lt;div style="text-align: left; padding: 3px;"&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/3903129835/" title="photo sharing"&gt;&lt;img src="http://farm3.static.flickr.com/2465/3903129835_28fcd0ec83.jpg" style="border: solid 2px #000000;" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.8em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/afflictedmonkey/3903129835/"&gt;Cat on the Path&lt;/a&gt;, originally uploaded by &lt;a href="http://www.flickr.com/people/afflictedmonkey/"&gt;afflictedmonkey&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;p&gt;There's a load of cats at the condo here, they tend to hang out around the base of our block waiting for food. Each cat has its own territory. One day I should map it out and see which cat owns which part of the condo. &lt;br /&gt;&lt;br /&gt;Our block belongs to the white cat relaxing near the path light.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-523827180372341852?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/523827180372341852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/09/cat-on-path.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/523827180372341852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/523827180372341852'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/09/cat-on-path.html' title='Cat on the Path'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2465/3903129835_28fcd0ec83_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-8600967378452574263</id><published>2009-08-22T06:17:00.003-07:00</published><updated>2009-08-22T06:17:19.652-07:00</updated><title type='text'>Fingers and Claws</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/24771070@N00/3844670767/" title="photo sharing"&gt;&lt;img src="http://farm3.static.flickr.com/2649/3844670767_3674894de6_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.9em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/24771070@N00/3844670767/"&gt;Fingers and Claws&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/24771070@N00/"&gt;afflictedmonkey&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;br clear="all" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-8600967378452574263?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/8600967378452574263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/08/fingers-and-claws.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/8600967378452574263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/8600967378452574263'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/08/fingers-and-claws.html' title='Fingers and Claws'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2649/3844670767_3674894de6_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-7133451927502488541</id><published>2009-08-22T06:17:00.001-07:00</published><updated>2009-08-22T06:17:09.279-07:00</updated><title type='text'>Transit Hub</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/24771070@N00/3845463960/" title="photo sharing"&gt;&lt;img src="http://farm4.static.flickr.com/3431/3845463960_b5a44a65f7_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.9em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/24771070@N00/3845463960/"&gt;Transit Hub&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/24771070@N00/"&gt;afflictedmonkey&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;Playing with my camera, a few shots from flickr.&lt;br clear="all" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-7133451927502488541?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/7133451927502488541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/08/transit-hub.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/7133451927502488541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/7133451927502488541'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/08/transit-hub.html' title='Transit Hub'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3431/3845463960_b5a44a65f7_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-4193448755336851954</id><published>2009-08-22T06:16:00.001-07:00</published><updated>2009-08-22T06:16:33.753-07:00</updated><title type='text'>To War!</title><content type='html'>&lt;div style="float: right; margin-left: 10px; margin-bottom: 10px;"&gt;&lt;a href="http://www.flickr.com/photos/24771070@N00/3845456364/" title="photo sharing"&gt;&lt;img src="http://farm3.static.flickr.com/2486/3845456364_4bff2299c1_m.jpg" alt="" style="border: solid 2px #000000;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 0.9em; margin-top: 0px;"&gt;&lt;a href="http://www.flickr.com/photos/24771070@N00/3845456364/"&gt;To War!&lt;/a&gt;&lt;br /&gt;Originally uploaded by &lt;a href="http://www.flickr.com/people/24771070@N00/"&gt;afflictedmonkey&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;At the Turtle museum in Chinese Garden, they all live free in the pool and go crazy when people feed them.&lt;br clear="all" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-4193448755336851954?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/4193448755336851954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/08/to-war.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/4193448755336851954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/4193448755336851954'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/08/to-war.html' title='To War!'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2486/3845456364_4bff2299c1_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-4092802582949286030</id><published>2009-08-15T07:21:00.000-07:00</published><updated>2009-08-15T07:22:35.128-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='singapore'/><category scheme='http://www.blogger.com/atom/ns#' term='shares'/><category scheme='http://www.blogger.com/atom/ns#' term='investment'/><category scheme='http://www.blogger.com/atom/ns#' term='exchange'/><category scheme='http://www.blogger.com/atom/ns#' term='indeces'/><category scheme='http://www.blogger.com/atom/ns#' term='money'/><category scheme='http://www.blogger.com/atom/ns#' term='bonds'/><category scheme='http://www.blogger.com/atom/ns#' term='stocks'/><category scheme='http://www.blogger.com/atom/ns#' term='business'/><title type='text'>On the folly of investors advice.</title><content type='html'>Teh Hooi Ling in this mornings Business Times reiterates many of the common investment advice for novice investors (like myself). I guess, this morning my mind finally snapped and I just couldn't take the mindless thoughtless advice constantly repeated as if it is mantra from these professionals. Actually, I'm being a little unfair in singling out Teh Hooi Ling, who's column I often enjoy, but to distill it to it's base, investment advice commonly boils down to this simple set of vague pointers:&lt;br /&gt;&lt;br /&gt;1. Compound interest is miraculous, at 8-10% you will be a millionaire in your 50's!&lt;br /&gt;2. Research and think in detail about the stocks you buy,&lt;br /&gt;3. Sell when things are too risky!&lt;br /&gt;&lt;br /&gt;The first one really pisses me off, but I'll come back to that one, so I'll deal with objection 1 first: I think a lot of this sort of advice is really lacking in specifics - you know really practical specifics, e.g. buy a stock when the PE goes below 10, or buy the market after 3 straight days of losses. I can understand this totally - there are no specifics to give. Every rigid investment strategy known to man has at some time found wanting (value investing, dividend yield, technical, fundamental etc.), so there are no specifics to give. Then, you base your research on a companies last quarter of results (assuming it's available, and for the Singapore Exchange it often isn't). But that is in the past, and the exchange prices the share *on future earnings*. So, what, at the end of the day is research - it all comes down to a gut feeling on whether a share is good or not. &lt;br /&gt;&lt;br /&gt;Objection 3 is easy to dismiss - risk is obvious in hindsight. I know a lot of people who got out of the market in 2005 as it appeared too risky. It was, for sure, but in the meantime it continued to run up until 2008, only then did it crash. Risk and value are easy in hindsight. Examples from the past are meaningless. Currently as I write this I think that risk has possibly never been higher in the world, due to a variety of factors, essentially between China and the US, but perhaps in another entry.&lt;br /&gt;&lt;br /&gt;Objection 1 is the one that always gets me though. Not because it is untrue, it is true - 100,000 units of currency invested at 8-10 % will become 1,000,000 units in about 30 years. That's maths. My objection is - where can I find and purchase these investment vehicles that pay me 8-10 % per year with little to no risk? Or, perhaps even with a lot of risk? The local banks pay a shocking 0.125% interest, whilst their 'special' 'super' 'amazing' accounts pay a whopping 0.8%! Oh. my. god. Hold the front page! The Straits Time Index (an index of approx 70% of the turnover on the singapore exchange) pays a dividend yield of around 3.7% (as of 2009, it's probably going to be lower in the near future due to reduced profitability). &lt;br /&gt;&lt;br /&gt;I suppose you could buy preference shares, DBS will give you 6% and UOB 5%, or you could get into some of the REITs, which do start to get near the magical 8-10% (Suntec Reit pays ~7%, although it's share price is rising). And finally you could buy some of the really wierd esoteric dividend yield vehicles - like the shipping trusts, some of which pay ~12%. But you would be a fool to put your trust in such horrifyingly volatile instruments, they pay 12% or more for a reason (er... because sometimes, they don't pay anything at all).&lt;br /&gt;&lt;br /&gt;Then there is the old chestnut that the stock exchange grows at 10% on average per year. But these measurements always seem to choose good windows for measurement. Let's look at the STI from 1987 to today. In 1987 it was ~800. Today it hovers around 2600 after a pretty robust rebound (despite Singapore still being in a recession). That's a gain of 69%. Or, 3.13% per year (actually it's less than that due to compounding, which I can't be bothered to work out). So, adding in a generous dividend yield of 3.7% (it has not always been so high) and the generous growth of 3.13%, that still only makes 6.9%. Still a couple of percents short of the magical 8-10%. Actually there is a reason it's 6.9%, and it's terribly simple - when all is said and done, the exchange can go up and down (and it sure can go up and down a hell of a lot), but it must return to its trend line - GDP growth.&lt;br /&gt;&lt;br /&gt;Well, that's probably enough for now. I haven't talked about bonds (appalling, even risky companies can get away with ~4% and a lot of the juicy stuff is not available to the retail investor - you need ~100,000 SGD to even get started), inflation linked treasuries (miserly, inflation +2-3%) hedge funds (not always available to the retail investor, and anyway fund of hedge funds only get the same as the market over the long term).&lt;br /&gt;&lt;br /&gt;Rant over.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-4092802582949286030?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/4092802582949286030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/08/on-folly-of-investors-advice.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/4092802582949286030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/4092802582949286030'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/08/on-folly-of-investors-advice.html' title='On the folly of investors advice.'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-3110599284136215408</id><published>2009-05-27T18:41:00.001-07:00</published><updated>2009-05-27T18:55:42.754-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GLbase'/><category scheme='http://www.blogger.com/atom/ns#' term='Chip-seq'/><category scheme='http://www.blogger.com/atom/ns#' term='microarrays'/><category scheme='http://www.blogger.com/atom/ns#' term='biocondutor'/><category scheme='http://www.blogger.com/atom/ns#' term='R'/><title type='text'></title><content type='html'>GLbase&lt;br /&gt;&lt;br /&gt;Analysis of ChIP-seq data.&lt;br /&gt;&lt;br /&gt;From the preamble:&lt;br /&gt;This is GLbase, a set of tools to deal with heterogeneous genomic data. It's particularly useful for intersecting any data that can be expressed as a CSV file. Examples are microarray data, gene lists, Chip-seq location lists. GLbase excels at integrating these data and then outputting graphical representations of the resulting data:&lt;br /&gt;&lt;br /&gt;You can get GLbase &lt;a href="http://bitbucket.org/oaxiom/glbase/wiki/Home"&gt;here&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;Some screenshots of the output it can generate (via R):&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_zn5PXxCvZWY/Sh3sg0TbLSI/AAAAAAAAABI/dZCnoC8BtHE/s1600-h/top2_5k_all.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="http://2.bp.blogspot.com/_zn5PXxCvZWY/Sh3sg0TbLSI/AAAAAAAAABI/dZCnoC8BtHE/s200/top2_5k_all.png" alt="" id="BLOGGER_PHOTO_ID_5340684781671361826" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_zn5PXxCvZWY/Sh3sgdp4MYI/AAAAAAAAABA/qOX5sYpuyAA/s1600-h/Norm_chip2_5k_all_zoom.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/_zn5PXxCvZWY/Sh3sgdp4MYI/AAAAAAAAABA/qOX5sYpuyAA/s200/Norm_chip2_5k_all_zoom.png" alt="" id="BLOGGER_PHOTO_ID_5340684775591522690" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_zn5PXxCvZWY/Sh3sgayakAI/AAAAAAAAAA4/00PlgpGhKnM/s1600-h/ChIP_Norm_down_2_5k_list.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 150px; height: 200px;" src="http://3.bp.blogspot.com/_zn5PXxCvZWY/Sh3sgayakAI/AAAAAAAAAA4/00PlgpGhKnM/s200/ChIP_Norm_down_2_5k_list.png" alt="" id="BLOGGER_PHOTO_ID_5340684774822023170" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_zn5PXxCvZWY/Sh3sf8GWJJI/AAAAAAAAAAo/L48ZqflfUnk/s1600-h/chip_2_5k_NSH3K4me3.png.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 150px; height: 200px;" src="http://1.bp.blogspot.com/_zn5PXxCvZWY/Sh3sf8GWJJI/AAAAAAAAAAo/L48ZqflfUnk/s200/chip_2_5k_NSH3K4me3.png.png" alt="" id="BLOGGER_PHOTO_ID_5340684766584120466" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_zn5PXxCvZWY/Sh3sgICoWTI/AAAAAAAAAAw/JOv5mgoD2QE/s1600-h/NSH3k4me3_chip2_5k.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 150px; height: 200px;" src="http://4.bp.blogspot.com/_zn5PXxCvZWY/Sh3sgICoWTI/AAAAAAAAAAw/JOv5mgoD2QE/s200/NSH3k4me3_chip2_5k.png" alt="" id="BLOGGER_PHOTO_ID_5340684769789761842" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_zn5PXxCvZWY/Sh3s3yeRV3I/AAAAAAAAABg/UMyJjq-OFxk/s1600-h/Norm_DistCurves_All.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 150px;" src="http://4.bp.blogspot.com/_zn5PXxCvZWY/Sh3s3yeRV3I/AAAAAAAAABg/UMyJjq-OFxk/s200/Norm_DistCurves_All.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5340685176316974962" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_zn5PXxCvZWY/Sh3s3qH00XI/AAAAAAAAABY/u4BmXr7CmoU/s1600-h/Norm_chip20k_all_box.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_zn5PXxCvZWY/Sh3s3qH00XI/AAAAAAAAABY/u4BmXr7CmoU/s200/Norm_chip20k_all_box.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5340685174075347314" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_zn5PXxCvZWY/Sh3s3pISB-I/AAAAAAAAABQ/qdqAo50TONM/s1600-h/ChIP_merge_NSH3K4me3.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 150px;" src="http://4.bp.blogspot.com/_zn5PXxCvZWY/Sh3s3pISB-I/AAAAAAAAABQ/qdqAo50TONM/s200/ChIP_merge_NSH3K4me3.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5340685173808826338" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-3110599284136215408?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/3110599284136215408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/05/glbase-analysis-of-chip-seq-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/3110599284136215408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/3110599284136215408'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/05/glbase-analysis-of-chip-seq-data.html' title=''/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_zn5PXxCvZWY/Sh3sg0TbLSI/AAAAAAAAABI/dZCnoC8BtHE/s72-c/top2_5k_all.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-7258272222697940579</id><published>2009-05-04T17:11:00.000-07:00</published><updated>2009-05-04T17:19:24.200-07:00</updated><title type='text'>Google Earth</title><content type='html'>&lt;div style="text-align: center;"&gt;Google Earth is Fun&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;2004-2009 - Singapore&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_zn5PXxCvZWY/Sf-EQB9y10I/AAAAAAAAAAY/WLTcEKNwnlI/s1600-h/Houses.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 227px;" src="http://4.bp.blogspot.com/_zn5PXxCvZWY/Sf-EQB9y10I/AAAAAAAAAAY/WLTcEKNwnlI/s320/Houses.png" alt="" id="BLOGGER_PHOTO_ID_5332125894770349890" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;2000-2004 - Norwich, UK.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_zn5PXxCvZWY/Sf-FhjmchsI/AAAAAAAAAAg/dxhQQMWQ_14/s1600-h/2004.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 226px;" src="http://4.bp.blogspot.com/_zn5PXxCvZWY/Sf-FhjmchsI/AAAAAAAAAAg/dxhQQMWQ_14/s320/2004.png" alt="" id="BLOGGER_PHOTO_ID_5332127295368627906" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-7258272222697940579?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/7258272222697940579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/05/google-earth.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/7258272222697940579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/7258272222697940579'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/05/google-earth.html' title='Google Earth'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_zn5PXxCvZWY/Sf-EQB9y10I/AAAAAAAAAAY/WLTcEKNwnlI/s72-c/Houses.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-3247130944909381603</id><published>2009-04-26T03:42:00.000-07:00</published><updated>2009-04-29T23:59:34.908-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Renvy'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='R'/><title type='text'>Renvy 0.1</title><content type='html'>&lt;a href="http://bitbucket.org/oaxiom/renvy/overview/"&gt;Renvy 0.1&lt;/a&gt;, in its most basic form is usable. It will load and save R scripts, and you can run them. Plenty of things to do, it only deals with single tabs, no cut copy paste, no undo redo, no syntax highlighting or other nice bells and whistles. &lt;br /&gt;&lt;br /&gt;Renvy requires rpy, python, and R. Click main.py to run Renvy. Or type:&lt;br /&gt;&lt;br /&gt;$ python main.py&lt;br /&gt;&lt;br /&gt;to run Renvy. You can get Renvy &lt;a href="http://bitbucket.org/oaxiom/renvy/overview/"&gt;here&lt;/a&gt;. Or clone the mercurial repository with:&lt;br /&gt;&lt;br /&gt;$ hg clone https://oaxiom@bitbucket.org/oaxiom/renvy/&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_zn5PXxCvZWY/SfQ7zpdrbNI/AAAAAAAAAAM/QSZoepe3CQc/s1600-h/Screenshot-Renvy.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 237px;" src="http://4.bp.blogspot.com/_zn5PXxCvZWY/SfQ7zpdrbNI/AAAAAAAAAAM/QSZoepe3CQc/s320/Screenshot-Renvy.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5328950017575840978" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-3247130944909381603?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/3247130944909381603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/04/renvy-01.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/3247130944909381603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/3247130944909381603'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/04/renvy-01.html' title='Renvy 0.1'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_zn5PXxCvZWY/SfQ7zpdrbNI/AAAAAAAAAAM/QSZoepe3CQc/s72-c/Screenshot-Renvy.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-1819016132959780290</id><published>2009-04-19T18:33:00.000-07:00</published><updated>2009-04-19T18:39:02.911-07:00</updated><title type='text'>Renvy</title><content type='html'>My general disappointment with the available R GUI's has finally led me to develop my own, Renvy, a simple GUI front-end to R without much of the bells and whistles. Think of Geany for coding, Renvy is to R. [Actually Geany can integrate R, it just does it poorly]. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.r-project.org/"&gt;R is a statistical programming language&lt;/a&gt; that has gained a lot of traction amongst biologists due to the excellent &lt;a href="http://www.bioconductor.org/"&gt;Bioconductor&lt;/a&gt; package which allows researchers to do amazing amounts of analysis with the minimum of fuss.&lt;br /&gt;&lt;br /&gt;You can follow the progress of Renvy &lt;a href="http://bitbucket.org/oaxiom/renvy/overview/"&gt;here&lt;/a&gt;. Suffice to say it is not usable currently!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-1819016132959780290?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/1819016132959780290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/04/renvy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/1819016132959780290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/1819016132959780290'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/04/renvy.html' title='Renvy'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-2008382158023627984</id><published>2009-04-08T17:52:00.000-07:00</published><updated>2009-04-08T17:55:55.599-07:00</updated><title type='text'>Economics - China and the reserve currency.</title><content type='html'>Hmm... Probably not the best entry to start with, 200 lines of Python code. It's just I'd only seen this code as fragments on the web and had never seen it pieced together and integrated into a GUI.&lt;br /&gt;&lt;br /&gt;I commented on a blog entry here &lt;a href="http://www.riseupforthenewday.net/2009/03/24/china-moves-to-position-itself-as-a-power-player-in-time-of-crisis/comment-page-1/#comment-36"&gt;http://www.riseupforthenewday.net/2009/03/24/china-moves-to-position-itself-as-a-power-player-in-time-of-crisis/comment-page-1/#comment-36&lt;/a&gt; talking about China's push for a reserve currency.&lt;br /&gt;&lt;br /&gt;I've edited it a little for clarity.&lt;br /&gt;&lt;br /&gt;I’m not really sure the Chinese could really see this financial crisis coming. If they could then they certainly would not have parked massive reserves in the dollar nor their disastrous investment in Morgan Stanley and Blackstone.&lt;br /&gt;&lt;br /&gt;As for the crisis not affecting China’s economy - I think it is to early to declare that. There is a large lag between import/export declines and direct effects on the economy. World-wide logistic chains take a while to unravel.&lt;br /&gt;&lt;br /&gt;6.5% growth forecast in China next year sounds impressive, but is actually considered a catastrophe in China (re: protect 8, ie preserve 8% growth), this forecast is likely to be revised downwards as well, unlikely to go negative, but in a country of 1.2bn people with a dubious social contract with the people (don’t do anything political and we’ll provide the growth) it is a recipe for combustion. If China really does escape this crisis unscathed, then it is likely just saving up problems in their banking system for the future.&lt;br /&gt;&lt;br /&gt;As for the new reserve currency - this is just China grandstanding to get a place at the table. The chances of it getting off the ground are zero. And commodity linked currencies would be a disaster, plus whom would guarantee the currency? The USD is the reserve currency because it is the largest economy with a massive and liquid trade in dollars. If China was serious about a new reserve currency then it should concentrate on opening up its own currency - as the third largest economy in the world it could form a bipolar reserve currency with the US. But it would not do that because the China government (rightly) fears massive currency movements overseas and is still chastened by 1997.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-2008382158023627984?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/2008382158023627984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/04/economics-china-and-reserve-currency.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/2008382158023627984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/2008382158023627984'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/04/economics-china-and-reserve-currency.html' title='Economics - China and the reserve currency.'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-6385774190751919863</id><published>2009-03-27T08:02:00.000-07:00</published><updated>2009-04-19T18:42:30.510-07:00</updated><title type='text'>Integrating Cairo into wxWidgets...</title><content type='html'>Some python code to integrate Cairo into wxWidgets:&lt;br /&gt;&lt;br /&gt;This goes into the top of your code:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="py"&gt;&lt;br /&gt;#----------------------------------------------------------------------&lt;br /&gt;# The Cairo interface.&lt;br /&gt;import wx.lib.wxcairo&lt;br /&gt;&lt;br /&gt;import ctypes&lt;br /&gt;import cairo&lt;br /&gt;from ctypes.util import find_library&lt;br /&gt;&lt;br /&gt;cairo_dll = ctypes.CDLL(find_library("cairo"))&lt;br /&gt;&lt;br /&gt;# Pycairo's API representation (from pycairo.h)&lt;br /&gt;class Pycairo_CAPI(ctypes.Structure):&lt;br /&gt;  _fields_ = [&lt;br /&gt;     ('Context_Type', ctypes.py_object),&lt;br /&gt;     ('Context_FromContext', ctypes.PYFUNCTYPE(ctypes.py_object,&lt;br /&gt;                                               ctypes.c_void_p,&lt;br /&gt;                                               ctypes.py_object,&lt;br /&gt;                                               ctypes.py_object)),&lt;br /&gt;     ('FontFace_Type', ctypes.py_object),&lt;br /&gt;     ('FontFace_FromFontFace', ctypes.PYFUNCTYPE(ctypes.py_object, ctypes.c_void_p)),&lt;br /&gt;     ('FontOptions_Type', ctypes.py_object),&lt;br /&gt;     ('FontOptions_FromFontOptions', ctypes.PYFUNCTYPE(ctypes.py_object, ctypes.c_void_p)),&lt;br /&gt;     ('Matrix_Type', ctypes.py_object),&lt;br /&gt;     ('Matrix_FromMatrix', ctypes.PYFUNCTYPE(ctypes.py_object, ctypes.c_void_p)),&lt;br /&gt;     ('Path_Type', ctypes.py_object),&lt;br /&gt;     ('Path_FromPath', ctypes.PYFUNCTYPE(ctypes.py_object, ctypes.c_void_p)),&lt;br /&gt;     ('Pattern_Type', ctypes.py_object),&lt;br /&gt;     ('SolidPattern_Type', ctypes.py_object),&lt;br /&gt;     ('SurfacePattern_Type', ctypes.py_object),&lt;br /&gt;     ('Gradient_Type', ctypes.py_object),&lt;br /&gt;     ('LinearGradient_Type', ctypes.py_object),&lt;br /&gt;     ('RadialGradient_Type', ctypes.py_object),&lt;br /&gt;     ('Pattern_FromPattern', ctypes.c_void_p),&lt;br /&gt;     ('ScaledFont_Type', ctypes.py_object),&lt;br /&gt;     ('ScaledFont_FromScaledFont', ctypes.PYFUNCTYPE(ctypes.py_object, ctypes.c_void_p)),&lt;br /&gt;     ('Surface_Type', ctypes.py_object),&lt;br /&gt;     ('ImageSurface_Type', ctypes.py_object),&lt;br /&gt;     ('PDFSurface_Type', ctypes.py_object),&lt;br /&gt;     ('PSSurface_Type', ctypes.py_object),&lt;br /&gt;     ('SVGSurface_Type', ctypes.py_object),&lt;br /&gt;     ('Win32Surface_Type', ctypes.py_object),&lt;br /&gt;     ('XlibSurface_Type', ctypes.py_object),&lt;br /&gt;     ('Surface_FromSurface', ctypes.PYFUNCTYPE(ctypes.py_object, ctypes.c_void_p)),&lt;br /&gt;     ('Check_Status', ctypes.PYFUNCTYPE(ctypes.c_int, ctypes.c_int))]&lt;br /&gt;&lt;br /&gt;# look up the API&lt;br /&gt;ctypes.pythonapi.PyCObject_Import.restype = ctypes.POINTER(Pycairo_CAPI)&lt;br /&gt;pycairo_api = ctypes.pythonapi.PyCObject_Import("cairo", "CAPI").contents;&lt;br /&gt;&lt;br /&gt;ContextType = pycairo_api.Context_Type&lt;br /&gt;&lt;br /&gt;def Context_FromSWIGObject(swigObj):&lt;br /&gt;   """&lt;br /&gt;   (Internal)&lt;br /&gt;   get the Cairo object for drawing.&lt;br /&gt;   """&lt;br /&gt;   ptr = ctypes.c_void_p(int(swigObj))&lt;br /&gt;   #increment the native context's ref count, since the Pycairo_Context decrements it&lt;br /&gt;   #when it is finalised.&lt;br /&gt;   cairo_dll.cairo_reference(ptr)&lt;br /&gt;   return pycairo_api.Context_FromContext(ptr, ContextType, None)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then inside your drawing class you will need to add an OnPaint event:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="py"&gt;&lt;br /&gt;    def OnPaint(self, event):&lt;br /&gt;        """&lt;br /&gt;        Call to get Cairo to paint, this is done automatically if bound&lt;br /&gt;        to a Panel.&lt;br /&gt;        """&lt;br /&gt;        try:&lt;br /&gt;            dc = wx.PaintDC(self.panel) # make each time OnPaint is called.&lt;br /&gt;            #dc = wx.AutoBufferedPaintDC(self) # not clear why this doesn't work ...&lt;br /&gt;            self.size = dc.GetSizeTuple()&lt;br /&gt;            self.setViewPortSize(self.size[0], self.size[1])&lt;br /&gt;            gc = wx.GraphicsContext.Create(dc)&lt;br /&gt;            nc = gc.GetNativeContext()&lt;br /&gt;            ctx = Context_FromSWIGObject(nc)&lt;br /&gt;        except:&lt;br /&gt;            raise ErrorCairoAcquireDevice&lt;br /&gt;&lt;br /&gt;        self._paint(ctx) # actual paint calls go here.&lt;br /&gt;        return(True)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I found it useful to bind all of this into a panel on my wxWidgets GUI. I have a panel in the GUI already, then I bind another panel on top of that panel.&lt;br /&gt;My panel needs a few special options (see below), so I can't just bind it into that panel.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="py"&gt;&lt;br /&gt;    def bindPanel(self, panel):&lt;br /&gt;        """&lt;br /&gt;        bind a wx.Panel into gDraw.&lt;br /&gt;        """&lt;br /&gt;        self.panel = drawPanel(panel, self.OnPaint)&lt;br /&gt;&lt;br /&gt;        return(self.panel)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And this is my drawPanel class, which I used to bind the events into and exists somewhere were I need it in the GUI.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="py"&gt;&lt;br /&gt;class drawPanel(wx.Panel):&lt;br /&gt;    """&lt;br /&gt;    An empty Panel class that sets things up suitably for Cairo.&lt;br /&gt;    """&lt;br /&gt;    def __init__(self, parent, paint_Procedure):&lt;br /&gt;        # This has to be set to full repaint to work, &lt;br /&gt;        # otherwise it will try to repaint only small parts.&lt;br /&gt;        wx.Panel.__init__(self, parent, -1, size=(-1,-1), style=wx.FULL_REPAINT_ON_RESIZE) &lt;br /&gt;        self.Bind(wx.EVT_PAINT, paint_Procedure, self)&lt;br /&gt;        self.Fit()&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-6385774190751919863?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/6385774190751919863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/03/integrating-cairo-into-wxwidgets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/6385774190751919863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/6385774190751919863'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/03/integrating-cairo-into-wxwidgets.html' title='Integrating Cairo into wxWidgets...'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4151181583264905232.post-4226941538548339675</id><published>2009-03-27T07:54:00.000-07:00</published><updated>2009-04-19T18:45:11.258-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='introduction'/><category scheme='http://www.blogger.com/atom/ns#' term='oAxiom'/><category scheme='http://www.blogger.com/atom/ns#' term='biotech'/><title type='text'>Welcome to oAxiom</title><content type='html'>An occasional spot for me to write stuff I find interesting, and my faltering efforts to find funding for a biotech venture.&lt;br /&gt;&lt;br /&gt;I sit at the interface of biology and bioinformatics - I'm in the unique position to be both a fully trained biologist (cell culture, Western blots, all that stuff). And I am also an experienced programmer (Python, C, R).&lt;br /&gt;&lt;br /&gt;My project sits at the interface between these two people. As such this blog will contain snippets of code, snippets of biology and a dose of entrepreneurship, as wells as other miscellaneous nonsense.&lt;br /&gt;&lt;br /&gt;Welcome to oAxiom, its only employee (if I could call myself that): Andrew Hutchins. I'm in Singapore (currently), and you can contact me at oaxiom@oaxiom.com.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4151181583264905232-4226941538548339675?l=oaxiom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oaxiom.blogspot.com/feeds/4226941538548339675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://oaxiom.blogspot.com/2009/03/welcome-to-oaxiom.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/4226941538548339675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4151181583264905232/posts/default/4226941538548339675'/><link rel='alternate' type='text/html' href='http://oaxiom.blogspot.com/2009/03/welcome-to-oaxiom.html' title='Welcome to oAxiom'/><author><name>oAxiom</name><uri>http://www.blogger.com/profile/09775383920309768033</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_zn5PXxCvZWY/SnFWNQQ_hXI/AAAAAAAAABs/tvzS_EDDSWY/S220/Bee_Avatar.jpg'/></author><thr:total>0</thr:total></entry></feed>
