matcal.full_field.data

The data module contains classes and functions for converting data into the structure that MatCal requires for studies.

Functions

convert_dictionary_to_field_data(dict_data)

Takes a dictionary and attempts to create a MatCal FieldData object.

Classes

FieldData(data[, state, name])

Extension of the Data that incorporates the ability to store nodal positions and connectivity.

class matcal.full_field.data.FieldData(data, state=<matcal.core.state.SolitaryState object>, name=None)[source]

Extension of the Data that incorporates the ability to store nodal positions and connectivity.

property spatial_coords
Returns:

the spatial coordinates of the two dimensional point cloud/mesh nodes for which the FieldData object stores data on. A two-dimensional array is returned where the columns correspond to two-dimensions of interest (name ‘X’ and ‘Y’ by default) and the rows are the values for each point.

property num_dimensions
Returns:

get the number of spatial dimensions the coordinates are in.

property num_nodes
Returns:

Get the number of nodes. Will return 0 if the coordinates are not defined.

property num_elements
Returns:

Get the number of elements. Will return 0 if the connectivity is not defined.

property connectivity
Returns:

the nodal connectivity for the data if generated from a finite element mesh. None is data is for a point cloud.

property surfaces
Returns:

a dictionary containing groups of point or node indices. The key is the name of the group ( a node set name for meshes) and the values is an array of indices that can be used to access this set of point/node data from all of the field data.

property skeleton

Development property, not intended for users.

set_spatial_coords(coords)[source]

Set the spatial coordinates for the field data nodes/point positions. A two-dimensional array is expected with the number of point rows and two columns. The columns corresponds to the position names passed to the FieldSeriesData() function.

set_connectivity(connectivity)[source]

Development method, not intended for users.

add_node_sets(**surfaces)[source]

Development method, not intended for users.

add_field(field_name, data)

Adds a new 1D field to the data and returns the updated data. The original data object is not modified. The added field must have the same length as the existing fields.

Parameters:
  • field_name (str) – The name of the new field to be added.

  • data (ArrayLike) – the data to be added.

Returns:

the data with newly added field

Return type:

~matcal.core.data.Data

property field_names
Returns:

list of strings of all field names.

Return type:

list

property length
Returns:

The length of the data for each field.

Return type:

int

property name

Returns the name for the data. If the data is imported using FileData(), the name is set to the filename from which the data was imported. If no name is passed and the data was created from the constructor or another function, an arbitrary name will be given to the data.

Rtype name:

str

remove_field(field)

Returns a copy of the Data class with the desired field removed. The original data object is not modified.

Return type:

Data

rename_field(old_name, new_name)

Returns the Data class with the desired the field name changed. Note that the old name is overwritten and not saved.

Parameters:
  • old_name (str) – the old field name that is to be updated

  • new_name (str) – the replacement field name for the field name that is being changed.

set_name(name)

Sets the optional name value for the data. If the data is imported using FileData(), the name is set to the filename from which the data was imported. If no name is passed and the data was created from the constructor or another function, an arbitrary name will be given to the data.

Parameters:

name (str) – The name for this particular data set.

set_state(state)

Sets the optional state value for the data.

Parameters:

state (State) – The state for this particular data set.

property state
Returns:

The physical state of the data corresponding to the experimental conditions.

Return type:

State

matcal.full_field.data.convert_dictionary_to_field_data(dict_data, coordinate_names=[], connectivity_name=None, node_set_name=None)[source]

Takes a dictionary and attempts to create a MatCal FieldData object. The keys for the dictionary are expected to be strings for the field names and the values are expected to be valid numeric or string data.

Parameters:
  • dict_data (dict or OrderedDict) – a dictionary with field names as keys and the data values as the dictionary values.

  • coordinate_names (list(str)) – a list of the names of the coordinates used in the data, in the conventional x, y, z ordering.

  • connectivity_name (str) – the name of the dictionary key containing the connectivity information

Returns:

a Data object with the default state SolitaryState.

Return type:

FieldData