Running NiBetaSeries

This example runs through a basic call of NiBetaSeries using the commandline entry point nibs. While this example is using python, typically nibs will be called directly on the commandline.

Import all the necessary packages

import tempfile  # make a temporary directory for files
import os  # interact with the filesystem
import urllib.request  # grad data from internet
import tarfile  # extract files from tar
from subprocess import Popen, PIPE, STDOUT  # enable calling commandline

import matplotlib.pyplot as plt  # manipulate figures
import seaborn as sns  # display results
import pandas as pd   # manipulate tabular data
import nibabel as nib  # load the beta maps in python
from nilearn import plotting  # plot nifti images

Download relevant data from ds000164 (and Atlas Files)

The subject data came from openneuro [notebook-1]. The atlas data came from a recently published parcellation in a publically accessible github repository.

# atlas github repo for reference:
"""https://github.com/ThomasYeoLab/CBIG/raw/master/stable_projects/\
brain_parcellation/Schaefer2018_LocalGlobal/Parcellations/MNI/"""
data_dir = tempfile.mkdtemp()
print('Our working directory: {}'.format(data_dir))

# download the tar data
url = "https://www.dropbox.com/s/fvtyld08srwl3x9/ds000164-test_v2.tar.gz?dl=1"
tar_file = os.path.join(data_dir, "ds000164.tar.gz")
u = urllib.request.urlopen(url)
data = u.read()
u.close()

# write tar data to file
with open(tar_file, "wb") as f:
    f.write(data)

# extract the data
tar = tarfile.open(tar_file, mode='r|gz')
tar.extractall(path=data_dir)

os.remove(tar_file)

Out:

Our working directory: /tmp/tmphvcov12o

Display the minimal dataset necessary to run nibs

# https://stackoverflow.com/questions/9727673/list-directory-tree-structure-in-python
def list_files(startpath):
    for root, dirs, files in os.walk(startpath):
        level = root.replace(startpath, '').count(os.sep)
        indent = ' ' * 4 * (level)
        print('{}{}/'.format(indent, os.path.basename(root)))
        subindent = ' ' * 4 * (level + 1)
        for f in files:
            print('{}{}'.format(subindent, f))


list_files(data_dir)

Out:

tmphvcov12o/
    ds000164/
        task-stroop_events.json
        dataset_description.json
        T1w.json
        README
        task-stroop_bold.json
        CHANGES
        derivatives/
            fmriprep/
                dataset_description.json
                sub-001/
                    func/
                        sub-001_task-stroop_desc-confounds_regressors.tsv
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
            data/
                Schaefer2018_100Parcels_7Networks_order.txt
                Schaefer2018_100Parcels_7Networks_order_FSLMNI152_2mm.nii.gz
        sub-001/
            func/
                sub-001_task-stroop_bold.nii.gz
                sub-001_task-stroop_events.tsv
            anat/
                sub-001_T1w.nii.gz

Manipulate events file so it satifies assumptions

1. the correct column has 1’s and 0’s corresponding to correct and incorrect, respectively. 2. the condition column is renamed to trial_type nibs currently depends on the “correct” column being binary and the “trial_type” column to contain the trial types of interest.

read the file

events_file = os.path.join(data_dir,
                           "ds000164",
                           "sub-001",
                           "func",
                           "sub-001_task-stroop_events.tsv")
events_df = pd.read_csv(events_file, sep='\t', na_values="n/a")
print(events_df.head())

Out:

    onset  duration correct  condition  response_time
0   0.342         1       Y    neutral          1.186
1   3.345         1       Y  congruent          0.667
2  12.346         1       Y  congruent          0.614
3  15.349         1       Y    neutral          0.696
4  18.350         1       Y    neutral          0.752

replace condition with trial_type

events_df.rename({"condition": "trial_type"}, axis='columns', inplace=True)
print(events_df.head())

Out:

    onset  duration correct trial_type  response_time
0   0.342         1       Y    neutral          1.186
1   3.345         1       Y  congruent          0.667
2  12.346         1       Y  congruent          0.614
3  15.349         1       Y    neutral          0.696
4  18.350         1       Y    neutral          0.752

save the file

events_df.to_csv(events_file, sep="\t", na_rep="n/a", index=False)

Manipulate the region order file

There are several adjustments to the atlas file that need to be completed before we can pass it into nibs. Importantly, the relevant column names MUST be named “index” and “regions”. “index” refers to which integer within the file corresponds to which region in the atlas nifti file. “regions” refers the name of each region in the atlas nifti file.

read the atlas file

atlas_txt = os.path.join(data_dir,
                         "ds000164",
                         "derivatives",
                         "data",
                         "Schaefer2018_100Parcels_7Networks_order.txt")
atlas_df = pd.read_csv(atlas_txt, sep="\t", header=None)
print(atlas_df.head())

Out:

   0                   1    2   3    4  5
0  1  7Networks_LH_Vis_1  120  18  131  0
1  2  7Networks_LH_Vis_2  120  18  132  0
2  3  7Networks_LH_Vis_3  120  18  133  0
3  4  7Networks_LH_Vis_4  120  18  135  0
4  5  7Networks_LH_Vis_5  120  18  136  0

drop color coding columns

atlas_df.drop([2, 3, 4, 5], axis='columns', inplace=True)
print(atlas_df.head())

Out:

   0                   1
0  1  7Networks_LH_Vis_1
1  2  7Networks_LH_Vis_2
2  3  7Networks_LH_Vis_3
3  4  7Networks_LH_Vis_4
4  5  7Networks_LH_Vis_5

rename columns with the approved headings: “index” and “regions”

atlas_df.rename({0: 'index', 1: 'regions'}, axis='columns', inplace=True)
print(atlas_df.head())

Out:

   index             regions
0      1  7Networks_LH_Vis_1
1      2  7Networks_LH_Vis_2
2      3  7Networks_LH_Vis_3
3      4  7Networks_LH_Vis_4
4      5  7Networks_LH_Vis_5

remove prefix “7Networks”

atlas_df.replace(regex={'7Networks_(.*)': '\\1'}, inplace=True)
print(atlas_df.head())

Out:

   index   regions
0      1  LH_Vis_1
1      2  LH_Vis_2
2      3  LH_Vis_3
3      4  LH_Vis_4
4      5  LH_Vis_5

write out the file as .tsv

atlas_tsv = atlas_txt.replace(".txt", ".tsv")
atlas_df.to_csv(atlas_tsv, sep="\t", index=False)

Run nibs

This demonstration mimics how you would use nibs on the command line If you only wanted the beta maps and not the correlation matrices, do not include the atlas (-a) and lookup table options (-l)

out_dir = os.path.join(data_dir, "ds000164", "derivatives")
work_dir = os.path.join(out_dir, "work")
atlas_mni_file = os.path.join(data_dir,
                              "ds000164",
                              "derivatives",
                              "data",
                              "Schaefer2018_100Parcels_7Networks_order_FSLMNI152_2mm.nii.gz")
cmd = """\
nibs -c WhiteMatter CSF \
--participant-label 001 \
--estimator lsa \
--hrf-model glover \
-w {work_dir} \
-a {atlas_mni_file} \
-l {atlas_tsv} \
{bids_dir} \
fmriprep \
{out_dir} \
participant
""".format(atlas_mni_file=atlas_mni_file,
           atlas_tsv=atlas_tsv,
           bids_dir=os.path.join(data_dir, "ds000164"),
           out_dir=out_dir,
           work_dir=work_dir)

# Since we cannot run bash commands inside this tutorial
# we are printing the actual bash command so you can see it
# in the output
print("The Example Command:\n", cmd)

# call nibs
p = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)

while True:
    line = p.stdout.readline()
    if not line:
        break
    print(line)

Out:

The Example Command:
 nibs -c WhiteMatter CSF --participant-label 001 --estimator lsa --hrf-model glover -w /tmp/tmphvcov12o/ds000164/derivatives/work -a /tmp/tmphvcov12o/ds000164/derivatives/data/Schaefer2018_100Parcels_7Networks_order_FSLMNI152_2mm.nii.gz -l /tmp/tmphvcov12o/ds000164/derivatives/data/Schaefer2018_100Parcels_7Networks_order.tsv /tmp/tmphvcov12o/ds000164 fmriprep /tmp/tmphvcov12o/ds000164/derivatives participant

b'200320-20:15:14,98 nipype.utils INFO:\n'
b'\t No new version available.\n'
b'200320-20:15:14,228 nipype.workflow INFO:\n'
b"\t Workflow nibetaseries_participant_wf settings: ['check', 'execution', 'logging', 'monitoring']\n"
b'200320-20:15:14,300 nipype.workflow INFO:\n'
b'\t Running in parallel.\n'
b'200320-20:15:14,321 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b"/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/bids/layout/models.py:157: UserWarning: Accessing entities as attributes is deprecated as of 0.7. Please use the .entities dictionary instead (i.e., .entities['task'] instead of .task.\n"
b'  % (attr, attr))\n'
b"/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/bids/layout/models.py:157: UserWarning: Accessing entities as attributes is deprecated as of 0.7. Please use the .entities dictionary instead (i.e., .entities['space'] instead of .space.\n"
b'  % (attr, attr))\n'
b'200320-20:15:14,396 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "nibetaseries_participant_wf.single_subject001_wf.betaseries_wf.betaseries_node" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/betaseries_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/betaseries_node".\n'
b'200320-20:15:14,402 nipype.workflow INFO:\n'
b'\t [Node] Running "betaseries_node" ("nibetaseries.interfaces.nistats.LSABetaSeries")\n'
b'200320-20:15:16,315 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 6.79/6.99, Free processors: 3/4.\n'
b'                     Currently running:\n'
b'                       * nibetaseries_participant_wf.single_subject001_wf.betaseries_wf.betaseries_node\n'
b'200320-20:15:22,916 nipype.workflow INFO:\n'
b'\t [Node] Finished "nibetaseries_participant_wf.single_subject001_wf.betaseries_wf.betaseries_node".\n'
b'200320-20:15:24,321 nipype.workflow INFO:\n'
b'\t [Job 0] Completed (nibetaseries_participant_wf.single_subject001_wf.betaseries_wf.betaseries_node).\n'
b'200320-20:15:24,329 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 2 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:26,324 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 6 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:26,380 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_betaseries_file0" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_betaseries_file/mapflow/_ds_betaseries_file0".\n'
b'200320-20:15:26,381 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_betaseries_file1" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_betaseries_file/mapflow/_ds_betaseries_file1".\n'
b'200320-20:15:26,384 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_betaseries_file0" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:26,385 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_betaseries_file1" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:26,393 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_betaseries_file2" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_betaseries_file/mapflow/_ds_betaseries_file2".\n'
b'200320-20:15:26,396 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_censor_volumes0" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/censor_volumes/mapflow/_censor_volumes0".\n'
b'200320-20:15:26,398 nipype.workflow INFO:\n'
b'\t [Node] Running "_censor_volumes0" ("nibetaseries.interfaces.nilearn.CensorVolumes")\n'
b'200320-20:15:26,401 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_betaseries_file1".\n'
b'200320-20:15:26,401 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_betaseries_file0".\n'
b'200320-20:15:26,404 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_betaseries_file2" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:26,418 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_betaseries_file2".\n'
b'200320-20:15:26,459 nipype.workflow INFO:\n'
b'\t [Node] Finished "_censor_volumes0".\n'
b'200320-20:15:28,325 nipype.workflow INFO:\n'
b'\t [Job 7] Completed (_ds_betaseries_file0).\n'
b'200320-20:15:28,325 nipype.workflow INFO:\n'
b'\t [Job 8] Completed (_ds_betaseries_file1).\n'
b'200320-20:15:28,326 nipype.workflow INFO:\n'
b'\t [Job 9] Completed (_ds_betaseries_file2).\n'
b'200320-20:15:28,327 nipype.workflow INFO:\n'
b'\t [Job 10] Completed (_censor_volumes0).\n'
b'200320-20:15:28,328 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 3 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:28,382 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "nibetaseries_participant_wf.single_subject001_wf.ds_betaseries_file" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_betaseries_file".\n'
b'200320-20:15:28,384 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_censor_volumes1" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/censor_volumes/mapflow/_censor_volumes1".\n'
b'200320-20:15:28,386 nipype.workflow INFO:\n'
b'\t [Node] Running "_censor_volumes1" ("nibetaseries.interfaces.nilearn.CensorVolumes")\n'
b'200320-20:15:28,387 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_betaseries_file0" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_betaseries_file/mapflow/_ds_betaseries_file0".\n'
b'200320-20:15:28,389 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_censor_volumes2" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/censor_volumes/mapflow/_censor_volumes2".\n'
b'200320-20:15:28,389 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_betaseries_file0" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:28,391 nipype.workflow INFO:\n'
b'\t [Node] Running "_censor_volumes2" ("nibetaseries.interfaces.nilearn.CensorVolumes")\n'
b'200320-20:15:28,399 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_betaseries_file0".\n'
b'200320-20:15:28,401 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_betaseries_file1" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_betaseries_file/mapflow/_ds_betaseries_file1".\n'
b'200320-20:15:28,403 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_betaseries_file1" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:28,413 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_betaseries_file1".\n'
b'200320-20:15:28,414 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_betaseries_file2" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_betaseries_file/mapflow/_ds_betaseries_file2".\n'
b'200320-20:15:28,416 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_betaseries_file2" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:28,425 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_betaseries_file2".\n'
b'200320-20:15:28,427 nipype.workflow INFO:\n'
b'\t [Node] Finished "nibetaseries_participant_wf.single_subject001_wf.ds_betaseries_file".\n'
b'200320-20:15:28,449 nipype.workflow INFO:\n'
b'\t [Node] Finished "_censor_volumes2".\n'
b'200320-20:15:28,451 nipype.workflow INFO:\n'
b'\t [Node] Finished "_censor_volumes1".\n'
b'200320-20:15:30,327 nipype.workflow INFO:\n'
b'\t [Job 1] Completed (nibetaseries_participant_wf.single_subject001_wf.ds_betaseries_file).\n'
b'200320-20:15:30,328 nipype.workflow INFO:\n'
b'\t [Job 11] Completed (_censor_volumes1).\n'
b'200320-20:15:30,329 nipype.workflow INFO:\n'
b'\t [Job 12] Completed (_censor_volumes2).\n'
b'200320-20:15:30,330 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:30,387 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "nibetaseries_participant_wf.single_subject001_wf.censor_volumes" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/censor_volumes".\n'
b'200320-20:15:30,391 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_censor_volumes0" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/censor_volumes/mapflow/_censor_volumes0".\n'
b'200320-20:15:30,392 nipype.workflow INFO:\n'
b'\t [Node] Cached "_censor_volumes0" - collecting precomputed outputs\n'
b'200320-20:15:30,392 nipype.workflow INFO:\n'
b'\t [Node] "_censor_volumes0" found cached.\n'
b'200320-20:15:30,393 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_censor_volumes1" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/censor_volumes/mapflow/_censor_volumes1".\n'
b'200320-20:15:30,394 nipype.workflow INFO:\n'
b'\t [Node] Cached "_censor_volumes1" - collecting precomputed outputs\n'
b'200320-20:15:30,394 nipype.workflow INFO:\n'
b'\t [Node] "_censor_volumes1" found cached.\n'
b'200320-20:15:30,395 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_censor_volumes2" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/censor_volumes/mapflow/_censor_volumes2".\n'
b'200320-20:15:30,396 nipype.workflow INFO:\n'
b'\t [Node] Cached "_censor_volumes2" - collecting precomputed outputs\n'
b'200320-20:15:30,396 nipype.workflow INFO:\n'
b'\t [Node] "_censor_volumes2" found cached.\n'
b'200320-20:15:30,398 nipype.workflow INFO:\n'
b'\t [Node] Finished "nibetaseries_participant_wf.single_subject001_wf.censor_volumes".\n'
b'200320-20:15:32,329 nipype.workflow INFO:\n'
b'\t [Job 2] Completed (nibetaseries_participant_wf.single_subject001_wf.censor_volumes).\n'
b'200320-20:15:32,331 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:32,386 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "nibetaseries_participant_wf.single_subject001_wf.check_beta_series_list" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/check_beta_series_list".\n'
b'200320-20:15:32,390 nipype.workflow INFO:\n'
b'\t [Node] Running "check_beta_series_list" ("nipype.interfaces.utility.wrappers.Function")\n'
b'200320-20:15:32,398 nipype.workflow INFO:\n'
b'\t [Node] Finished "nibetaseries_participant_wf.single_subject001_wf.check_beta_series_list".\n'
b'200320-20:15:34,331 nipype.workflow INFO:\n'
b'\t [Job 3] Completed (nibetaseries_participant_wf.single_subject001_wf.check_beta_series_list).\n'
b'200320-20:15:34,333 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:36,334 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 3 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:36,381 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_atlas_corr_node0" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/correlation_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/atlas_corr_node/mapflow/_atlas_corr_node0".\n'
b'200320-20:15:36,382 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_atlas_corr_node1" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/correlation_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/atlas_corr_node/mapflow/_atlas_corr_node1".\n'
b'200320-20:15:36,384 nipype.workflow INFO:\n'
b'\t [Node] Running "_atlas_corr_node0" ("nibetaseries.interfaces.nilearn.AtlasConnectivity")\n'
b'200320-20:15:36,384 nipype.workflow INFO:\n'
b'\t [Node] Running "_atlas_corr_node1" ("nibetaseries.interfaces.nilearn.AtlasConnectivity")\n'
b'200320-20:15:36,384 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_atlas_corr_node2" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/correlation_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/atlas_corr_node/mapflow/_atlas_corr_node2".\n'
b'200320-20:15:36,387 nipype.workflow INFO:\n'
b'\t [Node] Running "_atlas_corr_node2" ("nibetaseries.interfaces.nilearn.AtlasConnectivity")\n'
b'200320-20:15:38,335 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 3 tasks, and 0 jobs ready. Free memory (GB): 6.39/6.99, Free processors: 1/4.\n'
b'                     Currently running:\n'
b'                       * _atlas_corr_node2\n'
b'                       * _atlas_corr_node1\n'
b'                       * _atlas_corr_node0\n'
b'[NiftiLabelsMasker.fit_transform] loading data from /tmp/tmphvcov12o/ds000164/derivatives/data/Schaefer2018_100Parcels_7Networks_order_FSLMNI152_2mm.nii.gz\n'
b'Resampling labels\n'
b'[NiftiLabelsMasker.transform_single_imgs] Loading data from /tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/betaseries_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/betaseries_node/desc-neutral_betase\n'
b'[NiftiLabelsMasker.transform_single_imgs] Extracting region signals\n'
b'[NiftiLabelsMasker.transform_single_imgs] Cleaning extracted signals\n'
b'200320-20:15:48,58 nipype.workflow INFO:\n'
b'\t [Node] Finished "_atlas_corr_node0".\n'
b'[NiftiLabelsMasker.fit_transform] loading data from /tmp/tmphvcov12o/ds000164/derivatives/data/Schaefer2018_100Parcels_7Networks_order_FSLMNI152_2mm.nii.gz\n'
b'Resampling labels\n'
b'[NiftiLabelsMasker.transform_single_imgs] Loading data from /tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/betaseries_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/betaseries_node/desc-incongruent_be\n'
b'[NiftiLabelsMasker.transform_single_imgs] Extracting region signals\n'
b'[NiftiLabelsMasker.transform_single_imgs] Cleaning extracted signals\n'
b'200320-20:15:48,70 nipype.workflow INFO:\n'
b'\t [Node] Finished "_atlas_corr_node2".\n'
b'[NiftiLabelsMasker.fit_transform] loading data from /tmp/tmphvcov12o/ds000164/derivatives/data/Schaefer2018_100Parcels_7Networks_order_FSLMNI152_2mm.nii.gz\n'
b'Resampling labels\n'
b'[NiftiLabelsMasker.transform_single_imgs] Loading data from /tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/betaseries_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/betaseries_node/desc-congruent_beta\n'
b'[NiftiLabelsMasker.transform_single_imgs] Extracting region signals\n'
b'[NiftiLabelsMasker.transform_single_imgs] Cleaning extracted signals\n'
b'200320-20:15:48,248 nipype.workflow INFO:\n'
b'\t [Node] Finished "_atlas_corr_node1".\n'
b'200320-20:15:48,345 nipype.workflow INFO:\n'
b'\t [Job 13] Completed (_atlas_corr_node0).\n'
b'200320-20:15:48,346 nipype.workflow INFO:\n'
b'\t [Job 14] Completed (_atlas_corr_node1).\n'
b'200320-20:15:48,346 nipype.workflow INFO:\n'
b'\t [Job 15] Completed (_atlas_corr_node2).\n'
b'200320-20:15:48,348 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:48,404 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "nibetaseries_participant_wf.single_subject001_wf.correlation_wf.atlas_corr_node" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/correlation_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/atlas_corr_node".\n'
b'200320-20:15:48,409 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_atlas_corr_node0" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/correlation_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/atlas_corr_node/mapflow/_atlas_corr_node0".\n'
b'200320-20:15:48,410 nipype.workflow INFO:\n'
b'\t [Node] Cached "_atlas_corr_node0" - collecting precomputed outputs\n'
b'200320-20:15:48,410 nipype.workflow INFO:\n'
b'\t [Node] "_atlas_corr_node0" found cached.\n'
b'200320-20:15:48,411 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_atlas_corr_node1" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/correlation_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/atlas_corr_node/mapflow/_atlas_corr_node1".\n'
b'200320-20:15:48,412 nipype.workflow INFO:\n'
b'\t [Node] Cached "_atlas_corr_node1" - collecting precomputed outputs\n'
b'200320-20:15:48,412 nipype.workflow INFO:\n'
b'\t [Node] "_atlas_corr_node1" found cached.\n'
b'200320-20:15:48,413 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_atlas_corr_node2" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/correlation_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/atlas_corr_node/mapflow/_atlas_corr_node2".\n'
b'200320-20:15:48,415 nipype.workflow INFO:\n'
b'\t [Node] Cached "_atlas_corr_node2" - collecting precomputed outputs\n'
b'200320-20:15:48,415 nipype.workflow INFO:\n'
b'\t [Node] "_atlas_corr_node2" found cached.\n'
b'200320-20:15:48,416 nipype.workflow INFO:\n'
b'\t [Node] Finished "nibetaseries_participant_wf.single_subject001_wf.correlation_wf.atlas_corr_node".\n'
b'200320-20:15:50,347 nipype.workflow INFO:\n'
b'\t [Job 4] Completed (nibetaseries_participant_wf.single_subject001_wf.correlation_wf.atlas_corr_node).\n'
b'200320-20:15:50,349 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 2 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:52,350 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 6 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:52,405 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_fig0" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_fig/mapflow/_ds_correlation_fig0".\n'
b'200320-20:15:52,406 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_fig1" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_fig/mapflow/_ds_correlation_fig1".\n'
b'200320-20:15:52,407 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_fig0" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:52,408 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_fig1" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:52,409 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_fig2" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_fig/mapflow/_ds_correlation_fig2".\n'
b'200320-20:15:52,410 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_matrix0" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_matrix/mapflow/_ds_correlation_matrix0".\n'
b'200320-20:15:52,411 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_fig2" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:52,412 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_matrix0" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:52,427 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_matrix0".\n'
b'200320-20:15:52,429 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_fig2".\n'
b'200320-20:15:52,435 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_fig0".\n'
b'200320-20:15:52,438 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_fig1".\n'
b'200320-20:15:54,351 nipype.workflow INFO:\n'
b'\t [Job 16] Completed (_ds_correlation_fig0).\n'
b'200320-20:15:54,352 nipype.workflow INFO:\n'
b'\t [Job 17] Completed (_ds_correlation_fig1).\n'
b'200320-20:15:54,352 nipype.workflow INFO:\n'
b'\t [Job 18] Completed (_ds_correlation_fig2).\n'
b'200320-20:15:54,353 nipype.workflow INFO:\n'
b'\t [Job 19] Completed (_ds_correlation_matrix0).\n'
b'200320-20:15:54,354 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 3 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:54,406 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "nibetaseries_participant_wf.single_subject001_wf.ds_correlation_fig" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_fig".\n'
b'200320-20:15:54,408 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_matrix2" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_matrix/mapflow/_ds_correlation_matrix2".\n'
b'200320-20:15:54,410 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_fig0" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_fig/mapflow/_ds_correlation_fig0".\n'
b'200320-20:15:54,410 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_matrix2" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:54,413 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_fig0" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:54,416 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_matrix1" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_matrix/mapflow/_ds_correlation_matrix1".\n'
b'200320-20:15:54,418 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_matrix1" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:54,426 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_fig0".\n'
b'200320-20:15:54,426 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_matrix1".\n'
b'200320-20:15:54,427 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_fig1" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_fig/mapflow/_ds_correlation_fig1".\n'
b'200320-20:15:54,430 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_fig1" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:54,430 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_matrix2".\n'
b'200320-20:15:54,441 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_fig1".\n'
b'200320-20:15:54,442 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_fig2" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_fig/mapflow/_ds_correlation_fig2".\n'
b'200320-20:15:54,445 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_fig2" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:54,456 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_fig2".\n'
b'200320-20:15:54,458 nipype.workflow INFO:\n'
b'\t [Node] Finished "nibetaseries_participant_wf.single_subject001_wf.ds_correlation_fig".\n'
b'200320-20:15:56,353 nipype.workflow INFO:\n'
b'\t [Job 5] Completed (nibetaseries_participant_wf.single_subject001_wf.ds_correlation_fig).\n'
b'200320-20:15:56,354 nipype.workflow INFO:\n'
b'\t [Job 20] Completed (_ds_correlation_matrix1).\n'
b'200320-20:15:56,355 nipype.workflow INFO:\n'
b'\t [Job 21] Completed (_ds_correlation_matrix2).\n'
b'200320-20:15:56,357 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b'200320-20:15:56,410 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "nibetaseries_participant_wf.single_subject001_wf.ds_correlation_matrix" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_matrix".\n'
b'200320-20:15:56,414 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_matrix0" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_matrix/mapflow/_ds_correlation_matrix0".\n'
b'200320-20:15:56,416 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_matrix0" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:56,425 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_matrix0".\n'
b'200320-20:15:56,426 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_matrix1" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_matrix/mapflow/_ds_correlation_matrix1".\n'
b'200320-20:15:56,428 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_matrix1" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:56,436 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_matrix1".\n'
b'200320-20:15:56,437 nipype.workflow INFO:\n'
b'\t [Node] Setting-up "_ds_correlation_matrix2" in "/tmp/tmphvcov12o/ds000164/derivatives/work/NiBetaSeries_work/nibetaseries_participant_wf/single_subject001_wf/be88f8479de851cec27ee0e444fe7a56a8598c6d/ds_correlation_matrix/mapflow/_ds_correlation_matrix2".\n'
b'200320-20:15:56,439 nipype.workflow INFO:\n'
b'\t [Node] Running "_ds_correlation_matrix2" ("nibetaseries.interfaces.bids.DerivativesDataSink")\n'
b'200320-20:15:56,447 nipype.workflow INFO:\n'
b'\t [Node] Finished "_ds_correlation_matrix2".\n'
b'200320-20:15:56,449 nipype.workflow INFO:\n'
b'\t [Node] Finished "nibetaseries_participant_wf.single_subject001_wf.ds_correlation_matrix".\n'
b'200320-20:15:58,355 nipype.workflow INFO:\n'
b'\t [Job 6] Completed (nibetaseries_participant_wf.single_subject001_wf.ds_correlation_matrix).\n'
b'200320-20:15:58,357 nipype.workflow INFO:\n'
b'\t [MultiProc] Running 0 tasks, and 0 jobs ready. Free memory (GB): 6.99/6.99, Free processors: 4/4.\n'
b"/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/sklearn/feature_extraction/text.py:17: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working\n"
b'  from collections import Mapping, defaultdict\n'
b'/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/nibetaseries/interfaces/nilearn.py:130: RuntimeWarning: invalid value encountered in greater\n'
b'  n_lines = int(np.sum(connmat > 0) / 2)\n'
b"/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/sklearn/feature_extraction/text.py:17: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working\n"
b'  from collections import Mapping, defaultdict\n'
b'/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/nibetaseries/interfaces/nilearn.py:130: RuntimeWarning: invalid value encountered in greater\n'
b'  n_lines = int(np.sum(connmat > 0) / 2)\n'
b'/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/nibetaseries/interfaces/nistats.py:216: DeprecationWarning: The parameter "mask" will be removed in next release of Nistats. Please use the parameter "mask_img" instead.\n'
b'  minimize_memory=False,\n'
b'Computing run 1 out of 1 runs (go take a coffee, a big one)\n'
b'\n'
b'Computation of 1 runs done in 5 seconds\n'
b'\n'
b"/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/nistats/regression.py:339: FutureWarning: 'resid' from RegressionResults has been deprecated and will be removed. Please use 'residuals' instead.\n"
b'  FutureWarning,\n'
b"/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/sklearn/feature_extraction/text.py:17: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working\n"
b'  from collections import Mapping, defaultdict\n'
b'/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/nibetaseries/interfaces/nilearn.py:130: RuntimeWarning: invalid value encountered in greater\n'
b'  n_lines = int(np.sum(connmat > 0) / 2)\n'
b'pandoc: Error running filter pandoc-citeproc:\n'
b"Could not find executable 'pandoc-citeproc'.\n"
b'Could not generate CITATION.html file:\n'
b'pandoc -s --bibliography /home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/nibetaseries/data/references.bib --filter pandoc-citeproc --metadata pagetitle="NiBetaSeries citation boilerplate" /tmp/tmphvcov12o/ds000164/derivatives/nibetaseries/logs/CITATION.md -o /tmp/tmphvcov12o/ds000164/derivatives/nibetaseries/logs/CITATION.html\n'

Observe generated outputs

list_files(data_dir)

Out:

tmphvcov12o/
    ds000164/
        task-stroop_events.json
        dataset_description.json
        T1w.json
        README
        task-stroop_bold.json
        CHANGES
        derivatives/
            fmriprep/
                fMRIPrep.sqlite
                dataset_description.json
                sub-001/
                    func/
                        sub-001_task-stroop_desc-confounds_regressors.tsv
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
            nibetaseries/
                logs/
                    CITATION.bib
                    CITATION.md
                    CITATION.tex
                sub-001/
                    func/
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-congruent_correlation.svg
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-incongruent_correlation.svg
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-neutral_correlation.tsv
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-neutral_betaseries.nii.gz
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-incongruent_correlation.tsv
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-incongruent_betaseries.nii.gz
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-neutral_correlation.svg
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-congruent_betaseries.nii.gz
                        sub-001_task-stroop_space-MNI152NLin2009cAsym_desc-congruent_correlation.tsv
            work/
                dbcache
                NiBetaSeries_work/
                    nibetaseries_participant_wf/
                        graph1.json
                        index.html
                        graph.json
                        d3.js
                        single_subject001_wf/
                            be88f8479de851cec27ee0e444fe7a56a8598c6d/
                                censor_volumes/
                                    _node.pklz
                                    _inputs.pklz
                                    _0x6f805cc53fd12d3ba5cae9b559315d9d.json
                                    result_censor_volumes.pklz
                                    _report/
                                        report.rst
                                    mapflow/
                                        _censor_volumes0/
                                            _0xc45174ba67a744b372bb745c0016a068.json
                                            _node.pklz
                                            result__censor_volumes0.pklz
                                            _inputs.pklz
                                            _report/
                                                report.rst
                                        _censor_volumes1/
                                            _node.pklz
                                            result__censor_volumes1.pklz
                                            _0xb5cff9508d598e63fcb3b968877688de.json
                                            _inputs.pklz
                                            _report/
                                                report.rst
                                        _censor_volumes2/
                                            _node.pklz
                                            _0x698a29243ebb5f7848f0eaf91bbb25ae.json
                                            result__censor_volumes2.pklz
                                            _inputs.pklz
                                            _report/
                                                report.rst
                                ds_correlation_fig/
                                    _0x5851564c514f9fe7f6cda313649cefa5.json
                                    _node.pklz
                                    result_ds_correlation_fig.pklz
                                    _inputs.pklz
                                    _report/
                                        report.rst
                                    mapflow/
                                        _ds_correlation_fig0/
                                            _node.pklz
                                            _inputs.pklz
                                            _0x3b90987315ef499f7da10e2acbf4aabb.json
                                            result__ds_correlation_fig0.pklz
                                            _report/
                                                report.rst
                                        _ds_correlation_fig2/
                                            result__ds_correlation_fig2.pklz
                                            _node.pklz
                                            _inputs.pklz
                                            _0x20ae5f1caf5398f07e8d200248f3849a.json
                                            _report/
                                                report.rst
                                        _ds_correlation_fig1/
                                            _node.pklz
                                            _0x277e302dca216b38f17aa2e151c87110.json
                                            result__ds_correlation_fig1.pklz
                                            _inputs.pklz
                                            _report/
                                                report.rst
                                ds_correlation_matrix/
                                    _node.pklz
                                    result_ds_correlation_matrix.pklz
                                    _inputs.pklz
                                    _0x810fa1ca1227334fe993ec3c83b04468.json
                                    _report/
                                        report.rst
                                    mapflow/
                                        _ds_correlation_matrix0/
                                            _node.pklz
                                            _inputs.pklz
                                            result__ds_correlation_matrix0.pklz
                                            _0xc72c39bd65cc269df899c4152db65148.json
                                            _report/
                                                report.rst
                                        _ds_correlation_matrix1/
                                            _node.pklz
                                            _0xbd0aba1914429e59c0e2fc933e219bf1.json
                                            _inputs.pklz
                                            result__ds_correlation_matrix1.pklz
                                            _report/
                                                report.rst
                                        _ds_correlation_matrix2/
                                            _node.pklz
                                            _0x36230b4a1eb3ac6b03d35af098695e53.json
                                            _inputs.pklz
                                            result__ds_correlation_matrix2.pklz
                                            _report/
                                                report.rst
                                ds_betaseries_file/
                                    _node.pklz
                                    result_ds_betaseries_file.pklz
                                    _0x9417fa4fd1f9a6b4dfbd236c32151909.json
                                    _inputs.pklz
                                    _report/
                                        report.rst
                                    mapflow/
                                        _ds_betaseries_file0/
                                            _node.pklz
                                            result__ds_betaseries_file0.pklz
                                            _0x09a283f5f6e38e10328513d5854ece1d.json
                                            _inputs.pklz
                                            _report/
                                                report.rst
                                        _ds_betaseries_file1/
                                            _node.pklz
                                            _0x669ed6ce51cb29702409d56a74a03dbe.json
                                            result__ds_betaseries_file1.pklz
                                            _inputs.pklz
                                            _report/
                                                report.rst
                                        _ds_betaseries_file2/
                                            result__ds_betaseries_file2.pklz
                                            _node.pklz
                                            _0xa8b44a752e96b1b030c94c154b6c7a97.json
                                            _inputs.pklz
                                            _report/
                                                report.rst
                                check_beta_series_list/
                                    _node.pklz
                                    _inputs.pklz
                                    _0x948d0594f2d57214d6c191f678765429.json
                                    result_check_beta_series_list.pklz
                                    _report/
                                        report.rst
                            betaseries_wf/
                                be88f8479de851cec27ee0e444fe7a56a8598c6d/
                                    betaseries_node/
                                        desc-incongruent_betaseries.nii.gz
                                        _node.pklz
                                        desc-neutral_betaseries.nii.gz
                                        desc-congruent_betaseries_censored.nii.gz
                                        result_betaseries_node.pklz
                                        desc-congruent_betaseries.nii.gz
                                        _inputs.pklz
                                        desc-neutral_betaseries_censored.nii.gz
                                        _0x754c19a7c0e3a13c381d837c3a83fd6f.json
                                        desc-incongruent_betaseries_censored.nii.gz
                                        _report/
                                            report.rst
                            correlation_wf/
                                be88f8479de851cec27ee0e444fe7a56a8598c6d/
                                    atlas_corr_node/
                                        _node.pklz
                                        result_atlas_corr_node.pklz
                                        _inputs.pklz
                                        _0x98772d55b79ccbbb896c67ce72dbfd28.json
                                        _report/
                                            report.rst
                                        mapflow/
                                            _atlas_corr_node0/
                                                _node.pklz
                                                result__atlas_corr_node0.pklz
                                                _inputs.pklz
                                                desc-neutral_correlation.svg
                                                desc-neutral_correlation.tsv
                                                _0x90ee14ed3b6b965213d5e199829692b1.json
                                                _report/
                                                    report.rst
                                            _atlas_corr_node1/
                                                _node.pklz
                                                _0xd8fda64788f3b4369f3bcc0c4d315ca7.json
                                                result__atlas_corr_node1.pklz
                                                desc-congruent_correlation.tsv
                                                desc-congruent_correlation.svg
                                                _inputs.pklz
                                                _report/
                                                    report.rst
                                            _atlas_corr_node2/
                                                _node.pklz
                                                result__atlas_corr_node2.pklz
                                                desc-incongruent_correlation.svg
                                                desc-incongruent_correlation.tsv
                                                _inputs.pklz
                                                _0x146c3219579a52accc700e4eb1a86887.json
                                                _report/
                                                    report.rst
            data/
                Schaefer2018_100Parcels_7Networks_order.tsv
                Schaefer2018_100Parcels_7Networks_order.txt
                Schaefer2018_100Parcels_7Networks_order_FSLMNI152_2mm.nii.gz
        sub-001/
            func/
                sub-001_task-stroop_bold.nii.gz
                sub-001_task-stroop_events.tsv
            anat/
                sub-001_T1w.nii.gz

Collect correlation results

output_path = os.path.join(out_dir, "nibetaseries", "sub-001", "func")
trial_types = ['congruent', 'incongruent', 'neutral']
filename_template = ('sub-001_task-stroop_space-MNI152NLin2009cAsym_'
                     'desc-{trial_type}_{suffix}.{ext}')

pd_dict = {}
for trial_type in trial_types:
    fname = filename_template.format(trial_type=trial_type, suffix='correlation', ext='tsv')
    file_path = os.path.join(output_path, fname)
    pd_dict[trial_type] = pd.read_csv(file_path, sep='\t', na_values="n/a", index_col=0)
# display example matrix
print(pd_dict[trial_type].head())

Out:

          LH_Vis_1  LH_Vis_2  ...  RH_Default_PCC_1  RH_Default_PCC_2
LH_Vis_1       NaN  0.218441  ...         -0.229994          0.030440
LH_Vis_2  0.218441       NaN  ...         -0.272071          0.051983
LH_Vis_3 -0.193264  0.448418  ...          0.087879          0.083368
LH_Vis_4  0.122960  0.526585  ...         -0.185481          0.188477
LH_Vis_5  0.284347  0.534536  ...         -0.393536         -0.288098

[5 rows x 100 columns]

Graph the correlation results

fig, axes = plt.subplots(nrows=3, ncols=1, sharex=True, sharey=True, figsize=(10, 30),
                         gridspec_kw={'wspace': 0.025, 'hspace': 0.075})

cbar_ax = fig.add_axes([.91, .3, .03, .4])
r = 0
for trial_type, df in pd_dict.items():
    g = sns.heatmap(df, ax=axes[r], vmin=-.5, vmax=1., square=True,
                    cbar=True, cbar_ax=cbar_ax)
    axes[r].set_title(trial_type)
    # iterate over rows
    r += 1
plt.tight_layout()
../_images/sphx_glr_plot_run_nibetaseries_001.png

Out:

/home/docs/checkouts/readthedocs.org/user_builds/nibetaseries/envs/v0.5.0/lib/python3.7/site-packages/matplotlib/figure.py:2299: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
  warnings.warn("This figure includes Axes that are not compatible "

Collect beta map results

nii_dict = {}
for trial_type in trial_types:
    fname = filename_template.format(trial_type=trial_type, suffix='betaseries', ext='nii.gz')
    file_path = os.path.join(output_path, fname)
    nii_dict[trial_type] = nib.load(file_path)

# view incongruent beta_maps
nib.viewers.OrthoSlicer3D(nii_dict['incongruent'].get_fdata(),
                          title="Incongruent Betas").set_position(10, 13, 10)
../_images/sphx_glr_plot_run_nibetaseries_002.png

Graph beta map standard deviation

We can find where the betas have the highest standard deviation for each trial type. Unsuprisingly, the largest deviations are near the edge of the brain mask and the subcortical regions.

# standard deviations for each trial type
std_dict = {tt: nib.Nifti1Image(img.get_fdata().std(axis=-1), img.affine, img.header)
            for tt, img in nii_dict.items()}

fig, axes = plt.subplots(nrows=3, ncols=1, figsize=(10, 20))

for idx, (trial_type, nii) in enumerate(std_dict.items()):
    plotting.plot_stat_map(nii, title=trial_type, cut_coords=(0, 0, 0),
                           threshold=5, vmax=20, axes=axes[idx])
../_images/sphx_glr_plot_run_nibetaseries_003.png

References

notebook-1

Timothy D Verstynen. The organization and dynamics of corticostriatal pathways link the medial orbitofrontal cortex to future behavioral responses. Journal of Neurophysiology, 112(10):2457–2469, 2014. URL: https://doi.org/10.1152/jn.00221.2014, doi:10.1152/jn.00221.2014.

Total running time of the script: ( 1 minutes 14.827 seconds)

Gallery generated by Sphinx-Gallery