diff --git a/.gitignore b/.gitignore
index 6146b2ba..c1db3745 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,8 +23,10 @@ tests/*.tsv*
check_my_code_report.txt
# jupyter notebook checkpoints
-.ipynb_checkpoints
-*/.ipynb_checkpoints/*
+notebooks/.ipynb_checkpoints/*
+notebooks/source/*
+notebooks/output/*
+notebooks/new_experiment/*
# ignore node js files
node_modules/*
diff --git a/lib/utils/abspath.m b/lib/utils/abspath.m
new file mode 100644
index 00000000..4376fc4f
--- /dev/null
+++ b/lib/utils/abspath.m
@@ -0,0 +1,117 @@
+function fpath = abspath(fpath)
+%ABSPATH Converts path to an absolute path
+%
+% Converts a relative path from the current working directory to an
+% absolute path by glueing the pwd and the relative path together and
+% eliminating relative references like '.' and '..'. If the provided path
+% is already absolute, only the references like '.' and '..' are removed.
+%
+% Syntax:
+% fpath = abspath(fpath)
+%
+% Input:
+% fpath = path to be converted
+%
+% Output:
+% fpath = absolute path
+%
+% Example
+% fpath = abspath(fpath)
+%
+% See also
+
+%% Copyright notice
+% --------------------------------------------------------------------
+% Copyright (C) 2010 Deltares
+% Bas Hoonhout
+%
+% bas.hoonhout@deltares.nl
+%
+% Rotterdamseweg 185
+% 2629HD Delft
+%
+% This library is free software: you can redistribute it and/or
+% modify it under the terms of the GNU Lesser General Public
+% License as published by the Free Software Foundation, either
+% version 2.1 of the License, or (at your option) any later version.
+%
+% This library is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+% Lesser General Public License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public
+% License along with this library. If not, see .
+% --------------------------------------------------------------------
+
+% This tool is part of OpenEarthTools.
+% OpenEarthTools is an online collaboration to share and manage data and
+% programming tools in an open source, version controlled environment.
+% Sign up to recieve regular updates of this function, and to contribute
+% your own tools.
+
+%% Version
+% Created: 24 Nov 2010
+% Created with Matlab version: 7.9.0.529 (R2009b)
+
+% $Id$
+% $Date$
+% $Author$
+% $Revision$
+% $HeadURL$
+% $Keywords: $
+
+%% convert to absolute path
+% make sure fileseperators are right
+fpath = fullfile(fpath, '');
+
+% check if path is relative
+isRelative = false;
+if ispc()
+ if length(fpath) < 2 || ...
+ (fpath(2) ~= ':' && ~strcmpi(repmat(filesep,1,2), fpath(1:2)))
+ isRelative = true;
+ end
+elseif isunix()
+ if ~any(strcmp(fpath(1), {filesep '~'}))
+ isRelative = true;
+ end
+else
+ error('Unsupported operating system');
+end
+
+if isRelative
+ fpath = fullfile(pwd, fpath);
+end
+
+if ispc()
+ root = fpath(1:2);
+ fpath = fpath(3:end);
+elseif isunix()
+ root = fpath(1);
+ fpath = fpath(2:end);
+end
+
+p = regexp(fpath, filesep, 'split');
+
+% remove '.' elements
+p = p(~strcmp(p, '.'));
+
+% replace relative references
+i = 1;
+while i <= length(p)
+ if strcmp(p{i}, '..')
+ p(i-1:i) = [];
+ i = i-2;
+ end
+ i = i+1;
+end
+
+% glue path together
+fpath = fullfile(root, p{:}, '');
+
+% help unix users
+if isunix && ...
+ (isempty(fpath) || ~strcmp(fpath(1), '~'))
+ fpath = [filesep fpath];
+end
\ No newline at end of file
diff --git a/notebooks/basic_usage.ipynb b/notebooks/basic_usage.ipynb
index 595c05a8..47aca2e9 100644
--- a/notebooks/basic_usage.ipynb
+++ b/notebooks/basic_usage.ipynb
@@ -1,13 +1,21 @@
{
"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Basic usage"
+ ]
+ },
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
- "% add the relevant functions from the src folder\n",
- "addpath(genpath(fullfile(pwd, '..', 'src')))"
+ "% add the relevant functions from the source and library folder\n",
+ "addpath(genpath(fullfile(pwd, '..', 'src')))\n",
+ "addpath(genpath(fullfile(pwd, '..', 'lib')))"
]
},
{
@@ -16,7 +24,7 @@
"source": [
"## Setting the parameters about our experiment\n",
"\n",
- "We need to define the configuration structure where we put all our information."
+ "We need to define the configuration structure where we put the information about the experiment."
]
},
{
@@ -28,41 +36,40 @@
"% define the folder where the data will be saved\n",
"cfg.dir.output = fullfile(pwd, 'output');\n",
"\n",
+ "cfg.verbose = 1;\n",
+ "\n",
"% define the name of the task\n",
"cfg.task.name = 'test task';\n",
"\n",
- "% can use the userInputs function to collect subject info\n",
+ "% We can use the userInputs function to collect subject info: this won't work in a jupyter notebook though\n",
"% cfg = userInputs;\n",
"\n",
- "% Or we can add those information manually directly\n",
+ "% so we can add those information manually directly\n",
"cfg.subject.subjectNb = 1;\n",
"cfg.subject.runNb = 1;\n",
"\n",
"% if set to 'mri' then the data will be saved in the `func` folder\n",
- "cfg.testingDevice = 'mri';\n",
- "\n",
- "% to keep things quiet\n",
- "cfg.verbose = false;\n"
+ "cfg.testingDevice = 'mri';"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "If set to `eeg` then the data will be saved in the `eeg` folder\n",
- "\n",
- "```\n",
- "cfg.testingDevice = 'eeg';\n",
- "```\n",
- "\n",
- "By default we assume you are running things on a behavioral PC with no eyetracker.\n",
+ "By default we assume you are running a purely behavioral experiment with no eyetracker.\n",
"\n",
"```\n",
"cfg.eyeTracker = false;\n",
"cfg.testingDevice = 'pc';\n",
"```\n",
"\n",
- "If the testing device is set to `pc` then the data will be saved in the `beh` folder"
+ "If the testing device is set to `pc` then the data will be saved in the `beh` folder\n",
+ "\n",
+ "If set to `eeg` then the data will be saved in the `eeg` folder\n",
+ "\n",
+ "```\n",
+ "cfg.testingDevice = 'eeg';\n",
+ "```"
]
},
{
@@ -74,110 +81,41 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "cfg =\r\n",
- "\r\n",
- " scalar structure containing the fields:\r\n",
- "\r\n",
- " bids =\r\n",
- "\r\n",
- " scalar structure containing the fields:\r\n",
- "\r\n",
- " datasetDescription =\r\n",
- "\r\n",
- " scalar structure containing the fields:\r\n",
- "\r\n",
- " Acknowledgements: 0x0 sq_string\r\n",
- " Authors: 1x1 cell\r\n",
- " BIDSVersion: 0x0 sq_string\r\n",
- " DatasetDOI: 0x0 sq_string\r\n",
- " Funding: 1x1 cell\r\n",
- " HowToAcknowledge: 0x0 sq_string\r\n",
- " License: 0x0 sq_string\r\n",
- " Name: 0x0 sq_string\r\n",
- " ReferencesAndLinks: 1x1 cell\r\n",
- "\r\n",
- " mri =\r\n",
- "\r\n",
- " scalar structure containing the fields:\r\n",
- "\r\n",
- " Instructions: 0x0 sq_string\r\n",
- " RepetitionTime: 0x0 matrix\r\n",
- " SliceTiming: 0x0 matrix\r\n",
- " TaskDescription: 0x0 sq_string\r\n",
- " TaskName: 1x9 sq_string\r\n",
- "\r\n",
- " meg =\r\n",
- "\r\n",
- " scalar structure containing the fields:\r\n",
- "\r\n",
- " DewarPosition: 0x0 matrix\r\n",
- " DigitizedHeadPoints: 0x0 matrix\r\n",
- " DigitizedLandmarks: 0x0 matrix\r\n",
- " PowerLineFrequency: 0x0 matrix\r\n",
- " SamplingFrequency: 0x0 matrix\r\n",
- " SoftwareFilters: 0x0 matrix\r\n",
- " TaskName: 1x9 sq_string\r\n",
- "\r\n",
"\r\n",
- " dir =\r\n",
"\r\n",
- " scalar structure containing the fields:\r\n",
+ "___________________________________________________\r\n",
+ "___________________________________________________\r\n",
+ " \r\n",
+ " ___ ___ ___ ___ ___ ___ ___ \r\n",
+ " / __| _ \\ _ \\ | _ )_ _| \\/ __|\r\n",
+ " | (__| _/ _/ | _ \\| || |) \\__ \\\r\n",
+ " \\___|_| |_| |___/___|___/|___/\r\n",
+ " \r\n",
+ "Thank you for using the CPP BIDS - version v1.0.0. \r\n",
"\r\n",
- " output = /home/remi/github/CPP_BIDS/notebooks/output\r\n",
+ "Current list of contributors includes:\r\n",
+ " Rémi Gau\r\n",
+ " Marco Barilari\r\n",
+ " Ceren Battal\r\n",
+ " Tomas Lenc\r\n",
+ "\b\r\n",
"\r\n",
- " eyeTracker =\r\n",
+ "Please cite using the following DOI: \r\n",
+ " https://doi.org/10.5281/zenodo.4007674\r\n",
"\r\n",
- " scalar structure containing the fields:\r\n",
+ "For bug report, suggestions or contributions see: \r\n",
+ " https://github.com/cpp-lln-lab/CPP_BIDS\r\n",
"\r\n",
- " do = 0\r\n",
+ "___________________________________________________\r\n",
+ "___________________________________________________\r\n",
"\r\n",
- " fileName =\r\n",
- "\r\n",
- " scalar structure containing the fields:\r\n",
- "\r\n",
- " task = testTask\r\n",
- " zeroPadding = 3\r\n",
- " dateFormat = yyyymmddHHMM\r\n",
- "\r\n",
- " mri =\r\n",
- "\r\n",
- " scalar structure containing the fields:\r\n",
- "\r\n",
- " acquisition = [](0x0)\r\n",
- " contrastEnhancement = [](0x0)\r\n",
- " echo = [](0x0)\r\n",
- " phaseEncodingDirection = [](0x0)\r\n",
- " reconstruction = [](0x0)\r\n",
- " repetitionTime = [](0x0)\r\n",
- "\r\n",
- " subject =\r\n",
- "\r\n",
- " scalar structure containing the fields:\r\n",
- "\r\n",
- " askGrpSess =\r\n",
- "\r\n",
- " 1 1\r\n",
- "\r\n",
- " runNb = 1\r\n",
- " sessionNb = 1\r\n",
- " subjectGrp = \r\n",
- " subjectNb = 1\r\n",
- "\r\n",
- " task =\r\n",
- "\r\n",
- " scalar structure containing the fields:\r\n",
- "\r\n",
- " name = test task\r\n",
- "\r\n",
- " testingDevice = mri\r\n",
- " verbose = 0\r\n",
"\r\n"
]
}
],
"source": [
"% We can then initialize all the other fields. The ones we have already filled in will not be overwritten\n",
- "cfg = checkCFG(cfg)"
+ "cfg = checkCFG(cfg);"
]
},
{
@@ -195,7 +133,7 @@
"source": [
"% create the filenames: this include a step to check that all the information is there: createFilename calls \n",
"% checkCFG before running\n",
- "[cfg] = createFilename(cfg);"
+ "cfg = createFilename(cfg);"
]
},
{
@@ -220,12 +158,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "ans = /home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001\r\n"
+ "/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001\r\n"
]
}
],
"source": [
- "cfg.dir.outputSubject"
+ "disp(cfg.dir.outputSubject)"
]
},
{
@@ -248,12 +186,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "ans = sub-001_ses-001_task-testTask_run-001_events_date-202008142236.tsv\r\n"
+ "sub-001_ses-001_task-testTask_run-001_events_date-202011171229.tsv\r\n"
]
}
],
"source": [
- "cfg.fileName.events"
+ "disp(cfg.fileName.events)"
]
},
{
@@ -272,15 +210,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "ans = /home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/func/sub-001_ses-001_task-testTask_run-001_events_date-202008142236.tsv\r\n"
+ "/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/func/sub-001_ses-001_task-testTask_run-001_events_date-202011171229.tsv\r\n"
]
}
],
"source": [
- "fullfile(...\n",
+ "disp(fullfile(...\n",
" cfg.dir.outputSubject, ...\n",
" cfg.fileName.modality, ...\n",
- " cfg.fileName.events)"
+ " cfg.fileName.events))"
]
},
{
@@ -303,10 +241,12 @@
"metadata": {},
"outputs": [],
"source": [
- "clear cfg\n",
+ "clear cfg logFile\n",
"\n",
"cfg.dir.output = fullfile(pwd, 'output');\n",
"\n",
+ "cfg.verbose = 0;\n",
+ "\n",
"cfg.task.name = 'test task';\n",
"\n",
"cfg.subject.subjectNb = 1;\n",
@@ -314,13 +254,11 @@
"\n",
"cfg.testingDevice = 'mri';\n",
"\n",
- "cfg.verbose = false;\n",
- "\n",
"% Create the filenames\n",
"[cfg] = createFilename(cfg);\n",
"\n",
"% We can define what extra columns we want in our tsv file beyond the \n",
- "% BIDS holy trinity ('onset', 'duration', 'trial_type')\n",
+ "% BIDS \"holy trinity\" ('onset', 'duration', 'trial_type')\n",
"\n",
"% Say we want to keep track of the type of target that what presented during a trial and of its position\n",
"logFile.extraColumns = {'target_position', 'target_type'};\n"
@@ -348,7 +286,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "This will initialize a structure for each extra column."
+ "This will initialize a structure for each extra column.\n"
]
},
{
@@ -362,7 +300,6 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "ans =\r\n",
"\r\n",
" scalar structure containing the fields:\r\n",
"\r\n",
@@ -370,12 +307,12 @@
" Levels = \r\n",
" LongName = \r\n",
" TermURL = \r\n",
- "\r\n"
+ " Units = \r\n"
]
}
],
"source": [
- "logFile.extraColumns.target_position.bids"
+ "disp(logFile.extraColumns.target_position.bids)"
]
},
{
@@ -394,7 +331,6 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "ans =\r\n",
"\r\n",
" scalar structure containing the fields:\r\n",
"\r\n",
@@ -407,7 +343,7 @@
" }\r\n",
" LongName = \r\n",
" TermURL = \r\n",
- "\r\n"
+ " Units = \r\n"
]
}
],
@@ -415,7 +351,7 @@
"logFile.extraColumns.target_position.bids.Description = 'Position of the target on the screen';\n",
"logFile.extraColumns.target_position.bids.Levels = {'left', 'center', 'right'};\n",
"\n",
- "logFile.extraColumns.target_position.bids"
+ "disp(logFile.extraColumns.target_position.bids)"
]
},
{
@@ -471,33 +407,17 @@
"├── basic_usage.ipynb\r\n",
"├── creating_BIDS_dataset.ipynb\r\n",
"├── more_on_saving.ipynb\r\n",
- "├── octave-workspace\r\n",
"├── \u001b[01;34moutput\u001b[00m\r\n",
- "│ ├── \u001b[01;34mrawdata\u001b[00m\r\n",
- "│ │ ├── CHANGES\r\n",
- "│ │ ├── dataset_description.json\r\n",
- "│ │ ├── README\r\n",
- "│ │ └── \u001b[01;34msub-001\u001b[00m\r\n",
- "│ │ └── \u001b[01;34mses-001\u001b[00m\r\n",
- "│ │ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold.json\r\n",
- "│ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events.json\r\n",
- "│ │ └── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events.tsv\r\n",
"│ └── \u001b[01;34msource\u001b[00m\r\n",
- "│ ├── CHANGES\r\n",
- "│ ├── dataset_description.json\r\n",
- "│ ├── README\r\n",
"│ └── \u001b[01;34msub-001\u001b[00m\r\n",
"│ └── \u001b[01;34mses-001\u001b[00m\r\n",
"│ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold_date-202008090023.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.tsv\r\n",
- "│ ├── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.json\r\n",
- "│ └── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.tsv\r\n",
- "└── README.md\r\n",
+ "│ ├── sub-001_ses-001_task-testTask_run-001_events_date-202011171229.json\r\n",
+ "│ └── sub-001_ses-001_task-testTask_run-001_events_date-202011171229.tsv\r\n",
+ "├── README.md\r\n",
+ "└── using_2_logfiles.ipynb\r\n",
"\r\n",
- "9 directories, 19 files\r\n",
+ "5 directories, 7 files\r\n",
"\n"
]
}
@@ -531,7 +451,7 @@
"{\r\n",
" \"onset\": {\r\n",
" \"Description\": \"time elapsed since experiment start\",\r\n",
- " \"Unit\": \"s\"\r\n",
+ " \"Units\": \"s\"\r\n",
" },\r\n",
" \"trial_type\": {\r\n",
" \"Description\": \"types of trial\",\r\n",
@@ -539,7 +459,7 @@
" },\r\n",
" \"duration\": {\r\n",
" \"Description\": \"duration of the event or the block\",\r\n",
- " \"Unit\": \"s\"\r\n",
+ " \"Units\": \"s\"\r\n",
" },\r\n",
" \"target_position\": {\r\n",
" \"Description\": \"Position of the target on the screen\",\r\n",
@@ -549,13 +469,15 @@
" \"right\"\r\n",
" ],\r\n",
" \"LongName\": \"\",\r\n",
- " \"TermURL\": \"\"\r\n",
+ " \"TermURL\": \"\",\r\n",
+ " \"Units\": \"\"\r\n",
" },\r\n",
" \"target_type\": {\r\n",
" \"Description\": \"\",\r\n",
" \"Levels\": \"\",\r\n",
" \"LongName\": \"\",\r\n",
- " \"TermURL\": \"\"\r\n",
+ " \"TermURL\": \"\",\r\n",
+ " \"Units\": \"\"\r\n",
" }\r\n",
"}\n"
]
@@ -574,14 +496,18 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "2.000000\t1.000000\tmotion_up\tleft\taudio\t\r\n",
- "6.000000\t1.200000\tstatic\tright\tvisual\t\r\n"
+ "ans = 2\r\n",
+ "ans = 1\r\n",
+ "\r\n",
+ "ans = 6\r\n",
+ "ans = 1.2000\r\n",
+ "\r\n"
]
}
],
"source": [
"% The information about 2 events that we want to save\n",
- "% NOTE : If the user DOES NOT provide `onset`, `trial_type`, this events will be skipped.\n",
+ "% NOTE : If the user DOES NOT provide `onset`, `duration`, this events will be skipped.\n",
"\n",
"% Trial one\n",
"logFile(1,1).onset = 2;\n",
@@ -618,10 +544,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "warning: \r\n",
- "Skipping saving this event.\r\n",
+ "warning: Skipping saving this event. \r\n",
" onset: NaN \r\n",
- " duration: NaN\r\n"
+ " duration: NaN \r\n"
]
}
],
@@ -649,11 +574,13 @@
"text": [
"warning: Missing some target_position data for this event.\r\n",
"warning: called from\r\n",
- " saveEventsFile>checkExtracolumns at line 219 column 13\r\n",
- " saveEventsFile>checklLogFile at line 140 column 21\r\n",
- " saveEventsFile>saveToLogFile at line 282 column 17\r\n",
- " saveEventsFile at line 90 column 21\r\n",
- "10.000000\t1.000000\tmotion_down\tn/a\taudio\t\r\n"
+ " saveEventsFile>checkExtracolumns at line 288 column 13\r\n",
+ " saveEventsFile>checklLogFile at line 173 column 21\r\n",
+ " saveEventsFile>saveToLogFile at line 351 column 17\r\n",
+ " saveEventsFile at line 123 column 21\r\n",
+ "ans = 10\r\n",
+ "ans = 1\r\n",
+ "\r\n"
]
}
],
@@ -679,22 +606,9 @@
"cell_type": "code",
"execution_count": 18,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\r\n",
- "Data were saved in this file:\r\n",
- "\r\n",
- "/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/func/sub-001_ses-001_task-testTask_run-001_events_date-202008142236.tsv\r\n",
- "\r\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"% close the file\n",
- "cfg.verbose = true; % set verbose in true if you want to know where things are\n",
"saveEventsFile('close', cfg, logFile);"
]
},
diff --git a/notebooks/creating_BIDS_dataset.ipynb b/notebooks/creating_BIDS_dataset.ipynb
index 9141308c..7cc44047 100644
--- a/notebooks/creating_BIDS_dataset.ipynb
+++ b/notebooks/creating_BIDS_dataset.ipynb
@@ -16,12 +16,20 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 33,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "addpath(genpath(fullfile(pwd, '..', 'src')))\n",
+ "addpath(genpath(fullfile(pwd, '..', 'lib')))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
"metadata": {},
"outputs": [],
"source": [
- "addpath(genpath(fullfile(pwd, '..', 'src')));\n",
- "\n",
"cfg.dir.output = fullfile(pwd, 'output');\n",
"\n",
"cfg.task.name = 'test task';\n",
@@ -33,14 +41,56 @@
"\n",
"cfg.eyetracker.do = 1;\n",
"\n",
- "cfg.verbose = false;"
+ "cfg.verbose = 2;"
]
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 35,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r\n",
+ "\r\n",
+ "___________________________________________________\r\n",
+ "___________________________________________________\r\n",
+ " \r\n",
+ " ___ ___ ___ ___ ___ ___ ___ \r\n",
+ " / __| _ \\ _ \\ | _ )_ _| \\/ __|\r\n",
+ " | (__| _/ _/ | _ \\| || |) \\__ \\\r\n",
+ " \\___|_| |_| |___/___|___/|___/\r\n",
+ " \r\n",
+ "Thank you for using the CPP BIDS - version v1.0.0. \r\n",
+ "\r\n",
+ "Current list of contributors includes:\r\n",
+ " Rémi Gau\r\n",
+ " Marco Barilari\r\n",
+ " Ceren Battal\r\n",
+ " Tomas Lenc\r\n",
+ "\b\r\n",
+ "\r\n",
+ "Please cite using the following DOI: \r\n",
+ " https://doi.org/10.5281/zenodo.4007674\r\n",
+ "\r\n",
+ "For bug report, suggestions or contributions see: \r\n",
+ " https://github.com/cpp-lln-lab/CPP_BIDS\r\n",
+ "\r\n",
+ "___________________________________________________\r\n",
+ "___________________________________________________\r\n",
+ "\r\n",
+ "\r\n",
+ "\r\n",
+ "Data will be saved in this directory:\r\n",
+ "\t/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/func\r\n",
+ "\r\n",
+ "Data will be saved in this file:\r\n",
+ "\tsub-001_ses-001_task-testTask_run-001_events_date-202011171530.tsv\r\n"
+ ]
+ }
+ ],
"source": [
"cfg.bids.datasetDescription.Name = 'my new bids data set';\n",
"cfg.bids.datasetDescription.BIDSVersion = '1.3';\n",
@@ -57,66 +107,41 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
- "mkdir(fullfile(cfg.dir.outputSubject, cfg.fileName.modality));\n",
- "\n",
"createDatasetDescription(cfg)"
]
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 37,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[01;34m.\u001b[00m\r\n",
- "├── basic_usage.ipynb\r\n",
- "├── creating_BIDS_dataset.ipynb\r\n",
- "├── more_on_saving.ipynb\r\n",
- "├── octave-workspace\r\n",
- "├── \u001b[01;34moutput\u001b[00m\r\n",
- "│ ├── \u001b[01;34mrawdata\u001b[00m\r\n",
- "│ │ ├── CHANGES\r\n",
- "│ │ ├── dataset_description.json\r\n",
- "│ │ ├── README\r\n",
- "│ │ └── \u001b[01;34msub-001\u001b[00m\r\n",
- "│ │ └── \u001b[01;34mses-001\u001b[00m\r\n",
- "│ │ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold.json\r\n",
- "│ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events.json\r\n",
- "│ │ └── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events.tsv\r\n",
- "│ └── \u001b[01;34msource\u001b[00m\r\n",
- "│ ├── CHANGES\r\n",
- "│ ├── dataset_description.json\r\n",
- "│ ├── README\r\n",
- "│ └── \u001b[01;34msub-001\u001b[00m\r\n",
- "│ └── \u001b[01;34mses-001\u001b[00m\r\n",
- "│ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold_date-202008090023.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.tsv\r\n",
- "│ ├── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.json\r\n",
- "│ └── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.tsv\r\n",
- "└── README.md\r\n",
+ "\u001b[01;34moutput\u001b[00m\r\n",
+ "└── \u001b[01;34msource\u001b[00m\r\n",
+ " ├── dataset_description.json\r\n",
+ " └── \u001b[01;34msub-001\u001b[00m\r\n",
+ " └── \u001b[01;34mses-001\u001b[00m\r\n",
+ " └── \u001b[01;34mfunc\u001b[00m\r\n",
"\r\n",
- "9 directories, 19 files\r\n",
+ "4 directories, 1 file\r\n",
"\n"
]
}
],
"source": [
- "!tree"
+ "!tree output"
]
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 38,
"metadata": {},
"outputs": [
{
@@ -162,42 +187,83 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"cfg.mri.repetitionTime = 2.1;\n",
- "cfg.mri.contrastEnhancement = [];\n",
- "cfg.mri.phaseEncodingDirection = [];\n",
- "cfg.mri.reconstruction = 'fast';\n",
- "cfg.mri.echo = '1';\n",
- "cfg.mri.acquisition = 'slow';"
+ "cfg.suffix.phaseEncodingDirection = 'i-';\n",
+ "cfg.suffix.reconstruction = 'motion correction';\n",
+ "cfg.suffix.echo = '1';\n",
+ "cfg.suffix.acquisition = 'slow';"
]
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 48,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\r\n",
+ "\r\n",
+ "___________________________________________________\r\n",
+ "___________________________________________________\r\n",
+ " \r\n",
+ " ___ ___ ___ ___ ___ ___ ___ \r\n",
+ " / __| _ \\ _ \\ | _ )_ _| \\/ __|\r\n",
+ " | (__| _/ _/ | _ \\| || |) \\__ \\\r\n",
+ " \\___|_| |_| |___/___|___/|___/\r\n",
+ " \r\n",
+ "Thank you for using the CPP BIDS - version v1.0.0. \r\n",
+ "\r\n",
+ "Current list of contributors includes:\r\n",
+ " Rémi Gau\r\n",
+ " Marco Barilari\r\n",
+ " Ceren Battal\r\n",
+ " Tomas Lenc\r\n",
+ "\b\r\n",
+ "\r\n",
+ "Please cite using the following DOI: \r\n",
+ " https://doi.org/10.5281/zenodo.4007674\r\n",
+ "\r\n",
+ "For bug report, suggestions or contributions see: \r\n",
+ " https://github.com/cpp-lln-lab/CPP_BIDS\r\n",
+ "\r\n",
+ "___________________________________________________\r\n",
+ "___________________________________________________\r\n",
+ "\r\n",
+ "\r\n",
+ "\r\n",
+ "Data will be saved in this directory:\r\n",
+ "\t/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/func\r\n",
+ "\r\n",
+ "Data will be saved in this file:\r\n",
+ "\tsub-001_ses-001_task-testTask_run-001_events_date-202011171531.tsv\r\n"
+ ]
+ }
+ ],
"source": [
"[cfg] = createFilename(cfg);"
]
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 47,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "ans = sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008142237.tsv\r\n"
+ "sub-001_ses-001_task-testTask_run-001_events_date-202011171531.tsv\r\n"
]
}
],
"source": [
- "cfg.fileName.events"
+ "disp(cfg.fileName.events)"
]
},
{
@@ -213,65 +279,43 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 51,
"metadata": {},
"outputs": [],
"source": [
- "createBoldJson(cfg)"
+ "createJson(cfg, 'func')"
]
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 52,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[01;34m.\u001b[00m\r\n",
- "├── basic_usage.ipynb\r\n",
- "├── creating_BIDS_dataset.ipynb\r\n",
- "├── more_on_saving.ipynb\r\n",
- "├── octave-workspace\r\n",
- "├── \u001b[01;34moutput\u001b[00m\r\n",
- "│ ├── \u001b[01;34mrawdata\u001b[00m\r\n",
- "│ │ ├── CHANGES\r\n",
- "│ │ ├── dataset_description.json\r\n",
- "│ │ ├── README\r\n",
- "│ │ └── \u001b[01;34msub-001\u001b[00m\r\n",
- "│ │ └── \u001b[01;34mses-001\u001b[00m\r\n",
- "│ │ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold.json\r\n",
- "│ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events.json\r\n",
- "│ │ └── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events.tsv\r\n",
- "│ └── \u001b[01;34msource\u001b[00m\r\n",
- "│ ├── CHANGES\r\n",
- "│ ├── dataset_description.json\r\n",
- "│ ├── README\r\n",
- "│ └── \u001b[01;34msub-001\u001b[00m\r\n",
- "│ └── \u001b[01;34mses-001\u001b[00m\r\n",
- "│ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold_date-202008090023.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold_date-202008142237.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.tsv\r\n",
- "│ ├── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.json\r\n",
- "│ └── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.tsv\r\n",
- "└── README.md\r\n",
+ "\u001b[01;34moutput\u001b[00m\r\n",
+ "└── \u001b[01;34msource\u001b[00m\r\n",
+ " ├── dataset_description.json\r\n",
+ " └── \u001b[01;34msub-001\u001b[00m\r\n",
+ " └── \u001b[01;34mses-001\u001b[00m\r\n",
+ " └── \u001b[01;34mfunc\u001b[00m\r\n",
+ " ├── sub-001_ses-001_task-testTask_run-001_bold_date-202011171530.json\r\n",
+ " └── sub-001_ses-001_task-testTask_run-001_bold_date-202011171531.json\r\n",
"\r\n",
- "9 directories, 20 files\r\n",
+ "4 directories, 3 files\r\n",
"\n"
]
}
],
"source": [
- "!tree"
+ "!tree output"
]
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 44,
"metadata": {},
"outputs": [
{
@@ -283,27 +327,6 @@
" \"RepetitionTime\": [],\r\n",
" \"SliceTiming\": [],\r\n",
" \"TaskDescription\": \"\",\r\n",
- " \"TaskName\": \"test Task\",\r\n",
- " \"timing\": {\r\n",
- " \"IBI\": 5.4,\r\n",
- " \"ISI\": 0.1,\r\n",
- " \"onsetDelay\": 0.1,\r\n",
- " \"endDelay\": 0.1,\r\n",
- " \"eventDuration\": 0.8\r\n",
- " },\r\n",
- " \"dot\": {\r\n",
- " \"speed\": 30,\r\n",
- " \"coherence\": 1,\r\n",
- " \"density\": 0.1,\r\n",
- " \"lifeTime\": 10,\r\n",
- " \"proportionKilledPerFrame\": 0,\r\n",
- " \"size\": 1\r\n",
- " }\r\n",
- "}{\r\n",
- " \"Instructions\": \"\",\r\n",
- " \"RepetitionTime\": [],\r\n",
- " \"SliceTiming\": [],\r\n",
- " \"TaskDescription\": \"\",\r\n",
" \"TaskName\": \"test Task\"\r\n",
"}\n"
]
@@ -326,7 +349,7 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
@@ -365,12 +388,12 @@
"metadata": {},
"outputs": [],
"source": [
- "createBoldJson(cfg, parameters)"
+ "createJson(cfg, parameters)"
]
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 15,
"metadata": {},
"outputs": [
{
@@ -382,43 +405,7 @@
" \"RepetitionTime\": [],\r\n",
" \"SliceTiming\": [],\r\n",
" \"TaskDescription\": \"\",\r\n",
- " \"TaskName\": \"test Task\",\r\n",
- " \"timing\": {\r\n",
- " \"IBI\": 5.4,\r\n",
- " \"ISI\": 0.1,\r\n",
- " \"onsetDelay\": 0.1,\r\n",
- " \"endDelay\": 0.1,\r\n",
- " \"eventDuration\": 0.8\r\n",
- " },\r\n",
- " \"dot\": {\r\n",
- " \"speed\": 30,\r\n",
- " \"coherence\": 1,\r\n",
- " \"density\": 0.1,\r\n",
- " \"lifeTime\": 10,\r\n",
- " \"proportionKilledPerFrame\": 0,\r\n",
- " \"size\": 1\r\n",
- " }\r\n",
- "}{\r\n",
- " \"Instructions\": \"\",\r\n",
- " \"RepetitionTime\": [],\r\n",
- " \"SliceTiming\": [],\r\n",
- " \"TaskDescription\": \"\",\r\n",
- " \"TaskName\": \"test Task\",\r\n",
- " \"timing\": {\r\n",
- " \"IBI\": 5.4,\r\n",
- " \"ISI\": 0.1,\r\n",
- " \"onsetDelay\": 0.1,\r\n",
- " \"endDelay\": 0.1,\r\n",
- " \"eventDuration\": 0.8\r\n",
- " },\r\n",
- " \"dot\": {\r\n",
- " \"speed\": 30,\r\n",
- " \"coherence\": 1,\r\n",
- " \"density\": 0.1,\r\n",
- " \"lifeTime\": 10,\r\n",
- " \"proportionKilledPerFrame\": 0,\r\n",
- " \"size\": 1\r\n",
- " }\r\n",
+ " \"TaskName\": \"test Task\"\r\n",
"}\n"
]
}
@@ -438,7 +425,7 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 18,
"metadata": {},
"outputs": [
{
@@ -446,8 +433,17 @@
"output_type": "stream",
"text": [
"onset\tduration\ttrial_type\ttarget_position\ttarget_type\n",
- "2.000000\t1.000000\tmotion_up\tleft\taudio\t\n",
- "6.000000\t1.200000\tstatic\tright\tvisual\t\n"
+ "ans = 2\n",
+ "2.000000\tans = 1\n",
+ "1.000000\tmotion_up\tleft\taudio\t\n",
+ "ans = 6\n",
+ "6.000000\tans = 1.2000\n",
+ "1.200000\tstatic\tright\tvisual\t\n",
+ "\n",
+ "Data were saved in this file:\n",
+ "\n",
+ "/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/func/sub-001_ses-001_task-testTask_run-001_events_date-202011171307.tsv\n",
+ "\n"
]
}
],
@@ -455,6 +451,7 @@
"\n",
"logFile.extraColumns = {'target_position', 'target_type'};\n",
"\n",
+ "logFile = saveEventsFile('init', cfg, logFile);\n",
"logFile = saveEventsFile('open', cfg, logFile);\n",
"\n",
"logFile(1,1).onset = 2;\n",
@@ -476,7 +473,7 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 53,
"metadata": {
"scrolled": false
},
@@ -485,46 +482,22 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "\u001b[01;34m.\u001b[00m\r\n",
- "├── basic_usage.ipynb\r\n",
- "├── creating_BIDS_dataset.ipynb\r\n",
- "├── more_on_saving.ipynb\r\n",
- "├── octave-workspace\r\n",
- "├── \u001b[01;34moutput\u001b[00m\r\n",
- "│ ├── \u001b[01;34mrawdata\u001b[00m\r\n",
- "│ │ ├── CHANGES\r\n",
- "│ │ ├── dataset_description.json\r\n",
- "│ │ ├── README\r\n",
- "│ │ └── \u001b[01;34msub-001\u001b[00m\r\n",
- "│ │ └── \u001b[01;34mses-001\u001b[00m\r\n",
- "│ │ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold.json\r\n",
- "│ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events.json\r\n",
- "│ │ └── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events.tsv\r\n",
- "│ └── \u001b[01;34msource\u001b[00m\r\n",
- "│ ├── CHANGES\r\n",
- "│ ├── dataset_description.json\r\n",
- "│ ├── README\r\n",
- "│ └── \u001b[01;34msub-001\u001b[00m\r\n",
- "│ └── \u001b[01;34mses-001\u001b[00m\r\n",
- "│ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold_date-202008090023.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold_date-202008142237.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.tsv\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008142237.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008142237.tsv\r\n",
- "│ ├── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.json\r\n",
- "│ └── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.tsv\r\n",
- "└── README.md\r\n",
+ "\u001b[01;34moutput\u001b[00m\r\n",
+ "└── \u001b[01;34msource\u001b[00m\r\n",
+ " ├── dataset_description.json\r\n",
+ " └── \u001b[01;34msub-001\u001b[00m\r\n",
+ " └── \u001b[01;34mses-001\u001b[00m\r\n",
+ " └── \u001b[01;34mfunc\u001b[00m\r\n",
+ " ├── sub-001_ses-001_task-testTask_run-001_bold_date-202011171530.json\r\n",
+ " └── sub-001_ses-001_task-testTask_run-001_bold_date-202011171531.json\r\n",
"\r\n",
- "9 directories, 22 files\r\n",
+ "4 directories, 3 files\r\n",
"\n"
]
}
],
"source": [
- "!tree"
+ "!tree output"
]
},
{
@@ -540,7 +513,7 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
@@ -549,7 +522,7 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": 21,
"metadata": {},
"outputs": [
{
@@ -559,34 +532,17 @@
"\u001b[01;34m.\u001b[00m\r\n",
"├── basic_usage.ipynb\r\n",
"├── creating_BIDS_dataset.ipynb\r\n",
- "├── more_on_saving.ipynb\r\n",
- "├── octave-workspace\r\n",
"├── \u001b[01;34moutput\u001b[00m\r\n",
- "│ ├── \u001b[01;34mrawdata\u001b[00m\r\n",
+ "│ ├── \u001b[01;34mraw\u001b[00m\r\n",
"│ │ ├── CHANGES\r\n",
"│ │ ├── dataset_description.json\r\n",
"│ │ ├── README\r\n",
- "│ │ ├── \u001b[01;34msource\u001b[00m\r\n",
- "│ │ │ ├── CHANGES\r\n",
- "│ │ │ ├── dataset_description.json\r\n",
- "│ │ │ ├── README\r\n",
- "│ │ │ └── \u001b[01;34msub-001\u001b[00m\r\n",
- "│ │ │ └── \u001b[01;34mses-001\u001b[00m\r\n",
- "│ │ │ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ │ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold_date-202008090023.json\r\n",
- "│ │ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold_date-202008142237.json\r\n",
- "│ │ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.json\r\n",
- "│ │ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.tsv\r\n",
- "│ │ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008142237.json\r\n",
- "│ │ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008142237.tsv\r\n",
- "│ │ │ ├── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.json\r\n",
- "│ │ │ └── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.tsv\r\n",
"│ │ └── \u001b[01;34msub-001\u001b[00m\r\n",
"│ │ └── \u001b[01;34mses-001\u001b[00m\r\n",
"│ │ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold.json\r\n",
- "│ │ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events.json\r\n",
- "│ │ └── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events.tsv\r\n",
+ "│ │ ├── sub-001_ses-001_task-testTask_run-001_bold.json\r\n",
+ "│ │ ├── sub-001_ses-001_task-testTask_run-001_events.json\r\n",
+ "│ │ └── sub-001_ses-001_task-testTask_run-001_events.tsv\r\n",
"│ └── \u001b[01;34msource\u001b[00m\r\n",
"│ ├── CHANGES\r\n",
"│ ├── dataset_description.json\r\n",
@@ -594,17 +550,15 @@
"│ └── \u001b[01;34msub-001\u001b[00m\r\n",
"│ └── \u001b[01;34mses-001\u001b[00m\r\n",
"│ └── \u001b[01;34mfunc\u001b[00m\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold_date-202008090023.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_bold_date-202008142237.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008090023.tsv\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008142237.json\r\n",
- "│ ├── sub-001_ses-001_task-testTask_acq-slow_rec-fast_run-001_echo-1_events_date-202008142237.tsv\r\n",
- "│ ├── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.json\r\n",
- "│ └── sub-001_ses-001_task-testTask_run-001_events_date-202008142236.tsv\r\n",
- "└── README.md\r\n",
+ "│ ├── sub-001_ses-001_task-testTask_run-001_bold_date-202011171307.json\r\n",
+ "│ ├── sub-001_ses-001_task-testTask_run-001_events_date-202011171307.json\r\n",
+ "│ └── sub-001_ses-001_task-testTask_run-001_events_date-202011171307.tsv\r\n",
+ "├── README.md\r\n",
+ "├── saving_arrays.ipynb\r\n",
+ "├── saving_stim_files.ipynb\r\n",
+ "└── using_2_logfiles.ipynb\r\n",
"\r\n",
- "13 directories, 33 files\r\n",
+ "9 directories, 18 files\r\n",
"\n"
]
}
diff --git a/notebooks/demo_1_IoNS YRD_20201118.ipynb b/notebooks/demo_1_IoNS YRD_20201118.ipynb
new file mode 100644
index 00000000..97b94de0
--- /dev/null
+++ b/notebooks/demo_1_IoNS YRD_20201118.ipynb
@@ -0,0 +1,179 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# CPP BIDS: quick demo 1"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "% add the relevant functions from the source and library folder\n",
+ "addpath(genpath(fullfile(pwd, '..', 'src')))\n",
+ "addpath(genpath(fullfile(pwd, '..', 'lib')))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Simplest case: behavioral experiment"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Set up"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "% clean up\n",
+ "clear cfg logFile\n",
+ "rmdir(fullfile(pwd, 'new_experiment'), 's');\n",
+ "\n",
+ "% Define where to save things, subject and run number, task name\n",
+ "cfg.dir.output = fullfile(pwd, 'new_experiment'); \n",
+ "\n",
+ "cfg.subject.subjectNb = 1;\n",
+ "cfg.subject.runNb = 1;\n",
+ "\n",
+ "cfg.task.name = 'test task';\n",
+ "\n",
+ "% to print some output to the prompt\n",
+ "cfg.verbose = 1;\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Initialize the output files"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "cfg = createFilename(cfg);\n",
+ "logFile = saveEventsFile('init', cfg);\n",
+ "logFile = saveEventsFile('open', cfg, logFile);"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Add content to the outpute file\n",
+ "\n",
+ "Append content to `logFile` and then save it."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "logFile(1, 1).onset = 2;\n",
+ "logFile(1, 1).trial_type = 'target';\n",
+ "logFile(1, 1).duration = 0.25;\n",
+ "\n",
+ "logFile(2, 1).onset = 5;\n",
+ "logFile(2, 1).trial_type = 'no_target';\n",
+ "logFile(2, 1).duration = 0.36;\n",
+ "\n",
+ "logFile = saveEventsFile('save', cfg, logFile);\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "% close the file\n",
+ "saveEventsFile('close', cfg, logFile);"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### check the output"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "!tree new_experiment"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "!cat new_experiment/source/sub-001/ses-001/beh/sub-001_ses-001_task-testTask_run-001_events_date-*.tsv"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "!cat new_experiment/source/sub-001/ses-001/beh/sub-001_ses-001_task-testTask_run-001_events_date-*.json"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Octave",
+ "language": "octave",
+ "name": "octave"
+ },
+ "language_info": {
+ "file_extension": ".m",
+ "help_links": [
+ {
+ "text": "GNU Octave",
+ "url": "https://www.gnu.org/software/octave/support.html"
+ },
+ {
+ "text": "Octave Kernel",
+ "url": "https://github.com/Calysto/octave_kernel"
+ },
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://metakernel.readthedocs.io/en/latest/source/README.html"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "octave",
+ "version": "4.2.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/notebooks/demo_2_IoNS YRD_20201118.ipynb b/notebooks/demo_2_IoNS YRD_20201118.ipynb
new file mode 100644
index 00000000..ee21c112
--- /dev/null
+++ b/notebooks/demo_2_IoNS YRD_20201118.ipynb
@@ -0,0 +1,325 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# CPP BIDS: quick demo 2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "% add the relevant functions from the source and library folder\n",
+ "addpath(genpath(fullfile(pwd, '..', 'src')))\n",
+ "addpath(genpath(fullfile(pwd, '..', 'lib')))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# fMRI experiment with eyetracking"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Set up"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "% clean up\n",
+ "clear cfg logFile\n",
+ "\n",
+ "% Define where to save things, subject and run number, task name\n",
+ "cfg.dir.output = fullfile(pwd, 'new_experiment'); \n",
+ "\n",
+ "cfg.subject.subjectNb = 1;\n",
+ "cfg.subject.runNb = 1;\n",
+ "\n",
+ "cfg.task.name = 'test task';\n",
+ "\n",
+ "cfg.testingDevice = 'mri';\n",
+ "\n",
+ "cfg.eyeTracker.do = 1;\n",
+ "\n",
+ "% to print some output to the prompt\n",
+ "cfg.verbose = 1;\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Additional details about the experiment "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "% other information to save in the TSV file\n",
+ "logFile.extraColumns = {'target_position', 'target_type'};\n",
+ "\n",
+ "% Time between events in seconds\n",
+ "parameters.timing.ISI = 0.1;\n",
+ "\n",
+ "% Number of seconds before the stimuli are presented\n",
+ "parameters.timing.onsetDelay = .1;\n",
+ "\n",
+ "% Event duration\n",
+ "parameters.timing.eventDuration = 0.8;\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## fMRI details"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "cfg.mri.repetitionTime = 2.1;\n",
+ "\n",
+ "cfg.suffix.phaseEncodingDirection = 'AP';\n",
+ "cfg.suffix.reconstruction = 'MoCo';\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Initialize the output files"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "cfg = createFilename(cfg);\n",
+ "\n",
+ "logFile = saveEventsFile('init', cfg, logFile);\n",
+ "logFile = saveEventsFile('open', cfg, logFile);"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Save metadata"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "createJson(cfg, 'func', parameters)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "!tree new_experiment"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Add content to the outpute file"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "logFile(1,1).onset = 2;\n",
+ "logFile(1,1).trial_type = 'motion_up';\n",
+ "logFile(1,1).duration = 1;\n",
+ "logFile(1,1).target_position = 'left';\n",
+ "logFile(1,1).target_type = 'audio';\n",
+ "\n",
+ "logFile(2,1).onset = 6;\n",
+ "logFile(2,1).trial_type = 'static';\n",
+ "logFile(2,1).duration = 1.2;\n",
+ "logFile(2,1).target_position = 'right';\n",
+ "logFile(2,1).target_type = 'visual';\n",
+ "\n",
+ "logFile = saveEventsFile('save', cfg, logFile);"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "% close the file\n",
+ "saveEventsFile('close', cfg, logFile);"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Content of the `events.tsv` file"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "!cat new_experiment/source/sub-001/ses-001/func/sub-001_ses-001_task-*events*.tsv"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Content of the data dictionary `events.json` file"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "!cat new_experiment/source/sub-001/ses-001/func/sub-001_ses-001_task-*events*.json"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Content of the metadata `bold.json` file"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "!cat new_experiment/source/sub-001/ses-001/func/sub-001_ses-001_task-*bold*.json"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Convert to a BIDS dataset"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Create a dataset description"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [],
+ "source": [
+ "cfg.bids.datasetDescription.Name = 'A new BIDS dataset';\n",
+ "cfg.bids.datasetDescription.BIDSVersion = '1.3';\n",
+ "cfg.bids.datasetDescription.License = 'CC-BY';\n",
+ "cfg.bids.datasetDescription.Authors = {'IONS YRD 2020'};\n",
+ "cfg.bids.datasetDescription.Acknowledgements = '';\n",
+ "cfg.bids.datasetDescription.HowToAcknowledge = '';\n",
+ "cfg.bids.datasetDescription.Funding = {''};\n",
+ "cfg.bids.datasetDescription.ReferencesAndLinks = {''};\n",
+ "cfg.bids.datasetDescription.DatasetDOI = '';\n",
+ "\n",
+ "[cfg] = createFilename(cfg);\n",
+ "createDatasetDescription(cfg)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "convertSourceToRaw(cfg)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "!tree new_experiment"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Octave",
+ "language": "octave",
+ "name": "octave"
+ },
+ "language_info": {
+ "file_extension": ".m",
+ "help_links": [
+ {
+ "text": "GNU Octave",
+ "url": "https://www.gnu.org/software/octave/support.html"
+ },
+ {
+ "text": "Octave Kernel",
+ "url": "https://github.com/Calysto/octave_kernel"
+ },
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://metakernel.readthedocs.io/en/latest/source/README.html"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "octave",
+ "version": "4.2.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/notebooks/more_on_saving.ipynb b/notebooks/saving_arrays.ipynb
similarity index 76%
rename from notebooks/more_on_saving.ipynb
rename to notebooks/saving_arrays.ipynb
index b3c25aea..c3cb9fd0 100644
--- a/notebooks/more_on_saving.ipynb
+++ b/notebooks/saving_arrays.ipynb
@@ -4,17 +4,22 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Saving arrays in the tsv file"
+ "## Saving arrays in the tsv file\n",
+ "\n",
+ "It is possible to save several values at once in a tsv file."
]
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
+ "clear cfg logFile\n",
+ "\n",
"% add the relevant functions from the src folder\n",
- "addpath(genpath(fullfile(pwd, '..', 'src')));\n",
+ "addpath(genpath(fullfile(pwd, '..', 'src')))\n",
+ "addpath(genpath(fullfile(pwd, '..', 'lib')))\n",
"\n",
"cfg.dir.output = fullfile(pwd, 'output');\n",
"\n",
@@ -25,7 +30,7 @@
"\n",
"cfg.testingDevice = 'mri';\n",
"\n",
- "cfg.verbose = false;\n",
+ "cfg.verbose = 1;\n",
"\n",
"[cfg] = createFilename(cfg);\n",
"\n",
@@ -41,24 +46,7 @@
},
{
"cell_type": "code",
- "execution_count": 10,
- "metadata": {},
- "outputs": [],
- "source": [
- "logFile.extraColumns.target_position.length = 2;\n",
- "logFile.extraColumns.target_type.length = 1;"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "Note that it is also possible to directly open the file: things will be intialised automatically."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 11,
+ "execution_count": 23,
"metadata": {},
"outputs": [
{
@@ -70,6 +58,10 @@
}
],
"source": [
+ "logFile.extraColumns.target_position.length = 2;\n",
+ "logFile.extraColumns.target_type.length = 1;\n",
+ "\n",
+ "logFile = saveEventsFile('init', cfg, logFile);\n",
"logFile = saveEventsFile('open', cfg, logFile);"
]
},
@@ -82,7 +74,7 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 18,
"metadata": {
"scrolled": true
},
@@ -91,7 +83,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "2.000000\t1.000000\tmotion_up\tn/a\tn/a\tn/a\t2.000000\t1.000000\tvisual\t\r\n"
+ "ans = 2\r\n",
+ "ans = 1\r\n",
+ "ans = 2\r\n",
+ "ans = 1\r\n",
+ "\r\n",
+ "ans = 4\r\n",
+ "ans = 1\r\n",
+ "ans = 2\r\n",
+ "ans = 1\r\n",
+ "\r\n"
]
}
],
@@ -99,16 +100,16 @@
"% Trial one : missing duration value\n",
"logFile(1,1).onset = 2;\n",
"logFile(1,1).trial_type = 'motion_up';\n",
- "logFile(1,1).duration = [];\n",
+ "logFile(1,1).duration = 1;\n",
"logFile(1,1).target_position = [2, 1];\n",
"logFile(1,1).target_type = 'visual';\n",
"\n",
"% Trial two\n",
- "logFile(1,1).onset = 2;\n",
- "logFile(1,1).trial_type = 'motion_up';\n",
- "logFile(1,1).duration = 1;\n",
- "logFile(1,1).target_position = [2, 1];\n",
- "logFile(1,1).target_type = 'visual';\n",
+ "logFile(2,1).onset = 4;\n",
+ "logFile(2,1).trial_type = 'motion_up';\n",
+ "logFile(2,1).duration = 1;\n",
+ "logFile(2,1).target_position = [2, 1];\n",
+ "logFile(2,1).target_type = 'visual';\n",
"\n",
"logFile = saveEventsFile('save', cfg, logFile);"
]
@@ -122,7 +123,7 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 19,
"metadata": {},
"outputs": [
{
@@ -131,11 +132,14 @@
"text": [
"warning: Missing some target_position data for this event.\r\n",
"warning: called from\r\n",
- " saveEventsFile>checkExtracolumns at line 219 column 13\r\n",
- " saveEventsFile>checklLogFile at line 140 column 21\r\n",
- " saveEventsFile>saveToLogFile at line 282 column 17\r\n",
- " saveEventsFile at line 90 column 21\r\n",
- "6.000000\t1.200000\tstatic\tn/a\tn/a\tn/a\t3.000000\tn/a\taudio\t\r\n"
+ " saveEventsFile>checkExtracolumns at line 288 column 13\r\n",
+ " saveEventsFile>checklLogFile at line 173 column 21\r\n",
+ " saveEventsFile>saveToLogFile at line 351 column 17\r\n",
+ " saveEventsFile at line 123 column 21\r\n",
+ "ans = 6\r\n",
+ "ans = 1.2000\r\n",
+ "ans = 3\r\n",
+ "\r\n"
]
}
],
@@ -159,7 +163,7 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 20,
"metadata": {},
"outputs": [
{
@@ -168,12 +172,16 @@
"text": [
"warning: A field for this event is longer than expected. Truncating the extra values.\r\n",
"warning: called from\r\n",
- " saveEventsFile>nanPadding at line 269 column 9\r\n",
- " saveEventsFile>checkExtracolumns at line 214 column 14\r\n",
- " saveEventsFile>checklLogFile at line 140 column 21\r\n",
- " saveEventsFile>saveToLogFile at line 282 column 17\r\n",
- " saveEventsFile at line 90 column 21\r\n",
- "6.000000\t1.200000\tstatic\tn/a\tn/a\tn/a\t3.000000\t4.000000\ttouch\t\r\n"
+ " saveEventsFile>nanPadding at line 338 column 9\r\n",
+ " saveEventsFile>checkExtracolumns at line 283 column 14\r\n",
+ " saveEventsFile>checklLogFile at line 173 column 21\r\n",
+ " saveEventsFile>saveToLogFile at line 351 column 17\r\n",
+ " saveEventsFile at line 123 column 21\r\n",
+ "ans = 6\r\n",
+ "ans = 1.2000\r\n",
+ "ans = 3\r\n",
+ "ans = 4\r\n",
+ "\r\n"
]
}
],
@@ -190,7 +198,7 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 21,
"metadata": {},
"outputs": [
{
@@ -200,7 +208,7 @@
"\r\n",
"Data were saved in this file:\r\n",
"\r\n",
- "/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/func/sub-001_ses-001_task-testTask_run-001_events_date-202008142241.tsv\r\n",
+ "/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/func/sub-001_ses-001_task-testTask_run-001_events_date-202011171253.tsv\r\n",
"\r\n"
]
}
@@ -222,7 +230,7 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 22,
"metadata": {},
"outputs": [
{
@@ -245,15 +253,9 @@
"logFile.extraColumns.Speed.length = 12;\n",
"\n",
"% open the file\n",
+ "logFile = saveEventsFile('init', cfg, logFile);\n",
"logFile = saveEventsFile('open', cfg, logFile);\n"
]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Saving `_stim.tsv` files"
- ]
}
],
"metadata": {
diff --git a/notebooks/saving_stim_files.ipynb b/notebooks/saving_stim_files.ipynb
new file mode 100644
index 00000000..320f0829
--- /dev/null
+++ b/notebooks/saving_stim_files.ipynb
@@ -0,0 +1,47 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Saving `_stim.tsv` files"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Octave",
+ "language": "octave",
+ "name": "octave"
+ },
+ "language_info": {
+ "file_extension": ".m",
+ "help_links": [
+ {
+ "text": "GNU Octave",
+ "url": "https://www.gnu.org/software/octave/support.html"
+ },
+ {
+ "text": "Octave Kernel",
+ "url": "https://github.com/Calysto/octave_kernel"
+ },
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://metakernel.readthedocs.io/en/latest/source/README.html"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "octave",
+ "version": "4.2.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/notebooks/using_2_logfiles.ipynb b/notebooks/using_2_logfiles.ipynb
index 77f76f4d..ef29eddb 100644
--- a/notebooks/using_2_logfiles.ipynb
+++ b/notebooks/using_2_logfiles.ipynb
@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# saving two `_events.tsv` for the same run\n",
+ "# Saving two `_events.tsv` for the same run\n",
"\n",
"This won't create BIDS valid output but this might help you organize some of your output in different TSV files.\n",
"\n"
@@ -17,18 +17,15 @@
"outputs": [],
"source": [
"% add the relevant functions from the src folder\n",
- "addpath(genpath(fullfile(pwd, '..', 'src')));\n",
+ "addpath(genpath(fullfile(pwd, '..', 'src')))\n",
+ "addpath(genpath(fullfile(pwd, '..', 'lib')))\n",
"\n",
"cfg.dir.output = fullfile(pwd, 'output');\n",
"\n",
"cfg.task.name = 'test task';\n",
"\n",
"cfg.subject.subjectNb = 1;\n",
- "cfg.subject.runNb = 1;\n",
- "\n",
- "cfg.testingDevice = 'pc';\n",
- "\n",
- "cfg.verbose = true;"
+ "cfg.subject.runNb = 1;"
]
},
{
@@ -50,11 +47,34 @@
"output_type": "stream",
"text": [
"\r\n",
- "Data will be saved in this directory:\r\n",
- "\t/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/beh\r\n",
"\r\n",
- "Data will be saved in this file:\r\n",
- "\tsub-001_ses-001_task-testTask_run-001_events_date-202010191603.tsv\r\n"
+ "___________________________________________________\r\n",
+ "___________________________________________________\r\n",
+ " \r\n",
+ " ___ ___ ___ ___ ___ ___ ___ \r\n",
+ " / __| _ \\ _ \\ | _ )_ _| \\/ __|\r\n",
+ " | (__| _/ _/ | _ \\| || |) \\__ \\\r\n",
+ " \\___|_| |_| |___/___|___/|___/\r\n",
+ " \r\n",
+ "Thank you for using the CPP BIDS - version v1.0.0. \r\n",
+ "\r\n",
+ "Current list of contributors includes:\r\n",
+ " Rémi Gau\r\n",
+ " Marco Barilari\r\n",
+ " Ceren Battal\r\n",
+ " Tomas Lenc\r\n",
+ "\b\r\n",
+ "\r\n",
+ "Please cite using the following DOI: \r\n",
+ " https://doi.org/10.5281/zenodo.4007674\r\n",
+ "\r\n",
+ "For bug report, suggestions or contributions see: \r\n",
+ " https://github.com/cpp-lln-lab/CPP_BIDS\r\n",
+ "\r\n",
+ "___________________________________________________\r\n",
+ "___________________________________________________\r\n",
+ "\r\n",
+ "\r\n"
]
}
],
@@ -77,6 +97,7 @@
}
],
"source": [
+ "logFile = saveEventsFile('init', cfg, logFile);\n",
"logFile = saveEventsFile('open', cfg, logFile);"
]
},
@@ -91,20 +112,7 @@
"cell_type": "code",
"execution_count": 4,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\r\n",
- "Data will be saved in this directory:\r\n",
- "\t/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/beh\r\n",
- "\r\n",
- "Data will be saved in this file:\r\n",
- "\tsub-001_ses-001_task-testTask_acq-extraInfo_run-001_events_date-202010191603.tsv\r\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"% we use a copy of the configuration and we modify the 'acq' field in the BIDS naming convention\n",
"cfg_2 = cfg;\n",
@@ -128,6 +136,7 @@
}
],
"source": [
+ "logFile_2 = saveEventsFile('init', cfg_2, logFile_2);\n",
"logFile_2 = saveEventsFile('open', cfg_2, logFile_2);\n",
"clear cfg2 % we don't need it anymore as this was only need to create the new filename"
]
@@ -150,12 +159,22 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "2.000000\t0.500000\tmotion_up\t2.000000\tvisual\t\n",
- "3.000000\t1.000000\tmotion_down\t1.000000\tvisual\t\n",
+ "ans = 2\n",
+ "ans = 0.50000\n",
+ "ans = 2\n",
+ "\n",
+ "ans = 3\n",
+ "ans = 1\n",
+ "ans = 1\n",
"\n",
"\n",
- "2.000000\t0.500000\tmotion_up\tred\t\n",
- "3.000000\t1.000000\tmotion_down\tblue\t\n"
+ "\n",
+ "ans = 2\n",
+ "ans = 0.50000\n",
+ "\n",
+ "ans = 3\n",
+ "ans = 1\n",
+ "\n"
]
}
],
@@ -198,24 +217,7 @@
"cell_type": "code",
"execution_count": 7,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "Data were saved in this file:\n",
- "\n",
- "/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/beh/sub-001_ses-001_task-testTask_run-001_events_date-202010191603.tsv\n",
- "\n",
- "\n",
- "Data were saved in this file:\n",
- "\n",
- "/home/remi/github/CPP_BIDS/notebooks/output/source/sub-001/ses-001/beh/sub-001_ses-001_task-testTask_acq-extraInfo_run-001_events_date-202010191603.tsv\n",
- "\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"saveEventsFile('close', cfg, logFile);\n",
"saveEventsFile('close', cfg, logFile_2);"
diff --git a/src/utils/checkCppBidsDependencies.m b/src/utils/checkCppBidsDependencies.m
index 88cd1833..1bb82894 100644
--- a/src/utils/checkCppBidsDependencies.m
+++ b/src/utils/checkCppBidsDependencies.m
@@ -16,21 +16,23 @@ function checkCppBidsDependencies(cfg)
if strcmp(GITHUB_WORKSPACE, '/github/workspace')
pth = GITHUB_WORKSPACE;
- addpath(fullfile(pth, 'lib', 'JSONio'));
- addpath(fullfile(pth, 'lib', 'bids-matlab'));
+ addpath(genpath(fullfile(pth, 'lib')));
elseif isempty(GITHUB_WORKSPACE) % local
pth = fullfile(fileparts(mfilename('fullpath')), '..', '..');
+ addpath(fullfile(pth, 'lib', 'utils'));
+
+ pth = fullfile(fileparts(mfilename('fullpath')), '..', '..');
+ pth = abspath(pth);
+
checkSubmodule(fullfile(pth, 'lib', 'JSONio'));
checkSubmodule(fullfile(pth, 'lib', 'bids-matlab'));
- addpath(fullfile(pth, 'src', 'subfun'));
+ addpath(genpath(fullfile(pth, 'src')));
end
- addpath(fullfile(pth, 'lib', 'utils'));
-
printCreditsCppBids(cfg);
end
diff --git a/src/utils/printCreditsCppBids.m b/src/utils/printCreditsCppBids.m
index 46209414..e7547ce0 100644
--- a/src/utils/printCreditsCppBids.m
+++ b/src/utils/printCreditsCppBids.m
@@ -30,8 +30,9 @@ function printCreditsCppBids(cfg)
contributors = { ...
'Rémi Gau', ...
'Marco Barilari', ...
- 'Ceren Battal'};
-
+ 'Ceren Battal', ...
+ 'Tomas Lenc'};
+
DOI_URL = 'https://doi.org/10.5281/zenodo.4007674';
repoURL = 'https://github.com/cpp-lln-lab/CPP_BIDS';
diff --git a/src/utils/utilsForTests/setUp.m b/src/utils/utilsForTests/setUp.m
index 0f7cf9eb..ec282c03 100644
--- a/src/utils/utilsForTests/setUp.m
+++ b/src/utils/utilsForTests/setUp.m
@@ -2,7 +2,7 @@
function [cfg, logFile] = setUp()
- cfg.verbose = true;
+ cfg.verbose = 2;
cfg.subject.subjectNb = 1;
cfg.subject.runNb = 1;