April 17, 2015

Howto: Access/Convert HAMEG *.mes file from Linux

We have a Hameg HM5014-2 spectrum analyzer in our lab, which can be controlled via RS232 from a windows box.
For this purpose, the software "AS100E V305 spectrum analyzer software" from www.hameg.com is installed on a Win XP laptop and analyzer is accessed via a USB-to-RS232 dongle.

So far, so good. But the stupid thing is that you can not save/export your data in standard formats (e.g. *.dat, *.csv, *.txt), which can be opened with any text editor. Instead, you only can save a *.mes file.

This file turns out to be a Microsoft JET Database (http://en.wikipedia.org/wiki/Microsoft_Jet_Database_Engine), which is proprietary and also flagged as depricated by MS. To access such an database, you could use "MS Access", the database program from Microsoft (office package).

Fortunately, there is a way to dump the data using free software: MDB-TOOLS (https://github.com/brianb/mdbtools). You can compile it from github source, but it also should be available via the package managing source of your distro (apt-get, pacman, etc).

I have a test measurement called "hameg.mes".

To see which tables are stored inside this file, one can use the tool mdb-tables:

>mdb-tables hameg.mes            
 Measurement Limitlines Settings
Now one can dump one specific table using mdb-dump:

> mdb-export hameg.mes Measurement

Frequency,Sample_dBmW,Average_dBmW,Maxhold_dBmW,QPeak_dBmW,memory_dBmW,Ambient_H_dBmW,Ambient_V_dBmW,V_memory_dBmW,H_memory_dBmW,H_Average_dBmW,H_Maxhold_dBmW,H_QPeak_dBmW,V_Average_dBmW,V_Maxhold_dBmW,V_QPeak_dBmW
2.50000000e+01,-5.04000015e+01,0.00000000e+00,0.00000000e+00,0.00000000e+00,0.00000000e+00,,,,,,,,,,
2.51000004e+01,-5.04000015e+01,0.00000000e+00,0.00000000e+00,0.00000000e+00,0.00000000e+00,,,,,,,,,,
2.52000008e+01,-
....
As visible, the dump is in the CSV format which can be easily piped into a csv-file:

> mdb-export hameg.mes Measurement > hameg_measurement.csv


PS: the our version of the HM5014-2 creates databases in the  JET3-format.
>mdb-ver hameg.mes
JET3
I was able to view/dump/edit this version with mdbtools version 0.7.1 (clone from github)