Skip to content

Conversation

@Remi-Gau
Copy link
Contributor

@Remi-Gau Remi-Gau commented Aug 5, 2020

fix #70

@marcobarilari @CerenB

If you put the following line at the end of your experiment script, it will dump the content in the json file that would be associated the bold MRI file of this run.

The reason I did this is that all the parameters that you used to run your experiment are this way saved in a human readable format: so that when you write your methods sections 2 years later, the info you used WHEN you ran the experiment is saved in an easily accessible text format ("F you .mat file!").

And also you don't have to read it from the setParameters.m file because you might have modified the content of a parameter when running the experiment and not committed and tagged that change with git.

createBoldJson(cfg, cfg)

See an example of output here:

{
    "Instructions": "",
    "RepetitionTime": 2,
    "SliceTiming": [],
    "TaskDescription": "",
    "TaskName": "visual Localizer",
    "IBI": 0.1,
    "ISI": 0.1,
    "aperture": {
        "type": "circle",
        "width": 36.00605610909393,
        "xPos": 0,
        "xPosPix": 0,
        "widthPix": 1080,
        "texture": 11
    },
    "audio": {
        "do": false
    },
    "bids": {
        "MRI": {
            "Instructions": "Detect the RED fixation cross",
            "TaskDescription": []
        },
        "datasetDescription": {
            "Acknowledgements": "",
            "Authors": [""],
            "BIDSVersion": "",
            "DatasetDOI": "",
            "Funding": [""],
            "HowToAcknowledge": "",
            "License": "",
            "Name": "",
            "ReferencesAndLinks": [""]
        },
        "meg": {
            "DewarPosition": [],
            "DigitizedHeadPoints": [],
            "DigitizedLandmarks": [],
            "PowerLineFrequency": [],
            "SamplingFrequency": [],
            "SoftwareFilters": [],
            "TaskName": "visual Localizer"
        },
        "mri": {
            "Instructions": "",
            "RepetitionTime": 2,
            "SliceTiming": [],
            "TaskDescription": "",
            "TaskName": "visual Localizer"
        }
    },
    "color": {
        "background": [0,0,0],
        "black": [0,0,0],
        "grey": [127.5,127.5,127.5],
        "red": [255,0,0],
        "white": [255,255,255]
    },
    "debug": {
        "do": true,
        "smallWin": false,
        "transpWin": true
    },
    "design": {
        "motionType": "translation",
        "names": [
            "static",
            "motion"
        ],
        "nbRepetitions": 4,
        "nbEventsPerBlock": 12,
        "blockNames": [
            "static",
            "motion",
            "static",
            "motion",
            "static",
            "motion",
            "static",
            "motion"
        ],
        "nbBlocks": 8,
        "directions": [[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[180,270,0,90,0,90,270,180,90,270,0,180],[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[90,270,0,180,0,90,270,180,90,180,270,0],[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[270,90,180,0,270,180,90,0,90,270,180,0],[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,180,270,90,270,180,0,90,0,90,180,270]],
        "speeds": [[7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333],[7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333],[7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333],[7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333],[7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333],[7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333],[7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333],[7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333,7.483333333333333]],
        "fixationTargets": [[0,0,1,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,1,0,0,0,0,1,0],[0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,1,0,0,0,0,0,1,0,0],[0,1,0,0,0,0,1,0,0,0,0,0],[0,1,0,0,0,0,0,0,0,0,0,0],[0,0,0,1,0,0,0,0,0,0,0,0]]
    },
    "dir": {
        "output": "/home/remi/github/CPP_localizer_visual_motion/../output",
        "outputSubject": "/home/remi/github/CPP_localizer_visual_motion/../output/source/sub-ctrl666/ses-666"
    },
    "dot": {
        "speed": 15,
        "coherence": 1,
        "density": 0.1,
        "lifeTime": 10,
        "proportionKilledPerFrame": 0,
        "size": 1,
        "color": [255,255,255],
        "matrixWidth": 1080,
        "sizePix": 29,
        "speedPix": 449,
        "speedPixPerFrame": 7.483333333333333,
        "number": 410,
        "texture": 12
    },
    "endDelay": 0.1,
    "eventDuration": 0.5,
    "extraColumns": [
        "direction",
        "speed",
        "target",
        "event",
        "block"
    ],
    "eyeTracker": {
        "do": false
    },
    "fileName": {
        "base": "sub-ctrl666_ses-666_task-visualLocalizer",
        "datasetDescription": "/home/remi/github/CPP_localizer_visual_motion/../output/dataset_description.json",
        "date": "202008051222",
        "dateFormat": "yyyymmddHHMM",
        "events": "sub-ctrl666_ses-666_task-visualLocalizer_run-666_events_date-202008051222.tsv",
        "modality": "beh",
        "pattern": "%03.0f",
        "stim": "sub-ctrl666_ses-666_task-visualLocalizer_run-666_stim_date-202008051222.tsv",
        "suffix": {
            "mri": {
                "acquisition": "",
                "contrastEnhancement": "",
                "echo": "",
                "phaseEncodingDirection": "",
                "reconstruction": ""
            },
            "run": "_run-666"
        },
        "task": "visualLocalizer",
        "zeroPadding": 3
    },
    "fixation": {
        "color": [255,255,255],
        "colorTarget": [255,0,0],
        "lineWidthPix": 2,
        "type": "crossS",
        "width": 1,
        "xDisplacement": 0,
        "yDisplacement": 0
    },
    "keyboard": {
        "escapeKey": "ESCAPE",
        "keyboard": [],
        "responseBox": [],
        "responseKey": ["space"]
    },
    "mri": {
        "acquisition": [],
        "contrastEnhancement": [],
        "echo": [],
        "phaseEncodingDirection": [],
        "reconstruction": [],
        "repetitionTime": 2,
        "triggerKey": "t",
        "triggerNb": 4
    },
    "onsetDelay": 0.1,
    "screen": {
        "monitorDistance": 40,
        "monitorWidth": 50,
        "idx": 0,
        "win": 10,
        "winRect": [0,0,1920,1080],
        "winWidth": 1920,
        "winHeight": 1080,
        "center": [960,540],
        "FOV": 64.01076641616699,
        "ppd": 29.99495409127099,
        "ifi": 0.01666666666666667,
        "monitorRefresh": 60
    },
    "subject": {
        "askGrpSess": [true,true],
        "runNb": 666,
        "sessionNb": 666,
        "subjectGrp": "ctrl",
        "subjectNb": 666
    },
    "target": {
        "maxNbPerBlock": 2,
        "duration": 0.05
    },
    "task": {
        "name": "visual localizer",
        "instruction": "1-Detect the RED fixation cross\\n \\n\\n"
    },
    "testingDevice": "pc",
    "text": {
        "color": [255,255,255],
        "font": "Courier New",
        "size": 18,
        "style": 1
    },
    "verbose": false,
    "experimentStart": 1596622967.563883
}

@codecov
Copy link

codecov bot commented Aug 5, 2020

Codecov Report

Merging #72 into master will decrease coverage by 0.08%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #72      +/-   ##
==========================================
- Coverage   76.66%   76.58%   -0.09%     
==========================================
  Files          19       19              
  Lines         420      427       +7     
==========================================
+ Hits          322      327       +5     
- Misses         98      100       +2     
Flag Coverage Δ
#unittests 76.58% <71.42%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/createBoldJson.m 84.61% <71.42%> (-15.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b52ab2a...0c03781. Read the comment docs.

@Remi-Gau Remi-Gau merged commit 4e504e5 into cpp-lln-lab:master Aug 5, 2020
@Remi-Gau Remi-Gau deleted the remi-json_extra branch September 23, 2020 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to add data to JSON files on the fly when saving them

1 participant