Validation Schema

C-PAC uses voluptuous to validate pipeline configurations against defined types and value restrictions. Default values should be set in the default pipeline along with comments explaining each option.

Validation schema for C-PAC pipeline configurations.

CPAC.pipeline.schema.name_motion_filter(mfilter, mfilters=None)[source]

Given a motion filter, create a short string for the filename.

Parameters:
Return type:

str

Examples

>>> name_motion_filter({'filter_type': 'notch', 'filter_order': 2,
...     'center_frequency': 0.31, 'filter_bandwidth': 0.12})
'notch2fc0p31bw0p12'
>>> name_motion_filter({'filter_type': 'notch', 'filter_order': 4,
...     'breathing_rate_min': 0.19, 'breathing_rate_max': 0.43})
'notch4fl0p19fu0p43'
>>> name_motion_filter({'filter_type': 'lowpass', 'filter_order': 4,
...     'lowpass_cutoff': .0032})
'lowpass4fc0p0032'
>>> name_motion_filter({'filter_type': 'lowpass', 'filter_order': 2,
...     'breathing_rate_min': 0.19})
'lowpass2fl0p19'
>>> name_motion_filter({'filter_type': 'lowpass', 'filter_order': 2,
...     'breathing_rate_min': 0.19}, [{'Name': 'lowpass2fl0p19'}])
'lowpass2fl0p19dup1'
>>> name_motion_filter({'filter_type': 'lowpass', 'filter_order': 2,
...     'breathing_rate_min': 0.19}, [{'Name': 'lowpass2fl0p19'},
...     {'Name': 'lowpass2fl0p19dup1'}])
'lowpass2fl0p19dup2'
CPAC.pipeline.schema.permutation_message(key, options)[source]

Give a human-readable error message for keys that accept permutation values.

Parameters:
Returns:

msg

Return type:

str

CPAC.pipeline.schema.sanitize(filename)[source]

Sanitize a filename and replace whitespaces with underscores.

CPAC.pipeline.schema.schema(config_dict)[source]

Validate a participant-analysis pipeline configuration.

Validate against the latest validation schema by first applying backwards- compatibility patches, then applying Voluptuous validation, then handling complex configuration interaction checks before returning validated config_dict.

Parameters:

config_dict (dict)

Return type:

dict

CPAC.pipeline.schema.str_to_bool1_1(x)[source]

Convert strings to Booleans for YAML1.1 syntax.

Ref https://yaml.org/type/bool.html

Parameters:

x (any)

Return type:

bool