-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
It can be useful to map over nodes that have inputs but Sciline / Cyclebane do not allow this. For example, in ESSreflectometry, we want to map over filenames and sample angles. However, the sample angle is by default read from a file. So its provider has inputs and Sciline refuses to map over it.
Here is a simplified example:
import sciline as sl
def foo(i: int) -> float:
return 10.0 * i
def bar(f: float) -> str:
return str(f)
pl = sl.Pipeline([foo, bar])
pl = pl.map({float: [2.0, 3.0]})This fails with ValueError: Mapped node '<class 'float'>' is not a source node.
It can be circumvented using
pl = sl.Pipeline([foo, bar])
pl[float] = 0.0
pl = pl.map({float: [2.0, 3.0]})but this is not great.
Mapping nodes corresponds to assigning values to them. So it is analogous to setting a parameter value. And since this is allowed for non-source nodes, mapping should also be allowed.
Metadata
Metadata
Assignees
Labels
No labels