Posts about sciblog (old posts, page 4)

2010-09-27 bundling using py2app

2010-09-28 05:44:57

using macports

  • install py2app :

    sudo port install -u  py26-py2app
  • there's sometimes a problem in py2app to check the right architecture to build on:

    find /opt/local -name apptemplate/
    sudo vim /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/py2app/apptemplate/
  • in this case, this can be done by adding the following lines to py2app/apptemplate/

    gPreBuildVariants = [
            'name': 'main-x86_64',
            'target': '10.6',
            'cflags': '-isysroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64',
            'cc': 'gcc-4.2',
            'name': 'main-i386',
            'target': '10.6',
            'cflags': '-isysroot / -arch i386',
            'cc': 'gcc-4.2',

    . So, change to

    gPreBuildVariants = [
            'name': 'main-x86_64',
            'target': '10.5',
            'cflags': '-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64',
            'cc': 'gcc-4.2',
    #     {
    #         'name': 'main-universal',
    #         'target': '10.5',
    #         'cflags': '-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch i386 -arch ppc -arch ppc64 -arch x86_64',
    #         'cc': 'gcc-4.2',
    #     },
    #     {
    #         'name': 'main-fat3',
    #         'target': '10.5',
    #         'cflags': '-isysroot / -arch i386 -arch ppc -arch x86_64',
    #         'cc': 'gcc-4.2',
    #     },
    #     {
    #         'name': 'main-intel',
    #         'target': '10.5',
    #         'cflags': '-isysroot / -arch i386 -arch x86_64',
    #         'cc': 'gcc-4.2',
    #     },
    #     {
    #         'name': 'main-fat',
    #         'target': '10.3',
    #         'cflags': '-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc',
    #         'cc': 'gcc-4.0',
    #     },

using homebrew


2010-09-09 Journée de l'IFR 131 -Sciences du Cerveau et de la Cognition

2010-09-09 06:49:06

Aujourd'hui avait lieu la journée de l'IFR, pendant laquelle nous sommes intervenu avec F._X. Alario et A. Montagnini sur le thème de la variabilité comportementale.


2010-09-03 A neurocentric approach to Bayesian inference

2010-09-03 08:34:14
  • one-page paper arguing that Friston's free-energy view may not be complete. Some points made are
    1. the inversion operated assumes a generative model
    2. the use of surprise is defined using a frequentist approach not informational
      • one idea : from the frequentist measure one one can derive a conditional probability (a Xhi-2 distribution) of the probability. Not very far to the idea of Sahani & Dayan of a double probabilistic distribution
    3. explore surprise or avoid it: Fiorillo makes here a confusion of time scales. On the long term (learning) one tends to avoid surprise, on the short term (coding) this implies one jumps one surprise.
    4. points to his PLoS one paper: Fiorillo, C. D. Towards a general theory of neural computation based on prediction by single neurons. PLoS ONE 3, e3298 (2008)
  • once again, people love bipolarity: frequentists against probabilists, top-down vs. bottom-up, neurocentric vs global. neurons, areas, brains, groups of brains just don't care and evolve. it is our description that can be multiple. does a single one ("unified theory") exists iun today's language? at least I am convinced that (over generations) neurons adapt to behavior not the inverse, thus that if one has to seek for an information measure, it is certainly not in a ion's channel dynamic only.
  • the answer of Friston goes into that direction / correctly defines surprise / nice figure showing how one can learn "to be a Lorenz attractor" (certainly assuming a generative model of dynamics)
  • the open question is rather "how is the free-energy principle encoded in the brain's architecture and dynamics?"


  • Christopher D. Fiorillo. A neurocentric approach to Bayesian inference, URL . Nature Reviews Neuroscience, 11(8):605, 2010

    A primary function of the brain is to infer the state of the world in order to determine which motor behaviours will best promote adaptive fitness. Bayesian probability theory formally describes how rational inferences ought to be made, and it has been used with great success in recent years to explain a range of perceptual and sensorimotor phenomena1, 2, 3, 4, 5. .

  • Karl Friston. Is the free-energy principle neurocentric?, URL . Nature Reviews Neuroscience, 11(8):605, 2010

    Recently, a free-energy formulation of brain function was reviewed in relation to several other neurobiological theories (The free-energy principle: a unified brain theory? Nature Rev. Neurosci. 11, 127–138 (2010) .


2010-08-31 managing packages on MacOsX : testing HomeBrew

2010-08-31 09:11:31
  • a newcomer after fink and MacPorts:

  • advertised here

  • install

     $ ruby -e "$(curl -fsS"
    ==> This script will install:
    Press enter to continue
    ==> Downloading and Installing Homebrew...
    ==> Installation successful!
  • fix permissions

    $ sudo chown -R `whoami` /usr/local
  • to install python specific stuff, use pip:

    brew install pip
    echo '[install]
    install-data=/usr/local/Cellar/PyPi/2.6/share' > ~/.pydistutils.cfg
    pip install ipython
  • this is with the exception of numpy + scipy, the latter needing

    cd tmp
    svn co numpy
    pip install numpy
    brew install suite-sparse
    svn co scipy
    pip install scipy


2010-08-30 shortcuts

2010-08-31 09:35:58
  • from

    To make Ctrl← and Ctrl→  useful again, that is going a word forward or backward like they usually do on Linux, you must make send the right string to the shell. In the preferences, go to the Settings tab and select your default profile. Go to Keyboard and set control cursor left and control cursor right to send string \033b and \033f respectively.
    While your're at it, you can also fix Home (\033[H), End (\033[F), Page Up (\033[5~) and Page Down (\033[6~) so that they send those keys to the shell instead of scrolling the buffer.


2010-08-29 System Updates

  • install a package

    sudo installer -pkg <chemin d’accès au paquet> -target /
  • CLI for Software Updates :

    sudo softwareupdate -i -a


2010-08-11 getting the PID from matlab

2010-08-11 07:45:20
  • I need the pid to know if one of the many simulations I run are still running. There's no native solution in matlab to my knowledge.

  • using hint @

  • create getpid.c with

    1 #include "mex.h"
    2 #include <unistd.h>
    3 mexFunction(int nlhs, mxArray *plhs[ ], int nrhs, const mxArray *prhs[ ])
    4 {
    5   plhs[0] = mxCreateDoubleScalar((double) getpid());
    6 }
  • compile with ``mex getpid.c ``

    System Message: WARNING/2 (<string>, line 21); backlink

    Inline literal start-string without end-string.

  • use in matlab as pid=getpid()

  • this is part of the package in SparseHebbianLearning


2010-08-09 running embarassingly parallel simulations on a multicore machine using bash loops

2010-08-11 11:33:50
  • I need to run a single-processor experiment on some parameters, say N times

  • embarassingly parallel: scans all these parameters:

    1 for i in range(N):
    2     if experiment[i] is not finished and not locked:
    3         lock(experiment[i])
    4         run(experiment[i])
  • to run this on 8 cores, bash is your friend (may also apply to *sh where * is either z, c, tc, ...)

    for i in {1..8}; do cd /data/work/ && python  & done
  • however, runnning them simultaneously may cause problems if the locking mechanism is not fast enough, so I introduce a random jitter

    for i in {1..8}; do cd /data/work/ && sleep 0.$(( RANDOM%1000 )) ; python  & done


2010-08-07 distributed computing

2010-08-07 13:42:38
  • guess you have a bunch (4000) of embarrassingly parallel tasks (one hour each) and access to about 40 CPUs through SSH. All tasks would run easily on each node, and they all share some network drive (NFS). Would be nice to run everything from just one place (script, command-line, web interface, ...)

what we can do


2010-08-05 Pinna illusion

2010-08-05 15:32:20
  • from :

    Pinna illusion is the first visual illusion showing a rotating motion effect. In Figure 1  the squares, delineated by two white and two black edges each, are grouped by proximity in two concentric rings. All the squares have the same width, length, and orientation in relation to the center of their circular arrangements. The two rings differ only in the relative position of their narrow black and white edges forming the vertexes. More precisely, the two rings show reversal of the vertex orientation and, consequently, opposite inclination of the virtual or implicit diagonal orientation polarity obtained by joining the two vertexes where black and white lines meet (Pinna, 1990; Pinna & Brelstaff, 2000).
  • related to the aperture problem

    The Pinna illusion and the related effects represent an opportunity within the context of vision science and cognitive neuroscience  (Gazzaniga, 2004; Purves & Lotto, 2003). If the task of a sensory system is to provide a faithful representation of biologically relevant events in the external world, the previous phenomena show that visual perception  contrives, through complex neural computations, to create informative and efficient representations of the external environment. These representations are at the same time simpler and richer than the raw signals transduced by receptors. They are simpler because they simplify the enormous quantity of raw measurement information submitted to the central nervous system (see Section 2). They are richer because they contain properties of events and objects abstracted from the primitive sensory signals (see Sections 3 and 4). Therefore, the first opportunity suggested by the previous effects concerns the basic encoding of the features of the stimuli, i.e. the nature and meanings of the signals carried by single neurons, the maps and areas where they operate (see Section 2) and the pattern of motion of objects, surfaces, and edges in a visual scene due to the relative motion between an observer and the scene (optical flow, Gibson, 1979). Furthermore, they are good tests to understand the perceptual context within which a specific element is perceived, namely “what is ‘figure and what is ‘background”, “how separated elements of a visual event are combined and organized in a sensory representation” (see Section 4).
  • windmill illusion. link to the waghon-wheel illusion?