# How to return NaN for the probe located outside the domain?

**URL:** https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345
**Category:** ParaView Support
**Tags:** python, vtk
**Created:** [June 2, 2021, 10:45am UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345 "2021-06-02T10:45:48Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Aroma](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@Aroma](https://discourse.paraview.org/u/Aroma)
#### Post date: [June 2, 2021, 10:45am UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345/1 "2021-06-02T10:45:48Z")

</div>

Hi,

I am using Paraview functions to read results of various point in my 2D simulation result (vtk format).  
However, it returns 0 if I give a point outside the domain. Is it possible to return NaN for the points outside the domain? Or is the any way to check if the entered point is located inside or outside the domain.  
Many thanks in advance for your help.

---

<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: [June 2, 2021, 12:48pm UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345/2 "2021-06-02T12:48:37Z")

</div>

> [@Aroma](#):
>
> Paraview functions

Which functions ? Please be specific.

---

<div class="post-metadata">

### Author: ![Aroma](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@Aroma](https://discourse.paraview.org/u/Aroma)
#### Post date: [June 2, 2021, 2:19pm UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345/3 "2021-06-02T14:19:12Z")

</div>

I’m am quite new at using Paraview. Sorry for my vague question.

I am using Paraview simple module and importing them. This is my code:

from paraview import numpy\_support as ns  
from paraview.simple import \*  
probeResults = []  
reader = OpenDataFile()  
probe = ProbeLocation(reader, ProbeType = “Fixed Radius Point Source”)  
probe.ProbeType.Center = # as [x,y,z]  
reader.FileNames =   
probe.UpdatePipeline()  
data = servermanager.Fetch(probe)  
probeResults.append(ns.vtk\_to\_numpy(data.GetPointData().GetArray()))

If I enter a point outside of the domain, it returns 0. Is it possible to get NaN for points outside the domain?

---

<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: [June 2, 2021, 2:21pm UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345/4 "2021-06-02T14:21:00Z")

</div>

You can use the “vtkValidPointMask” array to know if a point is outside the domain or not.

---

<div class="post-metadata">

### Author: ![Aroma](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@Aroma](https://discourse.paraview.org/u/Aroma)
#### Post date: [June 2, 2021, 2:23pm UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345/5 "2021-06-02T14:23:58Z")

</div>

Just now found it out and came to post it, and saw your reply.  
Thanks a lot.

---

<div class="post-metadata">

### Author: ![Aroma](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@Aroma](https://discourse.paraview.org/u/Aroma)
#### Post date: [June 6, 2021, 10:24am UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345/6 "2021-06-06T10:24:51Z")

</div>

Hi Mathieu @mwestphal ,  
How I may get the results for multiple points? (like giving an array of points and get an array of results)  
I tried to add more than one point in the code above, but it didn’t work.

Thanks a lot for your kind help.

---

<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: [June 6, 2021, 6:35pm UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345/7 "2021-06-06T18:35:01Z")

</div>

no idea what you mean

---

<div class="post-metadata">

### Author: ![Aroma](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@Aroma](https://discourse.paraview.org/u/Aroma)
#### Post date: [June 6, 2021, 7:02pm UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345/8 "2021-06-06T19:02:29Z")

</div>

For instance, I want to know the results from the dataset for 1000 points (let’s say stored in a list [[x1,y1,z1],[x2,y2,z2],…,[x1000,y1000,z1000]]  
Is there a way to give this list to ProbeLocation and return a list of 1000 results corresponding to the 1000 points?  
I am asking because, I need to accelerate my code. Currently I need to use a for loop and call the function 1000 times, which is too slow for me.

Many thanks for your kind advice.

---

<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: [June 7, 2021, 3:39pm UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345/9 "2021-06-07T15:39:26Z")

</div>

If you can pass this point list server side, you can use ResampleWithDataSet

---

<div class="post-metadata">

### Author: ![Aroma](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@Aroma](https://discourse.paraview.org/u/Aroma)
#### Post date: [June 7, 2021, 5:58pm UTC](https://discourse.paraview.org/t/how-to-return-nan-for-the-probe-located-outside-the-domain/7345/10 "2021-06-07T17:58:32Z")

</div>

Thanks a lot. I will try that.
