# programmable script - python bug, wrong results?

**URL:** https://discourse.paraview.org/t/programmable-script-python-bug-wrong-results/16300
**Category:** ParaView Support
**Tags:** python
**Created:** [March 11, 2025, 8:35pm UTC](https://discourse.paraview.org/t/programmable-script-python-bug-wrong-results/16300 "2025-03-11T20:35:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Dave1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dave1/32/11492_2.png) [@Dave1](https://discourse.paraview.org/u/Dave1)
#### Post date: [March 11, 2025, 8:35pm UTC](https://discourse.paraview.org/t/programmable-script-python-bug-wrong-results/16300/1 "2025-03-11T20:35:23Z")

</div>

Hi  
I have a simple programmable script with a condition where i use np.where.  
The velocity for example should be smaller than 1 otherwise it should be nan.  
VEL = np.where((VEL \>= 0) & (VEL \<= 1.0), VEL, np.nan))

When i check the results, it seems like the condition isn’t applied correctly since velocity values smaller than 1 got nan values, see picture.

 ![paraview](https://discourse.paraview.org/uploads/default/original/3X/8/9/89ce154b4d0d41b3a8767e8f6bc44ecd857cca6e.png)

What could be the reason for that?

i use paraview 5.13.2

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 12, 2025, 8:59am UTC](https://discourse.paraview.org/t/programmable-script-python-bug-wrong-results/16300/2 "2025-03-12T08:59:45Z")

</div>

Does that work correctly for other variables ?

---

<div class="post-metadata">

### Author: ![Dave1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dave1/32/11492_2.png) [@Dave1](https://discourse.paraview.org/u/Dave1)
#### Post date: [March 12, 2025, 7:03pm UTC](https://discourse.paraview.org/t/programmable-script-python-bug-wrong-results/16300/3 "2025-03-12T19:03:29Z")

</div>

Doesnt seem like: This is the variable TA

 ![paraview1](https://discourse.paraview.org/uploads/default/original/3X/6/9/69511eb05f759d370be1e24d74ec5b4909c5738e.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 13, 2025, 6:15am UTC](https://discourse.paraview.org/t/programmable-script-python-bug-wrong-results/16300/4 "2025-03-13T06:15:46Z")

</div>

Can you validate the numpy operation is correct ?

---

<div class="post-metadata">

### Author: ![Dave1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dave1/32/11492_2.png) [@Dave1](https://discourse.paraview.org/u/Dave1)
#### Post date: [March 14, 2025, 6:49pm UTC](https://discourse.paraview.org/t/programmable-script-python-bug-wrong-results/16300/5 "2025-03-14T18:49:20Z")

</div>

im not sure what you mean by that.

When i use a array with testdata it works fine within paraview.

 ![paraview2](https://discourse.paraview.org/uploads/default/original/3X/e/1/e1dd3f889c8d10569723959305f70092a3dceddc.png)

i’m confused because i ordered a similar script from you and it also uses the np.where. so i’m a little worried that the other one will also produce wrong results.
