Try on DesignSafe

4 PostProcess Ops-Express#

Take advantage of the interactive nature of the Jupyter environment to visualize output data quantitatively.

by Silvia Mazzoni, DesignSafe, 2025

In this training session we will visualize the job-output data before copying it over.

This is an important step because it helps you determine whether the job was run as intended. If not, you can resubmit a job without moving the data, yet.

Configure python#

import matplotlib.pyplot as plt
import numpy
# add the tilda at the beginning of the path to make it absolute
JobOutputFolder = '~/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples'
print('JobOutputFolder',JobOutputFolder)
# list some files:
print('Folder Content:')
display(os.system(f'ls {JobOutputFolder}'))
JobOutputFolder ~/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples
Folder Content:
DataTCL
Ex1a.Canti2D.Push.mp.tcl
Ex1a.Canti2D.Push.mpi.py
Ex1a.Canti2D.Push.mpi4py.py
Ex1a.Canti2D.Push.py
Ex1a.Canti2D.Push.tcl
Ex1a_many.Canti2D.Push.mp.tcl
0

4. Copy base path for output data from posted path:#

basePath = os.path.expanduser(JobOutputFolder)
print('basePath',basePath)
basePath /home/jupyter/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples
os.path.isdir(basePath)
True
os.listdir(basePath)
['DataTCL',
 'Ex1a_many.Canti2D.Push.mp.tcl',
 'Ex1a.Canti2D.Push.mpi4py.py',
 'Ex1a.Canti2D.Push.mp.tcl',
 'Ex1a.Canti2D.Push.mpi.py',
 'Ex1a.Canti2D.Push.py',
 'Ex1a.Canti2D.Push.tcl']

Visualize the Input File#


5. Plot some analysis results#

for any of the above analyses

#pick any case
dataDir = f'{basePath}/DataTCL'
Lcol = 300
print('dataDir',dataDir)
# list some files:
os.system(f'ls {dataDir}/*Lcol{Lcol}.out')
dataDir /home/jupyter/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples/DataTCL
/home/jupyter/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples/DataTCL/DBase_Lcol300.out
/home/jupyter/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples/DataTCL/DCol_Lcol300.out
/home/jupyter/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples/DataTCL/DFree_Lcol300.out
/home/jupyter/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples/DataTCL/FCol_Lcol300.out
/home/jupyter/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples/DataTCL/RBase_Lcol300.out
0
plt.close('all')
fname3o = f'DFree_Lcol{Lcol}.out'
fname3 = f'{dataDir}/{fname3o}'
print(fname3)
dataDFree = numpy.loadtxt(fname3)
plt.subplot(211)
plt.title(f'Ex1a.Canti2D Lcol={Lcol}')
plt.grid(True)
plt.plot(dataDFree[:,1])
plt.xlabel('Step Number')
plt.ylabel('Free-Node Displacement')
plt.subplot(212)
plt.grid(True)
plt.plot(dataDFree[:,1],dataDFree[:,0])
plt.xlabel('Free-Node Disp.')
plt.ylabel('Pseudo-Time (~Force)')
plt.savefig(f'{dataDir}/Response.jpg')
plt.show()
print(f'plot saved to {dataDir}/Response_Lcol{Lcol}.jpg')
print('End of Run: Ex1a.Canti2D.Push.py.ipynb')
/home/jupyter/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples/DataTCL/DFree_Lcol300.out
../_images/429cb3c358f32a533bd2d8872054a20bd016793481d5b80dc5db30ce4142f1da.png
plot saved to /home/jupyter/MyData/tapis-jobs-archive/2025-07-28Z/OpenSees_opensees-express-latest_2025-07-28T20:09:24-b17040ea-8d34-4916-9664-7caaee938467-007/BasicExamples/DataTCL/Response_Lcol300.jpg
End of Run: Ex1a.Canti2D.Push.py.ipynb
print('Done!')
Done!