sdynpy.core.sdynpy_coordinate.CoordinateArray

class CoordinateArray(shape, buffer=None, offset=0, strides=None, order=None)[source]

Bases: SdynpyArray

Coordinate information specifying Degrees of Freedom (e.g. 101X+).

Use the coordinate_array helper function to create the array.

__init__()

Methods

abs()

Returns a coordinate array with direction signs flipped positive

direction_string_array()

Returns a string array representation of the direction

from_matlab_cellstr(cellstr_data)

Creates a CoordinateArray from a matlab cellstring object loaded from scipy.io.loadmat

from_nodelist(nodes[, directions, flatten])

Returns a coordinate array with a set of nodes with a set of directions

local_direction()

Returns a local direction array

sign()

Returns the sign on the directions of the CoordinateArray

string_array()

Returns a string array representation of the coordinate array

Attributes

data_dtype

Datatype for the underlying numpy structured array

abs()[source]

Returns a coordinate array with direction signs flipped positive

data_dtype = [('node', 'uint64'), ('direction', 'int8')]

Datatype for the underlying numpy structured array

direction_string_array()[source]

Returns a string array representation of the direction

Returns

ndarray of direction strings representing the CoordinateArray

Return type

np.ndarray

classmethod from_matlab_cellstr(cellstr_data)[source]

Creates a CoordinateArray from a matlab cellstring object loaded from scipy.io.loadmat

Parameters

cellstr_data (np.ndarray) – Dictionary entry corresponding to a cell string variable in a mat file loaded from scipy.io.loadmat

Returns

CoordinateArray built from the provided cell string array

Return type

CoordinateArray

classmethod from_nodelist(nodes, directions=[1, 2, 3], flatten=True)[source]

Returns a coordinate array with a set of nodes with a set of directions

Parameters
  • nodes (iterable) – A list of nodes to create degrees of freedom at

  • directions (iterable, optional) – A list of directions to create for each node. The default is [1,2,3], which provides the three positive translations (X+, Y+, Z+).

  • flatten (bool, optional) – Specifies that the array should be flattened prior to output. The default is True. If False, the output will have a dimension one larger than the input node list due to the added direction dimension.

Returns

coordinate_array – Array of coordinates with each specified direction defined at each node. If flatten is false, this array will have shape nodes.shape + directions.shape. Otherwise, this array will have shape (nodes.size*directions.size,)

Return type

CoordinateArray

local_direction()[source]

Returns a local direction array

Returns

local_direction_array – Returns a (…,3) array where … is the dimension of the CoordinateArray. The (…,0), (…,1), and (…,2) indices represent the x,y,z direction of the local coordinate direction. For example, a CoordinateArray with direction X- would return [-1,0,0].

Return type

np.ndarray

sign()[source]

Returns the sign on the directions of the CoordinateArray

string_array()[source]

Returns a string array representation of the coordinate array

Returns

ndarray of strings representing the CoordinateArray

Return type

np.ndarray