Skip to content

Stop signal timeline#100

Open
beccaTurtle wants to merge 2 commits into
jspsych:mainfrom
beccaTurtle:main
Open

Stop signal timeline#100
beccaTurtle wants to merge 2 commits into
jspsych:mainfrom
beccaTurtle:main

Conversation

@beccaTurtle
Copy link
Copy Markdown

Hi! I created a timeline for the stop-signal cognitive test. You should be able to test it by running the index file in the examples folder. Let me know if there are any changes I need to make. Thanks!

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 23, 2026

🦋 Changeset detected

Latest commit: 32e7cd9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stop-signal Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

@jadeddelta jadeddelta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks again for the contribution, and this looks great! here's some feedback and once you're finished we'll take another look.

multiple_responses: false,
button_html: button_design,
choices: buttons,
data: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it would also be a good idea to include a human-readable "direction" or "stimulus-type" field, with values for left, right, left-x, right-x, so that at a glace it's easier to parse rather than the object URL

return html
}

export function createTimeline(jsPsych:JsPsych, {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're trying to get this out right now, it's not necessary to do this suggestion. but in the future it's a good idea to parameterize the SVGs for the fixation, left, right, left stop, and right stop, in case a developer wants to use their own custom SVGs.

return URL.createObjectURL(blob)
}

const plus = get_svg_url('<svg version="1.1" viewBox="0.0 0.0 480.0 480.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l480.0 0l0 480.0l-480.0 0l0 -480.0z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#ffffff" d="m0 0l480.0 0l0 480.0l-480.0 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m17.023623 240.0l0 0c0 -120.72858 99.829926 -218.59842 222.97638 -218.59842l0 0c59.137024 0 115.85193 23.03084 157.66812 64.026c41.816162 40.995155 65.30826 96.59652 65.30826 154.57242l0 0c0 120.72858 -99.829926 218.59842 -222.97638 218.59842l0 0c-123.146454 0 -222.97638 -97.86984 -222.97638 -218.59842z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="16.0" stroke-linejoin="round" stroke-linecap="butt" d="m17.023623 240.0l0 0c0 -120.72858 99.829926 -218.59842 222.97638 -218.59842l0 0c59.137024 0 115.85193 23.03084 157.66812 64.026c41.816162 40.995155 65.30826 96.59652 65.30826 154.57242l0 0c0 120.72858 -99.829926 218.59842 -222.97638 218.59842l0 0c-123.146454 0 -222.97638 -97.86984 -222.97638 -218.59842z" fill-rule="evenodd"/><path fill="#000000" d="m175.8033 220.30988l44.506577 0l0 -41.83316l39.38025 0l0 41.83316l44.50656 0l0 39.38025l-44.50656 0l0 41.83316l-39.38025 0l0 -41.83316l-44.506577 0z" fill-rule="evenodd"/></g></svg>')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also not necessary now, but might be good to export these in the utils object to give developers access to these svgs (probably just the strings, rather than the get_svg_url?)

}

/* defines a test */
var test = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be a good idea to turn the test variable into a function that is called here, a getTestTrial(params) function that you can then export into timelineUnits that developers can have access to


/* displays a + between trials */
var fixation = {
type: jsPsychImageButtonResponse,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly for the test variable, it would be good to turn this into a function for timelineUnits export

| stop_percent | number | 0.25 | The percent of the trials that will have stop signals. |


### timelineUnits
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when you've added timelineUnits and utils, be sure to document them here

frame_delay: function() {
if (delay_adaptive) {
var data = jsPsych.data.get().filter({task: "response"}).last(1).values()[0];
console.log(data)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the console.log when you're finished

var new_delay = current_delay - delay_change

if (new_delay > min_delay)
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for whatever reason the auto-styling on commits doesn't work, after you've done your work feel free to run npx pretty-quick before you commit to standardize your code's style

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.

2 participants