Peano
Loading...
Searching...
No Matches
tarch.plotter.api.output.PointProbe.PointProbe Class Reference

Probe the data within a Peano patch file at one point over time. More...

Inheritance diagram for tarch.plotter.api.output.PointProbe.PointProbe:
Collaboration diagram for tarch.plotter.api.output.PointProbe.PointProbe:

Public Member Functions

 __init__ (self, file_name, point, output_file, start, end, verbose=False)
 process_snapshot (self, snapshot, i)
 Return (timestamp, dict from unknown name onto (number of unknowns, description, values or None)).
 display (self, max_workers=1)
 This is the one routine the visualisers typically do overwrite.
 display_single_file (self)
 If we are here we've supplied a single file which is itself a snapshot.
Public Member Functions inherited from tarch.plotter.api.output.Visualiser.Visualiser
 __init__ (self, file_name, start, end, verbose=False)
 Abstract superclass of a visualiser.
 read_metadata (self)
 Read the patch file metadata.
 append_filter (self, filter)
 remove_filters (self)
 parse_and_render_snapshot (self, snapshot)
 We pass in a snapshot object here, which should contain time stamp and filenames for everything we want to render here.
 parse_snapshot (self, snapshot)
 We rewrite "reload" from previous version of this file.

Static Public Attributes

int Tolerance = 1e-8

Protected Member Functions

 _probe_patch_data (self, patch_file_data, point)
 Return list of unknowns at point or None if point is not covered.
 _assert_default_cell_mapping (self, patch_file_data)
 Cell data with a user-defined (distorted) mapping is not supported.
 _run (self, max_workers)
 _column_names (self, columns, descriptions)
 One column name per unknown of each data set.
 _write_csv (self, results)

Protected Attributes

 _point = tuple(float(x) for x in point)
 _output_file = output_file
Protected Attributes inherited from tarch.plotter.api.output.Visualiser.Visualiser
 _file_name = file_name
 _start = start
 _end = end
list _filter = []
int _dimensions = 0
str _description = "" #
bool _is_data_associated_to_cell = False

Additional Inherited Members

Data Fields inherited from tarch.plotter.api.output.Visualiser.Visualiser
tuple identifier
 verbose = verbose
bool show_progress = True
 patch_filter = None
list snapshots = []
bool meta_data_has_been_read = False

Detailed Description

Probe the data within a Peano patch file at one point over time.

This is not a visualiser but a postprocessing tool, but it reuses the whole meta file and snapshot logic of the Visualiser. Per snapshot, we parse only those patches which contain the probe point (

See also
PatchContainsPoint), pick the finest one of them, and take the value of the cell (for cell data) or of the nearest dof (for vertex data) which contains the point. There is no interpolation.

The result is a csv file with one row per snapshot. The first column is the snapshot's time stamp, followed by all unknowns of all data sets found in the file. If the point is not covered by any patch in a snapshot, we write NaNs.

If the point sits exactly on the face between two patches of the same size, we take the patch to the right/top/front, i.e. we use half-open intervals [offset,offset+size). Only if no such patch exists (domain boundary), we fall back to the patch to the left.

Definition at line 37 of file PointProbe.py.

Constructor & Destructor Documentation

◆ __init__()

tarch.plotter.api.output.PointProbe.PointProbe.__init__ ( self,
file_name,
point,
output_file,
start,
end,
verbose = False )

Definition at line 61 of file PointProbe.py.

References __init__().

Referenced by __init__().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ _assert_default_cell_mapping()

tarch.plotter.api.output.PointProbe.PointProbe._assert_default_cell_mapping ( self,
patch_file_data )
protected

Cell data with a user-defined (distorted) mapping is not supported.

Definition at line 130 of file PointProbe.py.

Referenced by _probe_patch_data().

Here is the caller graph for this function:

◆ _column_names()

tarch.plotter.api.output.PointProbe.PointProbe._column_names ( self,
columns,
descriptions )
protected

One column name per unknown of each data set.

If a data set names its unknowns (

See also
unknown_names_from_description()), we use these names, e.g. h, hu, hv, b. If two data sets use the same name, we prefix the names with the data set, e.g. SWEQ_h. Data sets without names yield SWEQ_0, SWEQ_1, ...

Definition at line 195 of file PointProbe.py.

Referenced by _write_csv().

Here is the caller graph for this function:

◆ _probe_patch_data()

tarch.plotter.api.output.PointProbe.PointProbe._probe_patch_data ( self,
patch_file_data,
point )
protected

Return list of unknowns at point or None if point is not covered.

Definition at line 66 of file PointProbe.py.

References _assert_default_cell_mapping(), and Tolerance.

Here is the call graph for this function:

◆ _run()

tarch.plotter.api.output.PointProbe.PointProbe._run ( self,
max_workers )
protected

Definition at line 172 of file PointProbe.py.

Referenced by display().

Here is the caller graph for this function:

◆ _write_csv()

tarch.plotter.api.output.PointProbe.PointProbe._write_csv ( self,
results )
protected

Definition at line 224 of file PointProbe.py.

References _column_names(), and _output_file.

Here is the call graph for this function:

◆ display()

tarch.plotter.api.output.PointProbe.PointProbe.display ( self,
max_workers = 1 )

This is the one routine the visualisers typically do overwrite.

Reimplemented from tarch.plotter.api.output.Visualiser.Visualiser.

Definition at line 253 of file PointProbe.py.

References _run(), and display().

Referenced by display().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ display_single_file()

tarch.plotter.api.output.PointProbe.PointProbe.display_single_file ( self)

If we are here we've supplied a single file which is itself a snapshot.

Turn it into an instance of the snapshot helper class, set the timestamp to 0 and pass it back. We can just call parse_and_render_snapshot() on the result

Reimplemented from tarch.plotter.api.output.Visualiser.Visualiser.

Definition at line 257 of file PointProbe.py.

◆ process_snapshot()

tarch.plotter.api.output.PointProbe.PointProbe.process_snapshot ( self,
snapshot,
i )

Return (timestamp, dict from unknown name onto (number of unknowns, description, values or None)).

Definition at line 155 of file PointProbe.py.

Field Documentation

◆ _output_file

tarch.plotter.api.output.PointProbe.PointProbe._output_file = output_file
protected

Definition at line 64 of file PointProbe.py.

Referenced by _write_csv().

◆ _point

tarch.plotter.api.output.PointProbe.PointProbe._point = tuple(float(x) for x in point)
protected

Definition at line 63 of file PointProbe.py.

◆ Tolerance

int tarch.plotter.api.output.PointProbe.PointProbe.Tolerance = 1e-8
static

Definition at line 59 of file PointProbe.py.

Referenced by _probe_patch_data().


The documentation for this class was generated from the following file: