TUM-Logo

libRASCH

 

Home
 

General

About libRASCH/News
Design
Screen shots
Sample programs (with source code)
License
 

Download

libRASCH
Tools
 

Documentation

User
Developer
 

Resources

Mailing list
Supported Formats
Plugins
Status
Links
 
Contact
About this site
 
Last updated
Tue Mar 27 23:03:48 2007

Python-Version of handle_recs

Sourcecode

import sys
from RASCH import *

# initialize libRASCH
ra = RASCH()
if not ra:
    print "can't initialize libRASCH"
    sys.exit()

# open measurement
meas = ra.open_meas(sys.argv[1], 0)
if not meas:
    print "can't open measurement", sys.argv[1]
    sys.exit()

# get root recording
rec = meas.get_first_session_rec(0)
if not rec:
    print "can't get root recording"
    sys.exit()

# get some infos about recording
[num_dev, n, d] = rec.get_info(info='rec_num_devices')
[num_ch, n, d] = rec.get_info(info='rec_num_channel')
[rec_name, n, d] = rec.get_info(info='rec_name')
[rec_date, n, d] = rec.get_info(info='rec_date')
print "measurement", rec_name, " --  recorded at", rec_date,       " --  #devices =", num_dev, " #channels =", num_ch

# print name for every device
print "infos about the recording devices used:"
if num_dev > 0:
    for i in range(num_dev):
        [name, v, d] = rec.get_info(dev=i, info='dev_hw_name')
        print "  device #%d: %s" % (i, name)
print ""
	
# print name for every channel
print "infos about the channels:";
if num_ch > 0:
    for i in range(num_ch):
        [name, n, d] = rec.get_info(ch=i, info='ch_name')
        [unit, n, d] = rec.get_info(ch=i, info='ch_unit')
        print "  channel #%d: %s [%s]" % (i, name, unit)
print "";
    

Output of the example

measurement 100s  --  recorded at 00.00.0  --  #devices =
None  #channels = 2
infos about the recording devices used:

infos about the channels:
  channel #0: MLII []
  channel #1: V5 []