Skip to content

Commit

Permalink
more fixes in compliance with updated context
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaumet committed Sep 4, 2023
1 parent 2f9adbc commit c8a5272
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 54 deletions.
4 changes: 2 additions & 2 deletions bids_prov/spm/spm_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def get_entities_from_ext_config(conf_dic: dict, activity_name: str, activity_id
for activity in conf_dic.keys():
if activity in activity_name:
# {'name': 'segment', 'outputs': ['c1xxx.nii.gz','c2xxx.nii.gz']}
# act_preproc = next((activity for activity in records["prov:Activity"] if activity['@id'] ==
# act_preproc = next((activity for activity in records["Activities"] if activity['@id'] ==
# activity_id), None)
for output in conf_dic[activity]['outputs']:
name = conf_dic[activity]['name']
Expand Down Expand Up @@ -293,7 +293,7 @@ def get_records(task_groups: dict, agent_id: str, verbose=False) -> dict:
Returns
-------
dict[str, list]
records : dict with key "@context", ... "Records":{"prov:Agent": ..."prov:Activity":..."Entities":....}
records : dict with key "@context", ... "Records":{"prov:Agent": ..."Activities":..."Entities":....}
"""

Expand Down
20 changes: 10 additions & 10 deletions bids_prov/tests/samples_test/batch_example_spm.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"Command": "matlabbatch{5}.spm.spatial.realign.estwrite.data{1}(1) = cfg_dep('GunZip Files: GunZipped Files', substruct('.','val', '{}',{3}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{':'}));\nmatlabbatch{5}.spm.spatial.realign.estwrite.eoptions.quality = 0.9;\nmatlabbatch{5}.spm.spatial.realign.estwrite.eoptions.sep = 4;\nmatlabbatch{5}.spm.spatial.realign.estwrite.eoptions.fwhm = 5;\nmatlabbatch{5}.spm.spatial.realign.estwrite.eoptions.rtm = 1;\nmatlabbatch{5}.spm.spatial.realign.estwrite.eoptions.interp = 2;\nmatlabbatch{5}.spm.spatial.realign.estwrite.eoptions.wrap = [0 0 0];\nmatlabbatch{5}.spm.spatial.realign.estwrite.eoptions.weight = '';\nmatlabbatch{5}.spm.spatial.realign.estwrite.roptions.which = [0 1];\nmatlabbatch{5}.spm.spatial.realign.estwrite.roptions.interp = 4;\nmatlabbatch{5}.spm.spatial.realign.estwrite.roptions.wrap = [0 0 0];\nmatlabbatch{5}.spm.spatial.realign.estwrite.roptions.mask = 1;\nmatlabbatch{5}.spm.spatial.realign.estwrite.roptions.prefix = 'r';",
"parameters": {
"Parameters": {
"eoptions.quality": "0.9",
"eoptions.sep": "4",
"eoptions.fwhm": "5",
Expand All @@ -87,7 +87,7 @@
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"Command": "matlabbatch{6}.spm.spatial.coreg.estimate.ref(1) = cfg_dep('Realign: Estimate & Reslice: Mean Image', substruct('.','val', '{}',{5}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','rmean'));\nmatlabbatch{6}.spm.spatial.coreg.estimate.source(1) = cfg_dep('GunZip Files: GunZipped Files', substruct('.','val', '{}',{4}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{':'}));\nmatlabbatch{6}.spm.spatial.coreg.estimate.other = {''};\nmatlabbatch{6}.spm.spatial.coreg.estimate.eoptions.cost_fun = 'nmi';\nmatlabbatch{6}.spm.spatial.coreg.estimate.eoptions.sep = [4 2];\nmatlabbatch{6}.spm.spatial.coreg.estimate.eoptions.tol = [0.02 0.02 0.02 0.001 0.001 0.001 0.01 0.01 0.01 0.001 0.001 0.001];\nmatlabbatch{6}.spm.spatial.coreg.estimate.eoptions.fwhm = [7 7];",
"parameters": {
"Parameters": {
"other": "{''}",
"eoptions.cost_fun": "'nmi'",
"eoptions.sep": "[4, 2]",
Expand All @@ -103,7 +103,7 @@
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"Command": "matlabbatch{7}.spm.spatial.preproc.channel.vols(1) = cfg_dep('GunZip Files: GunZipped Files', substruct('.','val', '{}',{4}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{':'}));\nmatlabbatch{7}.spm.spatial.preproc.channel.biasreg = 0.001;\nmatlabbatch{7}.spm.spatial.preproc.channel.biasfwhm = 60;\nmatlabbatch{7}.spm.spatial.preproc.channel.write = [0 1];\nmatlabbatch{7}.spm.spatial.preproc.tissue(1).tpm = {'/storage/essicd/data/NIDM-Ex/spm12_update/tpm/TPM.nii,1'};\nmatlabbatch{7}.spm.spatial.preproc.tissue(1).ngaus = 1;\nmatlabbatch{7}.spm.spatial.preproc.tissue(1).native = [1 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(1).warped = [0 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(2).tpm = {'/storage/essicd/data/NIDM-Ex/spm12_update/tpm/TPM.nii,2'};\nmatlabbatch{7}.spm.spatial.preproc.tissue(2).ngaus = 1;\nmatlabbatch{7}.spm.spatial.preproc.tissue(2).native = [1 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(2).warped = [0 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(3).tpm = {'/storage/essicd/data/NIDM-Ex/spm12_update/tpm/TPM.nii,3'};\nmatlabbatch{7}.spm.spatial.preproc.tissue(3).ngaus = 2;\nmatlabbatch{7}.spm.spatial.preproc.tissue(3).native = [1 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(3).warped = [0 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(4).tpm = {'/storage/essicd/data/NIDM-Ex/spm12_update/tpm/TPM.nii,4'};\nmatlabbatch{7}.spm.spatial.preproc.tissue(4).ngaus = 3;\nmatlabbatch{7}.spm.spatial.preproc.tissue(4).native = [1 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(4).warped = [0 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(5).tpm = {'/storage/essicd/data/NIDM-Ex/spm12_update/tpm/TPM.nii,5'};\nmatlabbatch{7}.spm.spatial.preproc.tissue(5).ngaus = 4;\nmatlabbatch{7}.spm.spatial.preproc.tissue(5).native = [1 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(5).warped = [0 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(6).tpm = {'/storage/essicd/data/NIDM-Ex/spm12_update/tpm/TPM.nii,6'};\nmatlabbatch{7}.spm.spatial.preproc.tissue(6).ngaus = 2;\nmatlabbatch{7}.spm.spatial.preproc.tissue(6).native = [0 0];\nmatlabbatch{7}.spm.spatial.preproc.tissue(6).warped = [0 0];\nmatlabbatch{7}.spm.spatial.preproc.warp.mrf = 1;\nmatlabbatch{7}.spm.spatial.preproc.warp.cleanup = 1;\nmatlabbatch{7}.spm.spatial.preproc.warp.reg = [0 0.001 0.5 0.05 0.2];\nmatlabbatch{7}.spm.spatial.preproc.warp.affreg = 'mni';\nmatlabbatch{7}.spm.spatial.preproc.warp.fwhm = 0;\nmatlabbatch{7}.spm.spatial.preproc.warp.samp = 3;\nmatlabbatch{7}.spm.spatial.preproc.warp.write = [0 1];",
"parameters": {
"Parameters": {
"channel.biasreg": "0.001",
"channel.biasfwhm": "60",
"channel.write": "[0, 1]",
Expand Down Expand Up @@ -149,7 +149,7 @@
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"Command": "matlabbatch{8}.spm.spatial.normalise.write.subj.def(1) = cfg_dep('Segment: Forward Deformations', substruct('.','val', '{}',{7}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','fordef', '()',{':'}));\nmatlabbatch{8}.spm.spatial.normalise.write.subj.resample(1) = cfg_dep('Realign: Estimate & Reslice: Realigned Images (Sess 1)', substruct('.','val', '{}',{5}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','sess', '()',{1}, '.','cfiles'));\nmatlabbatch{8}.spm.spatial.normalise.write.woptions.bb = [-78 -112 -70 78 76 85];\nmatlabbatch{8}.spm.spatial.normalise.write.woptions.vox = [2 2 2];\nmatlabbatch{8}.spm.spatial.normalise.write.woptions.interp = 4;\nmatlabbatch{8}.spm.spatial.normalise.write.woptions.prefix = 'w';",
"parameters": {
"Parameters": {
"woptions.bb": "[-78, -112, -70, 78, 76, 85]",
"woptions.vox": "[2, 2, 2]",
"woptions.interp": "4",
Expand All @@ -165,7 +165,7 @@
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"Command": "matlabbatch{9}.spm.spatial.normalise.write.subj.def(1) = cfg_dep('Segment: Forward Deformations', substruct('.','val', '{}',{7}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','fordef', '()',{':'}));\nmatlabbatch{9}.spm.spatial.normalise.write.subj.resample(1) = cfg_dep('Segment: Bias Corrected (1)', substruct('.','val', '{}',{7}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','channel', '()',{1}, '.','biascorr', '()',{':'}));\nmatlabbatch{9}.spm.spatial.normalise.write.woptions.bb = [-78 -112 -70 78 76 85];\nmatlabbatch{9}.spm.spatial.normalise.write.woptions.vox = [2 2 2];\nmatlabbatch{9}.spm.spatial.normalise.write.woptions.interp = 4;\nmatlabbatch{9}.spm.spatial.normalise.write.woptions.prefix = 'w';",
"parameters": {
"Parameters": {
"woptions.bb": "[-78, -112, -70, 78, 76, 85]",
"woptions.vox": "[2, 2, 2]",
"woptions.interp": "4",
Expand All @@ -180,7 +180,7 @@
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"Command": "matlabbatch{10}.spm.spatial.smooth.data(1) = cfg_dep('Normalise: Write: Normalised Images (Subj 1)', substruct('.','val', '{}',{8}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','files'));\nmatlabbatch{10}.spm.spatial.smooth.fwhm = [6 6 6];\nmatlabbatch{10}.spm.spatial.smooth.dtype = 0;\nmatlabbatch{10}.spm.spatial.smooth.im = 0;\nmatlabbatch{10}.spm.spatial.smooth.prefix = 's';",
"parameters": {
"Parameters": {
"fwhm": "[6, 6, 6]",
"dtype": "0",
"im": "0",
Expand All @@ -196,7 +196,7 @@
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"Command": "matlabbatch{11}.spm.stats.fmri_spec.dir = {'/storage/essicd/data/NIDM-Ex/BIDS_Data/RESULTS/TEST/nidmresults-examples/spm_contrast_mask'};\nmatlabbatch{11}.spm.stats.fmri_spec.timing.units = 'secs';\nmatlabbatch{11}.spm.stats.fmri_spec.timing.RT = 2;\nmatlabbatch{11}.spm.stats.fmri_spec.timing.fmri_t = 16;\nmatlabbatch{11}.spm.stats.fmri_spec.timing.fmri_t0 = 8;\nmatlabbatch{11}.spm.stats.fmri_spec.sess.scans(1) = cfg_dep('Smooth: Smoothed Images', substruct('.','val', '{}',{10}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','files'));\nmatlabbatch{11}.spm.stats.fmri_spec.sess.cond = struct('name', {}, 'onset', {}, 'duration', {}, 'tmod', {}, 'pmod', {}, 'orth', {});\nmatlabbatch{11}.spm.stats.fmri_spec.sess.multi = {'/storage/essicd/data/NIDM-Ex/BIDS_Data/RESULTS/EXAMPLES/ds011/SPM/PREPROCESSING/ONSETS/sub-01-MultiCond.mat'};\nmatlabbatch{11}.spm.stats.fmri_spec.sess.regress = struct('name', {}, 'val', {});\nmatlabbatch{11}.spm.stats.fmri_spec.sess.multi_reg = {''};\nmatlabbatch{11}.spm.stats.fmri_spec.sess.hpf = 128;\nmatlabbatch{11}.spm.stats.fmri_spec.fact = struct('name', {}, 'levels', {});\nmatlabbatch{11}.spm.stats.fmri_spec.bases.hrf.derivs = [0 0];\nmatlabbatch{11}.spm.stats.fmri_spec.volt = 1;\nmatlabbatch{11}.spm.stats.fmri_spec.global = 'None';\nmatlabbatch{11}.spm.stats.fmri_spec.mthresh = 0.8;\nmatlabbatch{11}.spm.stats.fmri_spec.mask = {''};\nmatlabbatch{11}.spm.stats.fmri_spec.cvi = 'AR(1)';",
"parameters": {
"Parameters": {
"dir": "{'/storage/essicd/data/NIDM-Ex/BIDS_Data/RESULTS/TEST/nidmresults-examples/spm_contrast_mask'}",
"timing.units": "'secs'",
"timing.RT": "2",
Expand All @@ -223,7 +223,7 @@
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"Command": "matlabbatch{12}.spm.stats.fmri_est.spmmat(1) = cfg_dep('fMRI model specification: SPM.mat File', substruct('.','val', '{}',{11}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','spmmat'));\nmatlabbatch{12}.spm.stats.fmri_est.write_residuals = 0;\nmatlabbatch{12}.spm.stats.fmri_est.method.Classical = 1;",
"parameters": {
"Parameters": {
"write_residuals": "0",
"method.Classical": "1"
}
Expand All @@ -236,7 +236,7 @@
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"Command": "matlabbatch{13}.spm.stats.con.spmmat(1) = cfg_dep('Model estimation: SPM.mat File', substruct('.','val', '{}',{12}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','spmmat'));\nmatlabbatch{13}.spm.stats.con.consess{1}.tcon.name = 'tone counting vs baseline';\nmatlabbatch{13}.spm.stats.con.consess{1}.tcon.weights = [1 0];\nmatlabbatch{13}.spm.stats.con.consess{1}.tcon.sessrep = 'none';\nmatlabbatch{13}.spm.stats.con.consess{2}.tcon.name = 'tone counting probe vs baseline';\nmatlabbatch{13}.spm.stats.con.consess{2}.tcon.weights = [0 1];\nmatlabbatch{13}.spm.stats.con.consess{2}.tcon.sessrep = 'none';\nmatlabbatch{13}.spm.stats.con.delete = 0;",
"parameters": {
"Parameters": {
"consess{1}.tcon.name": "'tone counting vs baseline'",
"consess{1}.tcon.weights": "[1, 0]",
"consess{1}.tcon.sessrep": "'none'",
Expand All @@ -254,7 +254,7 @@
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"Command": "matlabbatch{14}.spm.stats.results.spmmat(1) = cfg_dep('Contrast Manager: SPM.mat File', substruct('.','val', '{}',{13}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','spmmat'));\nmatlabbatch{14}.spm.stats.results.conspec.titlestr = '';\nmatlabbatch{14}.spm.stats.results.conspec.contrasts = 1;\nmatlabbatch{14}.spm.stats.results.conspec.threshdesc = 'none';\nmatlabbatch{14}.spm.stats.results.conspec.thresh = 0.001;\nmatlabbatch{14}.spm.stats.results.conspec.extent = 0;\nmatlabbatch{14}.spm.stats.results.conspec.conjunction = 1;\nmatlabbatch{14}.spm.stats.results.conspec.mask.contrast.contrasts = 2;\nmatlabbatch{14}.spm.stats.results.conspec.mask.contrast.thresh = 0.05;\nmatlabbatch{14}.spm.stats.results.conspec.mask.contrast.mtype = 0;\nmatlabbatch{14}.spm.stats.results.units = 1;\nmatlabbatch{14}.spm.stats.results.print = 'pdf';\nmatlabbatch{14}.spm.stats.results.write.none = 1;",
"parameters": {
"Parameters": {
"conspec.titlestr": "''",
"conspec.contrasts": "1",
"conspec.threshdesc": "'none'",
Expand Down
26 changes: 13 additions & 13 deletions bids_prov/tests/samples_test/batch_example_spm_ref.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
"version": "SPM12r7224"
}
],
"prov:Activity": [
"Activities": [
{
"@id": "urn:3f372617-f0ba-4f3a-86f0-ce2ea6ec39c1",
"Label": "Move file",
"Used": [
"urn:4a800646-417a-4105-bc31-99944567ceb1"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"action.copyto": "{'/storage/essicd/data/NIDM-Ex/BIDS_Data/RESULTS/EXAMPLES/ds011/SPM/PREPROCESSING/FUNCTIONAL'}"
}
},
Expand All @@ -31,7 +31,7 @@
"urn:df7142dc-af29-46f8-b774-4cca4d909eb2"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"action.copyto": "{'/storage/essicd/data/NIDM-Ex/BIDS_Data/RESULTS/EXAMPLES/ds011/SPM/PREPROCESSING/ANATOMICAL'}"
}
},
Expand All @@ -58,7 +58,7 @@
"urn:467c0714-a9fb-4797-aa59-c1698d242349"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"eoptions.quality": "0.9",
"eoptions.sep": "4",
"eoptions.fwhm": "5",
Expand All @@ -81,7 +81,7 @@
"urn:daa4ed3c-3454-4ae4-8628-7225154d1eb0"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"other": "{''}",
"eoptions.cost_fun": "'nmi'",
"eoptions.sep": "[4, 2]",
Expand All @@ -96,7 +96,7 @@
"urn:daa4ed3c-3454-4ae4-8628-7225154d1eb0"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"channel.biasreg": "0.001",
"channel.biasfwhm": "60",
"channel.write": "[0, 1]",
Expand Down Expand Up @@ -141,7 +141,7 @@
"urn:071d1481-5649-48e9-9846-6a921f7ea79c"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"woptions.bb": "[-78, -112, -70, 78, 76, 85]",
"woptions.vox": "[2, 2, 2]",
"woptions.interp": "4",
Expand All @@ -156,7 +156,7 @@
"urn:e57b37e7-704b-4d09-af2e-ab42fd8cfe33"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"woptions.bb": "[-78, -112, -70, 78, 76, 85]",
"woptions.vox": "[2, 2, 2]",
"woptions.interp": "4",
Expand All @@ -170,7 +170,7 @@
"urn:ac189004-8387-4e75-bc93-a36cdff27e9f"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"fwhm": "[6, 6, 6]",
"dtype": "0",
"im": "0",
Expand All @@ -185,7 +185,7 @@
"urn:1f05f4d1-1a38-4927-812e-cd08801f772d"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"dir": "{'/storage/essicd/data/NIDM-Ex/BIDS_Data/RESULTS/TEST/nidmresults-examples/spm_contrast_mask'}",
"timing.units": "'secs'",
"timing.RT": "2",
Expand All @@ -211,7 +211,7 @@
"urn:29663157-072a-468b-9e47-921f47d9e875"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"write_residuals": "0",
"method.Classical": "1"
}
Expand All @@ -223,7 +223,7 @@
"urn:6cd92a40-17cd-479a-9600-66c386988190"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"consess{1}.tcon.name": "'tone counting vs baseline'",
"consess{1}.tcon.weights": "[1, 0]",
"consess{1}.tcon.sessrep": "'none'",
Expand All @@ -240,7 +240,7 @@
"urn:4f3d0144-7485-4165-a2fe-005b88ebf5e6"
],
"AssociatedWith": "urn:c15521b1-b3dc-450a-9daa-37e51b591d75",
"parameters": {
"Parameters": {
"conspec.titlestr": "''",
"conspec.contrasts": "1",
"conspec.threshdesc": "'none'",
Expand Down
Loading

0 comments on commit c8a5272

Please sign in to comment.