Found a few answers about this but none worked so far. I'm trying to round all the numbers in my FieldValueArray to 2 decimals. This is the path in Abaqus I'm using to get my mises FieldValueArray.
topCenter=o1.rootAssembly.instances['PART-1-1'].elementSets['SET-1']
stress=session.odbs[path].steps['Step-1'].frames[-1].fieldOutputs['S']
area=stress.getSubset(region=topCenter,position=INTEGRATION_POINT,elementType='C3D20R')
mises= area.getScalarField(invariant=MISES)
I tried to round by using np.around
but the error is giving me this message.
import numpy as np
mises_round= np.around(mises,2)
File "C:\Abaqus\6.14-1\tools\SMApy\python2.7\lib\site-packages\numpy\core\fromnumeric.py", line 37, in _wrapit
result = getattr(asarray(obj),method)(*args, **kwds)
AttributeError: rint
The same error occurs for
mises_round= np.around(mises.values,2)
Thanks for any ideas!!
mises
is a FieldOutput object, and the first argument to around
must be an "array like" object. In FieldOutput you get the data like so:
mises.values[i].data
So even mises.values
won't work, because around
doesn't know to grab the data from the data
attribute. Therefore, you need to create a new array with the data:
mises_round = np.around([v.data for v in mises.values], 2)