Skip to content

Commit

Permalink
Add helpers for fiber plot data
Browse files Browse the repository at this point in the history
  • Loading branch information
u-anurag authored May 17, 2022
1 parent f77e0d2 commit 6df4bc1
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions vfo/internal_plotting_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,3 +577,62 @@ def _setStandardViewport(fig, ax, nodeCords, ndm, Disp = np.array([])):
ax.set_zlabel('Z')

return fig, ax

# =============================================================================
# Fiber Helpers
# =============================================================================

def _getAxisInfo(LocalAxis):

if LocalAxis == 'z':
axisIndex = 1
axisXlabel = "Local z value"
if LocalAxis == 'y':
axisIndex = 0
axisXlabel = "Local y value"

return axisIndex, axisXlabel


def _getResponseInfo(InputType):
if InputType == 'stress':
responseIndex = 3
axisYlabel = "Fiber Stress"
if InputType == 'strain':
responseIndex = 4
axisYlabel = "Fiber Strain"

return responseIndex, axisYlabel



def _getFiberBounds(fibrePositionSorted, fibreResponseSorted, Xbound, Ybound):
# Set up bounds based on data from
if Xbound == []:
xmin = 1.1*np.min(fibrePositionSorted)
xmax = 1.1*np.max(fibrePositionSorted)
else:
xmin = Xbound[0]
xmax = Xbound[1]

if Ybound == []:
ymin = 1.1*np.min(fibreResponseSorted)
ymax = 1.1*np.max(fibreResponseSorted)
else:
ymin = Ybound[0]
ymax = Ybound[1]

return xmin, xmax, ymin, ymax



def _skipFiberData(fibrePositionSorted, fibreResponseSorted, fiberYPosition, skipStart, skipEnd):
# If end data is not being skipped, use the full vector length.
if skipEnd ==0:
skipEnd = len(fiberYPosition)

# Remove unecessary data
xinputs = fibrePositionSorted[skipStart:skipEnd, :]
yinputs = fibreResponseSorted[skipStart:skipEnd, :]

return xinputs, yinputs

0 comments on commit 6df4bc1

Please sign in to comment.