uwmadison-chm / bioread

Utilities to work with files from BIOPAC's AcqKnowlege software
MIT License
65 stars 23 forks source link

command line code to convert data files from .acq to .mat #13

Closed 2puppies closed 9 years ago

2puppies commented 9 years ago

How do I go about running bioread to convert a folder of data using the Command prompt window (on a 64-bit windows computer, using python 2.7)?

njvack commented 9 years ago

Can you convert one file at the command line?

If so, you'll want to write a little script (either in Windows .bat, or powershell) to run the command for every file.

Failing that, you could write a little python script that would open all your input files and run acq2mat on them, or one that would do what acq2mat does (look at src/bioread/runners/acq2mat.py for a starting point). A (totally untested!) python script to run acq2mat might look a little like:

import glob
import subprocess

input_files = glob.glob("C:\files\*.acq")
for input_file in input_files:
    output_file = input_file.replace(".acq", ".mat")
    subprocess.call(["acq2mat", input_file, output_file])

Or you could write a Matlab script to do the same thing, I suspect.

Or if your directory isn't huge and you don't want spend the time scripting this, you could run it by hand (probably building the list of commands in a text editor or excel or something).

What makes the most sense depends on where you have the most programming experience, and what the experience of other people at your site is like.