Sigmas Percentile
Rescale a schedule off its typical values, not its extremes
- sigmas
- SIGMAS
Rescaling a schedule the naive way - measure its min and max, stretch that range onto a target range - has an obvious failure mode: one weird outlier value wrecks the whole mapping. Run a schedule through Sigmas Math3 or one of RES4LYF's stranger generators and you can easily end up with a single spike that, if you rescale off raw min/max, drags every other value along with it and flattens the part of the curve you actually cared about.
Percentile fixes that by measuring the schedule's typical range instead of its literal extremes. You tell it which percentiles to treat as the effective floor and ceiling - the defaults, 5th and 95th, deliberately ignore the outer 10% of values - and it maps that inner range onto your target range. It's the same idea as contrast-stretching an image while ignoring a few blown-out pixels: robust to a handful of bad values without needing to hunt them down and fix them individually.
The inputs and outputs that matter
sigmas is the schedule to rescale. percentile_min (default 5) and percentile_max (default 95) set which percentiles of the current schedule get treated as the effective bounds. target_min (default 0) and target_max (default 1) are what those bounds get mapped onto. clip_outliers (default on) decides what happens to values that fell outside the measured percentile range in the first place - with it on, they get clamped into the target range rather than allowed to overshoot past it. The output is a single SIGMAS.
Note the target defaults land on 0–1, not a typical sigma range like 0.03–14 - if you're feeding this straight into a sampler, set target_min/target_max to a range your sampler actually expects rather than leaving the defaults untouched.
Installing it
ComfyUI Manager: search RES4LYF, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ClownsharkBatwing/RES4LYF/
cd RES4LYF
pip install -r requirements.txt
(embedded pip.exe on portable installs). Restart and hard-refresh the browser afterward.
Where people get tripped up
The 0–1 default target range is the most common trap - it's meant as a normalized default, not a sigma-ready one, so a schedule that comes out of this node looking suspiciously tame or flat is usually just sitting in the wrong range for what comes next. Set target_min/max to match the scale you actually need.
The other thing to watch is clip_outliers. Turn it off and values beyond your percentile window can land outside your target range entirely, which defeats the point of using percentiles in the first place - if you wanted a hard clamp, leave it on; if you specifically want to preserve outliers as an exaggerated tail, that's the one case for turning it off.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| sigmas | SIGMAS | — | |
| percentile_min | FLOAT | 5.00–49 | — |
| percentile_max | FLOAT | 95.051–100 | — |
| target_min | FLOAT | 0.00-10000–10000 | — |
| target_max | FLOAT | 1.00-10000–10000 | — |
| clip_outliers | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SIGMAS | SIGMAS | — |