The sound of a bottle being filled

I got interested in seeing how do the spectral distribution of everyday sounds look like. So I got an app in my phone (Smart Recorder) and started recording them. The most interesting result (until now) is from the simplest sound I have recorded: a bottle of milk being filled at my kitchen’s tap. I present the audio, associated spectrogram and the theoretical analysis in this post. All the work is performed in Python, from reading the data to plotting.

Audio recording

Here is the audio:

As it sounds, it is just a bottle being filled with water. At the beginning (\(t\) < 1 second) there is nothing, until I open the tap. After about 32 seconds, the bottle is full and water is overflowing to the sink. There is a constant component lied to the impact of the particles on the bottom of the bottle/water column. Besides that, an indistinguishable and interesting tone that is changing in time can be heard. This sound is a resonance of air column with a closed-end (that is actually the water) and an open-end:

Illustration of the change of resonance frequency with the air column height
Change of resonance frequency with the air column height.

There is an increase of the frequency with the reduction of the wavelength \(\lambda\), that is linear in time until around 20 seconds. After that the increase is not constant due to the non linear modification of the available space for the air inside the bottle originated from the reduction of the diameter with the height.

Continue reading “The sound of a bottle being filled”

How many packs to complete the album?

The World Cup was recently over. Along with the competition, the sticker album also arises, it’s a quite big tradition, but I’ve never joined it. I got interested in the statistics behind it and asked myself how many stickers you must buy to fill the album completely.

My approach is a statistical simulation, modeling each package, until the album is complete. The same procedure is repeated for a large number of runs to get an estimated distribution of the total number of packages/stickers that are necessary to complete the album. First, I tested the convergence of the routine, initially based on 2 unanimous assumptions: the distribution of the stickers is uniform (that means, you have an equal chance to get any of the stickers) and that there are no repeated stickers for each pack (this one is maintained for all the tests here). Secondly, I tested what are the advantages of buying the missing stickers (from 1 to 50). Finally, two cases where the distribution is not uniform are evaluated: for a selected nation, the stickers are more abundant (from +10% to +50%) or rarer (from -10% to -50%) than the others.

This analysis can be performed for any album, being the number of stickers in the album and the number of stickers in a pack the necessary variables. So, for this case, the values for the Panini World Cup sticker book are selected:

  • 681 stickers in the album;
  • 5 stickers per pack.

Also, the possibility to buy missing stickers directly from them (maximum of 50) is also considered in this work.

Continue reading “How many packs to complete the album?”

My thesis in 3 minutes

As I said on a previous post, I was going to participate in a competition to present my thesis subject in 3 minutes.

Originally proposed by the University of Queensland (Australia) in 2008, 3 minutes Thesis (3MT) is a competition about presenting your PhD in 3 minutes for a general audience. Recently, the Coimbra Group, an association of Universities in Europe (39 Universities from 23 European countries in 2018), which the University of Poitiers is a part of, created its own version. On this year, the 2nd edition is being held, and I proudly gave it my try.

It’s a great opportunity to take a step back and look your subject from a global perspective. Sharing with a general audience is a challenge due to the obvious interdiction to say the technical terms we use daily and the fact that we must present in a simple manner while not escaping from the specific and complex core of your research. It’s a quest full of creativity and a nice moment to push yourself for speaking in public. I recommend every PhD student to participate.

To describe my search to modelling airframe noise I used a cake analogy: I’m loking at the ingredients (flow properties + geometry) to check their influences in the final result (aerodynamic field) and at the end propose a simple model of the bluff body wake dynamics for aeroacoustics. Here’s my video:

I also invite you to check the participation of my lab colleague Robin Sebastian (check his video here).

Simultaneously, I took part in the French version: Ma these en 180 secondes, organized by the CNRS, the French National Center for Scientific Research. If you are interested, you can check my presentation here. The videos with the performances of all the participants are hosted on University of Poitiers’ website.

A pie chart about pie charts names

As a part of my PhD, I’ve re-taken classes of statistics recently. Somewhere in the process, I realized that pie charts are called camembert, a type of cheese, in France. After a couple of seconds until I realized that those are pie charts, I recalled that they are also called differently in Brazil: pizza charts. Since then I’ve been thinking of what circle charts are called in different countries/languages.

To fulfill my curiosity, I’ve looked at Wikipedia articles on circle charts in several languages (full list on the Wikidata page). I’ve also stumbled across this french course on circle charts by J. R. Lobry of the University of Lyon that took me to the ISI (International Statistics Institute) glossary.

To see what the graph nicknames are, I used Google translate, always from the original language to English. The process started from the “Also known as” column on the Wikidata page, and later on the article itself if necessary, where I looked for expressions that looked like “something diagram” or “something chart” and occasionally I translated the full article. A total of 38 languages were analyzed, mostly indo-european (26).

The results are presented in the following graph: pie (36.8%) stands for languages where circle graphs are called pie charts, or some regional recipe that Wikipedia told me that it was a type of pie; cake (15.8%), pizza (2.6%) and cheese (2.6%) respect the same idea; pie/cake (13.2%) are either cases where the two versions were presented, such as for german, Kuchen-oder Tortendiagramm, or the translated word resulted in the two terms; and none (28.9%) represents cases where I could not recognize any related food analogy in the articles. In most of those cases only different terminologies related to circle or sectors were found.

A circle chart about circle charts. Each sector shows a food that associated to circle charts in different languages: pie (36.8%); none (28,9%); pie/cake (13,2%); cake (15.8%); pizza (2.6%); and cheese (2.6%). Each slice is filled by the food it stands for, light grey for none.
The nicknames of circle charts.

Although the pie chart is not really a good choice for representing any type of data, I considered it a must for the analysis of pie charts. Data treatment and plotting is done with Excel 2016, with a little help of Inkscape to prepare the images. The raw data is available here.

My results are obviously limited to my not so extensive sources, that don’t account for regionalisms (such as the use of different terms in countries that speak the same language). Also, there is a strong chance that mistakes were made in translation, what is really a problem when similar foods, such as cake and pie, may be called by the same word and vary by the situation. Certainly, such type of nuances are neglected by Google translate when no context is given (or even when it is supplied!). Finally, I miss the proper knowledge to technically distinguish a pie and a cake, so the “cake” and “cake/pie” categories must be considered with care.

Surprisingly, the only outliers (highlighted in the figure) are the ones that I have personally encountered in my academic life, according to my results. That explains why I have not found any type of analysis like this over the Internet.

If you find this slight interesting, please comment!

Photos used to build the graph:

Simple countdown video in Python

So, in a month from now I’m going to participate at the 3 Minute Thesis contest at my university. As one can deduct by its name, the whole idea is presenting your PhD subject in only 3 minutes.

For practicing, I created a simple countdown video using Python, obviously it goes from 180 to 0. For that, I had to install FFMpeg so I could save in a different format than the HTML provided by the matplotlib’s Animation module when you have no real video writer available. The simplest way was just using the conda environment (the one I use for my Python coding):

conda install -c menpo ffmpeg

The idea is just make one frame per second, so FPS = 1, where each one of them is a centered text with the correspoding time, no axis. The bitrate could be reduced, to make a smaller video. As it’s just a simple countdown, there is not any major losses in the quality with a bitrate of 80 (but reduced from 2.44 MB to 1.82 MB). So the writer options were:

    FFMpegWriter = animation.writers['ffmpeg']
    writer = FFMpegWriter(fps=1,

Using the default codec, it was running fine with the VLC player. Just to make it more general for sharing with my colleagues, I tried with Windows Media Player, and it was quite awful. So I just picked the MPEG-4 codec (as you can see in the previous extrait of the program), from the list of available codecs that you can see by typing in your terminal:

ffmpeg -codecs

A good improvement would be adding a bip when you reach 0 or something close to that. For the moment, the text color just changes to red.
You can check the complete script here:

If you got in here because you are also practicing for something similar, I hope this scripts helps you and wish you good luck. Once I do my presentation, I’ll problably put the video here, so stay tuned!