[Kst] Number formats in ASCII data file

Nicolas Brisset nicolas.brisset at free.fr
Tue Jun 12 21:02:29 UTC 2012


Hi Svenn,

----- Mail original -----
> De: "Svenn Are Bjerkem" <svenn.bjerkem at googlemail.com>
> À: "kst" <kst at kde.org>
> Envoyé: Mardi 12 Juin 2012 17:51:58
> Objet: [Kst] Number formats in ASCII data file
> 
> Hi,
> I have an ASCII log file from an Agilent logic analyzer which gives
> me
> hedadecimal numbers in signed 12-bit format from a quadrature ADC.
> 1,fff,002,001,ffe
> 0,ffe,fff,000,fff
> 1,000,001,fff,ffe
> 0,fff,ffd,000,001
> ....
> 
> So far I have used an awk script to extract all I-lines and Q-lines
> separately and convert them to signed decimal and write to two files
> and then read those two files into kst2. I wonder if there is a way
> inside kst to sample every line starting with 0 and put into one
> vector, and then sample every line starting with 1 and put into
> another vector. The next thing is the conversion of fff to -1 and so
> on. Usually hexadecimal numbers are prefixed with 0x, but that is not
> done by this Agilent device.
I can't think of any easy way to achieve that (neither the conversion nor the selective selection according to the first character in the line) with the current version of Kst.
 
> I have a workaround through the awk script, but I wonder if this kind
> of number filtering and conversion is already available in kst, or if
> it is something I can write a plugin to achieve. Advantage would be
> to have the logic analyzer stream the data on a network connection
> directly into kst.
What you could definitely do is write a datasource for that. I wrote a step-by-step explanation when developing the Matlab datasource recently (http://websvn.kde.org/*checkout*/branches/work/kst/portto4/kst/src/datasources/HOWTO_add_a_datasource.txt?revision=1283503). But you have to decide if the effort is worth it, depending on reusability and your coding skills.
Another alternative would be to write a program that reads stdin and streams the data to two files, like yur awk script but running continuously instead of needing to be reinvoked regularly like the awk script.

> I am using kst 2.0.3 as that is the latest version available in
> Debian unstable.
The latest is 2.0.5 but for your problem it does not make a big difference.

Hope that answers your questions.

Nicolas


More information about the Kst mailing list