Code Monkey home page Code Monkey logo

my_new_experiment's Introduction

Template repository for matlab PTB project

Content

This repo is for students who want to design a new PsychToolbox(PTB) experiment using an existing script template and a library of functions.

This repo used the template from the CPP Lab developpers here. It was adapted to be used as a teaching example and includes:

.
├── dev
├── exampleScripts  # where you will find demos
│   ├── PsychExampleExperiments    
│   └── simple_demos.m
├── lib # where you will find useful functions for your experiment from the CPP Lab
│   ├── CPP_BIDS
│   ├── CPP_PTB
├── src # where you put your code
├── LICENSE  
├── README.md
├── initEnv.m # a .m file to set up your project (adds the right folder to the path)
├── mainScript.m # a .m file to be used as a template script
└── setParameters.m # a .m file to initialize your parameters and configuration variables

Ressources to help structure your code

PsychDemos that are in the exampleScripts folder here were taken from the PTB code: C:\PATH\to\PTB\toolboxPsychtoolbox\PsychDemos (change path to where you downloaded PTB)

GitHub: Search for PTB repos/scripts

Peter Scarf PTB Tutorials. The simple_demos.m in the exampleScripts folder are a compilation of some of these tutorials. You can simply run each.

Forum PTB

Bug Report

Art of readable code

Quick PTB coding tips for designing your experiment

  1. Avoid long scripts- use fonctions : it's easier to read

    • Check if you can start from available functions from CPP_PTB here
  2. Avoid 'hard coding', centralize all your parameters in a function or structure

    • Save everything in the structure (configuration: cfg) & save in a .tsv file so other softwares can read it.
  3. Use 'try-catch' in case an error/bug happens in your code

    • See example in MullerLyler demos of PTB
  4. Use a seperate file for the order of trials/conditions

    • Should be independant of your code/main script.
  5. If an error occurs, enable debug mode in MATLAB:

    • Add breakpoints & run code

How to install and use this repo

For the intro course, fork this current repo to your github account with all the files, folders and submodules. You only have to then clone the repository and you are good to go.

This repo originally comes from this template PTB experiment repository from the CPP Lab.

How to install and run

Install

git clone --recurse-submodules https://github.com/your_github_account/the_name_of_your_new_experiment.git

Set parameters in setParameters.m

Run

mainScript

Basic steps of the mainScript (template experiment)

  • Clear screen,
  • Set parameters,
  • Prompt user input,
  • Initialize PTB,
  • Display instructions,
  • Start experiment,
  • Design blocks/trials, Collect responses, Save events,
  • Goodbye screen,
  • Close.

my_new_experiment's People

Contributors

mwmaclean avatar remi-gau avatar

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.