Skip to content

Commit 4e84dbd

Browse files
committed
Minor tweaks
1 parent 1f887c9 commit 4e84dbd

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

bidscoin/bids.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ def options(self, options: dict):
10301030
def plugins(self) -> Plugins:
10311031
"""The plugin dictionaries with their options"""
10321032

1033-
return self._data['Options']['plugins']
1033+
return self._data['Options'].get('plugins', [])
10341034

10351035
@plugins.setter
10361036
def plugins(self, plugins: Plugins):
@@ -1170,11 +1170,20 @@ def check_template(self) -> bool:
11701170
:return: True if the template bidsmap is valid, otherwise False
11711171
"""
11721172

1173-
valid = True
1174-
ignoretypes = self.options.get('ignoretypes', [])
1175-
bidsignore = self.options.get('bidsignore', [])
1173+
# Check the presence of the bidsmap Options
1174+
if 'Options' not in self._data:
1175+
LOGGER.error('The template bidsmap has no "Options" section')
1176+
return False
1177+
if 'bidscoin' not in self._data['Options']:
1178+
LOGGER.error('The template bidsmap has no "bidscoin" options')
1179+
return False
1180+
if 'plugins' not in self._data['Options']:
1181+
LOGGER.error('The template bidsmap contains no "plugins"')
1182+
return False
11761183

11771184
# Check all the datatypes in the bidsmap
1185+
ignoretypes = self.options.get('ignoretypes', [])
1186+
bidsignore = self.options.get('bidsignore', [])
11781187
LOGGER.verbose('Checking the template bidsmap datatypes:')
11791188
for dataformat in self.dataformats:
11801189
for datatype in dataformat.datatypes:
@@ -1190,14 +1199,16 @@ def check_template(self) -> bool:
11901199
re.compile(str(val))
11911200
except re.error:
11921201
LOGGER.warning(f"Invalid regex pattern in the {key} value '{val}' in: {runitem}\nThis may cause run-matching errors unless '{val}' is a literal attribute value")
1202+
if datatypesuffixes == ['events']: # Ugly work-around for sparse events2bids Presentation mappings
1203+
continue
11931204
for typegroup in filerules.get(datatype.datatype, {}):
11941205
for suffix in filerules[datatype.datatype][typegroup].suffixes:
11951206
if not (suffix in datatypesuffixes or suffix in str(bidsignore) or
11961207
'[DEPRECATED]' in bidsschema.objects.suffixes[suffix].description or
11971208
'**Change:** Removed from' in bidsschema.objects.suffixes[suffix].description or
11981209
'**Change:** Replaced by' in bidsschema.objects.suffixes[suffix].description):
11991210
LOGGER.info(f"Missing '{suffix}' run-item in: bidsmap[{dataformat}][{datatype}] (NB: this may perhaps be fine / a deprecated item)")
1200-
# valid = False # TODO: Fix this for sparse events2bids mappings
1211+
valid = False
12011212

12021213
# Validate against the json schema
12031214
with (templatefolder/'schema.json').open('r') as stream:

release_procedure.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This document describes how to prepare a new BIDScoin release from within the DC
99
rm -rf ~/.bidscoin
1010
cd ~/python/bidscoin
1111
git pull
12+
module load anaconda3
1213
source activate tox
1314
tox
1415
conda deactivate
@@ -21,14 +22,14 @@ This document describes how to prepare a new BIDScoin release from within the DC
2122

2223
rm -rf ~/.bidscoin
2324
cd ~/PycharmProjects/bidscoin
24-
vi apptainer.def # -> pip install github
25+
vi apptainer.def # -> Use `pip install github`
2526
sudo apptainer build bidscoin.sif apptainer.def
2627
xhost +
2728
apptainer exec --cleanenv --env DISPLAY=:0 bidscoin.sif bidscoin -t
2829
apptainer exec --cleanenv bidscoin.sif bidscoin -v
2930
apptainer exec --cleanenv bidscoin.sif pngappend
3031
apptainer cache clean
31-
vi apptainer.def # Restore pip install pypi
32+
vi apptainer.def # Restore `pip install pypi`
3233

3334
3. Inspect the git history and update the CHANGELOG (including the links)
3435
4. Update the cli help texts and RTD files

0 commit comments

Comments
 (0)