Tag Archives: python

A Linked Data Plaform Server in python/asyncio

It’s been a while I haven’t posted here (but at least this mean I’m kind of busy)!

A few years have passed since we’ve started dreaming of a decentralized, open data network for all our (web) projects. Happily, researchers have worked on the semantic web for quite a few years and with the latest W3 drafts, I think we’re almost there.

So, I’ve spent my latest weeks working on an implementation of a Linked Data Platform Server in python. It’s a rewrite of my previous attempt in Pyramid.

This rewrite, now fully in Python 3, uses the new asyncio library that allows me to use coroutines and therefore speed it up a lot compared to the previous implementation. After attending this year’s FOSDEM, I felt I had to try aiohttp and API-Hour. Thanks @saghul and @GMLudo for inspiring me with your talks! Yes, it rocks!

I see a lot of usages for this server: backing the data of the commons in a p2p way (think Unisson, TILIOS, p2pfoundation, Virtual Assembly), being the backbone of any cultural or research institution, allowing rapid data backend deployment, …

Currently, I’m trying to pass the W3 Test Suite to make my implementation conform and I already have a few upcoming projects to proof-test it! Yay!

Oh, yes, it’s called Glutton. It loves data, all the data!

Séminaire ArtS, ScienceS ET TECHNIQUEs

J’interviendrai ce Mercredi 4 Avril aux côtés de Véronique Béland dans le cadre d’une journée intitulée “Perception, Préhension du monde : Art et Langages”, lors du séminaire de recherche des Écoles Supérieures d’art du Nord-Pas de Calais et du Fresnoy –Studio national des arts contemporains.

Le vide de la distance n’est nulle part ailleurs

Par Véronique Béland, artiste en formation au Fresnoy, Guillaume Libersat, ingénieur et Pascal Denis, de l’équipe Mostrare (INRIA Lille Nord Europe, LIFL, Université Lille I, Université Lille III)

Travaillant principalement dans les domaines du son, de la photographie et de la littérature, Véronique Béland s’intéresse à des processus a priori inapparents, animée par un désir d’ausculter différents types de silence ou de vide pour en relever le contenu. Par diverses astuces de traduction ou de transcodage, sa démarche consiste à détourner des flux plus ou moins perceptibles ou indifférenciés pour en faire le récit à travers la voix humaine, d’où en jaillit une certaine forme de narration.

This is Major Tom to Ground Control (2012) : en partenariat avec Guillaume Libersat (FuzzyFrequency) et le laboratoire de recherche Mostrare (INRIA Lille Nord Europe, LIFL, Université Lille I, Université Lille III), l’artiste a entrepris de créer un générateur de textes aléatoires qui soit activé et contrôlé par l’analyse d’ondes radio provenant du cosmos, reçues par les radiotélescopes de l’Observatoire de Paris. Grâce à une voix de synthèse qui le récite en temps réel, le texte devient en quelque sorte la « voix de l’Univers », une interprétation poétique d’un phénomène scientifique. Reste à savoir si ce mécanisme aléatoire pourra nous divulguer des renseignements jusqu’à ce jour tenus secrets, nous offrir un sens nouveau à la vie ou encore donner des réponses à toutes nos questions irrésolues !
(Aucun extra-terrestre n’a été maltraité dans l’élaboration de ce projet.)

Vous pouvez télécharger le programme complet. Venez nombreux ! :-)

Accès aux données V’Lille (+ API Python)

Bon, c’est bien joli la carte sur le site de Transpole ( http://vlille.fr/stations/les-stations-vlille.aspx ) mais c’est quand même super triste de ne pas pouvoir avoir accès aux données brutes.

En fait, c’est juste très simple, après 1 minute passée à fouiller le javascript. Voici comment faire, le tout servi en XML :

  • Obtenir la liste des stations avec leur ID et emplacement géographique : http://vlille.fr/stations/xml-stations.aspx
  • Obtenir les infos d’une station en particulier : http://vlille.fr/stations/xml-station.aspx?borne=<ID>

Voilà, rien de plus simple… maintenant, à nous de faire voir qu’on peut intelligemment exploiter les données ouvertes :-)

Mise à jour du 19 Septembre : Je viens d’écrire une API Python pour accéder aux Vlilles Vous pouvez la trouver ici : https://github.com/glibersat/python-vlille

Happy Hacking !

Damassama @ Panorama 13

Durant ces dernières semaines, j’ai co-réalisé un projet nommé Damassama, une installation d’art numérique à l’initiative de Léonore Mercier. Le travail s’est réalisé en coopération avec l’équipe de recherche MINT, de l’Ircica. Maintenant que l’installation est terminée, vous pouvez aller l’essayer jusqu’au 24 Juillet au Fresnoy (Tourcoing), durant l’exposition annuelle Panorama (#13 cette année). Petite présentation de cette installation :

Damassama est une installation constituée de deux plans disposés en demi-cercles sur lesquels reposent des bols tibétains. Des marteaux frappent sur ces bols afin de les faire sonner, et ces marteaux sont activés grâce à la gestuelle de votre corps. Vous vous placer au centre de cet amphithéâtre et pour déclencher un bol, il suffit de tendre le bras dans sa direction. Pour faire une montée de gamme, vous pouvez balayer avec vos mains devant vous ou encore lancer vos bras pour un accord. Le tout étant harmonisé sur une gamme orientale, on se prend vite au jeu de créer des atmosphères un peu mystiques !

Côté technique, le seul capteur utilisé est une Kinect. A coup d’OpenNI, Mididings, Jack, Python, C++ et j’en passe, nous avons pu relever le défi de réaliser cette installation complexe, ce qui n’était pas gagné d’avance :-)

Bref, je vous laisse visionner les quelques photos, ça vaudra mieux qu’un long discours…

Zen Of Python Poster

The Zen Of Python
The Zen Of Python

I’ve been a long time fan and user of the Python programming language… so I had to show it in the office. I really love the trainspotting-like poster but I wanted also something more zen, something that shows the genius inside this language. Therefore, i’ve just import’d “this” and started to copy and paste some of them in inkscape. Here’s the result. It was never finished, but you know, you’re welcome to send patches :-)

So, here’s the repository, feel free to fork it (CC-BY-SA 3.0) !

https://github.com/glibersat/Zen-Of-Python-Poster

Cheers !

Enlarge your python x10 !

X10-controlled
X10-controlled

I have recently ordered a few X10 equipments to play with. For those who don’t know, X10 is a standard for Home-automation (domotics) that enables you to remote control devices over a classical power line. A typical scenario could be for example remotely changing the intensity of a light. This has many “serious” use cases but honestly, for me, this is more a fun device to play with. Even if I may use them later for my home, I guess, I’m more interested in seeing how they can be used in another contexes such as artistic installations.

CM15
CM15

One of the devices I’ve ordered is a USB controller (model CM15) that you plug both to a usb port and the powerline. It can also receive and send events coming from wireless controllers, but that’s out of the scope for now.

So, first, I’ve of course started lurking at the existing free software to control all these toys and discovered a few projects such as Eclipse, MisterHouse, etc. They all seem to be interesting but my initial plan was more to have a good library so that I can integrate them into my existing projects. I’ve then found a low-level perl library, another one for the CM17 in ruby and my best result was a C one with a demo application.

The later works like a charm and allowed me to enter the cool world of X10 by sending some commands to my actuators. Fun. But, even if C is good for many things such as operating systems, we nowadays tend to use higher level programming language, such as my prefered one : Python.

After searching for some CM15/X10 stuff for Python, I’ve only found three libraries : a module for the firecracker (CM17) which exposes a low-level interface (very C style, low level commands) and two others called PyXAL and PyX10 that basically wrap the X10 Abstraction Layer library. While they may seem interesting, these three projects are no more maintained and the latest commits are from 2000… erg !

One possible solution could have been to wrap this C code to a Python module, but even if it works well, I had the feeling that I could rewrite it in a more consive way and in an object-oriented manner. Moreoever, this kind of USB devices are usually not too much complex to use, leading me to prefer to write a pure Python module. Beginning of another story :D

My goal is to make a generic, yet not complex, X10 library. Using the documents and specifications I’ve found, I’ve already written what’s needed to detect, setup the CM15 and made a pretty object-oriented interface to talk to the devices. I’ve also added the concept of House and plan to have virtual groups to be able to send a command to a set of devices you have chosen. Have a look :

1
2
3
4
5
lamp = dev.actuator("A2")
lamp.dim(10)
lamp.off()
house = dev.house("B")
house.lightsOff()

By the way, the module can be used for any other X10 device, it’s made for that. All the code is almost generic, you just have to write your own controller class. Also, the API is likely to change so if you have suggestions…

I’ll publish the module soon and my plan is to enhance it little by little… in fact I’ll add a feature every time I need it. If you want it faster, I’ll be happy to apply your patches :-)