Code Monkey home page Code Monkey logo

cpp_bids's Introduction

Binder Documentation Status: stable DOI codecov All Contributors

CPP_BIDS

A set of function for matlab and octave to create BIDS-compatible folder structure and filenames for the output of behavioral, EEG, fMRI, eyetracking studies.

Installation

Use the CPP templates for PsychToolBox experiments

The easiest way to use this repository is to create a new repository by using the template PTB experiment repository: this creates a new repository on your github account with all the basic folders, files and submodules (including CPP_BIDS) already set up. You only have to then clone the repository and you are good to go.

Download with git

cd fullpath_to_directory_where_to_install

# use git to download the code and the submodules
git clone --recurse-submodules https://github.com/cpp-lln-lab/CPP_BIDS.git

Then get the latest commit:

# from the directory where you downloaded the code
git pull origin master

To work with a specific version, create a branch at a specific version tag number

# creating and checking out a branch that will be called version1 at the version tag v0.0.1
git checkout -b version1 v2.2.1

Add as a submodule

Add it as a submodule in the repo you are working on.

cd fullpath_to_directory_where_to_install

# use git to download the code
git submodule add https://github.com/cpp-lln-lab/CPP_BIDS.git

To get the latest commit you then need to update the submodule with the information on its remote repository and then merge those locally.

git submodule update --remote --merge

Remember that updates to submodules need to be committed as well.

Example

So say you want to clone a repo that has some nested submodules, then you would type this to get the content of all the submodules at once (here with assumption that you want to clone my experiment repo):

# clone the repo
git clone https://github.com/user_name/myExperiment.git

# go into the directory
cd myExperiment

# initialize and get the content of the first level of submodules
git submodule init
git submodule update

# get the nested submodules JSONio and BIDS-matlab for CPP_BIDS
git submodule foreach --recursive 'git submodule init'
git submodule foreach --recursive 'git submodule update'

Demos

How to use it: jupyter notebooks

Documentation

General documentation

Contributing

Feel free to open issues to report a bug and ask for improvements.

If you want to contribute, have a look at our contributing guidelines that are meant to guide you and help you get started. If something is not clear or you get stuck: it is more likely we did not do good enough a job at explaining things. So do not hesitate to open an issue, just to ask for clarification.

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


CerenB

๐Ÿ’ป ๐ŸŽจ ๐Ÿ“– ๐Ÿ““ ๐Ÿค” ๐Ÿ›

marcobarilari

๐Ÿ’ป ๐ŸŽจ ๐Ÿ“– ๐Ÿ““ ๐Ÿค” ๐Ÿ›

Remi Gau

๐Ÿ’ป ๐ŸŽจ ๐Ÿ“– ๐Ÿ› ๐Ÿ““ ๐Ÿค” ๐Ÿš‡ ๐Ÿšง โš ๏ธ ๐Ÿ’ฌ

Tomas Lenc

๐Ÿ’ป ๐Ÿค” โš ๏ธ

iqrashahzad14

๐Ÿ› โš ๏ธ

This project follows the all-contributors specification. Contributions of any kind welcome!

cpp_bids's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cpp_bids's Issues

[INFRA] Error in CI on checking the markdown

Error in CI on checking the markdown

https://travis-ci.com/github/cpp-lln-lab/CPP_BIDS/jobs/430652513

$ npm install `cat npm-requirements.txt`

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/travis/.npm/_cacache/content-v2/sha512/a4/f5'

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/travis/.npm/_cacache/content-v2/sha512/33/9a'

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/travis/.npm/_cacache/content-v2/sha512/ce/b2'

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/travis/.npm/_cacache/content-v2/sha512/d2/66'

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/travis/.npm/_cacache/content-v2/sha512/a2/ce'

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:

npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:

npm ERR!     /home/travis/.npm/_logs/2020-11-08T10_35_52_601Z-debug.log

The command "npm install `cat npm-requirements.txt`" failed and exited with 1 during .

Originally posted by @Remi-Gau in #120 (comment)

Unit tests

  • check good saveEvent behavior when the first event is empty
  • check warning behavior when an saveEvent has to deal with an empty event
  • make sure trial type, onset and duration are properly init
  • check warning behavior when an array is too long
  • create tests for errors

saveEventsFile - warning

  1. Warning
    It seems to be passing this warning when there's nan. But I think I still have nans - as early Xmas decoration in my response collection array, somehow. Thus I have 13 (number of button pressed) error messages like this:
Warning: Missing some target data for this event. 
> In saveEventsFile>checkExtracolumns (line 240)
  In saveEventsFile>checklLogFile (line 166)
  In saveEventsFile (line 84)
  In fMRIMainExperiment (line 229) 
           onset: 199.7325
      trial_type: 'response'
        duration: 0
        key_name: 'space'
         pressed: 1
          fileID: []
    extraColumns: []
          target: NaN
  1. It does not separate the time of the date in the saving name:
    sub-001_ses-001_task-RhythmCategFT_run-001_events_date-202007272044.tsv previously it was:
    sub-001_ses-001_task-RhythmCategFT_run-001_events_date-20200727_2044.tsv
    Previous version was slightly easier for a human to read.

consider making subjectGrp optional

in createFilename.m
at the current state, in userInput function I can leave the group part empty but then in createFilename gives error that
Reference to non-existent field 'subjectGrp'

cannot save cell input

In SaveEventFile.m, I cannot save cell array. Is there a solution or suggestion for this?

Error using fprintf
Function is not defined for 'cell' inputs.

Error in saveEventsFile (line 86)
                   fprintf(logFile(1).eventLogFile, '%f\t', data);

Error in tapMainExperiment (line 102)
       saveEventsFile('save', expParam, currSeq, ...

createFilename input reordering

It calls createFilename(expParameters,cfg)
I'm proposing to be consistent with the rest of the scripts the following order change:
createFilename(cfg,expParameters)

bids addpath

Atm, when the bids added with
addpath(fullfile(pth, 'lib', 'CPP_BIDS', 'src'));
due to the subfunc folder is not inside src, would it be an issue? Will check it now. (after resolving the following error)

cfg setDefault usage

I always forget, and was looking in README for usage of functions. first we set values in our experiment setParams.m and then run CPP_BIDS functions (e.g. userInput and createFilename). createFilename will set fields IF it's not set previously. Right? So my cfg.fields should be filled before I call BIDS functions.

Would you like to add one sentence somewhere that first the user should run their getParams and set all the fields. Then empty fields would be filled by the default values in CPP_BIDS functions.. I can add it as well, if you can point out where that info should be? e.g. in usage notebook?

Update doc

  • split into several files

Binder example

  • initialization of extracolumns
  • explain how to create the different JSON files
  • save stim file
  • save for EEG
  • save for iEEG
  • save for MEG

inccorect saved ouput by readAndFilterLogfile

@Remi-Gau and @marcobarilari this is still open issue right? I see the .tsv file is only producing 1-line instead of saving the full output structure. I see it's because of how readAndFilterLogfile is creating the data structure and how tsvwrite function reads, basically the dimensions do not match. the output readandFilterLogfile is size = 1, and tsvwrite goes through that size option.
The test_readAndFilter does not fail because it does not look at how .tsv file is saved - which is only saving the 1-line of the output.

Originally posted by @CerenB in #104 (comment)

json createDataDictionary overwrite

I'm opening two logfiles (_event and _stim) consecuitively. When I only open the logfile (_event) with extraColumn, createDataDictionary nicely creates a json file with all the extra columns.
Then when I open the following, _stim, that json file for the logfile / _event got back to its default settings without the extraColumns.

Any idea why is it happening?

    % create  logfile with extra columns to save - BIDS
    logFile.extraColumns = cfg.extraColumns;
    [logFile]  = saveEventsFile('open', cfg, logFile); %dummy initialise

    % set the real length of columns
    logFile(1).extraColumns.LHL24.length = 12;
    logFile(1).extraColumns.PE4.length = 12;

    % actual inititalization
    logFile = saveEventsFile('open', cfg, logFile);
    
    % create response file - used for counting button press
    responseFile.extraColumns = cfg.responseExtraColumns;
    responseFile  = saveEventsFile('open_stim', cfg, responseFile);

save stim file

is it possible to create two different output file? e.g. .tsv file for stimulus and .tsv file for tapping

userInput need else condition for subjectGrp variable

if askGrpSess(1)
        subjectGrp = lower(input('Enter subject group (leave empty if none): ', 's'));
    end

At the moment, outside of debug mode, there's no subjectGrp assignment if askGrpSess =0. So the script crashes there.

lower case in saveEventFile

is it compulsory for BIDS? If yes, then nothing can be done, I see. But if it's not having small letters all the way through does not help to read variables in logfile.

creating unasked folder

it might be my issue, will check but now the code is creating eyetracker folder in addition to beh folder.

make trial_type not required

The BIDS specs only have onset and duration as required so make sure that saveEvents skips events with the wrong values.

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.