In other news, this blog turned 10 last saturday (ftblog online!). Kind of missed that date myself. Post frequency is dwindling, but I guess I'll continue annoying you with my boring crap from time to time anyway. Cheers! ☺

Posted Sat 18 Apr 2015 22:24:32 CEST Tags:

So, The Prodigy released another record a few days ago.

In the past, I've been a massive fan of the band, buying everything I could get my hands on: Books, VHS Tapes, every single release in every version I could find, all the albums... Then the band took a bit time off (“The Fat of the Land” was released in 1997) and came back — seven years later — with “Always Outnumbered, Never Outgunned” in 2004. While it's a good release, it was the weakest when compared to the first three records. The next one (“Invaders Must Die” in 2009) was big again. I loved almost all tracks on that one.

And now in 2015 — after another six year waiting period — they release “The Day is my Enemy”. They put out a few things beforehand via their youtube channel (like “Nasty” and “Wild Frontier”); and nothing that I heard clicked immediately.

That's also why I put off buying the album right away. Today I did. And what can I say? Everything on this record works. Even the tracks I knew previously and dismissed work in the context of the album.

The Prodigy's sound doesn't change as much as it used to with the first three albums. But that's not necessarily a bad thing. They are probably converging towards how they are supposed to sound.

Don't get me wrong, this does not redefine which album is The Prodigy's magnum opus (that is and will remain “Music for the Jilted Generation”), but this is a versatile, 14-track, modern dance record that everyone who liked the two predecessors will love.

NP: The Prodigy — The Day is my Enemy — Destroy

Posted Sat 18 Apr 2015 21:33:02 CEST Tags:

I find it odd, that some people don't make the slightest attempt at learning to use a new tool because they know a similar tool and want the new tool to work exactly like the old one.

That's like a carpenter looking at screws after working with nails previously, now refusing to use a screwdriver like screws are supposed to be used and instead just hammer screws into wood without giving it a second though, even complaining when the ill-applied screws don't work as well as the screw manufacturers claimed they would…

I'd love to see more screwdriver builders to tell lazy people to fuck off.

Posted Sat 04 Apr 2015 16:59:36 CEST Tags:
ft U+1F596

Sadly, Leonard Nimoy passed away yesterday.

I wanted to use U+1F596 (🖖: “RAISED HAND WITH PART BETWEEN MIDDLE AND RING FINGERS”) in here. But as it turns out, my system doesn't support displaying that, yet (it's new in Unicode 7). Sadness all around. ☹

Posted Sat 28 Feb 2015 01:03:09 CET Tags:

I'm a bit of a fan of Hewlett-Packard. Mainly for their excellent hand-held calculators and for their equally awesome laboratory equipment, like function generators, oscilloscopes and signal analyzers. And they were known for their quality. In 1999 it was decided to throw away that good name and move all non-computing products to a spin-off company called “Agilent”. And by now, that name basically rings as well as the old HP one.

But guess what, someone with Agilent seems to have run weary of that name as well: I was looking for Agilent's entry level oscilloscopes and couldn't find any with the usual distributors. What came up were scopes by a company called “Keysight”. I was like “Wat. Are those knock-offs!?” - But no. That company is a spin-off off of Agilent, that takes care of the electronic measurement products. Meh.

Posted Sat 25 Oct 2014 12:13:59 CEST Tags:

Yet another Update

So, they are calling it “CommonMark”. Not quite as catchy, but who cares. As long as it's technically sound.


Seems like the “Standard Markdown” effort didn't really look at John Gruber's licencing text, that he used for the original description. It allows you to do just about anything you like, but one of the few restrictions the licence includes is that you cannot use the name “Markdown” or the name of any of the original contributors to endorse or promote derived products. At least not without specific prior written permission. So now Gruber is a wee bit pissed, and understandably so, if you ask me.

Yet, having a specification of a language that is used for input into computer programs, that is not ambiguous sounds like a good thing to have. I don't care about what they will call it (I don't know if the panic move to “Common Markdown” makes any sense, since “Common” is pretty much a synonym to “Standard”), but from a technical point of view it is a move in the right direction. If you cannot find agreement, find another clever name and run with that.

Markdown is great. Usual texts are simple, and you get away with minimal markup languages such as this. If you want to do stuff like control text colour for individual words in a document, you should see a doctor anyway. If you'e a reasonable person, markdown is what you are looking for. This blog (and indeed the rest of my website) is also written using markdown, processed by ikiwiki.

Jeff Atwood just blogged about Standard Markdown, which came to be because the original Markdown description by John Gruber isn't an unambiguous specification. That's where the spec of the Standard Markdown comes into play. Sounds great.

The one concern I had was, whether or not this project had John MacFarlane on board. My concern was unfounded, because John is in. Knee deep, as it would seem: He wrote the specification as well as the standard implementations in C and JavaScript. ☺

Why I am such a fanboy? Well, basically because John is the author of pandoc, the most awesome document processing tool you will ever come across. It can - brace yourself - convert Markdown, reStructuredText, Textile, HTML, DocBook, LaTeX, MediaWiki markup, OPML, Emacs Org-Mode, txt2tags, Microsoft Word docx, EPUB, or Haddock markup to - sure, take a moment to catch your breath - HTML (including HTML5 and shiny things like slideshows using reveal.js and stuff like that), EPUB, FictionBook2, Microsoft Word docx, OpenOffice/LibreOffice ODT, OpenDocument XML, DocBook, GNU TexInfo, Groff man pages, Haddock markup, ICML a markup language used in Adobe InDesign, OPML, LaTeX, ConTeXt, LaTeX Beamer slides, PDF via LaTeX, Markdown, reStructuredText, AsciiDoc, MediaWiki markup, DokuWiki markup, Emacs Org-Mode and Textile. It is positively mind-boggling. The project's website features a diagram, that visualises this paragraph, if you can't believe it…

Write your documents using pandoc's extended markdown, keep them in version control (because markdown is a plain-text format, that's trivial), and generate whatever format you need. Seriously, if you're still using “office” style programs to write your documents with, you can't be helped.

I'll acknowlegde, that sometimes you'll want full control of your document, and sure, use LaTeX in those cases. But the newest pandoc has support for calling filters during the conversion phase, which open the door for almost any extension you can think of. I'll use markdown&pandoc for the next larger document I have to write. I did use pandoc to produce my latest presentation slides: The filters feature of pandoc allowed me to extend pandoc's markdown to target multi-column slides as well as freely positionable images. It produces LaTeX beamer slides in PDF format, which are plain beautiful anyway.

Pandoc has installers for windows and OSX, too. So there's no way you'll get away claiming it's not available for your platform. Your linux installation will probably feature pandoc packages out of the box; if not: Switch to debian already! PDF output needs a LaTeX installation, but there are open-source distributions for all major OSs readily available for installation.

Posted Wed 03 Sep 2014 22:08:06 CEST Tags:

BT Templeton (bipt) has been working (AFAIK in four consecutive GSOCs now) on porting emacs's Elisp engine to GNU Guile. The Guile-folks have been dreaming about this for a while now (see this mail by Andy Wingo from 2010, for example). I'm obviously not an expert, but I was rather sceptical about the chances of success of this endeavour…

Christopher Allan Webber summarises the current state. bipt said on ‘#guile’, that he was successfully performing tasks like reading mail using gnus and using large systems like org-mode on his build of such a Guile-hosted emacs-binary. This is great news indeed. ☺

Posted Mon 18 Aug 2014 16:10:45 CEST Tags:

Today a user on IRC wondered how hard it would be to indicate the current mode of zsh's vi keyboard mode in grml's new prompt-theme.

The prompt theme is designed to not only be configurable, but also to be extensible with custom information. The theme is not the issue with this request. The issue is to get solid information about the current state of zsh's vi-mode, with ordinary keymap changes, signal handling, recognition of minibuffers and override modes...

Since I use vi-mode in my zsh setup, I did all that a while back (CODE: You may want to take a look at the CONFIGURATION section, especially `zle_use_ctrl_d', which you may want to set to "no" if you like to use ESC like you'd expect in vi). Which means that the only question that remains is how to actually perform the integration.

Turns out, that this is rather easy. Suppose you copied the code that's linked from my old blog post to ~/ Let's do the integration in ~/.zshrc.local, which is a file that grml's zshrc loads after all its own code ran. The integration can be done in three lines of code then:

source ~/
grml_theme_add_token vi-mode '%1v' '%K{blue}%F{white}(' ')%f%k '
zstyle ':prompt:grml:left:setup' items vi-mode rc change-root \
                                       user at host path vcs percent

And here's how that looks:

vi-mode integration with grml's new prompt theme

I'm kind of glad, we rewrote our prompt code to make things like this possible, clean and fairly easy. :)

Posted Tue 05 Aug 2014 13:47:03 CEST Tags:

Always. Right? RIGHT!?

Neil Young must have thought something along those lines when he started developing pono.

Audio sampled using 24Bit resolution at 192kHz is indeed more. But is it better? Better for audio playback than, say, 16Bit resolution at 44.1kHz (you know, like on regular compact discs)? You won't trust me anyway, so let me link you to an article by Christopher Montgomery of, who has much more expertise regarding this topic than I will ever have anyway: 24/192 Music Downloads ...and why they make no sense

The short answer is:

Why push back against 24/192? Because it's a solution to a problem that
doesn't exist, a business model based on willful ignorance and scamming

That punchline is actually rather boring compared to the rest of the article's content, since he completely dismantles all the talking points that proponents of 192/24 usually present. If you thought $400 for a pono sounds like a bargain considering those figures, please do read it before you place yourself onto the preorder list. Samplerate and resolution are not the issue.

Posted Sat 10 May 2014 11:06:03 CEST Tags:

Useful font is useful

Posted Fri 11 Apr 2014 11:34:36 CEST Tags:

Previously I was using matplotlib. Things went fairly smoothly. The only awkward places were those where I tried to customise the looks of things a bit. Having to do that for each and every plot seems cumbersome. And I guess I'm not alone with that feeling, because matplotlib let's you provide a configuration file, that sets up things the way you'd like. You name the thing “matplotlibrc” in your current working directory to have different setups in different places. So I created a file that contains the following:

lines.linewidth  : 1.5
axes.grid        : True
axes.color_cycle : b, r, g, c, m, y, k
xtick.labelsize  : 8
ytick.labelsize  : 8
legend.fancybox  : True
legend.fontsize  : small

Then the plotting script reduces the Python code to only pieces that are pretty self-explanatory:

import numpy as np
import matplotlib.pyplot as pp

data = map(lambda x: [ x[0],
                       complex(x[1], x[2]),
                       complex(x[3], x[4]),
                       complex(x[5], x[6]),
                       complex(x[7], x[8]) ],
           np.loadtxt("wifi-antennas.s2p", skiprows=5))

def column(data, i):
    return [ row[i] for row in data ]

def lin2db20(data):
    return 20 * np.log10(np.abs(data))

xx = np.multiply(1/1.0e9, column(data, 0))
s11 = lin2db20(column(data, 1))
pp.plot(xx, s11, label = '2.4GHz antenna')
pp.xticks(list(pp.xticks()[0]) + [ 2.4 ])
pp.xlim(0, xx.max())
pp.ylim(np.min([s11.min(), s22.min()]) - 1, 1)
pp.xlabel("frequency [GHz]")
pp.ylabel("S11 [dB]")

pp.savefig("wifi-antennas.pdf", bbox_inches = 'tight')


Posted Fri 21 Mar 2014 15:24:38 CET Tags:

I'm a fan of high-quality representation of data. Be it typesetting, plotting, technical drawings or circuit schematics. And when it comes to plots, the output most applications deliver are nothing short of abysmal. If your plots are not available in a vector format, they are useless. If you decide to plot light-green lines on white background, that is utterly useless. If your axis labels read “db(mag(scatter(port1,port1)))” without the option of changing them: useless.

Luckily, most applications recognise that they suck at producing high quality plots and provide ways to get the numeric data out of them to use a dedicated utility to generate publication quality plots. The upside with that is, that all your plots will also look uniformly - which is important if you are working on something like a paper or thesis, where you'll surely want a consistent high-quality look to what you are preparing.

One such program is my good old friend “gnuplot”. I've written a fair number of small tools that turn data from simulators and measurement equipment into gnuplot scripts or into gnuplot-digestable formats. Gnuplot produces high-quality scalable plots and is immensely powerful, to satisfy most if not all of your plotting needs. However this story is not about gnuplot.

Because sometimes, I feel like I either hit the limit of gnuplot's capabilities or the language you control it by seems to get in the way. Sometimes I just want to create a sort of plot, that I think should be trivial to produce, and when I try it's just very very hard, while other things that looks incredibly hard seem trivial to create with it.

When you look for alternatives, your attention will quickly turn to “matplotlib”. That's a Python library for producing all sorts of plots and all of them in publication quality. Actually, together with NumPy and SciPy it forms a set of tools to tackle scientific and numeric problems. But let's not get distracted by that.

In the lab, we got a fairly big number of high-end measurement equipment, like high-bandwidth digital scopes, spectrum-, logic-, network-analyzers and the like. And the plots these things produce vary from mildly irritating to complete and utter crap. But that's okay, since there are usually ways to that the actual data out of them and into our high quality plotting engines (be it gnuplot or matplotlib).

Today I copied a dataset from a Rohde&Schwarz network analyzer measuring the Scattering Parameters of a setup with two wifi-antennas (one for 2.4GHz and the other in the 5GHz band) from 9kHz to 8.5GHz, so I had something to throw matplotlib against in the evening.

What S11 roughly represents (for those of you who are too lazy to read the wikipedia entry on scattering parameters) with respect to the antenna is this: The analyzer blows sine waves of all frequencies in the measured range into the antenna and looks at how much of the wave came back to it. For frequencies at which an antenna works, that value is typically quite small since most of the wave is supposed to be send off into the air. For frequencies at which the antenna doesn't work, a lot of the wave is reflected back to the analyzer. If everything of a wave is reflected and not otherwise lost on the way, incident and reflected amplitudes are the same and the magnitude of S11 at that frequency is 1 - the largest possible value in this kind of setting.

With two ports (like here with the each of the two antennas connected to one port) you get more scattering parameters: S22 is like S11 but for the second port. S21 describes how much of a wave from port 1 arrives at port two and S12 is the same just in the other direction.

Scattering parameters are usually plotted in logarithmic scale (S11log = 20·log10(|S11|)): A value of 1 would correspond to 0dB; 0.1 would be -20dB. So with this 2.4GHz antenna, you'd expect S11 to be small (like -10dB) around 2.4GHz and not-so-small everywhere else.

The network analyzer exports its datasets in touchstone format. A "s1p" file in that format has three columns. Since scattering parameters are complex numbers, the lines look either like this:

frequency   real(S11)   imag(S11)

Or like this:

frequency   magnitude(S11)   angle(S11)

"s2p" files contain the scattering parameters of a two port system (i.e. S11, S22, S21 and S12) in very much the same way. Either:

frequency real(S11) imag(S11) real(S21) imag(S21) ...etc...


frequency magnitude(S11) angle(S11) magnitude(S21) angle(S21) ...etc...

The Rohde&Schwarz analyzer uses the former version. The touchstone files also contain header lines (that define how the lines and columns are formatted, if you don't know the format) and comments at the top.

So. I got a "s2p" file that contains the measurement data and I want to plot the S11 values (representing the reflection data at port one, where the 2.4GHz antenna was connected). This is pretty easy to do in gnuplot, so matplotlib better doesn't make it too hard or I'll be demotivated massively. :)

Some constraints: The Y-axis should be labeled "S11 [dB]" and the X-axis should be labled "frequency [GHz]". It should be a plot, that you can use in a regular document: That means no title, since there will usually be a caption below or above the plot's figure in the document. And it also means that there should be minimal bounding box around the plot, so that no space is wasted. Also, it should obviously be a scalable format. I'd also like an extra tick at 2.4GHz on the frequency axis.

So postscript, pdf or svg. Proper inclusion in LaTeX documents is possible with postscript and pdf. And since there are more standalone pdf viewers than postscript viewers, let's settle for pdf.

Most of the work here is to read the dataset from the touchstone file. Luckily, the NumPy package provides a useful function to slurp in text-based datasets like this: loadtxt. So first things first:

import matplotlib.pyplot as pp
import numpy as np

Now we have access to ‘loadtxt’ as well as matplotlib's ‘pyplot’ API. The thing is, that we need to turn the real/imaginary pairs into actual complex numbers. But that's not so hard, if you know the ‘map’ function:

data = map(lambda x: [ x[0],
                       complex(x[1], x[2]),
                       complex(x[3], x[4]),
                       complex(x[5], x[6]),
                       complex(x[7], x[8]) ],
           np.loadtxt("wiki-antennas.s2p", skiprows=5))

Like I said, ‘loadtxt’ is the work-horse here. The ‘skiprows’ parameter just tells it to ignore the first five lines of the input file (that's the touchstone file's header and comments). The first argument to ‘map’ here is an anonymous function, that reorganises the data sucked in by ‘loadtxt’: It leaves the first column alone (that's the frequency entry) and then it takes the next columns in pairs and turns them into complex numbers. That does the trick.

You have to realise that my Python-fu is rather weak. I didn't know how to cleverly access an array of arrays column-wise. But the internet came the the recue:

def column(data, i):
    return [ row[i] for row in data ]

Now getting the data is trivial:

xx = np.multiply(1/1.0e9, column(data, 0))
yy = 20 * np.log10(np.abs(column(data, 1)))

Then prepare the plot:

# The font-size of the tick marks render a little big
# in pdf output by default. This needs to be tuned early:
fig = pp.figure()
plot = fig.add_subplot(111)
plot.tick_params(axis='both', which='major', labelsize=8)
plot.tick_params(axis='both', which='minor', labelsize=6)

# Prepare the plot, and take into account, that I like
# the plot's lines a tad ticker than the default.
pp.plot(xx, yy, linewidth = 1.5)

Now it's time to tune the plot to our liking:

# Extra tick at 2.4GHz:
pp.xticks(list(pp.xticks()[0]) + [ 2.4 ])
# Data range for X and Y axes:
pp.xlim(xx.min(), xx.max())
pp.ylim(yy.min() - 1, yy.max() + 1)
# A grid helps with orientation on the canvas:
# Axes labels like specified:
pp.xlabel("frequency [GHz]")
pp.ylabel("S11 [dB]")

Finally, write the bugger to a file:

           # Remember? Minimal bounding box!
           bbox_inches = 'tight')
# Also, a PNG for the blog post as a thumbnail
# for the PDF:
           bbox_inches = 'tight')
# Alternatively, if uncommented the following
# shows the data in a plotting window:

And here's the result (the image links to a scalable PDF version):

matplotlib plotting S11 of a 2.4GHz antenna

I can work with that. :)

Posted Thu 20 Mar 2014 21:53:40 CET Tags: