In [1]:
# TimeStamp
import time, datetime
st = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
print('Last Run: {}'.format(st))
In [2]:
# Hidden - Run this cell only once
from IPython.display import clear_output
import pandas as pd
%cd ../
clear_output()
pd.set_option('display.max_columns', 9)
pd.set_option('precision', 4)
In [3]:
# Import LamAna and setup plotting in Jupyter
import lamana as la
%matplotlib inline
In [4]:
# Build dicts of loading parameters and and material properties
load_params = {
'R' : 12e-3, # specimen radius
'a' : 7.5e-3, # support ring radius
'r' : 2e-4, # radial distance from center loading
'P_a' : 1, # applied load
'p' : 2, # points/layer
}
# Quick Form: a dict of lists
mat_props = {
'HA' : [5.2e10, 0.25],
'PSu' : [2.7e9, 0.33],
}
# Select geometries
single_geo = ['400-200-800']
multiple_geos = [
'350-400-500', '400-200-800', '200-200-1200', '200-100-1400',
'100-100-1600', '100-200-1400', '300-400-600'
]
This file is forked from Demo - Academic 0.1.3.ipynb. All cells above this level are hidden in readthedocs by the nbsphinx extension.
Here is a brief gallery of some stress distribution plots produced from LamAna.
We can plot stress distributions for a single laminate as a function of height, d or normalized thicknesses, k (default).
In [5]:
case1 = la.distributions.Case(load_params, mat_props) # instantiate a User Input Case Object through distributions
case1.apply(single_geo)
case1.plot(normalized=False)
In [6]:
case1.plot(normalized=True, grayscale=True)
We can superimpose insets and adjust the colors for publications quality.
In [7]:
case1.plot(annotate=True, colorblind=True, inset=True)
With normalized layers, we can superimpose multiple stress distributions fpr laminates different geometries. Data for multiple laminates are encapsulated in a Case object.
In [8]:
title = 'Stress Distributions of HA/PSu for Multiple Geometries'
multiple_geos = [
'350-400-500', '400-200-800', '200-200-1200', '200-100-1400',
'100-100-1600', '100-200-1400', '300-400-600'
]
In [9]:
case2 = la.distributions.Case(load_params, mat_props) # instantiate a User Input Case Object through distributions
case2.apply(multiple_geos)
In [10]:
case2.plot(title, colorblind=True, annotate=True)
These distributions can be separated as desired into a panel of various plots.
In [11]:
case2.plot(title, colorblind=True, annotate=True, separate=True)
The following has not been fully implemented yet, but demonstrates several multi-plots of tensile data. Each plot shows some pattern of interest, for example:
Panels of multi-plots are possible with a Cases object, a container for several Case objects.
In [12]:
# Setup a list of geometry strings
const_total = [
'350-400-500', '400-200-800', '200-200-1200',
'200-100-1400', '100-100-1600', '100-200-1400'
]
# Setup cases
cases1 = la.distributions.Cases(
const_total, load_params=load_params, mat_props=mat_props,
model='Wilson_LT', ps=[2, 3]
)
In [13]:
cases1.plot(extrema=False)
Using a prior case, we can analyze the data calculations based on a given theorical model.
In [14]:
case1
Out[14]:
In [15]:
case1.model
Out[15]:
In [16]:
case1.LMs
Out[16]:
Data for each laminate is contained in a pandas DataFrame, a powerful data structure for data analysis.
In [17]:
#df = case1.frames
df = case1.frames[0]
df
#df.style # pandas 0.17.1, css on html table
#df.style.bar(subset=['stress_f (MPa/N)', 'strain'], color='#d65f5f')
Out[17]:
Finally, we can export data and parameters to Excel or .csv formats.
With a few simple lines of code, we can use LamAna to quickly perform laminate analysis calculations, visulalize stress distributions and export data.
...and it's FREE.