gazeplotter
Version:
Gazeplotter is a Svelte application for visualizing eye-tracking data.
34 lines (33 loc) • 1.31 kB
JavaScript
import { AbstractEyeDeserializer } from './AbstractEyeDeserializer.ts';
export class OgamaEyeDeserializer extends AbstractEyeDeserializer {
stimulusName;
cParticipant;
cSegments;
constructor(header, fileName) {
super();
// extract name from file name (SimilarityXXX.txt) where XXX is the stimulus name
// this.stimulusName = fileName.split('.')[0].split('Similarity')[1]
this.stimulusName = fileName.split('.')[0];
this.cParticipant = this.getIndex(header, 'Sequence Similarity');
this.cSegments = this.getIndex(header, 'Scanpath string');
}
finalize() {
return null;
}
deserialize(row) {
const segments = row[this.cSegments]; // just letters - each one fixation
if (segments === undefined)
return [];
const participant = row[this.cParticipant];
const result = [];
for (let i = 0; i < segments.length; i++) {
const aoi = segments[i] === '#' ? null : [segments[i]];
const start = i.toString();
const end = (i + 1).toString();
const category = 'Fixation';
const stimulus = this.stimulusName;
result.push({ aoi, category, end, participant, start, stimulus });
}
return result;
}
}