# Scalar name (point data) undefined when using Calculator filter in Anaconda Prompt

**URL:** https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980
**Category:** ParaView Support
**Tags:** python
**Created:** [July 28, 2020, 11:15pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980 "2020-07-28T23:15:12Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![jclai](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jclai/32/4482_2.png) [@jclai](https://discourse.paraview.org/u/jclai)
#### Post date: [July 28, 2020, 11:15pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980/1 "2020-07-28T23:15:12Z")

</div>

Hello,

I have no problem using the calculator filter in the ParaView GUI. Basically, my initial dataset consists of pressure ‘p’, velocity components ‘vxs’, ‘vys’, and ‘vzs’ - they are all point data. I applied many filters to the original dataset and then near the end I want to calculate p\*Normals\_Y. This is right after a GenerateSurfaceNormals filter which I called ‘normals’. It outputs ‘Normals\_X’, ‘Normals\_Y’, and ‘Normals\_Z’. It works perfectly in the GUI, but I’m not sure how to do it in Python.

When scripting, I used this line of code:  
`pressure = Calculator(Input=normals, ResultArrayName='Force_Y', Function= p*Normals_Y)`

And I get this error:  
`NameError: name 'p' is not defined`

I also tried using my original dataset as the input to the Calculator filter because I can’t exactly tell what the exact input is from the GUI, but it gave the same error.

---

<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 30, 2020, 3:25pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980/2 "2020-07-30T15:25:52Z")

</div>

`Function` should be a string, so just add quotation marks around it, i.e.

`pressure = Calculator(Input=normals, ResultArrayName='Force_Y', Function='p*Normals_Y')`

---

<div class="post-metadata">

### Author: ![jclai](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jclai/32/4482_2.png) [@jclai](https://discourse.paraview.org/u/jclai)
#### Post date: [July 30, 2020, 6:16pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980/3 "2020-07-30T18:16:30Z")

</div>

Hi, thanks for your reply.

I tried that but I got this error:  
`( 3.532s) [paraview] vtkFunctionParser.cxx:1227 ERR| vtkFunctionParser (0000022B0EBFE470): Syntax error: expecting a variable name; see position 2 ( 3.612s) [paraview] vtkFunctionParser.cxx:1227 ERR| vtkFunctionParser (0000022B0EBFE470): Syntax error: expecting a variable name; see position 2 ( 3.665s) [paraview] vtkArrayCalculator.cxx:348 WARN| vtkPVArrayCalculator (0000022B0FDE92D0): An error occurred when parsing the calculator's function. See previous errors.`

I am wondering if it is because I haven’t used UpdatePipeline() at all in my script? I see it being used in the ParaView Guide, but do not quite understand what it does. What do you think?

---

<div class="post-metadata">

### Author: ![jclai](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jclai/32/4482_2.png) [@jclai](https://discourse.paraview.org/u/jclai)
#### Post date: [July 31, 2020, 4:44pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980/4 "2020-07-31T16:44:52Z")

</div>

After I use the calculator function, I try to display pressure by using these commands:

`Show(pressure)`  
`Interact()`

Is there possibly an error in these commands? Am I allowed to visualize the calculator-filtered data?

---

<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 31, 2020, 5:01pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980/5 "2020-07-31T17:01:44Z")

</div>

Could you post some more of your script? I’m confused because in some places you have `p` but other places you mention `pressure`. Are you using the variable names consistently in the script?

---

<div class="post-metadata">

### Author: ![jclai](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jclai/32/4482_2.png) [@jclai](https://discourse.paraview.org/u/jclai)
#### Post date: [July 31, 2020, 5:04pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980/6 "2020-07-31T17:04:21Z")

</div>

Yes, `p` is the name of the scalar point data that is in the original file I am opening.

`reader = TecplotReader(FileNames=['C:/Users/joyce/OneDrive/Documents/S4.5 UH REU Summer 2020/0.675Simple2Pitch_Regrid_Off_Simulation_Output_7-17-2020/0.675Simple-20Hz-0mms-p50.dat'])`  
`if reader==0:`  
` print('\n **ERROR: Could not open file** \n')`  
`else:`  
` print(' -- Successfully read .dat file --')`

`# Apply ExtractRegionSurface() filter to remove volume between swimmer and boundary`  
`removeVolume = ExtractRegionSurface(reader)`  
`print(' -- Successfully extracted region surface --')`

`# Select Swimmer`  
`extraction = ExtractCellsByRegion(Input = removeVolume)`  
`SetProperties(extraction, IntersectWith = 'Box')`  
`extraction.IntersectWith.Position = BoxPosition`  
`extraction.IntersectWith.Length = BoxLength`  
`print(' -- Successfully selected swimmer --')`

`# Extract swimmer surface`  
`swimmerSurface = ExtractRegionSurface(extraction)`

`# Generate normals`  
`normals = GenerateSurfaceNormals(swimmerSurface)`  
`pressure = Calculator(Input=removeVolume, ResultArrayName='Force_Y', Function='p*Normals_Y')`

`Show(pressure)`  
`Interact()`

I also defined BoxPosition and BoxLength arrays earlier in my code but did not include it here.

---

<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 31, 2020, 5:11pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980/7 "2020-07-31T17:11:06Z")

</div>

Oh, sorry. I didn’t see that `pressure` was the name of the Calculator filter.

In any case, I think you’ll need to change the Input parameter of the **Calculator** filter to be `normals` instead of `removeVolume`.

---

<div class="post-metadata">

### Author: ![jclai](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jclai/32/4482_2.png) [@jclai](https://discourse.paraview.org/u/jclai)
#### Post date: [July 31, 2020, 5:15pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980/8 "2020-07-31T17:15:56Z")

</div>

Oh yes, you’re right… I was experimenting with different inputs and forgot to change it back. I used `normals` as the input, but still got a similar looking error.

```
( 5.028s) [paraview] vtkOpenGLState.cxx:1380 WARN| Hardware does not support the number of textures defined.
( 5.104s) [paraview] vtkOpenGLState.cxx:1380 WARN| Hardware does not support the number of textures defined.
( 5.138s) [paraview] vtkShaderProgram.cxx:437 ERR| vtkShaderProgram (0000021650459330): 1: #version 150
2: #ifndef GL_ES
3: #define highp
4: #define mediump
5: #define lowp
6: #endif // GL_ES
7: #define attribute in
8: #define varying out
9:
10:
11: /*=========================================================================
12:
13: Program: Visualization Toolkit
14: Module: vtkPolyDataVS.glsl
15:
16: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
17: All rights reserved.
18: See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
19:
20: This software is distributed WITHOUT ANY WARRANTY; without even
21: the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
22: PURPOSE. See the above copyright notice for more information.
23:
24: =========================================================================*/
25:
26: in vec4 vertexMC;
27:
28:
29:
30: // frag position in VC
31: out vec4 vertexVCVSOutput;
32:
33: // optional normal declaration
34: in vec3 normalMC;
35: uniform mat3 normalMatrix;
36: out vec3 normalVCVSOutput;
37:
38: // extra lighting parameters
39: //VTK::Light::Dec
40:
41: // Texture coordinates
42: //VTK::TCoord::Dec
43:
44: // material property values
45: //VTK::Color::Dec
46:
47: // clipping plane vars
48: //VTK::Clip::Dec
49:
50: // camera and actor matrix values
51: uniform mat4 MCDCMatrix;
52: uniform mat4 MCVCMatrix;
53:
54: // Apple Bug
55: //VTK::PrimID::Dec
56:
57: // Value raster
58: //VTK::ValuePass::Dec
59:
60: // picking support
61: //VTK::Picking::Dec
62:
63: void main()
64: {
65: //VTK::Color::Impl
66:
67: normalVCVSOutput = normalMatrix * normalMC;
68:
69: //VTK::TCoord::Impl
70:
71: //VTK::Clip::Impl
72:
73: //VTK::PrimID::Impl
74:
75: vertexVCVSOutput = MCVCMatrix * vertexMC;
76: gl_Position = MCDCMatrix * vertexMC;
77:
78:
79: //VTK::ValuePass::Impl
80:
81: //VTK::Light::Impl
82:
83: //VTK::Picking::Impl
84: }

( 6.276s) [paraview] vtkShaderProgram.cxx:438 ERR| vtkShaderProgram (0000021650459330): Could not create shader object.
```

---

<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 31, 2020, 5:33pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980/9 "2020-07-31T17:33:05Z")

</div>

That’s odd, it’s a rendering error. Your pipeline code looks fine.

Do you still see it if you remove the `Interact()` call?

---

<div class="post-metadata">

### Author: ![jclai](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jclai/32/4482_2.png) [@jclai](https://discourse.paraview.org/u/jclai)
#### Post date: [July 31, 2020, 6:01pm UTC](https://discourse.paraview.org/t/scalar-name-point-data-undefined-when-using-calculator-filter-in-anaconda-prompt/4980/10 "2020-07-31T18:01:18Z")

</div>

No I don’t get the error when I remove `Interact()`.

I’ll also add that when I do `from paraview.simple import *`, I get this error many times:  
`#osp: INITIALIZATION ERROR --> could not open module lib ospray_module_ispc: The specified module could not be found.`  
and I think the error also generates in other parts of the code. I couldn’t find a solution for it and the functions seemed to work fine so I ignored it for now.

I’m also using Anaconda Prompt and Spyder to edit my script. Perhaps my paths are not configured correctly? I’m not too sure.
