Reference

This is the reference for the classes and functions defined in the nodefinder module.

Identify

Run function

Submodule for identifying nodal features such as points and lines from a point-cloud of nodes as created by the search submodule.

nodefinder.identify.run(result, feature_size=None, evaluate_line_method='ballistic')[source]

Identify the nodal clusters from a search.run() result.

Parameters
  • result (SearchResultContainer) – Result of the search step.

  • feature_size (float, optional) – Distance between two nodal points at which they are considered distinct. Uses the feature_size used in the search step by default.

nodefinder.identify.run_from_positions(positions, *, coordinate_system, feature_size, evaluate_line_method='shortest_path')[source]

Identify the nodal clusters from a list of positions.

Parameters
  • positions (list(tuple(float))) – The list of nodal positions.

  • coordinate_system (CoordinateSystem) – Coordinate system used to calculate distances.

  • feature_size (float) – Distance between two nodal points at which they are considered distinct.

Result classes

Define the result classes for the identification step.

class nodefinder.identify.result.IdentificationResultContainer(*, coordinate_system, feature_size, results=())[source]

Container class for the result of the identification step.

coordinate_system

The coordinate system of the problem.

Type

CoordinateSystem

results

List of identified objects.

Type

list(IdentificationResult)

feature_size

The feature_size used when identifying the objects.

Type

float

classmethod from_hdf5(hdf5_handle)

Deserializes the object stored in HDF5 format.

class nodefinder.identify.result.IdentificationResult(positions, dimension, shape=None)[source]

Contains the attributes of an identified object.

positions

Positions of the nodal points making up the object.

Type

list(tuple(float))

shape

Shape of the identified object. If the shape could not be identified, it is set to None.

Type

None or NodalPoint or NodalLine

dimension

Dimension of the identified object. Is set to None if the dimension is ambiguous.

Type

int

classmethod from_hdf5(hdf5_handle)[source]

Deserializes the object stored in HDF5 format.

to_hdf5(hdf5_handle)[source]

Serializes the object to HDF5 format, attaching it to the given HDF5 handle (might be a HDF5 File or Dataset).

class nodefinder.identify.result.NodalPoint(position)[source]

Shape class defining a nodal point.

position

The position of the point.

Type

tuple(float)

classmethod from_hdf5(hdf5_handle)

Deserializes the object stored in HDF5 format.

class nodefinder.identify.result.NodalLine(graph, degree_count)[source]

Shape class defining a nodal line.

graph

A graph describing the line.

Type

networkx.Graph

classmethod from_hdf5(hdf5_handle)[source]

Derialize the object from the given HDF5 handle.

property shape_name

Describes the shape of the line, as inferred from the degree count.

to_hdf5(hdf5_handle)[source]

Serialize the object and store in under the given HDF5 handle.

Plotting

Defines functions for plotting the results of the identify step.

nodefinder.identify.plot.result(res, *, axis=None)[source]

Plot the result of the identify step.

Parameters
nodefinder.identify.plot.nodal_point(shape, *, axis, color, feature_size=None)[source]

Plot a nodal point.

Parameters
  • shape (NodalPoint) – Nodal point to be plotted.

  • axis (matplotlib.axes.Axes) – Axes on which to plot.

  • color (str) – Color of the point.

  • feature_size (float) – Distance between two nodal points at which they are considered distinct. This argument is not used in this function.

nodefinder.identify.plot.nodal_line(shape, *, axis, color, feature_size=None)[source]

Plot a nodal line.

Parameters
  • shape (NodalLine) – Nodal line to be plotted.

  • axis (matplotlib.axes.Axes) – Axes on which to plot.

  • color (str) – Color of the nodal line.

  • feature_size (float) – Distance between two nodal points at which they are considered distinct. Used for cutting the line when it goes across periodic boundaries.

Coordinate System

Defines the coordinate system class.

class nodefinder.coordinate_system.CoordinateSystem(*, limits, periodic=True)[source]

Defines a “box” coordinate system, which is used to calculate the distances between points, and map between fractional and real coordinates.

limits

Limits of the coordinates, given as a the minimum and maximum value for each dimension.

Type

numpy.ndarray

periodic

Determies if periodic boundary conditions are used.

Type

bool

dim

Dimension of the coordinate system.

Type

int

size

Size of the coordinate system in each dimension.

Type

numpy.ndarray

average(positions)[source]

Get the average position from a list of positions.

connecting_vector(pos1, pos2)[source]

Get the shortest vector connecting two positions.

distance(pos1, pos2)[source]

Get the distance between two positions.

classmethod from_hdf5(hdf5_handle)

Deserializes the object stored in HDF5 format.

get_frac(pos)[source]

Get the fractional coordinates from the real position.

get_pos(frac)[source]

Get the real position from the fractional coordinates.

normalize_position(pos)[source]

Normalize the position by mapping it into the limits for periodic boundary conditions for the periodic case.

Saving and Loading

Defines free functions to serialize / deserialize nodefinder objects to HDF5.

These are aliases for the functions defined in fsc.hdf5_io, meaning that they can also handle other objects which are registered with the same system.

nodefinder.io.save(obj, hdf5_file)

Alias for to_hdf5_file().

nodefinder.io.load(hdf5_file)

Alias for from_hdf5_file().