Skip to content

iterfield in MapNode can't be range (py3) #2115

@djarecka

Description

@djarecka

Summary

In py3 range is not a list, and if iterfield in MapNode is defined as range than entire range is send to the interface at once.

Script/Workflow details

from nipype import Function, MapNode

def square_func(x):
    print(x, type(x))
    return x ** 2

square = Function(["x"], ["f_x"], square_func)

square_node = MapNode(square, name="square", iterfield=["x"])

square_node.inputs.x = range(4)
res  = square_node.run()

Actual behavior

print statement from square_func gives range(0, 4) <class 'range'>

Expected behavior

print statement from square_func should give 0 <class 'int'>, etc.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions