# pvpython Rescale to Data Range for Calculator

**URL:** https://discourse.paraview.org/t/pvpython-rescale-to-data-range-for-calculator/6767
**Category:** ParaView Support
**Created:** [March 22, 2021, 5:40pm UTC](https://discourse.paraview.org/t/pvpython-rescale-to-data-range-for-calculator/6767 "2021-03-22T17:40:56Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![TimJim](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timjim/32/1270_2.png) [@TimJim](https://discourse.paraview.org/u/TimJim)
#### Post date: [March 22, 2021, 5:40pm UTC](https://discourse.paraview.org/t/pvpython-rescale-to-data-range-for-calculator/6767/1 "2021-03-22T17:40:56Z")

</div>

Hi, I’m having some trouble getting the colourmap to rescale for a calculator output.

I used `calculator1Display.RescaleTransferFunctionToDataRange(False, True)` as in the trace, but it doesn’t seem to update the colour. After digging through some old ParaView help pages, I saw a suggestion to run `UpdatePipeline()`. I tried that on the function and the display proxy but neither worked. I’d appreciate any thoughts - I’m probably just missing something, as it should be a simple operation!

Kind regards,  
Tim

---

<div class="post-metadata">

### Author: ![MatsievskiySV](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/439d5e/32.png) [@MatsievskiySV](https://discourse.paraview.org/u/MatsievskiySV)
#### Post date: [August 18, 2021, 11:02am UTC](https://discourse.paraview.org/t/pvpython-rescale-to-data-range-for-calculator/6767/2 "2021-08-18T11:02:50Z")

</div>

I’ve used the following code:

```python
v = GetActiveView()
[(Show(s).RescaleTransferFunctionToDataRange()) for s in GetSources().values() if servermanager.GetRepresentation(s, v) is not None and GetDisplayProperties(s, v).Visibility==1]
Render()

```

Second line filters uninitialized sources (see [this post](https://discourse.paraview.org/t/obtain-information-if-proxy-is-visible/2346/11)).  
`Render()` may be omitted if you don’t need to redraw view right away.
