Nodes/More Math/Sigmas math
ComfyUI Node

Sigmas math

Rewrite your noise schedule as an expression

By mcDandy·Created about a year ago·Updated 3 days ago· 5
Sigmas math
  • V
  • F
  • Expression
  • stack
  • SIGMAS
  • STACK
length_mismatcherror

The noise schedule is the invisible hand behind every generation. ComfyUI's sampler dropdown hides it behind named schedulers, and the moment you want a schedule that isn't one of the presets you're stuck. Sigmas math from More Math lets you take a schedule and rewrite it with math - rescale it, shift it, invert it, or build a custom curve from scratch.

What it's for

"Sigmas" is just the list of noise levels a sampler walks down on its way to an image, and it's a real, first-class tensor type in ComfyUI (that's how advanced users plug schedules into samplers). This node treats that tensor like any other and runs your expression over it. The default I0*(1-F0)+I1*F0 blends two schedules by a float - useful on its own: crossfade between a standard schedule and an experimental one and dial F0 to taste.

Want to test a schedule that starts softer? Multiply early sigmas down: the element positions and sizes are available as D0/S0 variables. Want an aggressive jump near the end? That's an if on position. Every function in the pack's library - clamp, remap, smoothstep, exp, log - applies to the tensor, so a schedule becomes something you can genuinely design rather than pick.

Inputs and outputs

V is the autogrow list of sigma inputs (V0, V1, ...), F the floats, Expression the formula (the tooltip even calls it "Expression to apply on input images" - copy-paste drift from the image node, ignore it, it's a sigma tensor you're editing). length_mismatch handles schedules of different lengths, error default plus tile/pad.

Outputs are SIGMAS and STACK. The sigmas feed the sampler input of a KSampler, which is where custom schedules connect in ComfyUI.

Installing it

Standard for the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/mcDandy/more_math
cd more_math
pip install -r requirements.txt

Restart ComfyUI, or install "More math" from ComfyUI Manager. Dependency is antlr4-python3-runtime on top of torch. No model downloads.

Gotchas

Schedules are fragile in a specific way: they're descending noise levels, and if your expression makes sigmas non-monotonic or negative, the sampler will do something weird or crash. Keep results positive and roughly descending, or clamp deliberately. Also, because this is flow-matching territory these days, the "right" schedule shape depends heavily on what the model was trained on - a schedule that's golden on an SDXL-based model can be nonsense on a distilled one. And remember the length-mismatch default: blending a 10-step and 20-step schedule hits error immediately, so decide which behavior you want first. New pack, solo-maintained, but for anyone who's ever wished the scheduler dropdown had a "custom" option, this is it.

CategoryMore math

Inputs (5)

NameTypeDefaultDescription
VCOMFY_AUTOGROW_V3
FCOMFY_AUTOGROW_V3
ExpressionSTRING,SYNTAX_TREEV0Expression to apply on input images
length_mismatchCOMBOerrorHow to handle mismatched image batch sizes. tile: repeat shorter inputs; error: raise error on mismatch; pad: treat missing frames as zero.
stackoptSTACKAccess stack between nodes

Outputs (2)

NameTypeDescription
SIGMASSIGMAS
STACKSTACK