Processing of missed indices
I would like to clarify next situation.
Imagine, that we have thermal powers for 3 reactors, and two detectors. I would like multiple thermal power of each reactor by distance between reactor and detector. However, I include just two pairs of distances reactor-detector.
Check the code below:
from itertools import product
from dag_modelling.plot.graphviz import savegraph
from dag_modelling.core import Graph, NodeStorage
from dag_modelling.bundles.load_parameters import load_parameters
from dag_modelling.lib.arithmetic import Product
storage = NodeStorage()
index = {
"reactor": ["A", "B", "C"],
"detector": ["x", "y"],
}
combinations = list(product(index["reactor"], index["detector"]))
with (
Graph(close_on_exit=True, strict=True) as graph,
storage,
):
load_parameters(
format="value",
state="fixed",
parameters={
"thermal_power": {
"A": 2,
"B": 4,
"C": 8,
},
"baseline": {
"x": {
"A": 0.1,
"B": 0.2,
"C": 0.3,
},
"y": {
"A": 0.01,
"B": 0.02,
}
}
},
labels={
"thermal_power": {
"A": "reactor A",
"B": "reactor B",
"C": "reactor C",
},
"baseline": {
"x": {
"A": "baseline A-x",
"B": "baseline B-x",
"C": "baseline C-x",
},
"y": {
"A": "baseline A-y",
"B": "baseline B-y",
}
}
}
)
parameters = storage["parameters.all"]
Product.replicate(
parameters["thermal_power"],
parameters["baseline"],
replicate_outputs=combinations,
allow_skip_inputs=True,
skippable_inputs_should_contain=[("C", "y")],
name="check",
)
for out in storage["outputs.check"].walkvalues():
out.data
print(list(storage["outputs.check"].walkjoinedkeys()))
savegraph(graph, "graph.dot", show="all")
In check-output I will see 6 items, but I 5 items are expected.
Is it bug or feature?
cc @maxfl @tsegelnik