Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve conflict between lincuan:patch-1 and sccn:develop in OctaveWrapper #4

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/eegprep/eeglabcompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@ def wrapper(*args):
break
if needs_roundtrip:
# passage data through a file
with tempfile.NamedTemporaryFile(delete=False, suffix='.set') as temp_file:
with tempfile.NamedTemporaryFile(delete=True, suffix='.set') as temp_file:
# Save data to the temporary file
pop_saveset(args[0], temp_file.name)
# needs to use eval since returning struct arrays is not supported
# Ensure the file is fully written before proceeding
temp_file.flush()
os.fsync(temp_file.fileno()) # Force write to disk to avoid timing issues
# Needs to use eval since returning struct arrays is not supported in Octave
self.engine.eval(f"EEG = pop_loadset('{temp_file.name}');", nargout=0)
# TODO: marshalling of extra arguments should follow octave conventions
eval_str = f"EEG = {name}(EEG{',' if args[1:] else ''}{','.join([str(a) for a in args[1:]])});"
Expand Down Expand Up @@ -266,4 +270,4 @@ def test_eeglab_compat():
# clean_artifacts( EEG, ChannelCriterion='on' )


# test_eeglab_compat()
# test_eeglab_compat()