# Calculator filter generates unexpected results

**URL:** https://discourse.paraview.org/t/calculator-filter-generates-unexpected-results/2234
**Category:** ParaView Support
**Created:** [July 16, 2019, 3:12pm UTC](https://discourse.paraview.org/t/calculator-filter-generates-unexpected-results/2234 "2019-07-16T15:12:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![myousefi2016](https://discourse.paraview.org/user_avatar/discourse.paraview.org/myousefi2016/32/2457_2.png) [@myousefi2016](https://discourse.paraview.org/u/myousefi2016)
#### Post date: [July 16, 2019, 3:12pm UTC](https://discourse.paraview.org/t/calculator-filter-generates-unexpected-results/2234/1 "2019-07-16T15:12:36Z")

</div>

Hi all,

I’m working on a vtkPolyData file and I’m interested to write a formula based on some of the existing data arrays by using Calculator filter. One of the components of my formula is a vector (I’m pretty sure it is a vector and you could check it out in my file attached here) and the other one is the scalar. Let’s say the: “tangentialprojectiontraction\_average” is a vector and “shearstress\_average” is a scalar and I’m interested to calculate a new quantity of OSI as: OSI = “0.5\*(1-((mag(tangentialprojectiontraction\_average))/(shearstress\_average)))”. But the ParaView version 5.6.0 downloaded from your official website as a pre-built binary complains that “tangentialprojectiontraction\_average” is not a vector so I can’t apply mag operator on it despite the fact that indeed it is a vector for 100% sure. Any idea how to fix it? I attached my file here to reproduce this error. Thanks! Link to download the file: [https://drive.google.com/file/d/1x5ojmzrPcSFtdtlJZ34qOHo7lSN0h8ao/view?usp=sharing](https://drive.google.com/file/d/1x5ojmzrPcSFtdtlJZ34qOHo7lSN0h8ao/view?usp=sharing)

---

<div class="post-metadata">

### Author: ![myousefi2016](https://discourse.paraview.org/user_avatar/discourse.paraview.org/myousefi2016/32/2457_2.png) [@myousefi2016](https://discourse.paraview.org/u/myousefi2016)
#### Post date: [July 16, 2019, 3:41pm UTC](https://discourse.paraview.org/t/calculator-filter-generates-unexpected-results/2234/2 "2019-07-16T15:41:08Z")

</div>

Another unexpected behavior of Calculator filter is that even if you just write a simple formula: Result = “tangentialprojectiontraction\_average” you would expect Result should just show “tangentialprojectiontraction\_average” yes?! But, it’s not the case here cause it just passes 0 to Result:

Before Calculator filter:

 ![Screenshot%20from%202019-07-16%2011-42-24](https://discourse.paraview.org/uploads/default/original/2X/c/c8d58c9422bc68d6b96704d2491dc1c2d198011f.png)

After Calculator filter:

 ![Screenshot%20from%202019-07-16%2011-40-30](https://discourse.paraview.org/uploads/default/original/2X/4/44c81316fe234cc3508810306e60f03d25197c4d.png)

Interestingly, indeed “Result” data array that must be equal to “tangentialprojectiontraction\_average” is not a vector…

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [July 16, 2019, 3:44pm UTC](https://discourse.paraview.org/t/calculator-filter-generates-unexpected-results/2234/3 "2019-07-16T15:44:35Z")

</div>

Mehrdad, welcome to ParaView.

I can confirm there is a problem with your data in ParaView 5.6.0. Fortunately, using the expression `0.5*(1-((mag(tangentialprojectiontraction_average))/(shearstress_average)))` in ParaView 5.7.0-RC1 works fine, so the bug appears to have been fixed in time for the ParaView 5.7.0 release in the next few weeks.

---

<div class="post-metadata">

### Author: ![myousefi2016](https://discourse.paraview.org/user_avatar/discourse.paraview.org/myousefi2016/32/2457_2.png) [@myousefi2016](https://discourse.paraview.org/u/myousefi2016)
#### Post date: [July 16, 2019, 3:45pm UTC](https://discourse.paraview.org/t/calculator-filter-generates-unexpected-results/2234/4 "2019-07-16T15:45:58Z")

</div>

Thanks Cory, I would try ParaView 5.7.0-RC1 to see how it works.
