Assignment title: Information


Programming in NeuroImaging Assessment 2: Script Portfolio For the second assignment in the PIN module, you will be producing a portfolio of work which encompasses both: • two scripts (including commenting on both to demonstrate your understanding and ability to communicate it to others) and • documentation of the tools which you have produced. The overall theme for the assessment is to produce a set of tools to allow your lab members to run a Stroop task on participants and then to analyse the resulting data. The code for the stimulus presentation and data analysis must be clear, robust and easy to use. The accompanying documentation must be sufficient for an undergraduate level RA with no experience of coding to be able to use the scripts you produce with no further instruction. Extra marks are available for appropriate commenting of the scripts. Remember, comments should not just say what something does – they should explain why it does it. This assessment counts 70% towards the overall module. Remember: Test your scripts! They must at least run through even if they don't implement all of the functionality required. Also, make sure that you submit the correct version of your scripts. Section A – Present a Stroop task using Psychopy 40% of the available marks for this assessment. Produce a Psychopy script which presents a Stroop task. This is a task in which the names of colours are presented to a participant. There are two conditions: congruent and incongruent. In the congruent condition, the colour of the text will match the word being presented (i.e. red). In the incongruent condition, the colour of the text will not match the word being presented (i.e. red, red, red). The participant must respond by pressing the button which corresponds the colour presented – i.e. they must ignore the word. You should: • Present all stimuli on a black background • Present all stimuli in lower case. • Use the four colours: red, blue, green, yellow • Present a total of 120 trials, broken down as follows: ◦ 15 congruent trials for each colour ◦ 5 incongruent trials for each other combination of colours • Randomise the order of trial presentationred (15 trials) correct answer: red red (5 trials) correct answer: blue red (5 trials) correct answer: green red (5 trials) correct answer: yellow blue (5 trials) correct answer: red blue (15 trials) correct answer: blue blue (5 trials) correct answer: green blue (5 trials) correct answer: yellow green (5 trials) correct answer: red green (5 trials) correct answer: blue green (15 trials) correct answer: green green (5 trials) correct answer: yellow yellow (5 trials) correct answer: red yellow (5 trials) correct answer: blue yellow (5 trials) correct answer: green yellow (15 trials) correct answer: yellow • Use the following keys for responses (we will hand out coloured stickers to put on keys!): ◦ Red: f Blue: g Green: h Yellow: j • Record responses and response times in a CSV file with the following headers: trialnum,colourtext,colourname,condition,response,rt,correct ◦ trialnum should run from 1 up to 120 ◦ colourtext should be the word shown in the trial ◦ colourname should be the colour of the text shown in the trial ◦ condition should be congruent or incongruent ◦ response should be the colour name of the response the participant made ◦ rt should be the reaction time formatted appropriately as a floating point number in seconds ◦ correct should be True or False An extract from an example output file may therefore look something like this: trialnum,colourtext,colourname,condition,response,rt,correct 1,red,green,incongruent,green,1.374977,True 2,green,green,congruent,green,0.559735,True 3,yellow,red,incongruent,red,0.756133,True … many more lines … 120,red,yellow,incongruent,yellow,1.184296,True Some possible enhancements (for extra credit), could be: • Get information about the participant from the experimenter before starting the task and use this to name your output file. • Include a "Ready" screen • Give the participant a break every n trials where n is configurable in the script. Considerwaiting for the participant to indicate that they are ready to continue. The aim of this assignment is to produce a script which you would be happy to deploy in a real laboratory. Once you have your basic script, try and put yourself in the place of both the experimenter and the participant and consider what would make it more professional. Submission Requirements • Your experimental script. Call this stroop.py • One example output file from your experiment. Call this data.csv. Section B – Analyse the Stroop task output 30% of the available marks for this assessment. For this section, you will be provided with a set of 20 data files generated by participants who have performed the experiment. Your script must load in these data files, analyse the data and plot and display it in the appropriate manner. Your script should perform the following steps: 1. Load all of the files in a given directory whose names end with .csv. The files will be named for participants P1 to P20. 2. Print a neat table of the mean and standard deviation for each participant in each condition. Format the values with three decimal places. Also print the percentage correct for each participant for each condition to two decimal places. Finally, below the participant information, print the same values for the group. The table should contain columns similar to those below. It does not have to look identical but should be output in a neat format. | Participant | Congruent (s) | Incongruent (s) | | | Mean | Stddev | % Corr | Mean | Stddev | % Corr | 3. Plot the distribution of participant means for the congruent and incongruent conditions. Use the most appropriate form of plot for the data. Give the plot an appropriate title and make sure that you label the x and y axes appropriately. Extra marks are available for making the plot look production quality. Your script must save the plot as an image file with the name group_stroop.png Submission Requirements • Your analysis script. Call this analyse_stroop.py. • An example of your plot. Call this group_stroop.png Section C – Document your experiment and analysis 30% of the available marks for this assessment: 1000 words maximum (this is not a target). Produce a document in the style of a lab "wiki" page which documents the following: 1. What the experiment is.2. How the experiment should be run. This should be in a form that someone who has never seen the experimental code can follow. Write down the procedure for starting Psychopy, loading the script and running it. You should also include information which is to be given to the participant regarding the task (i.e. which keys to use etc) 3. How to analyse the outputs of the experiment using your analysis script When producing this document, it may help to have in mind an Undergraduate level Research Assistant who is not familiar with programming or the experimental task being performed but will be running participants through the procedure. Extra credit will be given for appropriate inclusion of screenshots and/or other appropriate diagrams. Credit will be given for providing all relevant information whilst remaining concise. Please submit this section as a PDF – these can be exported from Microsoft Word or Libreoffice.Submission Arrangements Please ensure that you do not identify yourself in any way in the work (for example in comments within your scripts). For the PiN Course, you are required to submit work electronically. The deadline for this assessment can be found on the wiki: https://wiki.york.ac.uk/display/PsySharedDocs/MSc+Assessment+Deadlines Work must be submitted electronically via the VLE. You must submit your work as a single zip file. Computer or network problems are not accepted as reasons for failing to submit on time. 1. Creating a zip file for electronic submission to the VLE • Create a folder which will only contain the files you want to submit - call this folder pin_assessment2 • Copy your files into the folder. For reference, these files should be named as follows: stroop.py Python script for section A (Stroop task) data.csv Example output from your Stroop task analyse_stroop.py Python script for section B (Analysis of stroop data) participant_stroop.png Example output graph from your analysis script labwiki.pdf Section C content (Lab wiki example) • Make sure that the files in this directory are the ones you wish to submit. You can submit to the VLE multiple times. We will accept the most recent submission made before the deadline. • Move to the directory above your pin_assessment2 folder so that you can see the folder in your file browser: • Right click on the folder, and choose Compress:• Change the file extension to .zip and then press Create • You should now find a file called pin_assessment2.zip has been created: • You can double check the contents of the file by double-clicking on it. It will open in Archive Manager and you should see a folder called pin_submission2. If you look inside of this folder, you should see your files: • You should now submit the pin_assessment2.zip file to the VLE. • Remember, the code in this file is what you will be marked on . It is your responsibility to check that it is the most up-to-date and correct version of your work. 2. Submitting your work via the VLE • Go to the VLE (https://vle.york.ac.uk) and go to the Masters: Assessment and Feedback course. Go to the Summer Term Assessments section. • In this area, you will find guidance on online submission and the submission point, named Programming in Neuroimaging - Assessment 2 Submission.