Skip to content

Commit 6df4bc1

Browse files
authored
Add helpers for fiber plot data
1 parent f77e0d2 commit 6df4bc1

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

vfo/internal_plotting_functions.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,3 +577,62 @@ def _setStandardViewport(fig, ax, nodeCords, ndm, Disp = np.array([])):
577577
ax.set_zlabel('Z')
578578

579579
return fig, ax
580+
581+
# =============================================================================
582+
# Fiber Helpers
583+
# =============================================================================
584+
585+
def _getAxisInfo(LocalAxis):
586+
587+
if LocalAxis == 'z':
588+
axisIndex = 1
589+
axisXlabel = "Local z value"
590+
if LocalAxis == 'y':
591+
axisIndex = 0
592+
axisXlabel = "Local y value"
593+
594+
return axisIndex, axisXlabel
595+
596+
597+
def _getResponseInfo(InputType):
598+
if InputType == 'stress':
599+
responseIndex = 3
600+
axisYlabel = "Fiber Stress"
601+
if InputType == 'strain':
602+
responseIndex = 4
603+
axisYlabel = "Fiber Strain"
604+
605+
return responseIndex, axisYlabel
606+
607+
608+
609+
def _getFiberBounds(fibrePositionSorted, fibreResponseSorted, Xbound, Ybound):
610+
# Set up bounds based on data from
611+
if Xbound == []:
612+
xmin = 1.1*np.min(fibrePositionSorted)
613+
xmax = 1.1*np.max(fibrePositionSorted)
614+
else:
615+
xmin = Xbound[0]
616+
xmax = Xbound[1]
617+
618+
if Ybound == []:
619+
ymin = 1.1*np.min(fibreResponseSorted)
620+
ymax = 1.1*np.max(fibreResponseSorted)
621+
else:
622+
ymin = Ybound[0]
623+
ymax = Ybound[1]
624+
625+
return xmin, xmax, ymin, ymax
626+
627+
628+
629+
def _skipFiberData(fibrePositionSorted, fibreResponseSorted, fiberYPosition, skipStart, skipEnd):
630+
# If end data is not being skipped, use the full vector length.
631+
if skipEnd ==0:
632+
skipEnd = len(fiberYPosition)
633+
634+
# Remove unecessary data
635+
xinputs = fibrePositionSorted[skipStart:skipEnd, :]
636+
yinputs = fibreResponseSorted[skipStart:skipEnd, :]
637+
638+
return xinputs, yinputs

0 commit comments

Comments
 (0)