Read_op2() 'include results'

Skip to first unread message

Matthew U

May 17, 2021, 9:51:40 PMMay 17
to pyNastran Discuss
Hello Steve,

I have a question about the read_op2 command. I want to define sets of results to include at one time, so that I am able to pull data from larger op2s one set of results vectors at a time without running into memory limitations.

The issue I seem to be running into here is that I do not want to define a specific set of subcases to run. In the documentation, it says that the standard for subcases = None, which should bring in all subcases. However, when I do the following command, for example:

op2 = read_op2(input_op2, 'True', 'None', include_results = 'cquad4_force')

I can't seem to get past the subcases one without defining specific subcases in order to get to include_results. I need to find a way to define that all subcases should be read in, or to circumvent defining subcases altogether so it will work how it would if I didn't define any parameters.

Thanks for your help! Matt

Steven Doyle

May 17, 2021, 11:20:41 PMMay 17
to pyNastran Discuss

I'm not sure exactly on the version you're using, but I think it's 1.3.3.  I strongly recommend explicitly listing optional arguments (the ones you care about) because that call is changing in the next release.

I guess first of all, I think you intended to write:
    op2 = read_op2(input_op2, combine='True', subcases='None', include_results='cquad4_force')

combine should be a boolean and not a string (so True/False).  The default is True.

subcases is also not a string and may be:
 - an integer
 - a list of integers
 - None -> all subcases  (default)

I guess, what are you trying to do?  Are you saying you don't know your subcases?

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
To view this discussion on the web visit

Matthew U

May 18, 2021, 10:36:56 AMMay 18
to pyNastran Discuss

So the big issue was that I was inputting combine and subcases as a string, thanks for pointing that out. To answer your question, this script is intended to handle a variety of op2 files, so I will not know the number or ID of subcases. But the following line I believe gets me what I want, so I think you helped me solve my issue:

op2 = read_op2(input_op2, combine = True, subcases = None, exclude_results = None, include_results = ['force.cquad4_force'])

That appears to only bring in the cquad4 force data for all subcases, which is exactly what I want.

Thanks again.

Reply all
Reply to author
0 new messages