mworks library unpacking on linux system

Rishi Rajalingham's Avatar

Rishi Rajalingham

18 Jul, 2019 01:48 PM

Hi Chris,

I'm trying to unpack mwel2 files, using either MATLAB or python, on a non-OSX machine. The mworks library that comes shipped with the app is compiled in OS X -- any chance you can provide something for a linux system?

Alternatively, I see that we can use the msgpack module to directly unpack mwel2 files, but I don't see how to get the variable names (rather than just the integer code). Can you advise on this?

Let me know, and thanks in advance,
Rishi

  1. Support Staff 1 Posted by Christopher Sta... on 18 Jul, 2019 02:05 PM

    Christopher Stawarz's Avatar

    Hi Rishi,

    The mworks library that comes shipped with the app is compiled in OS X -- any chance you can provide something for a linux system?

    Sorry, but MWorks doesn't support Linux.

    Alternatively, I see that we can use the msgpack module to directly unpack mwel2 files, but I don't see how to get the variable names (rather than just the integer code). Can you advise on this?

    You're referring to this Python code, right?

    You need to extract the variable codec from the event file. The codec has event code zero, which conveniently means it's the first event in an MWK2 file. Here's how you can use the codec to create a simple dictionary mapping integer codes to variable names:

    code_to_name = {}
    with MWK2Reader('my_data.mwk2') as event_file:
        for code, time, data in event_file:
            if code == 0 and not code_to_name:
                code_to_name = dict((c, data[c]['tagname']) for c in data)
            # Continue event processing
            ...
    

    Cheers,
    Chris

  2. Christopher Stawarz closed this discussion on 19 Jul, 2019 08:42 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac