Question - Load matrices from OP2

15 views
Skip to first unread message

Gustav Graves

unread,
Feb 8, 2021, 10:00:11 AMFeb 8
to pyNastran Discuss
Hello. I'm quite new to pyNastran and would appreciate little help. I've got OP2 file with results from modal analysis in which are stored modal mass matrices(EFMASS,EFMFACS etc.) My question is, how can I load these matrices into numpy array/matrix? I've got into the point where I've created the .matrix/Matrix "variable" but I am unable to load actual values. Here is copy from python console:

matrices:
  Matrix['EFMASSS'];  shape=(6, 6);     type=scipy.sparse.coo.coo_matrix;      dtype=float64;   desc=square
  Matrix['EFMFACS'];  shape=(1, 2);     type=scipy.sparse.coo.coo_matrix;      dtype=float64;   desc=rectangular
  Matrix['EFMFSMS'];  shape=(1, 1);     type=scipy.sparse.coo.coo_matrix;      dtype=float64;   desc=symmetric
  Matrix['MEFMASS'];  shape=(6, 2);     type=scipy.sparse.coo.coo_matrix;      dtype=float64;   desc=rectangular
  Matrix['MEFWTS'];   shape=(6, 2);     type=scipy.sparse.coo.coo_matrix;      dtype=float64;   desc=rectangular
  Matrix['MPFACS'];   shape=(6, 2);     type=scipy.sparse.coo.coo_matrix;      dtype=float64;   desc=rectangular
  Matrix['RBMASSS'];  shape=(6, 6);     type=scipy.sparse.coo.coo_matrix;      dtype=float64;   desc=square

model.matrices['EFMASSS']

Out[101]: Matrix['EFMASSS'];  shape=(6, 6);     type=scipy.sparse.coo.coo_matrix;      dtype=float64;   desc=square

Steven Doyle

unread,
Feb 8, 2021, 10:14:58 AMFeb 8
to pynastra...@googlegroups.com
Ohh...those really should use numpy arrays vs. sparse matrices.  Close enough ;)

I think you’re getting confused due to the print.  It’s just meant to be a quick overview.  You just need:

    data = model.matrices[‘EFMASSS’].data

--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pynastran-discuss/0cf955ac-d1b7-4c96-b524-36c7c720e6c4n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages