Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, fields=None, **kwargs):
super(CollateWithMetadata, self).__init__(**kwargs)
if not fields:
fields = self.inputs.field_to_metadata_map.keys()
if not fields:
raise ValueError("Fields must be a non-empty list")
self._fields = fields
add_traits(self.inputs, fields)
#
# Plotting
#
plot_contrasts = pe.MapNode(
GlassBrainPlot(image_type='png'),
iterfield='data',
name='plot_{}_contrasts'.format(level))
#
# Derivatives
#
collate_outputs = pe.Node(
CollateWithMetadata(
fields=['effect_maps', 'variance_maps', 'stat_maps', 'pvalue_maps', 'zscore_maps'],
field_to_metadata_map={
'effect_maps': {'stat': 'effect'},
'variance_maps': {'stat': 'variance'},
'pvalue_maps': {'stat': 'p'},
'zscore_maps': {'stat': 'z'},
}),
name=f'collate_{level}_outputs')
ds_contrast_maps = pe.Node(
BIDSDataSink(base_directory=out_dir,
path_patterns=contrast_pattern),
run_without_submitting=True,
name='ds_{}_contrast_maps'.format(level))
ds_contrast_plots = pe.Node(