'Is there a way to integrate matplotlib/Pandas in Abaqus Python?

i have been working with Abaqus python recently to solve some stress/strain problems. I wish to process the data from .odb file directly in python and then output it to excel. But turned out that these 2 libraries are not installed in Abaqus python. Since Abaqus python is a bit outdated. its still using python 2.7 Im wondering if there is any way I can install these external libraries into my Abaqus?

and furthermore, can I for example use VScode or other commonly used IDE instead of Abaqus Command prompt or GUI to run the script?



Solution 1:[1]

I have simple solution!
If you want to post-process the Stress-strain data, you can do that using Python 2 commands as well.

You can use getScalarField : To get scalar field data from vector or tensor field type data. Following is small snippet of code to do this:

tmp = odb.steps[stepName['Step-1']].frames[1].fieldOutputs['EE']

# Max principal elastic strain data in python array form
mx = tmp.getScalarField(invariant=MAX_PRINCIPAL)
mx = numpy.abs(numpy.concatenate(mx.bulkDataBlocks[0].data))

# Max principal elastic strain data in python array form
mn = tmp.getScalarField(invariant=MIN_PRINCIPAL)
mn = numpy.abs(numpy.concatenate(mn.bulkDataBlocks[0].data))

# Elastic strain data in python array form (No. of integration points x 6)
ee = tmp.bulkDataBlocks[0].data

You can following command to run your Abaqus Python script using system command prompt (without opening Abaqus/CAE while running the script).
abaqus cae noGUI=AbaqusPythonFile.py
If you get error regarding abaqus keyword, then you have to specify location of Abaqus batch file.

Solution 2:[2]

You can use IDEs for development, but not debugging of Abaqus Python. You have to point to the abaqus python library in your IDE for it to recognize the imports. I have an image of how to do that in PyCharm. [Pycharm add Abaqus code library to project][1]

You could probably insert "import pdb; pdb.set_trace()" in your code to pause the execution and interactively debug, or use Abaqus PDE.

Run scripts via "abaqus python AbaqusPythonFile.py" if you don't need the session object (viewports and display groups and such). If you need the session object, run via abaqus cae nogui=AbaqusPythonFile.py if you don't need the UI physically active.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2