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:50 2007
Access Recordings

3.3. Access Recordings

The example will show how to get the root recording and some information about it. We will perform the following steps:

  • get root recording

  • get some general informations about the recording

  • get some infos about all used recording devices

  • get some infos about all recorded channels

When more than one recording device was used, the root recording provides access to the channels as if they were recorded with one device.

#
use strict;
use RASCH;

# initialize libRASCH
my $ra = new RASCH or die "error initializing libRASCH\n";

# open measurement
my $meas = $ra->open_meas($ARGV[0], 0) or
    die "can't open measurement $ARGV[0]\n";

# get root recording
my $rec = $meas->get_first_rec(0) or         (1)
    die "can't get root recording\n";

# get some infos about recording
my $v = $rec->get_info(info => 'rec_num_devices');
my $num_dev = $v->value();
$v = $rec->get_info(info => 'rec_num_channel');
my $num_ch = $v->value();
$v = $rec->get_info(info => 'rec_name');
my $rec_name = $v->value();
$v = $rec->get_info(info => 'rec_date');
my $rec_date = $v->value;
print "measurement $rec_name  --  recorded at $rec_date" .
    "  --  #devices=$num_dev  #channels=$num_ch\n";

# print name for every device                                      (2)
print "infos about the recording devices used:\n";
for (my $i = 0; $i < $num_dev; $i++)
{
    $v = $rec->get_info(dev => $i, info => 'dev_hw_name');
    my $name = $v->value();
    print "  device #$i: $name\n";
}
print "\n";
	                                                             (3)
# print name for every channel
print "infos about the channels:\n";
for (my $i = 0; $i < $num_ch; $i++)
{
    $v = $rec->get_info(ch => $i, info => 'ch_name');
    my $name = $v->value();
    $v = $rec->get_info(ch => $i, info => 'ch_unit');
    my $unit = $v->value();
    print "  channel #$i: $name [$unit]\n";
}
print "\n";

exit 0;
#
(1)
The function get_first_session_rec(s_num) returns the root-recording of the session s_num. The sessions start with number 0.
(2)
When asking for information about recording devices you need to set the device number. In Perl this is done by setting the argument 'dev' to the device number, in C you do this in setting the variable 'dev' in the ra_info struct.
(3)
When asking for information about a channel you need to set the channel number. In Perl this is done by setting the argument 'ch' to the channel number, in C you do this in setting the variable 'ch' in the ra_info struct.

The output of the above example for the measurement '100s' is shown here:

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

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