Nodes/ComfyUI-Apt_Preset/list_num_range
ComfyUI Node

list_num_range

Generating evenly spaced number sequences in ComfyUI

By cardenluo·Created 2 years ago·Updated 18 days ago· 309
list_num_range
    • data
    • list
    • length
    start0.00
    stop1.00
    num10

    Need to sweep CFG from 3 to 12 across ten steps, or generate a clean sequence of ten seeds' worth of denoise strengths? list_num_range is a numpy.linspace-style node - give it a start, a stop, and a count, and it hands you back an evenly spaced sequence, no manual typing of ten separate values.

    What it does

    This is one of the data/list utility nodes in cardenluo's ComfyUI-Apt_Preset, sitting next to list_ListSlice and list_MergeList. It takes start and stop (both floats) and num (an integer, minimum 2), and produces num evenly spaced values between start and stop inclusive - the same behavior as numpy.linspace(start, stop, num) if you've used that. With the defaults (start=0, stop=1, num=10), you get ten values from 0.0 to 1.0 in even steps.

    It gives you the result in three different shapes, which is the practical part: data as an exploded FLOAT list (one value per batch item, for feeding directly into a node that iterates per-item, like driving a parameter sweep across a batch), list as a single LIST object (for nodes downstream that expect one list value rather than an exploded batch), and length as a plain INT count - handy for wiring into anything that needs to know how many items came out, like a batch-size input elsewhere in the graph, without hardcoding num twice.

    Inputs and outputs

    • start - sequence start value (float, default 0).
    • stop - sequence end value (float, default 1).
    • num - how many values to generate (int, minimum 2, default 10).

    Outputs: data (FLOAT, exploded list), list (LIST, single object), length (INT).

    Since num has a hard minimum of 2, you can't generate a single-value or empty sequence with this node - for a single fixed value, just use a plain number widget instead.

    Where this fits

    The obvious use is parameter sweeps: CFG, denoise strength, LoRA weight, ControlNet strength - anywhere you'd otherwise be manually typing out ten slightly different values across ten copies of a node. It also pairs well with this pack's list_Value for animation work - where list_Value gives you an eased, keyframed curve, list_num_range gives you a plain linear sweep, which is often exactly what a parameter test needs instead of an eased curve.

    Installing it

    Through ComfyUI Manager: search ComfyUI-Apt_Preset. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
    

    Run install.bat on Windows (or pip install -r requirements.txt), restart ComfyUI. No external models required - this is arithmetic, nothing more.

    Troubleshooting

    Check for a clean pack import first: ComfyUI-Apt_Preset is large and there's a documented IMPORT FAILED report for it, unrelated to this specific node - if list_num_range doesn't show up, check your ComfyUI console at startup before assuming a workflow problem.

    For the node itself, the thing worth knowing is that start can be greater than stop - the node will still generate a descending sequence rather than erroring, which is useful (a strength sweep from 1.0 down to 0.1, say) but easy to trigger by accident if you swap the two fields. And if a downstream node expects a single float rather than a list, feeding it data directly will error or behave oddly - that's what the list output and list_ListSlice (to pull one specific index back out) are for.

    CategoryApt_Preset/data/list|Batch

    Inputs (3)

    NameTypeDefaultDescription
    startFLOAT0.00
    stopFLOAT1.00
    numINT10

    Outputs (3)

    NameTypeDescription
    dataFLOAT
    listLIST
    lengthINT