Which country has the most Madagascar users?

September 11, 2011 FAQ No comments

During the last four years, there have been nearly 170,000 visits to the Madagascar website (including 126 visits from the island of Madagascar). The top ten countries, as counted by Google Analytics, are: USA, China, Canada, UK, Brazil, Germany, Italy, Saudi Arabia, France, and India.

If the top ten are normalized by population (to compute visits per capita), they become: Canada, Saudi Arabia, USA, UK, Italy, France, Germany, Brazil, China, and India.

Program of the month: sfclip

September 3, 2011 Programs No comments

sfclip is very simple yet very useful program. It “clips” the data to the specified maximum by the absolute value.

Here is a simple test. First, let us make some data.

bash$sfmath n1=10 output="sin(x1)" > data.rsf bash$ < data.rsf sfdisfil
0:             0       0.8415       0.9093       0.1411      -0.7568
5:       -0.9589      -0.2794        0.657       0.9894       0.4121

Now clip it to 0.5 by maximum absolute value.

bash$< data.rsf sfclip clip=0.5 > clip.rsf bash$ < clip.rsf sfdisfil
0:           0.5          0.5          0.5       0.1411         -0.5
5:          -0.5      -0.2794          0.5          0.5       0.4121

What if you need to clip the data not by the maximum value but to a specified range? Use sfclip2.

bash$< data.rsf sfclip2 lower=0 upper=0.9 > clip2.rsf bash$ < clip2.rsf sfdisfil
0:             0       0.8415          0.9       0.1411            0
5:             0            0        0.657          0.9       0.4121

sfclip should handle correctly infinite values, for example those resulting from division by zero.

bash$sfmath n1=10 output=1/x1 > data.rsf bash$ < data.rsf sfdisfil
0:           inf            1          0.5       0.3333         0.25
5:           0.2       0.1667       0.1429        0.125       0.1111
bash$< data.rsf sfclip clip=0.3 > clip.rsf bash$ < clip.rsf sfdisfil
0:           0.3          0.3          0.3          0.3         0.25
5:           0.2       0.1667       0.1429        0.125       0.1111

A prototype of sfclip is used as an example in Guide to madagascar API. The actual program is a little different.