In this assignment, you will build an interactive experiment focused on preattentive processing using visual attributes. Preattentive processing refers to the rapid detection of features in a visual field without conscious effort. This ability allows us to quickly identify a target element among distractors based on visual features like color, size, and shape. Your task is to implement an experiment interface that displays target and distractor elements, logs the user’s responses, and visualizes results from multiple trials.
You are a new member of a research team investigating preattentive processing in visual perception. The team is conducting a series of experiments to understand how quickly people can spot a unique target within a field of similar distractor elements. The experiment has been set up in a standardized format based on previous studies, and your colleagues have already completed portions of the experiment infrastructure, including the grid layout and results matrix for visualizing trial outcomes.
Your primary task is to develop the main Experiment component, which will generate randomized elements (target and distractors), display them in timed intervals, and capture user responses. This component will integrate with the existing infrastructure, so you will not need to modify any of the surrounding template code.
Your experiment will present elements in a four-quadrant grid to users. Each trial briefly shows a single target element among several distractors. After the elements disappear, users will select the quadrant they believe contained the target. You will program the experiment logic to:
To help you get started, the project template includes several files that are already set up and connected:
index.html
: Provides the user interface controls (e.g., exposure time, element settings) and buttons to run the experiment and download results.Experiment.js
: You will implement this file to manage the experiment’s logic. This includes the visualization, timing, and user interaction for each trial.ResultsMatrix.js
: Pre-built to handle the visualization of experiment results in a matrix format, showing accuracy across multiple trials and configurations.main.js
: Currently initializes the results matrix and populates the trial results with the historical data; You will add to this file and initialize a new instance of the experiment class and add additional logic depending on your experiment implementation.helpers.js
: Provides functions for updating UI elements, such as reflecting user-configured values in the HTML sliders and dropdowns. It also contains a utility function for saving experiment results as a CSV file. Depending on your implementation, you might have to add a line or two in some of those functions.index.html
provides an HTML grid with user controls, making it possible for users to adjust experiment parameters like exposure time, target shape, color, and more.Experiment.js
will take these configurations to display the target and distractors in randomized positions, run each trial with the specified settings, and record user responses.ResultsMatrix.js
receives trial results after each run, updating the matrix to show accuracy levels over various conditions.main.js
links the Experiment
and ResultsMatrix
classes, setting up the experiment and matrix displays.helpers.js
provides useful functions such as updating user selections that have been outsourced from main.js
to avoid clutter.In the experiment you’re about to design, users will complete multiple trials, each consisting of the following cycle:
Preparation Phase (1s):
A blank screen is shown to reset the user’s attention before each trial.
The above phases should be implemented sequentially in the runExperiment
method within Experiment.js
, using appropriate D3 and JavaScript delay functions (e.g., setTimeout
) to manage timing.
To create the core logic of the experiment, your colleagues have outlined a plan for the Experiment
class. This class will be responsible for setting up the experimental conditions, displaying elements during trials, and logging results based on user responses. The following methods are suggested to ensure structured and efficient functionality:
constructor
parentContainer
(where the SVG visualization will be drawn) and trialResults
(an array to store the results of each trial).initVis
parentContainer
, applying the required margins and dimensions.grabConfigs
wrangleData
updateVis
runExperiment
trialResults
array for later analysis.This structured setup should provide the foundation for creating an experiment that effectively tracks and visualizes preattentive processing accuracy.
Your task is to build the Experiment
class to manage all experiment aspects, from configuring elements to running trials and logging results. Below are instructions for each stage of the implementation, along with hints and suggestions. Remember, while these guidelines provide a framework, you should think creatively to solve any challenges that arise!
Experiment
ClassparentContainer
for rendering, and create an empty array, trialResults
, to hold the outcomes of each trial.initVis
:
[-1, 1]
to keep element positioning standardized across trials.grabConfigs
symbolMap
property in the constructor of ResultsMatrix
to understand D3 symbols. You might also want to understand how these glyphs are generated and used in the ResultsMatrix since you might want to use a similar approache when displaying the elements in the Experiment.wrangleData
Array.from
to generate an array of objects, each representing either a target or distractor element.updateVis
path
elements and render them on the SVG, applying the correct shape, color, and size.rect
elements to draw each quadrant, allowing users to click on them as part of the experiment interaction.runExperiment
setTimeout
.trialResults
.wrangleData
method in the ResultsMatrix
class to refresh the results matrix.ResultsMatrix.js
where this idea has already been applied.vis.elements.enter()
.append('path')
...
.attr("d", d => d3.symbol()
.size(d.size)
.type(d.shape)());
setTimeout
to sequence each step within a trial. Nest or chain setTimeout
calls to move smoothly from displaying elements to hiding them and finally showing clickable quadrants for user interaction. Here’s a recommended structure for handling the timing in each trial:
// Display elements, hide them after exposure, then capture user interaction
setTimeout(() => {
// Code to show elements
setTimeout(() => {
// Code to hide elements and show clickable quadrants
setTimeout(() => {
// Code to capture user response
}, 2000); // Time in ms for user interaction
}, exposureTime); // Duration in ms for element exposure
}, 1000); // Initial delay before showing elements
Experiment Setup Evaluation (1 Point): Critique the experimental setup in 3-5 sentences, focusing on the overall design, including the four-quadrant layout for identifying the target. Consider what aspects of the setup might present challenges or limitations for accurate results. Think about any potential issues users might face, and suggest possible improvements.
Results Series Evaluation (1 Point): Select two experiment series (i.e., all 10 exposure levels tested with at least 10 trials per level) and compare the results. If your Experiment
class implementation is working, configure and run your own two experiment series with different configurations. If it isn’t working, use the provided historical data. Reflect on trends observed across exposure times and configurations, considering whether these reveal insights into preattentive processing.
Use the following recommended folder structure & create a single .zip file:
/submission_week_09_FirstnameLastname
hw/
css/ ...folder with all CSS files
js/ ...folder with all JavaScript files
data/ ...filder with all data for the project, e.g. csv files, etc.
critique/ ...folder with design critique and potentially bonus .csv and screenshot
[potential other folders you might have used for the project, such as a fonts or an img folder]
index.html
lab/
css/
js/
index.html
class_activity/
[either pdf or link to gdrive that contains your running doc with class activities]
[latest Tableau workbook (either added here separately or within the gdrive)]
A few remarks based on some submissions we’ve seen:
Congratulations on finishing this week’s homework! See you in class!