# 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:** 1
**Showing post:** 2

<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.

---

_[View the full topic](https://discourse.paraview.org/t/pvpython-rescale-to-data-range-for-calculator/6767)._
