Read/write Nastran op4 files

Python tools for reading/writing Nastran .op4 files. Can read and write all formats (as far as I know) with the restrictions that the output files created by this class are always double precision, and all matrices are read in as double precision. The binary files can be in big or little endian format.

Notes on sparse matrices:

  1. By default, matrices read from .op4 files will be regular numpy.ndarray matrices. However, scipy.sparse matrices can be created instead. See the sparse option in read() and load().

  2. By default, matrices written to .op4 files will follow the Python type: numpy.ndarray matrices will be written in dense format and scipy.sparse matrices will be written in “bigmat” sparse format. This can be overridden by specifying the sparse option in write().

Note

Some features of this module are demonstrated in the pyYeti Tutorials: Reading and writing Nastran output4 files. There is also a link to the source Jupyter notebook at the top of the tutorial.

Main routines

dir([filename, verbose])

Directory of all matrices in op4 file; non-member version of OP4.dir().

load([filename, namelist, into, justmatrix, ...])

Read all matching matrices from op4 file into dictionary or list; non-member version of OP4.load().

read([filename, namelist, into, justmatrix, ...])

Read all matching matrices from op4 file into dictionary or list; non-member version of OP4.load().

write(filename, names[, matrices, binary, ...])

Write op4 file; non-member version of OP4.write().

Note: pyyeti.op4.save() is an alias for pyyeti.op4.write().

The OP4 Class

OP4()

Class for reading/writing Nastran output4 (.op4) files.

Member functions:

OP4.dctload(filename[, namelist, ...])

Read all matching matrices from op4 file into dictionary.

OP4.dir(filename[, verbose])

Directory of all matrices in op4 file.

OP4.listload(filename[, namelist, sparse])

Read all matching matrices from op4 file into a list; useful if op4 file has duplicate names.

OP4.load(filename[, namelist, into, ...])

Read all matching matrices from op4 file into dictionary or list; interface to dctload() and listload().

OP4.write(filename, names[, matrices, ...])

Write op4 file.