Commit a5dfd13
committed
Fix misleading cmap errors when norm/palette interact (#622)
Three related defects all manifested as errors blaming `cmap` for a
`norm`/`palette` mistake the user never made:
1. `norm=[n1, n2]` for a 3-channel image raised "If 'cmap' is provided,
its length must match the number of channels." even though the user
only passed `norm=`. _validate_image_render_params now validates the
norm-list length against the channel count up front, with a
norm-specific error message.
2. `cmap=["Reds","Greens"]` (wrong length) combined with `norm=` of
correct length silently nulled the cmap and used the default. The
wrong-length cmap is now rejected uniformly, matching the no-norm
path.
3. `palette + norm=list` raised "If 'palette' is provided, 'cmap' must
be None." because basic.py auto-expanded a default-cmap list to carry
the per-channel norms, and render.py couldn't tell the synthesized
list apart from a user-supplied one. The render path now keys the
palette/cmap conflict on whether any CmapParams was actually
user-supplied (cmap_is_default=False); the synthesized default-cmap
list falls through to the palette path, where per-channel norms are
already applied to the layers.
The "blending multiple cmaps" warning is also gated on user-supplied
cmaps, so it no longer fires spuriously when the user only set `norm`
or `palette + norm=list`.1 parent e107c0a commit a5dfd13
3 files changed
Lines changed: 60 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1286 | 1286 | | |
1287 | 1287 | | |
1288 | 1288 | | |
1289 | | - | |
1290 | | - | |
1291 | | - | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
1292 | 1303 | | |
1293 | 1304 | | |
1294 | 1305 | | |
| |||
1297 | 1308 | | |
1298 | 1309 | | |
1299 | 1310 | | |
1300 | | - | |
1301 | | - | |
1302 | | - | |
1303 | | - | |
1304 | 1311 | | |
1305 | 1312 | | |
1306 | 1313 | | |
| |||
1527 | 1534 | | |
1528 | 1535 | | |
1529 | 1536 | | |
1530 | | - | |
1531 | | - | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
1532 | 1540 | | |
1533 | 1541 | | |
1534 | 1542 | | |
| |||
1568 | 1576 | | |
1569 | 1577 | | |
1570 | 1578 | | |
1571 | | - | |
| 1579 | + | |
1572 | 1580 | | |
1573 | 1581 | | |
1574 | 1582 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2989 | 2989 | | |
2990 | 2990 | | |
2991 | 2991 | | |
| 2992 | + | |
| 2993 | + | |
2992 | 2994 | | |
2993 | 2995 | | |
2994 | | - | |
2995 | 2996 | | |
2996 | 2997 | | |
2997 | 2998 | | |
2998 | | - | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
2999 | 3002 | | |
3000 | | - | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
3001 | 3008 | | |
3002 | 3009 | | |
3003 | 3010 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
499 | 531 | | |
500 | 532 | | |
501 | 533 | | |
| |||
0 commit comments