# simnibs.ElementData¶

class simnibs.ElementData(value, name='', mesh=None)

Data (scalar, vector or tensor) defined in mesh elements.

Parameters
• value (ndarray) –

Value of field in elements. Should have the shape
• (n_elm,) or (n_elm, 1) for scalar fields

• (n_elm, 3) for vector fields

• (n_elm, 9) for tensors

• field_name (str (optional)) – name of field. Default: ‘’

• mesh (simnibs.msh.Msh (optional)) – Mesh structure where the field is defined. Required for many methods

value

Value of field in elements

Type

ndarray

field_name

name of field

Type

str

elm_number

index of elements

Type

ndarray

nr

number of data points

Type

property

nr_comp

number of dimensions per data point (1 for scalars, 3 for vectors)

Type

property

__init__(value, name='', mesh=None)

Initialize self. See help(type(self)) for accurate signature.

Methods

 __init__(value[, name, mesh]) Initialize self. append_to_mesh(fn[, mode]) Appends this ElementData fields to a file as_nodedata() Converts the current ElementData instance to NodaData For more information see the elm_data2node_data method assign_triangle_values() In-place Assigns field value at triangle as the same as the one of the tetrahedra with a similar tag to it. calc_flux([triangles]) Calculates the flux of a vectorial field elm_data2node_data() Transforms an ElementData field into a NodeData field using Superconvergent patch recovery For volumetric data. from_data_grid(mesh, data_grid, affine[, …]) Defines an ElementData field form a mesh and gridded data get_focality([cuttofs, peak_percentile]) Caluclates field focality as the area/volume of the mesh experiencing a field norm of above (cut_off% of the field peak). get_percentiles([percentile, roi]) Get percentiles of field (or field norm, if a vector field) interpolate_scattered(points[, out_fill, …]) Interpolates the ElementData into the points by finding the element containing the point and assigning the value in it interpolate_to_grid(n_voxels, affine[, …]) Interpolates the ElementData into a grid. interpolate_to_surface(surface[, out_fill, …]) Interpolates the field in the nodes of a given surface The interpolation occurs in the tetrahedra! mean_field_norm() Calculates V*w/sum(w) Where V is the norm of the field, and w is the volume or area of the mesh where the field is defined. norm([ord]) Calculate the norm of the field read_hdf5_data_matrix_row(leadfield_fn, …) Reads a row of an hdf5 data matrix and store it as Data summary([percentiles, focality_cutoffs, units]) Creates a text summaty of the field to_deformed_grid(warp, reference[, out, …]) Interpolates field to a grid and apply non-linear interpolation to_nifti(n_voxels, affine[, fn, units, …]) Transforms the data in a nifti file view_options([v_range, percentile, visible, …]) Generates a View object with visualization opions write(fn) Writes this ElementData fields to a file with field information only This file needs to be merged with a mesh for visualization write_hdf5(hdf5_fn[, path]) Writes the field to an hdf5 file

Attributes

 elm_number Element numbers (1, …, nr) indexing_nr Same as elm_number nr Number of data entries nr_comp Number of field components type NodeData of ElementData