Skip to content

parsesmi: support LF and CRLF line endings#32

Open
Okimoka wants to merge 2 commits into
olafdimigen:masterfrom
Okimoka:fix/parsesmi-lf
Open

parsesmi: support LF and CRLF line endings#32
Okimoka wants to merge 2 commits into
olafdimigen:masterfrom
Okimoka:fix/parsesmi-lf

Conversation

@Okimoka

@Okimoka Okimoka commented Apr 18, 2026

Copy link
Copy Markdown

Hello

I've encountered 2 small bugs working with EYE-EEG:

  1. In my setup, I had to rewrite SMI sample files before calling parsesmi, causing the file to use linux style line endings:
filename = '/path/to/subject_task_Samples.txt';
lines = readlines(filename);
sync_lines = regexprep(lines, '(# Message:\s)(\d+)', '$1SYNC $2');

lf_txt = fullfile(tempdir, 'sync_lf.txt');
lf_mat = fullfile(tempdir, 'sync_lf.mat');

writelines(sync_lines, lf_txt);   % writes LF-only on Linux
et_lf = parsesmi(lf_txt, lf_mat, 'SYNC');

With the current version of parsesmi, this crashes with:

parsesmi(): Parsing Sensomotoric Instruments (IView X/RED) raw data. This may take a moment...
-- reading txt...
    Done.
-- getting comment lines and column headers...
    Done.
-- getting data (this may take a moment...
    Done.
-- getting messages...
    Done.
Error using cellfun
Input #2 expected to be a cell array, was double instead.

Error in parsesmi (line 140)
    test3 = cellfun(@str2double,test2,'UniformOutput',false);

Changing the regexes in parsesmi.m to match "\r?\n" (like in parseeyelink.m) fixes this.

  1. In detecteyemovements.m, the final console summary says it prints the velocity thresholds as the mean across epochs, but the horizontal threshold was actually taken from l_msdx(e) / r_msdx(e), where e is the last epoch index from the loop. As a result, the horizontal threshold reflected only the last epoch. This only affects the console summary and can be fixed by removing the index

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant