Code Monkey home page Code Monkey logo

itrace-post's Introduction

iTrace-post

A pair of modules and sample script for processing output from the iTrace plugin, particularly when used in tandem with the FLUORITE plugin. The motivation for this repository is thus: In iTrace v0.0.1 (Alpha), editing is not supported. If you used a later version of iTrace that explicitly supports editing, this issue does not apply to your experiment, and you do not need to run FLUORITE in addition to iTrace. The work-around presented here is very time-consuming and should be avoided if at all possible.

As an additional useful tidbit, this code also performs automatic detection of Areas of Interest (AOIs) based on fixation data and code location.

Quick Start

Run setup.py like this: $ python setup.py install
As soon as this completes, you're ready to import the itrace_post and fluorite modules into your project. Please note that you will need to copy the script analyzer.py if you wish to use it in your project. Alternatively, it may be helpful to use this script as an example when writing a similar script to read output from iTrace. If you wish to do this, please refer to the relevant notebook.

Requirements

You must have the following programs installed and on your path:

  • gaze2src
  • srcml
  • tar

The following modules are also required (among others):

  • numpy
  • pandas
  • scipy

Using analyzer.py

Please note that this script is written for experiments where there is a record from the FLUORITE plugin. Given the parameters for the gaze2src program and a list of directories containing raw data from iTrace and FLUORITE, this script separates your data such that each partition's data comes from a period during which the participant did not change the set of code documents. With the log from FLUORITE, the state of each project file during this period is deduced. Once the data has been divided, the script runs srcml and gaze2src on each partition and then combines the output into a single file.

Translation of iTrace Files

The gaze2src program is a part of the iTrace v0.0.1 (alpha) program suite that performs post-processing on raw data collected from the iTrace plugin. The output is stored in a tab-separated file and a SQL database file. The analyzer.py script in this project reads both these files and produces a CSV containing the line and column numbers of subjects' fixations, and assigns each fixation to a rectangular AOI.

AOI Extraction And Assignment

Instead of pixels, the most basic spatial units are individual characters, corresponding to a particular source code file. This perspective is feasible because iTrace records the line and column numbers associated with a particular fixation. The position of a single character's cell is defined by zero-indexed line and column numbers. The get_aoi_intersection function produces a 2D numpy logical array describing the intersection between the subjects' gaze and the code in the file. (A single cell in this array represents a single character in the file). The rectangular bounding box of each region is considered an AOI, and the bounding boxes are returned from this function as a JSON-style list, sorted by decreasing area. For an example, please refer to the relevant notebook.

Generating A Mask From Code

The size of a line of code is identified by its string length, after the removal of trailing newline characters and the conversion of all tab characters to 4 spaces. Other leading and trailing whitespace characters, such as spaces, are not removed from the code mask. This procedure is inspired by the eyecode project.

Generating A Mask From Gaze Data

Fixation counts are placed in a 2D numpy array, organized by fixation positions. This array is smoothed using Gaussian smoothing, and then a threshold is applied to reveal regions that attracted the majority of subjects' gazes. This procedure is inspired by the implementation of the masking algorithm from the iMap project.

General Architecture

The following diagram is a simplification, but it conveys the principle upon which this post-processor operates. alt text In particular, the gaze2src program must take both the iTrace-Core log and the partitioned raw data as inputs, as well as some additional parameters. Furthermore, during this process, analysis such as AOI generation is also performed, but this fact is not explicitly shown in the diagram.

itrace-post's People

Contributors

ianbtr avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

akhyar-ahmed

itrace-post's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.