Nodes/ComfyUI-Keyframed/Sum Over Parameter Group
ComfyUI Node

Sum Over Parameter Group

Folding a bundle back into one curve

By dmarx·Created 3 years ago·Updated 2 years ago· 92
Sum Over Parameter Group
  • parameter_group
  • KEYFRAMED_CURVE

KfPGroupSum is the pack's group-to-single fold: it takes a parameter group full of curves and adds them all together into one curve. Where KfGetCurveFromPGroup extracts a single member, this collapses the whole group into a combined result - every curve's contribution summed at each point in time. If you have six oscillators in a group and you want to know what their combined signal looks like, this is the node.

Fair warning, though: this node lives in the keyframed/experimental category, and the source code says "not behaving as expected :(" - the author's own words. It's useful, it mostly works, but it's the node in this pack I'd least trust for anything production-grade. The mechanism is a straightforward loop - start with a constant curve at 0, add each member curve in turn - so in principle it's exactly the sum you'd expect. In practice, "experimental" is there for a reason.

Why you'd reach for it

The one genuinely useful pattern: sanity-checking entangled or layered curve sets. In the README's prompt-superposition setup, you generate N phase-offset sine curves whose amplitudes are tuned so their sum is always 1 - that property is what keeps combined prompt weights stable. KfPGroupSum is the fastest way to verify it: bundle the entangled curves, sum them, and check the result stays near 1 across time. For anything else, you're mostly using it to understand your own graph.

The inputs that matter

  • parameter_group - the PARAMETER_GROUP to sum, force-input. That's the whole input list. Every curve currently in the group gets folded into the result.

Output is a single KEYFRAMED_CURVE representing the point-by-point sum. The group is deep-copied before the fold, so the original is untouched.

How it works

The source is honest about its approach: outv = kf.Curve(0), then outv += curve for each curve in parameter_group.parameters.values(). Because curve addition happens at the union of keyframes, the sum's timeline is the merged timeline of all members, and interpolation fills between. It's the same arithmetic KfPGroupCurveAdd uses, just applied pairwise across the whole group.

Installing it

Part of ComfyUI-Keyframed (dmarx's pack wrapping his keyframed library). ComfyUI Manager: search "Keyframed". Or:

cd ComfyUI/custom_nodes
git clone https://github.com/dmarx/ComfyUI-Keyframed

Restart ComfyUI. The pack auto-installs keyframed and toolz on first load; no model downloads.

Troubleshooting

Since the author flags this node as misbehaving, treat surprises as expected. If the summed curve looks wrong, first check your members aren't built with division - the pack's README states division is broken, and KfPGroupSum will happily sum garbage. Second, verify the group actually contains what you think by drawing it with KfPGroupDraw first - a quick look at the curves beats a blind sum. If the sum is consistently off, that's the experimental node being experimental, and the answer is to sum the curves yourself with the non-experimental Curve_1 + Curve_2 nodes.

Categorykeyframed/experimental

Inputs (1)

NameTypeDefaultDescription
parameter_groupPARAMETER_GROUP

Outputs (1)

NameTypeDescription
KEYFRAMED_CURVEKEYFRAMED_CURVE