pyyeti.nastran.op4.OP4.dctload

OP4.dctload(filename, namelist=None, justmatrix=False, sparse=False)[source]

Read all matching matrices from op4 file into dictionary.

Parameters:
  • filename (string) – Name of op4 file to read.

  • namelist (list, string, or None; optional) – List of variable names to read in, or string with name of the single variable to read in, or None. If None, all matrices are read in.

  • justmatrix (bool; optional) – If True, only the matrix is stored in the dictionary. If False, a tuple of (matrix, form, mtype) is stored.

  • sparse (bool or None or two-tuple_like; optional) – Specifies whether output matrices will be regular numpy arrays or sparse arrays. If not two-tuple_like:

    sparse

    Action

    None

    Auto setting: each matrix will be sparse if and only if it was written in a sparse format

    True

    Matrices will be returned in sparse format

    False

    Matrices will be returned in regular (dense) numpy arrays

    If sparse is two-tuple_like, the first element is either None, True, or False (see table above) and the second element is a callable, as in: X = callable(X). A common usage of the callable would be to convert from “COO” sparse form (see scipy.sparse.coo_matrix) to a more desirable form. For example, to ensure all matrices are returned in CSC form (see scipy.sparse.csc_matrix) use:

    sparse=(True, scipy.sparse.coo_matrix.tocsc)
    

    The callable is ignored for non-sparse matrices.

Returns:

dct (collections.OrderedDict) – Keys are the lower-case matrix names and the values are either just the matrix or a tuple of: (matrix, form, mtype) depending on justmatrix.

Notes

The default form for sparse matrices is the “COO” sparse form (see scipy.sparse.coo_matrix). To override, provide a callable in the sparse option (see above).

See also

listload(), write(), dir()