psychopy.org | Reference | Downloads | Github

Getting the start and end timing for a brush component

Hi everyone,

I am new to Psychopy and Pavlovia and I am currently working on an experiment to work online with Pavlovia. I just need a couple more details to add to the experiment. I have provided some details below.

OS Win10
PsychoPy versionv2020.2.4
Standard Standalone

For one if my tasks I ask participants to connect a seires of circles in order using the brush component.

What I want to know is whether I can time how long the brush is used for?

Within my output I can see that brush start time is recorded, but because I don’t set an end duration (this will be detrmined by how long it takes the participant to connect all the circles) the end time is blank.

I was wondering is it possible to use a code component within builder to get the start and end time for this particular component, and if so what would be recommended?

Looking on previous discourse posts it seemed getting a time for a particular component was not possible, but I was wondering if there had been any updates since then.

Any advice would be very much appreciated!

Thanks,
Rebecca

If you have “Save onset/offset times” ticked in the Data tab for the Brush component, then it should save when the component stopped. However, when I test this it does appear to be None, so I’ll see what’s going on there.

You can force it to record a stop time by adding a Code component with this in the End Rouine tab:

thisExp.addData('myBrush.stopped', t)

(with myBrush being whatever you called your Brush component)

1 Like

Hi @TParsons,

Thank you so much for your swift reply and suggestion! This appeared to work and gave me an end time which appeared in the cell below “none” in the brush stopped column in the excel output when i run it from my desktop.

I have yet to try it on Pavlovia but I know there can be some issues with the translation from Py to JS.

I’m having another problem now, in that code which previously worked with Pavlovia no longer does. I am using another code component to reset the brush after a routine, so they can use the brush with a fresh start on another routine.

In the end routine tab i have:
myBrush.reset()

Works just fine in the builder, however, when I test in Pavlovia i get the following error:

TypeError: brush.reset is not a function

If you have any ideas of how I can fix this that would be great.

However, I am happy to open a new discussion in case someone else might be having the same problem in the future.

Thanks again for your help!
Rebecca

This might be one for the JavaScript team (@sotiri, @thomas_pronk, @apitiot), this probably means that the JavaScript Brush component is missing a function which the Python Brush component has. It may well be that it has this functionality but due to the differences between JavaScript and Python it needs a slightly different syntax, if so these three will know!

1 Like

Hi @TParsons, thanks so much for responding and tagging the JS team :slight_smile:

Hopefully they might know what the issue is!

Thanks for all your help!
Rebecca

Thanks @TParsons, sorry @rebecca_dw unfortunately a Brush component is unavailable for online studies at the moment and we should probably update the status page to reflect that. I have raised the issue on GitHub and appreciate your patience while we work towards expanding JS functionality, x

1 Like

Hi @sotiri,

Thanks for your swift reply. Is this a recent thing?

Previously I could get this to work in pilot mode on Pavlovia.

When I upload the task to Pavlovia I can get the brush component to work fine (again in ran pilot mode), however I can no longer reset the brush (with the code mentioned in the previous post) so the screen is clear for the next routine where the participant would connect a different set of circles.

So for me it appears the brush component is working, but it is struggling with the code I input to “reset” this component.

Since it works for me in pilot mode, I wonder would I still be able to use this for my study?

This was the final thing i needed to iron out before hopefully starting data collection, so I am hoping I won’t lose full functionality of it :grimacing:

Many thanks for all your guidance,
Rebecca

@rebecca_dw would it be possible to send me a link to your repo? Thanks, s.

No problem,

I am not 100% on how to share this, as I’m not sure if you need any permissions or anything – sorry!

I’ve pasted the link below so I hope this works:

I have removed the code so that it allows you to go through with the brush tool. Hopefully this works your end too.

If you need anything else just let me know!

Many thanks,

Rebecca

image001.jpg

Ah cool thanks, that link only points to Pavlovia not a specific project. If you sent me your .psyexp that might also work, cheers, s.

Hi, thanks for getting back to me – would it help if I add you as a collaborator?

Many thanks,

Rebecca

image001.jpg

Hey Rebecca, no problem at all, it might, but I would still need a link to the repo, the link above only points to https://gitlab.pavlovia.org for some reason? Here to help, s.

Hi @sotiri,

I have added you as a guest - hopefully this lets you see the files. I pasted the link to my gitlab repo… but it seems to just take you to a sign in page.

I have pasted this again to try and hopefully it takes you to the right page.

Apologies for the confusion, I haven’t shared files this way before with this software/Pavloiva so I am quite unsure how it works. If i am going about this the wrong way or you need me to do anything else let me know!

Thanks for all your help.
Rebecca

Hey @rebecca_dw, OK great, thanks for adding me as guest, that definitely helps, I can now see the project listed on my dashboard, but lack sufficient rights to go through the code :smirk: As it happens, with reference to Gitlab’s documentation, and assuming you would like to keep your project private, I would need reporter status to access the repo. I could then clone, make edits that address the problem and upload them for you to review and accept into the codebase once satisfied everything works as expected. Again, no stress, no trouble :blush:

Hey @sotiri,

Fantastic! Just changed this to reporter status - hope this helps.

I removed the code I was having issues with just so you can see that the brush component appears to work.

Shall I go ahead and add these reset brush codes back in as i think this is what is having JS issues?

Let me know and I’ll amend and resync if needed :slight_smile:

Thanks again for your time looking into this!
Rebecca

Hey @rebecca_dw, alright, excellent, many thanks, I was able to fork the project and so if you would like to make changes that should not affect my copy. If not much of a hassle, having the problematic bits added in would likely help me get a better picture of what the intended outcome is so that I can investigate further :nerd_face:

Hi @sotiri,

Brilliant, glad you have access finally!

Sorry for the mix up, the one you have forked has the code removed… I have just updated this to include the code again - so you may have to re-fork to get these changes - sorry about that!

Should all be in there now, but if you have any questions or I can provide any further help with this please just let me know!
Rebecca

:+1:

Hey @rebecca_dw, I was able to get this to run by replacing brush.reset() with brushReset(), brush_2.reset() with brush_2Reset() and so on for all the brushes. I put together a merge request with more details, which if you accept will apply the fix onto your code. Or you can just download the updated .psyexp and work off of that, re-export, re-sync etc. Hope that helps some, on standby for more if not, x

1 Like

Hi @sotiri,

Brilliant! I just merged your changes and tested this out - it works perfectly! :slight_smile:

Thank you so much for your time looking into this for me and for the fix! It is very much appreciated :star_struck:

Thanks again for all your support!
Rebecca

1 Like