# Point Probe¶

## Description¶

Extract a point probe from a given input Base.

## Parameters¶

• base: Base

Probes will be searched in this input base.

• coordinates: list(str)

The variable names that define the set of coordinates. The coordinates must always be located at nodes whatever the value of location.

• location: str in LOCATIONS, default= ‘node’

Location of values that are concerned by the search. If location is ‘node’, then the probe value will be computed with variables located at ‘node’.

• points: list(tuple)

List of point coordinates.

• interpolation: str in [‘closest’, ‘linear’], default= closest

Type of interpolation to apply to the input values to get the probe value.

• axis: str or None, default= None

Name of the rotation axis. Must be in coordinates. If None, then no rotation will be performed on the zones to find the probe location.

• angle_name: str, default= None

Name of the rotation angle that is a key in the dictionary Zone.attrs.

• vectors: tuple/list(tuple(str)), default= []

Coordinate names of vectors that need to be rotated.

• one_zone_per_probe: bool, default= True

If True, each valid point probe gives one Zone, else all probes are set in a single Zone.

## Preconditions¶

The underlying mesh must be time-independent (non-deformable and non-moving mesh).

If the zones have to be rotated, then the input zones must contain a key named as the value given by the parameter angle_name in Zone.attrs.

## Postconditions¶

The output Base object contains as many zones as probe points if they are all detected. Undetected probe points are ignored.

The name of an output zone is <name of the input zone>_x_y_z with (x,y,z) the coordinates of the probe. If the zone has been rotated N times, then the name of an output zone is <name of the input zone>_<’DUP%02d’%N>_x_y_z.

If location is ‘node’ and interpolation is ‘closest’, then the probe value will be the node value of the nearest mesh point.

If location is ‘cell’ and interpolation is ‘closest’, then the probe value will be the cell value of the mesh element in which the probe is located.

If location is ‘node’ and interpolation is ‘linear’, then the probe value will be the value interpolated from the vertices of the mesh element in which the probe is located.

If one_zone_per_probe is False, then the array ‘valid_interpolation’ is set in the instant of the zone. This boolean array says if a given point could have been interpolated.

## Example¶

import antares
myt = antares.Treatment('pointprobe')
myt['base'] = base
myt['points'] = [(-20., 160., 0.), (110, 160., 0.)]
myt['location'] = 'node'
myt['interpolation'] = 'linear'
probes_base = myt.execute()


## Main functions¶

class antares.treatment.TreatmentPointProbe.TreatmentPointProbe
execute()

Probe the data from the base.

Returns

The base containing the values of the given points.

Return type

Base

## Example¶

"""
This example illustrates how use the pointprobe treatment.

Compare with probe.py
"""
import os
if not os.path.isdir('OUTPUT'):
os.makedirs('OUTPUT')

import numpy as np

# ----------------------------------------------
# Reading the files and topological information
# ----------------------------------------------
reader['filename'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'flow_<zone>_ite0.dat')

# -----------------------------
# Retrieve the probes family
# -----------------------------
treatment = Treatment('pointprobe')
treatment['base'] = base
treatment['points'] = [(-20., 160., 0.), (110, 160., 0.)]
treatment['location'] = 'node'
treatment['interpolation'] = 'closest'
probes = treatment.execute()

print(probes)
# >>>  Base object
#      - zones : ['Block0002_-20.0_160.0_0.0', 'Block0000_110_160.0_0.0']

for zonen, zone in probes.items():
print('Probe {}'.format(zonen))
for inst in zone.values():
for varn, var in inst.items():
print('Variable {}: {}'.format(varn[0], np.squeeze(var)))