This is a pure-python module for reading mworks data files.
Requirements ----
Nothing for 'basics' on python 2.7
python 2.6 requires lxml because the ElementTree included with py2.6 does not support enough XPath
protocol inspection requires networkx
Intro |
---|
MWorks files are made up of events. Each event has |
time |
|
|
code |
|
|
value |
|
|
One special event (name = 'codec', code = 0) is useful for understanding |
other events. The codec contains (as a value) a dictionary of codes (as keys) |
and names (as values). |
Opening files |
An MWorks file can be opened in pymworks using pymworks.open_file. |
: |
|
|
|
By default, open_file with index the file (speeding up event fetching). |
This index is written to disk as as a hidden file ('.' pre-pended). |
For the above example (opening foo.mwk) a index file '.foo.mwk' would be |
created if it did not already exist. If you do not want to index the file, |
set the indexed kwarg to False for open_file: |
: |
|
The codec for this datafile is accessable as df.codec and for convenience a |
reversed version (keys=names, values=codes) is available as df.rcodec |
: |
|
|
Reading events |
Events can be accessed several ways, the easiest being df.get_events. |
: |
|
|
|
|
|
|
|
|
Events (type pymworks.datafile.Event) each contain a time, code and value |
: |
|
|
|
|
==== |
Notes |
LDOBinary.py and ScarabMarshal.py are originally from the mworks/mw_data_tools repo
LDOBinary.py was fixed to actually work and not just throw errors