File Exchange

image thumbnail

Load BIOPAC ACQ (AcqKnowledge for PC) data

version 1.3 (221 KB) by

Load BIOPAC's *.acq file (AcqKnowledge for Windows data format).

4.33333
11 Ratings

28 Downloads

Updated

View License

"load_acq.m" will load BIOPAC's AcqKnowledge (ACQ) data to a structure containing ACQ header field and data matrix field.

It is based on Application Note #156 from BIOPAC web site (see attachment). The note mentioned that: "This document describes file formatting for all Windows versions of AcqKnowledge 3.9.x or below". Thanks to the open Python source code provided by Nathan Vack, this program can also read AcqKnowledge 4.0 & 4.1 data (with no documentation from BIOPAC). Compressed data is not supported by this program.

Usage: acq = load_acq(filename, [force_chan_by_chan_load])

acq - AcqKnowledge file structure containing ACQ header field, and data matrix.

filename - BIOPAC's AcqKnowledge file

force_chan_by_chan_load is an optional argument. By default, this optional flag will be set to 1, which means that when you use acq = load_acq(fname), the data will be loaded one channel after the other. This can avoid memory crash when you load very large ACQ data. If your ACQ data is not huge, I suggest that you set this optional flag to 0, i.e. acq = load_acq(fname, 0). In this case, the program will read data depending on the data type. If the program detects that the data type in ACQ file are different from channel to channel, it will still read data channel by channel. Otherwise, it will read whole data in one block (a lot faster than using traditional way from channel to channel with the same result).

A script called "acq2mat.m" is provided to help you convert all .acq files to .mat files in all specified folders in advance, since to load corresponding .mat files will be much quicker. i.e. In your MATLAB code, instead of using: acq = load_acq('MyGSR.acq'); you can now use: load('MyGSR.mat');

Comments and Ratings (24)

Claudius Nöh

Piyush kant

i am also getting same error as sanjeev

Error in load_acq>read_acq (line 470)
mask(1:sample_divider(j):min_len, j)=1;

Error in load_acq (line 96)
acq.data = read_acq(fid, acq.hdr, chan_by_chan);

if any one can help???

Susan Rose

Lawliet, it is the problem of the latest version of MATLAB. I am still using old R2010 and do not have this problem.

Lawliet Luid

I have some problem while loading acq which is
"Error: Unexpected MATLAB expression"
anyone know how to fix this? Thanks

Lawliet Luid

I have some problem while loading acq which is
"Error: Unexpected MATLAB expression"
anyone know how to fix this? Thanks

Sanjeev

I am trying to load a dataset recorded by Biopac Version 4.3 , when i am trying to load that data using acq=load_acq('data.acq_'); it shows following error
Loading data.acq_ Subscript indices must either be real positive integers or logicals.

Error in load_acq>read_acq (line 470)
mask(1:sample_divider(j):min_len, j)=1;

Error in load_acq (line 96)
acq.data = read_acq(fid, acq.hdr, chan_by_chan);

Please suggest how to resolve this

Peter

Peter (view profile)

In acq2mat.m flip the if statement to save lots of space and time

if str2num(v7(1))<7
save(mat_fn, '-V6', 'acq');
else
save(mat_fn, 'acq');
end

Jimmy Shen

Jimmy Shen (view profile)

Thijs, thanks to the open Python source code provided by Nathan Vack, this program can now load both ACQ4.0 and ACQ4.1. However, there is no documentation about ACQ 4 data format from BIOPAC.

Thijs Schrama

An Biopac ACQ4.0 version would be highly appriciated. Works great allready for 3.9.1, thanks!

Oscar

Oscar (view profile)

Hi Nathan

Thanks for sharing the Python code.
i had to spend hours setting up python and its packages, and it was worth the effort!!! your code works excellent for AcqKnowledge 4.1.

Jimmy Shen

Jimmy Shen (view profile)

The latest release of file format by BIOPAC is up to AcqKnowledge 3.9:
http://www.biopac.com/ResearchNotes.asp?Aid=&ANid=82&Level=4
According to BIOPAC's AcqKnowledge 4 Software Guide:
http://www.biopac.com/file.asp?ManualID=56
It is now also able to save data into MAT-file binary format.

Anthi

Anthi (view profile)

hi Damien...
i am having the same problems with AcqKwoledge 4.1.Did you found a solution???

Damien

Damien (view profile)

hi Jimmy,

thanx a lot. There were problems with the version... I saved my file with 4.1, so the header was different...
Unfortunately BIOPAC does not support informations about 4.1 file format...

Nathan Vack

FYI, I've written a package in Python that'll do the .ACQ -> .MAT conversion. As far as I know, it'll handle any .ACQ file out there, including compressed files and very new ones.

It's available here:

https://github.com/njvack/bioread

It'll also let you work with the files in Python, of course -- but this is a Matlab site ;-)

Jimmy Shen

Jimmy Shen (view profile)

There are 4 places that are using 'dec2hex' command. They are: dec2hex(hdr.color_major_grid), dec2hex(hdr.color_minor_grid), dec2hex(hdr.rgb_color), dec2hex(hdr.active_seg_color).

Those values in ACQ file header are not supposed to be negative.

Since none of those values will affect the channel data, you can replace them with ' ' if you believe your ACQ data have no other problem.

Damien

Damien (view profile)

hi,
I've tried to use it, but it returned:
Error using ==> dec2hex
First argument must contain non-negative integers.
can u help me, please?
thanks a lot

Jimmy Shen

Jimmy Shen (view profile)

Hi Dino:

Theoretically, the changes that you suggested will increase the speed. However, it doesn't seem to speed up, after I tried several datasets.

Anyway, thank you very much for the feedback, and I will make the change in the next version.

Jimmy

Dino Dvorak

Great tool. Thank you.

Couple of things to fix:

line 375, add this: data = zeros(min_len, hdr.graph.num_channels);
line 409, change
data(:,i) = tmp(1:min_len);
to
data(1:min_len, i) = tmp(1:min_len);

Alpesh Patel

Antonio Molins

Did not work for me as provided, but worked with significant changes: halted before getting to the foreign data section (missed it by 2 bytes), and did not read markers and positions. A new version has been offered to the author, and is available on request.

Wojtek Grabski

Works.

boris fain

Thank you, works great.

Aida Jimenez-Gonzalez

Updates

1.3

Thanks to the open Python source code provided by Nathan Vack, this program can also read AcqKnowledge 4.0 & 4.1 data (with no documentation from BIOPAC).

1.2

Fixed a bug in acq2mat.m script.

1.1

Fixed a bug when you use it with Matlab 6.5 and earlier.

Found '&&' in last update, which cannot run under Matlab5. It has been fixed in 'load_acq_20080609.zip'.

don't know why zip file on fileexchange is still old. upload the new one again.

Thanks Antonio Molins (amolins@mit.edu) for the changes he made (all comments started with "AM").

Modify on 31-JUL-2007 by Julio Cruz (julio.cruz@juliocruz.info) to make the program also work on MAC OS.

Thanks to Aida Jimenez in University of Southampton, I fixed a bug when reading AcqKnowledge version 3.5 and earlier.

Thanks to the bug report from Stefan Schumann in University of Freiburg, now my load_acq supports new versions of data with different sample dividers.

Added "force_chan_by_chan_load" option and set it to 1 by default to prevent out of memory problem when loading huge ACQ data

Added rgb_color interpretation, and modified description.

MATLAB Release
MATLAB 5.3.1 (R11.1)
Acknowledgements

Inspired: ACQREAD

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video