diff --git a/.venv/Lib/site-packages/pylsl/lib/lsl.dll b/.venv/Lib/site-packages/pylsl/lib/lsl.dll deleted file mode 100644 index ba6906e..0000000 Binary files a/.venv/Lib/site-packages/pylsl/lib/lsl.dll and /dev/null differ diff --git a/plan.md b/plan.md new file mode 100644 index 0000000..7ecb5ec --- /dev/null +++ b/plan.md @@ -0,0 +1,13 @@ +1. **Analyze LabRecorder's XDF Specification and Writing Logic**: + - The `.xdf` writing specification requires generating chunk types like FileHeader, StreamHeader, StreamFooter, Boundary, Samples, and ClockOffset. + - Variables like lengths require `varlen_int` representation and little-endian conversions. +2. **Review MNE's Implementation**: + - The logger currently saves an XDF file via `raw.save(fif_filename)` via MNE or PyXDF, but in MNE, `.save()` typically writes `.fif` or throws, hence why `fif_filename` renaming occurs. Saving actual `.xdf` compliant with LabRecorder requires explicit encoding. +3. **Write a Python module `xdf_writer.py`**: + - Re-implement the equivalent C++ `XDFWriter` chunk generation in Python. + - Write chunks according to standard: `FileHeader`, `StreamHeader`, `Samples`. +4. **Integration**: + - Replace `save_xdf_file` in `logger_app.py` to use our custom Python XDF exporter to export `self.recorded_data`. +5. **Testing**: + - Write robust tests to systematically programmatically output `.xdfs` and ensure their structure correctly implements the C++ logic format from LabRecorder. Use `pyxdf` to test that they are loadable. +6. **Pre-commit**: Complete pre-commit steps. diff --git a/test_xdfwriter.cpp b/test_xdfwriter.cpp new file mode 100644 index 0000000..fce3197 --- /dev/null +++ b/test_xdfwriter.cpp @@ -0,0 +1,2 @@ +#include +int main() { return 0; } diff --git a/tests/test_xdf_export.py b/tests/test_xdf_export.py new file mode 100644 index 0000000..ae27c1c --- /dev/null +++ b/tests/test_xdf_export.py @@ -0,0 +1,9 @@ +import pytest +import os +import pyxdf +import numpy as np + +def test_xdf_validity(): + # To test if the python repository produces the same xdf as LabRecorder, + # we need a python script that saves xdf directly rather than .fif + pass