slippens's blog

Saving of images in scipy and preventing dynamic range rescaling

1 February, 2006 - 13:30
Categories:

Scipy is a (set of) open source Python modules for scientific/mathematical/engineering stuff. I (try to) use it instead of Matlab or its open source clone Octave because I don't like Matlab's scripting language and prefer Python's programming features.

If you want to store a 2D array (aka matrix) to an image file, the default behaviour of Scipy's imsave() function is to rescale the matrix to a 0-255 range (like Matlab's imagesc() function). For example:

Read more...

Reading OpenDocument office files from Python

20 January, 2006 - 19:58

The OpenDocument file format (aka "OASIS Open Document Format for Office Applications"), is an open and free standard for office files. It's fairly easy to read OpenDocument files in/from Python. Basicly, an OpenDocument file is just a zip archive but with another extension (".ods" spreadsheets, ".odt" for text documents, ".odg" for graphics and so on). The files in the zip file are mainly some XML files, like content.xml, settings.xml and styles.xml.

Basicly, we just need two standard python modules from the nice standard Python library to extract data from a OpenDocument File: zipfile for handling the zip compression and xml.parsers.expat (or another xml parser module) for parsing the xml. A possible/simple/minimal way to do read a fictional spreadsheet file pelican.ods is as follows:

Read more...

lenna lorem ipsum

6 January, 2006 - 18:10
Categories:

I want to share an image with the world.
It is not art. It is just the result of a experiment that — how should I put it — went wrong.

To be continued

ugly binary image

fun with reflective linux commands

3 January, 2006 - 16:43
Categories:

Man, this is heavy linux/unix commandline fun:

which which
locate locate
man man
help help
info info
whatis whatis
echo echo
touch touch
yes yes
whereis whereis
Read more...

Blender: change active camera

28 December, 2005 - 21:38
Categories:

It's a simple concept, but I already lost a lot of time looking for the solution: changing the active (aka default or just render) camera in Blender. I just can't find any clue in the (context) menus or in the wikified Blender manual. Google directed me to this Blender survival guide in which the solution is concealed:
select the camera which you want to make active and press ctrl + numpad-0

Last.fm player on Linux

19 December, 2005 - 17:36
Categories:

Today I bothered to intall the Last.fm player just to give it a try. The installation (on my Kubuntu 5.10 Linux laptop) was very easy. I just downloaded a tarball with the Linux binary from the Last.fm player download page and extracted it to a local folder in my home directory. Next I had to tell my webbrowser (firefox) to use this player for links with the lastfm:// protocol (like explained here). That was all to make it work.

Read more...

LaTeX: use \textnormal instead of \textrm (or \textsf) in math

14 December, 2005 - 14:17
Categories:

If you you want to use normal text in a math environment (mathdisplay, equation,...) you should use \textnormal{} instead of \textrm{}. Apparently the latter is more popular: a google search for "latex textrm" delivers almost 25.000 hits, whereas google search for "latex textnormal" returns not more than 800 hits. The advantage of \textnormal is that the text will be typeset in the normal font of the body text. \textrm on the other hand activates a roman (serif) font. Most of the time the result of these two will be the same because the default font of the body text is a serif one in most cases. But sometimes it is not.

Read more...

LaTeX: the order of \caption and \label matters in floats

13 December, 2005 - 18:14
Categories:

The order of \caption and \label declarations matter in LaTeX floats (tables and figures). It is important to get references to the float right. The \label should come after the \caption or even inside the \caption environment. If you put the \label before the \caption you will get a reference to the (sub)section where float is declared instead of a reference to the float itself.

Read more...

LaTeX: change the font and other properties of captions of floats

13 December, 2005 - 14:12
Categories:

With the LaTeX package caption you can change the properties (such as font family) of the captions of floats (tables and figures). It's part of a default LaTeX installation, so probably you don't need installing something.

Read more...

The floppy disk as symbol for saving

6 December, 2005 - 16:18

Why is the floppy disk still used as symbol/icon on widgets related to saving a document? Who uses floppy disks nowadays? People that worked with computers ten years ago will know what that icon stands for, but for the younger and future generation it is/will be probably an ugly squarisch thing. Maybe it's time to dump the floppy disk icon and think about an alternative representation of the save action?

Some people at dot.kde.org agree on this: http://dot.kde.org/1132098617/1132173875/