This article shows you how to create time vector & timestamp information from raw OpenSignals sensor data.
Creating a Time Vector using the Sequence Number
The biosignalsplux device provides a Sequence Number (nseq) with each sample it sends, which can be found in the first column of any OpenSignals acquisition file. This sequence number can be used to recreate a time vector as shown in the following steps.
Let’s take as an example a single-sensor acquisition conducted with a biosignalsplux system at two different sampling frequencies.
- Acquisition A acquired sensor data at 1000Hz sampling rate. In this setting, each sample is successively acquired at 1ms intervals.
- Acquisition B acquired sensor data at 500Hz sampling rate. In this setting, each sample is successively acquired at 1ms intervals.
Using this information, we can remap the nseq values into the relative time passed since the beginning of the acquisition as follows:
Acquired @ 1000Hz | Acquired @ 500Hz | |||
Nseq | t [ms] | Nseq | t [ms] | |
0 | 0 | 0 | 0 | |
1 | 1 | 1 | 2 | |
2 | 2 | 2 | 4 | |
3 | 3 | 3 | 6 | |
4 | 4 | 4 | 8 | |
5 | 5 | 5 | 10 | |
… | … | … | … |
Creating a Time Stamp using the Time Vector and Acquisition Start Time
With the created time vector, it is possible to create an actual timestamp. For this, you need to record the time at which you receive your first sample from the biosignalsplux device or when the acquisition started.
Following up on the previous example, imagine that we get the first time sample exactly at 12:00.000pm. Using this starting time, we can recreate the timestamp for the biosignalsplux devices:
Acquired @ 1000Hz | Start at 12:00.000pm | Acquired @ 500Hz | Start at 12:00.000pm | |||||
Nseq | t [ms] | Timestamp | Nseq | t [ms] | Timestamp | |
0 | 0 | 12:00.000 | 0 | 0 | 12:00.000 | |
1 | 1 | 12:00.001 | 1 | 2 | 12:00.002 | |
2 | 2 | 12:00.002 | 2 | 4 | 12:00.004 | |
3 | 3 | 12:00.003 | 3 | 6 | 12:00.006 | |
4 | 4 | 12:00.004 | 4 | 8 | 12:00.008 | |
5 | 5 | 12:00.005 | 5 | 10 | 12:00.010 | |
… | … | … | … | … | … |
If you are using OpenSignals, you can also check the information in the header of the acquisition file. In there, you should find an entry “time” which provides information about the time the acquisitions started and use this time as the start of your timestamp series.