~ gem update tioga ctioga2
A blog from a scientist and former Debian developer (and occasional book writer)... Tricks for data handling, programming, debian administration and development, command-line and many other joyful things in the same spirit. Oh, and sometimes completely unrelated things !
Thursday, September 3, 2015
Releases 1.19.1 of Tioga and 0.13.1 of ctioga2
Sunday, June 7, 2015
Release 1.19 of Tioga
Friday, January 2, 2015
New home for Tioga
Saturday, August 31, 2013
First release of Tioga that works on win32
fopen(file, "w") for binary files, that don't make any difference on Linux and Mac, but that do on Windows...). The release is already available on the rubyforge download page. Gems will be available later on today.To actually make it work on windows, here is what you need to install:
- Ruby, using the one-click installer. The 1.9.3 version works just fine. Don't forget to click the box to add the executables to the PATH
- the Ruby DevKit, at the same location. Make sure you take the one matching the Ruby version you installed (there's an explicative text on the side). You need to unpack it in the directory where Ruby got installed
- you need to get a LaTeX distribution, try out proTeXt
- at this point, you may need to reboot
- then, just open a windows terminal (Execute
cmd.exe) and run:
gem install tioga
And that's it ! That also means that ctioga2 works on windows, if you run:
gem install ctioga2
Saturday, February 5, 2011
ctioga superseded by ctioga2
ctioga, I was compelled to see my initial design mistakes, and think about a complete rewrite.
This is where ctioga2 was born, some time at the beginning of 2009. I completely stopped using the old ctioga a few month after starting to work on ctioga2, but it took ages before I finally came up with a decent enough documentation to release and announce publicly. But now, it's done, and the first public release of ctioga2 is out, still fresh !
Here are a few highlights of the differences:
- For me, it's day and night: adding new commands is painless: I only need to create an object with the appropriate code; registering is done automatically.
- Now, command-line switches also accept options looking like this
/option valuethat allow many small tweaks I had never had the courage to write for the oldctiogaas it was way too painful to add new commands there. ctioga2can be driven both from command-line and using command files, in the style of gnuplot, which is the reason why I call it polymorphic.- More importantly, I finally had the possibility (and more or less compelling reasons, to be found in a paper currently in press) to implement 3D data displays in
ctioga2, in the form of color maps (that's what is shown here). - There are still a few things that could be done by
ctiogaand that miss fromctioga2, such as histograms. When I have some time and/or motivation...
In any case, you can make yourself an opinion of ctioga2 by looking at the galleries.
Enjoy !
Friday, January 4, 2008
Tioga and text sizes
Tioga is powerful, as I undoubtedly mentioned here already. But, so far, it had a dreadful drawback: it was not possible to know the (TeX) text size other than by guesswork. This has now changed: starting from revision 453, it can find out and provide the information. All you need to do is to give a 'measure' => 'name' argument to show_text, and you can get information about the text size using get_text_size('name'). I used this new feature in figures.rb for a small demonstration:
def text_size
t.stroke_rect(0,0,1,1)
t.rescale(0.5)
equation = '\int_{-\infty}^{\infty} \! e^{-x^{2}}\, \! dx = \sqrt{\pi}'
text = "\\fbox{$\\displaystyle #{equation}$}"
nb = 5
nb.times do |i|
scale = 0.5 + i * 0.2
angle = i * 37
x = (i+1)/(nb+1.0)
y = x
color = [1.0 - i * 0.2, i*0.2, 0]
t.show_text('text' => text, 'color' => color, 'x' => x,
'y' => x,
'alignment' => ALIGNED_AT_MIDHEIGHT,
'scale' => scale , 'measure' => "box#{i}",
'angle' => angle )
size = t.get_text_size("box#{i}")
w = size['width']
h = size['height']
t.stroke_color = color
t.stroke_rect(x - w/2, x - h/2, w, h)
end
end
This works really simply: Tioga uses a wrapper TeX function that displays the size of the text on pdflatex output. If Tioga detects that a size was requested, it fills in the information, gives it back to the program via get_text_size and runs pdflatex a second time use the information. For the first call, dummy values are given by get_text_size. It seems that the last showstopper of Tioga has finally fallen today !
Monday, November 5, 2007
ctioga and tick labels
On ctioga's forum, I was asked to provide a way to turn tick labels - which there currently wasn't. But, in fact, the structure was already there. The SVN commit 632 has seen them in. See for yourself the result of
ctioga --xpdf --math --interpolate 'sin(x)' --scale yticks 2.2 --angle xticks 45
As with the title and other friends, options are available, to control the shift, scale and angle of the ticks. However, the color cannot currently be changed this way (this is a Tioga limitation).
Tuesday, October 30, 2007
Profiling Ruby/C applications
Dvector::fancy_read) is slow. Really slow. So I decided to switch to a C implementation keeping the same functionalities.
I quickly did a rough translation of the function into C, using basically the same mechanics (and in particular using Ruby regular expressions for parsing), and I was surprised when I found out that I was only winning a factor of around three in the speed of reading. I was even more surprised to see that the reading is O(n2) (reading 100000 lines is around 100 times slower than reading 100 times 1000 lines !). So, I decided I should try my luck with a profiler.
My first step was naively to compile the library with the -pg gcc option, but that didn't produce any output file (although it might have been due to the fact that I forgot to add the switch again for linking). I attributed that to the fact that the whole program should be compiled with the switch, and not only the shared library. So I did write a small C wrapper, compiled it, and ran it. It did produce a gmon.out file, but gprof was unable to give me any interesting information from that. I guess I needed a finer granularity that my own functions, and for that I should have compile Ruby with profiling support. Well. Drop it.
So, I was about to give up when I thought about valgrind. Valgrind also comes with a profiler tool, callgrind. So, I ended up doing the following:
~ valgrind --tool=callgrind ./fancy_read ~ callgrind_annotate callgrind.out.24425| less
The first command runs the program with valgrind, saving data into a file called something like callgrind.out.24425. The second parses this file and displays the number of intructions spent in each of the most significative functions. Here is a extract of the output:
306,777,466 ???:__printf_fp [/lib/libc-2.6.1.so] 226,575,122 ???:0x0000000000041C20 [/lib/libc-2.6.1.so] 121,900,026 ???:0x00000000000805F0 [/usr/lib/libruby1.8.so.1.8.6] 98,208,889 ???:__strtod_internal [/lib/libc-2.6.1.so] 90,449,474 ???:0x00000000000482D0 [/lib/libc-2.6.1.so] 87,300,200 ???:vfprintf [/lib/libc-2.6.1.so] 84,197,045 ???:ruby_re_search [/usr/lib/libruby1.8.so.1.8.6] 71,866,550 ???:0x0000000000071D60 [/lib/libc-2.6.1.so] 65,387,136 ???:0x0000000000071380 [/lib/libc-2.6.1.so] 62,784,967 ???:0x000000000004A9F0'2 [/usr/lib/libruby1.8.so.1.8.6] 61,279,027 ???:0x000000000004AC80 [/usr/lib/libruby1.8.so.1.8.6] 48,357,879 ???:malloc [/lib/libc-2.6.1.so] 41,915,985 ???:free [/lib/libc-2.6.1.so] 34,200,000 ???:rb_reg_search [/usr/lib/libruby1.8.so.1.8.6] 31,432,232 ???:ruby_xmalloc [/usr/lib/libruby1.8.so.1.8.6]
This shows that most of the time is spent displaying the data. Normal, half of my program does only that. Then, a fair amount of time is spent in strtod. Nothing to improve there. Another fair amount is spent in regular expression matching, and then, a significant part of the processing time is actually spent on memory management ! Dreadful ! I guess there's not much more I could do
The conclusion to this is that if you need to profile something, use valgrind. This is much more powerful than gprof !
Wednesday, September 26, 2007
Ruby
He said that this library was producing great plots (he saw directly plots made by its creator, Bill Paxton). When I saw this video, I was sincerely convinced !
So then, as the library was only for the Ruby programming language, I started immediately to learn Ruby, using the Pragmatic Programmer's Programming Ruby. I found it an extremely enjoyable experience. Within an hour, I had made my first Ruby script using Tioga. Before the end of the day, I was sending my first bug report to Bill. The following day, I had already started to work on a (very poor at that time) first version of ctioga...
I've gone on working with Ruby ever since... I wrote no less than 9000 lines of code only in the SciYAG project on Rubyforge, not mentioning other projects using Ruby and the countless scripts I have written for my everyday science... Ruby is extremely comfortable to program with. A pure delight !