From 7f1a4097a9395bc077af63f42a6a6f869b140ead Mon Sep 17 00:00:00 2001 From: eakraus-yourspongeguy <77746147+eakraus-yourspongeguy@users.noreply.github.com> Date: Tue, 7 Sep 2021 22:11:45 -0400 Subject: [PATCH] Add files via upload --- LB.py | 165 ++++++++++++++ frequencysweepsummary.py | 184 ++++++++++++++++ shearstrainsweepsummary.py | 300 +++++++++++++++++++++++++ uniaxialstrainsummary.py | 434 +++++++++++++++++++++++++++++++++++++ 4 files changed, 1083 insertions(+) create mode 100644 LB.py create mode 100644 frequencysweepsummary.py create mode 100644 shearstrainsweepsummary.py create mode 100644 uniaxialstrainsummary.py diff --git a/LB.py b/LB.py new file mode 100644 index 0000000..9b1d3cd --- /dev/null +++ b/LB.py @@ -0,0 +1,165 @@ +""" +@author: EAK +""" + +from matplotlib.ticker import MaxNLocator +from mpl_toolkits.axes_grid1.inset_locator import inset_axes, mark_inset +from matplotlib import cm +import matplotlib.pyplot as plt +import numpy as np +import matplotlib.ticker as ticker +import os +import mainantonpaar + +#### data read-in and preprocessing ########################################## + +# change to directory where data are stored +dir='/Users/Emile/Documents/Graduate/AntonPaarData/Porifera/summary/shear data' +os.chdir(dir) + +# first round LAOS +fn1 = '02082020_sponge12_samp3_strainsweep_8mm_3mm 0' +run1 = mainantonpaar.LAOS(fn1, r = 0.006) +t1 = run1.Timep +gam0_1 = run1.gam0 +sig0_1 = run1.sig0 +gamma1 = run1.Strain +sigma1 = run1.Stress +GpM1 = run1.Gpm +GpL1 = run1.Gpl +Gstar1 = run1.Gstarnorm +n1 = run1.n +# second round LAOS +fn2 = '02082020_sponge12_samp3_strainsweep_8mm_3mm 1' +run2 = mainantonpaar.LAOS(fn2, r = 0.006) +t2 = run2.Timep +sig0_2 = run2.sig0 +gamma2 = run2.Strain +sigma2 = run2.Stress +GpM2 = run2.Gpm +GpL2 = run2.Gpl +Gstar2 = run2.Gstarnorm +n2 = run2.n +# number of amplitudes +Nf = np.size(gam0_1) +# amplitude array for looping +Nf_ = np.arange(0, Nf, 1) +# strain amplitudes, change to percent +gam0 = [100*gam0_1[i] for i in Nf_] + +#### plotting ################################################################ + +# color scheme +cwsubsec = np.linspace(0.7, 0.1, Nf) # first round, blues and reds +clrscw = [cm.pink(x) for x in cwsubsec] +grsubsec = np.linspace(0.2, 0.7, Nf) # second round, transparent grays +clrsgr = [cm.gray(x) for x in grsubsec] +# strain amplitude labels +lbls = ['$\gamma_{0}=$ %.2f' % gam0[i] +'\%' for i in Nf_] + +# time series +fig0, axs0 = plt.subplots(nrows = 1, ncols = 2, figsize = (22, 11)) +[axs0[0].plot(t1[i], gamma1[i], linewidth = 3, color = clrscw[i]) + for i in Nf_[1::2]] # strain vs time, 1st run +[axs0[0].plot(t2[i], gamma2[i], linewidth = 3, color = clrsgr[i]) + for i in Nf_[1::2]] # strain vs time, 2nd run +[axs0[1].plot(t1[i], sigma1[i]/1000, linewidth = 3, color = clrscw[i]) # kPa + for i in Nf_[1::2]] # stress vs time, 1st run +[axs0[1].plot(t2[i], sigma2[i]/1000, linewidth = 3, color = clrsgr[i]) # kPa + for i in Nf_[1::2]] # stress vs time, 2nd run +axs0[0].set_ylabel(r'$\gamma$ (\%)', fontsize = 48, labelpad = -30) +axs0[1].set_ylabel(r'$\tau$ (kPa)', fontsize = 48, labelpad = -30) +maxx = np.max(np.abs(axs0[0].get_xlim())) +maxy = [np.max(np.abs(axs0[i].get_ylim())) for i in [0,1]] +[axs0[i].set_ylim([-maxy[i]+0.06*maxy[i],maxy[i]-0.06*maxy[i]]) for i in [0,1]] +[axs0[j].set_xlabel(r'time (s)', fontsize = 48) for j in [0,1]] +[axs0[j].tick_params(axis = 'both', which = 'major', labelsize = 38) + for j in [0,1]] +# insets +axins = [inset_axes(axs0[i], width = '40%', height = '40%', loc = 1) + for i in [0,1]] +[axins[0].plot(t1[i], gamma1[i], lw = 3, c = clrscw[i]) for i in Nf_[1::2]] +[axins[0].plot(t2[i], gamma2[i], lw = 3, c = clrsgr[i]) for i in Nf_[1::2]] +[axins[i].tick_params(axis = 'both', labelsize = 28) for i in [0,1]] +[axins[i].set_xlim(0.5*maxx, maxx-0.1*maxx) for i in [0,1]] +[axins[i].set_ylim(-0.2*maxy[i], -0.001*maxy[i]) for i in [0,1]] +[axins[1].plot(t1[i], sigma1[i]/1000, lw = 3, c = clrscw[i]) + for i in Nf_[1::2]] +[axins[1].plot(t2[i], sigma2[i]/1000, lw = 3, c = clrsgr[i]) + for i in Nf_[1::2]] +[mark_inset(axs0[i], axins[i], loc1 = 4, loc2 = 3, fc = 'none', ec = '0') + for i in [0,1]] +fig0.subplots_adjust(wspace = 0.2) +fig0.savefig('plots/'+fn1[:-2]+'_timeseries.svg', bbox_inches = 'tight', + dpi = 1200) + +# Lissajous-Bowditch curves +fig1, ax1 = plt.subplots(figsize = (12,12)) +x1 = np.asarray(gamma1, dtype = object) +y1 = np.asarray(sigma1, dtype = object) +x2 = np.asarray(gamma2, dtype = object) +y2 = np.asarray(sigma2, dtype = object) +# wrap-around so curves are totally closed +x1 = [np.append(x1[i][:], x1[i][0]) for i in Nf_] +y1 = [np.append(y1[i][:], y1[i][0]) for i in Nf_] +x2 = [np.append(x2[i][:], x2[i][0]) for i in Nf_] +y2 = [np.append(y2[i][:], y2[i][0]) for i in Nf_] +# plot +[ax1.plot(x2[i], y2[i]/1000, lw = 3, c = clrsgr[i]) for i in Nf_[1::2]] +[ax1.plot(x1[i], y1[i]/1000, lw = 3, c = clrscw[i], label = lbls[i]) + for i in Nf_[1::2]] +# lines illustrating minimum and maximum moduli +x = np.array([-maxy[0]+0.06*maxy[0], 1.04*maxy[0]]) +ym = GpM1[-1]*x/100 +yl = GpL1[-1]*x/100 +ax1.plot(x, ym/1000, linestyle = '--', lw = 3, c = 'black', marker = None) +ax1.plot(x, yl/1000, linestyle = '-.', lw = 3, c = 'black', marker = None) +ax1.tick_params(axis = 'both', which = 'major', labelsize = 48) +ax1.set_xlabel(r'$\gamma$ (\%)', fontsize = 58) +ax1.set_ylabel(r'$\tau$ (kPa)', fontsize = 58, labelpad = -30) +ax1.set_xlim([-1.008*maxy[0], 1.008*maxy[0]]) +ax1.set_ylim([-1.008*maxy[1], 1.008*maxy[1]]) +ax1.xaxis.set_major_locator(ticker.MaxNLocator(5)) +ax1.yaxis.set_major_locator(ticker.MaxNLocator(6)) +hndls, lbls = ax1.get_legend_handles_labels() +fig1.legend(hndls, lbls, loc = 'center right', bbox_to_anchor = (1.32,0.32), + ncol = 1, fancybox = True, shadow = True, fontsize = 38) +# small strain inset +axins1 = inset_axes(ax1, width = '38%', height = '38%', loc = 4) +[axins1.plot(x2[i], y2[i]/1000, lw = 3, c = clrsgr[i]) for i in Nf_[1::2]] +[axins1.plot(x1[i], y1[i]/1000, lw = 3, c = clrscw[i]) for i in Nf_[1::2]] +axins1.set_xlim(-0.077*maxy[0], 0.077*maxy[0]) +axins1.set_ylim(-0.077*maxy[1], 0.077*maxy[1]) +axins1.xaxis.set_major_locator(ticker.MaxNLocator(3)) +axins1.yaxis.set_major_locator(ticker.MaxNLocator(3)) +axins1.xaxis.set_ticks_position('top') +axins1.tick_params(axis = 'both', labelsize = 28) +mark_inset(ax1, axins1, loc1 = 2, loc2 = 1, fc = 'none', ec = '0') +# large strain +axins2 = inset_axes(ax1, width = '38%', height = '38%', loc = 2) +[axins2.plot(x2[i], y2[i]/1000, lw = 3, c = clrsgr[i]) for i in Nf_[1::2]] +[axins2.plot(x1[i], y1[i]/1000, lw = 3, c = clrscw[i]) for i in Nf_[1::2]] +axins2.set_xlim(0.21*maxy[0], maxy[0]-0.077*maxy[0]) +axins2.set_ylim(0.21*maxy[1], maxy[1]-0.077*maxy[1]) +axins2.xaxis.set_major_locator(ticker.MaxNLocator(2)) +axins2.yaxis.set_major_locator(ticker.MaxNLocator(2)) +axins2.yaxis.set_ticks_position('right') +axins2.tick_params(axis = 'both', labelsize = 28) +mark_inset(ax1, axins2, loc1 = 4, loc2 = 1, fc = 'none', ec = '0') +# save +fig1.savefig('plots/'+fn1[:-2]+'_LB.svg', bbox_inches = 'tight', dpi = 1200) + +# power spectra +fig2, ax2 = plt.subplots(figsize = (12,12)) +[ax2.plot(n1[i], Gstar1[i], linewidth = 3, color = clrscw[i]) + for i in Nf_[1::2]] +[ax2.plot(n2[i], Gstar2[i], linewidth = 3, color = clrsgr[i]) + for i in Nf_[1::2]] +ax2.set_xlabel('$n$', fontsize = 42) +ax2.set_ylabel('$|G^{*}_{n}|$/$|G^{*}_{1}|$', fontsize = 42) +ax2.xaxis.set_major_locator(MaxNLocator(integer = True)) +ax2.tick_params(axis = 'both', which = 'major', labelsize = 48) +ax2.set_xlim([0, 12]) +ax2.set_ylim([0.0002, 1]) +ax2.set_yscale('log') +fig2.savefig('plots/'+fn1[:-2]+'_power.svg', bbox_inches = 'tight', dpi = 1200) \ No newline at end of file diff --git a/frequencysweepsummary.py b/frequencysweepsummary.py new file mode 100644 index 0000000..43a95a6 --- /dev/null +++ b/frequencysweepsummary.py @@ -0,0 +1,184 @@ +""" +@author: EAK +""" + +from matplotlib import cm +import matplotlib.pyplot as plt +import matplotlib as mpl +import pandas as pd +import numpy as np +import os +import rheofuncs + +#### Data Read-In ############################################################ + +# directory +dir = '/Users/Emile/Documents/Graduate/AntonPaarData/Porifera/summary/'+\ + 'frequency data' +os.chdir(dir) +# file +datstr = 'freqsweepfullsummary' +dat = pd.read_csv(datstr + '.csv').values +n = np.arange(0, np.int64(np.size(dat, 1)/8), 1) # number of species array +# columns +phi = [dat[0, 8*i+1] for i in n] # mass porosity +phi_e = [dat[0, 8*i+2] for i in n] # mass porosity uncertainty +w = [dat[:, 8*i+3].astype('float64') for i in n] # frequency, rad/s +Gp = [dat[:, 8*i+4].astype('float64') for i in n] # storage modulus, Pa +Gpp = [dat[:, 8*i+5].astype('float64') for i in n] # loss modulus, Pa +Gp_e = [dat[:, 8*i+6].astype('float64') for i in n] # stored uncertainty, Pa +Gpp_e = [dat[:, 8*i+7].astype('float64') for i in n] # loss uncertainty, Pa + +#### Calculations ############################################################ + +# loss tangent +tand = [Gpp[i]/Gp[i] for i in n] +# propagate its uncertainty from G' and G" uncertainties +tand_e = [np.sqrt((Gp_e[i]*Gpp[i]/Gp[i]**2)**2+(Gpp_e[i]/Gp[i])**2) for i in n] +# linear viscoelastic fit parameters file +fitstr, mdlstr = 'fitparams'+datstr[9:13], '_Zener' # choose which one +fit = pd.read_csv(fitstr + mdlstr + '.csv').values +params = [fit[:, i + 1].astype('float64') for i in n] +# get best fit values by inputting fit parameters into the model +Gpmodel = getattr(rheofuncs, mdlstr[1:] + 'Gp') +Gppmodel = getattr(rheofuncs, mdlstr[1:] + 'Gpp') +Gpbest = [ Gpmodel(w[i], *params[i][:-1]) for i in n] +Gppbest = [Gppmodel(w[i], *params[i][:-1]) for i in n] +tandbest = [Gppbest[i]/Gpbest[i] for i in n] +# power law exponent of G' +m = [np.polyfit(np.log10(w[i]), np.log10(Gp[i]), 1, cov = True) for i in n] +alpha = [m[i][0][0] for i in n] +alpha_e = [np.sqrt(np.diag(m[i][1])[0]) for i in n] + +#### Plotting ################################################################ +# font +mpl.rc('font', family = 'Courier New') +mpl.rc('text', usetex = True) +# full species list +spp = ['Axinella polycapella','Callyspongia sp.','Cinachyrella apion', + 'Cliona celata','Tectitethya keyensis','Tethya aurantium', + 'Aplysina fulva','Igernella notabilis'] +spp = [r'\textit{%s}' % spp[i] for i in n[:-1]] # italicize +spp.insert(len(spp), 'synthetic sponge') # add synthetic sponge label +# colors +spixclrs = [cm.cool(x) for x in np.linspace(0, 1, 6)] +nospixclrs = [cm.spring(x) for x in np.linspace(0.6, 0.89, 2)] +clrs = [spixclrs[5], spixclrs[4], spixclrs[3], spixclrs[2], spixclrs[1], + spixclrs[0], nospixclrs[0], nospixclrs[1]] +clrs.insert(len(spp), 'xkcd:dried blood') +# markers +mrkrs = ['s','s', 's','s','s','s','o','o','*'] + +# Gp vs omega +fig0, axs0 = plt.subplots(nrows = 1, ncols = 1, figsize = (12, 10)) +[axs0.errorbar(w[i], Gp[i], yerr = Gp_e[i], ms = 20, fmt = mrkrs[i], mew = 3, + mfc = clrs[i], mec = 'black', ecolor = 'dimgray', + label = spp[i], capsize = 6) for i in n] +[axs0.plot(w[i], Gpbest[i], ls = '--', lw = 3, c = clrs[i]) for i in n] +axs0.set_xscale('log') +axs0.set_yscale('log') +axs0.set_ylim([35000, 2500000]) +axs0.tick_params(axis = 'both', which = 'major', labelsize = 44) +axs0.set_xlabel('$\omega$ (rad/s)', fontsize = 44, labelpad = -6) +axs0.set_ylabel('$G^{\prime}$ (Pa)', fontsize = 44, labelpad = -10) +hndls, lbls = axs0.get_legend_handles_labels() # create legend +fig0.legend(hndls, lbls, loc = 'center right', bbox_to_anchor = (-0.075,0.5), + ncol = 1, fancybox = True, shadow = True, fontsize = 40) +fig0.savefig('plots/Gpvsomega'+datstr[9:13]+mdlstr+'.svg', dpi = 1200, + bbox_inches = 'tight') + +# Gpp vs omega +fig1, axs1 = plt.subplots(nrows = 1, ncols = 1, figsize = (12, 10)) +[axs1.errorbar(w[i], Gpp[i], yerr = Gpp_e[i], ms = 18, fmt = mrkrs[i], + mew = 3, mfc = clrs[i], mec = 'black', ecolor = 'dimgray', + label = spp[i], capsize = 6) for i in n] +[axs1.plot(w[i], Gppbest[i], ls = '--', lw = 3, c = clrs[i]) for i in n] +axs1.plot(w[8], Gppbest[8], ls = '--', lw = 3, c = clrs[8]) +axs1.set_xscale('log') +axs1.set_yscale('log') +axs1.set_ylim([2000, 400000]) +axs1.tick_params(axis = 'both', which = 'major', labelsize = 44) +axs1.set_xlabel('$\omega$ (rad/s)', fontsize = 44, labelpad = -6) +axs1.set_ylabel('$G^{\prime \prime}$ (Pa)', fontsize = 44, labelpad = -10) +fig1.savefig('plots/Gppvsomega'+datstr[9:13]+mdlstr+'.svg', dpi = 1200, + bbox_inches = 'tight') + +# loss tangent vs omega +fig2, axs2 = plt.subplots(nrows = 1, ncols = 1, figsize = (12, 10)) +[axs2.errorbar(w[i], tand[i], yerr = tand_e[i], ms = 18, fmt = mrkrs[i], + mew = 3, mfc = clrs[i], mec = 'black', ecolor = 'dimgray', + label = spp[i], capsize = 6) for i in n] +[axs2.plot(w[i], tandbest[i], ls = '--', lw = 3, c = clrs[i]) for i in n] +max2, min2 = np.max(axs2.get_ylim()), np.min(axs2.get_ylim()) +axs2.set_xscale('log') +axs2.set_yscale('log') +axs2.set_ylim([0.03, 0.3]) +axs2.tick_params(axis = 'both', which = 'major', labelsize = 44) +axs2.tick_params(axis = 'y', which = 'minor', labelsize = 28) +axs2.set_xlabel('$\omega$ (rad/s)', fontsize = 44, labelpad = -6) +axs2.set_ylabel(r'$\tan\delta$', fontsize = 44, labelpad = -10) +fig2.savefig('plots/tandelvsomega'+datstr[9:13]+mdlstr+'.svg', dpi = 1200, + bbox_inches = 'tight') + +# Gpp vs Gp +fig3, axs3 = plt.subplots(nrows = 1, ncols = 1, figsize = (10, 10)) +[axs3.errorbar(Gp[i][6], Gpp[i][6], xerr = Gp_e[i][6], yerr = Gpp_e[i][6], + ms = 18, fmt = mrkrs[i], mew = 3, mfc = clrs[i], + mec = 'black', ecolor = 'dimgray', capsize = 6) for i in n] +x = [10**4, 10**5, 10**6, 10**7] +axs3.plot(x,[0.06*x[i] for i in [0,1,2,3]], lw = 3, ls = '-.', c = 'silver', + label = '$G^{\prime \prime}=0.06G^{\prime}$') +axs3.plot(x,[0.18*x[i] for i in [0,1,2,3]], lw = 3, ls = ':', c = 'silver', + label = '$G^{\prime \prime}=0.18G^{\prime}$') +axs3.set_xscale('log') +axs3.set_yscale('log') +axs3.set_xlim([4*10**4, 2*10**6]) +axs3.set_ylim([2*10**3, 3*10**5]) +axs3.tick_params(axis = 'both', which = 'major', labelsize = 44) +axs3.set_xlabel('$G^{\prime}(\omega=\pi)$ (Pa)', fontsize = 44, labelpad = -6) +axs3.set_ylabel('$G^{\prime \prime}(\omega=\pi)$ (Pa)', fontsize = 44) +hndls, lbls = axs3.get_legend_handles_labels() # create legend +axs3.legend(hndls, lbls, loc = 'upper left', fancybox = True, shadow = True, + fontsize = 40) +fig3.savefig('plots/GppvsGp.svg', dpi = 1200, bbox_inches = 'tight') + +# alpha vs. specimen +fig4, axs4 = plt.subplots(nrows = 1, ncols = 1, figsize = (10, 10)) +X = np.argsort(-np.asarray(alpha)) +[axs4.bar(n[i], alpha[X[i]], 0.65, yerr = alpha_e[X[i]], color = clrs[X[i]], + capsize = 6, ecolor = 'dimgray') for i in n] +axs4.set_xticks(n) +axs4.set_xticklabels([]) +axs4.set_ylim(0, 0.076) +axs4.set_yticks([0.01, 0.03, 0.05, 0.07]) +axs4.tick_params(axis = 'y', which = 'major', labelsize = 44) +axs4.set_ylabel(r'$\alpha$', fontsize = 44, labelpad = 20, rotation = 0) +fig4.savefig('plots/alphabarplot.svg', dpi = 300, bbox_inches = 'tight') + +# porosity vs. specimen +fig5, axs5 = plt.subplots(nrows = 1, ncols = 1, figsize = (10, 10)) +X = np.argsort(-np.asarray(phi)) +[axs5.bar(n[i], phi[X[i]], 0.65, yerr = phi_e[X[i]], color = clrs[X[i]], + capsize = 6, ecolor = 'dimgray') for i in n] +spp_sort = [spp[X[i]] for i in n] +axs5.set_xticks(n) +axs5.set_xticklabels(spp_sort, fontdict = {'fontsize': 33}, rotation = 90) +axs5.set_ylim(0, 0.96) +axs5.set_yticks([0.2, 0.4, 0.6, 0.8]) +axs5.tick_params(axis = 'y', which = 'major', labelsize = 44) +axs5.set_ylabel(r'$\phi_{w}$', fontsize = 44, labelpad = 20, rotation = 0) +fig5.savefig('plots/phibarplot.svg', dpi = 300, bbox_inches = 'tight') + +# spicules bar plot +fig6, axs6 = plt.subplots(nrows = 1, ncols = 1, figsize = (10, 10)) +spix = [43900, 1540, 4020, 2000000, 2780, 5960, 0, 0, 0] # number per cm^3 +spix_e = [20000, 400, 2000, 1750000, 2000, 2000, 0, 0, 0] # uncertainty +[axs6.bar(n[i], spix[X[i]], 0.65, yerr = spix_e[X[i]], color = clrs[X[i]], + capsize = 6, ecolor = 'dimgray', rasterized = True) for i in n] +axs6.set_xticks(n) +axs6.set_xticklabels([]) +axs6.set_yticks([1000, 10000, 100000, 1000000]) +axs6.set_yscale('log') +axs6.tick_params(axis = 'y', which = 'major', labelsize = 44) +axs6.set_ylabel('$N_{spicules}$/cm$^{3}$', fontsize = 44, labelpad = 10) +fig6.savefig('plots/spiculesbarplot.svg', dpi = 300) \ No newline at end of file diff --git a/shearstrainsweepsummary.py b/shearstrainsweepsummary.py new file mode 100644 index 0000000..493e380 --- /dev/null +++ b/shearstrainsweepsummary.py @@ -0,0 +1,300 @@ +""" +@author: EAK +""" + +from mpl_toolkits.axes_grid1.inset_locator import inset_axes, mark_inset +from matplotlib import cm +import matplotlib.pyplot as plt +import matplotlib as mpl +import pandas as pd +import numpy as np +import os + +#### data read-in ############################################################ + +dir='/Users/Emile/Documents/Graduate/AntonPaarData/Porifera/summary/shear data' +os.chdir(dir) # change to directory where data are stored + +s = ('Axinella', 'Callyspongia', 'Cliona') # shear summarized data by species +ns = len(s) # number of species files +s_ = np.arange(0, ns, 1) # array of species data for looping + +df = [(pd.read_csv(s[i]+'_shearsummary.csv')).values for i in s_] # read 'em + +nr = np.int64(np.size(df, 2)/8) # number of distinct runs +r_ = np.arange(0, nr, 1) # array of runs for loopin' over runs + +na = np.int64(np.size(df, 1)) # number of amplitude points swept +a_ = np.arange(0, na, 1) # array of points for loopin' over points + +# variables, loop over species and runs to get all columns for each +# shear strains, dimensionless +gams = np.asarray([df[i][:, 8*j+1] for i in s_ for j in r_]).reshape(ns,nr,na) +# shear stresses, Pa +taus = np.asarray([df[i][:, 8*j+2] for i in s_ for j in r_]).reshape(ns,nr,na) +# storage moduli, Pa +Gps = np.asarray([df[i][:, 8*j+3] for i in s_ for j in r_]).reshape(ns,nr,na) +# loss moduli, Pa +Gpps = np.asarray([df[i][:, 8*j+4] for i in s_ for j in r_]).reshape(ns,nr,na) +# minimum strain modulus, Pa +GpMs = np.asarray([df[i][:, 8*j+5] for i in s_ for j in r_]).reshape(ns,nr,na) +# maximum strain modulus, Pa +GpLs = np.asarray([df[i][:, 8*j+6] for i in s_ for j in r_]).reshape(ns,nr,na) +# normal stress, Pa +sigs = np.asarray([df[i][:, 8*j+7] for i in s_ for j in r_]).reshape(ns,nr,na) + +#### calculations & averaging ################################################ + +# stiffening index, S +Ss = np.asarray([(GpLs[i, j, :] - GpMs[i, j, :])/GpLs[i, j, :] for i in s_ + for j in r_]).reshape(ns,nr,na) +# tangent of G"/G' +tandels = np.asarray([Gpps[i, j, :]/Gps[i, j, :] for i in s_ + for j in r_]).reshape(ns,nr,na) +# softening indices, WM and WL +WMs = np.asarray([(np.diff(GpMs[i, j, :]) / \ + np.diff(gams[i, j, :]))/GpMs[i, j, 0] for i in s_ + for j in r_]).reshape(ns,nr,na-1) +WLs = np.asarray([(np.diff(GpLs[i, j, :]) / \ + np.diff(gams[i, j, :]))/GpLs[i, j, 0] for i in s_ + for j in r_]).reshape(ns,nr,na-1) + +# calculate onsets of different nonlinearity + +# get first instances where S is >=0.02 for intracycle stiffening +ia = np.asarray([np.where(Ss[i, j, :] > 0.02)[0][0] for i in s_ + for j in r_]).reshape(ns,nr) +# get shear strains at these instances +gams_a = np.asarray([gams[i,j,ia[i,j]] for i in s_ for j in r_]).reshape(ns,nr) + +# get ratio of current GpM to GpM at previous amplitude +deltaGpM = np.asarray([(GpMs[i, j, k-1]-GpMs[i, j, k])/GpMs[i, j, k-1] + for i in s_ for j in r_ + for k in np.arange(1,na,1)]).reshape(ns,nr,na-1) +# get first instances where this ratio is >=0.05 for intercycle softening +ib = np.asarray([np.where(deltaGpM[i, j, :] > 0.05)[0][0] for i in s_ + for j in r_]).reshape(ns,nr) +# get shear strains at these other instances +gams_b = np.asarray([gams[i,j,ib[i,j]] for i in s_ for j in r_]).reshape(ns,nr) + +# check where WL is negative +checkc = np.asarray([np.where(WLs[i, j, :] < 0) for i in s_ + for j in r_]).reshape(ns,nr) +# now, the sizes of these provides where, if, WL becomes positive for inter- +# cycle stiffening. if it never does, the value will be the full size of WL, +# or na-1 +ic = np.asarray([np.size(checkc[i][j], axis = 0) for i in s_ + for j in r_]).reshape(ns,nr) +# finally, get shear strains at these instances of intercycle stiffening +gams_c = np.asarray([gams[i,j,ic[i,j]] for i in s_ for j in r_]).reshape(ns,nr) + +# averages and standard errors of critical strains for the first round +gam_a1 = [100*np.mean(gams_a[i, ::2], axis = 0) for i in s_] +gam_a1_e = [100*np.std(gams_a[i, ::2], axis = 0)/2 for i in s_] +gam_b1 = [100*np.mean(gams_b[i, ::2], axis = 0) for i in s_] +gam_b1_e = [100*np.std(gams_b[i, ::2], axis = 0)/2 for i in s_] +gam_c1 = [100*np.mean(gams_c[i, ::2], axis = 0) for i in s_] +gam_c1_e = [100*np.std(gams_c[i, ::2], axis = 0)/2 for i in s_] +# for the second round +gam_a2 = [100*np.mean(gams_a[i, 1::2], axis = 0) for i in s_] +gam_a2_e = [100*np.std(gams_a[i, 1::2], axis = 0)/2 for i in s_] +gam_b2 = [100*np.mean(gams_b[i, 1::2], axis = 0) for i in s_] +gam_b2_e = [100*np.std(gams_b[i, 1::2], axis = 0)/2 for i in s_] +gam_c2 = [100*np.mean(gams_c[i, 1::2], axis = 0) for i in s_] +gam_c2_e = [100*np.std(gams_c[i, 1::2], axis = 0)/2 for i in s_] + +# calculate first round averages of all other variables +gam1 = [np.mean(100*gams[i, ::2, :], axis = 0) for i in s_] # change to % +tau1 = [np.mean(taus[i, ::2, :], axis = 0) for i in s_] +Gp1 = [np.mean(Gps[i, ::2, :], axis = 0) for i in s_] +Gpp1 = [np.mean(Gpps[i, ::2, :], axis = 0) for i in s_] +GpM1 = [np.mean(GpMs[i, ::2, :], axis = 0) for i in s_] +GpL1 = [np.mean(GpLs[i, ::2, :], axis = 0) for i in s_] +sig1 = [np.mean(sigs[i, ::2, :], axis = 0) for i in s_] +S1 = [np.mean(Ss[i, ::2, :], axis = 0) for i in s_] +tandel1 = [np.mean(tandels[i, ::2, :], axis = 0) for i in s_] +WM1 = [np.mean(WMs[i, ::2, :], axis = 0) for i in s_] +WL1 = [np.mean(WLs[i, ::2, :], axis = 0) for i in s_] +# calculate second round averages +gam2 = [np.mean(100*gams[i, 1::2, :], axis = 0) for i in s_] +tau2 = [np.mean(taus[i, 1::2, :], axis = 0) for i in s_] +Gp2 = [np.mean(Gps[i, 1::2, :], axis = 0) for i in s_] +Gpp2 = [np.mean(Gpps[i, 1::2, :], axis = 0) for i in s_] +GpM2 = [np.mean(GpMs[i, 1::2, :], axis = 0) for i in s_] +GpL2 = [np.mean(GpLs[i, 1::2, :], axis = 0) for i in s_] +sig2 = [np.mean(sigs[i, 1::2, :], axis = 0) for i in s_] +S2 = [np.mean(Ss[i, 1::2, :], axis = 0) for i in s_] +tandel2 = [np.mean(tandels[i, 1::2, :], axis = 0) for i in s_] +WM2 = [np.mean(WMs[i, 1::2, :], axis = 0) for i in s_] +WL2 = [np.mean(WLs[i, 1::2, :], axis = 0) for i in s_] +# calculate first round standard errors +gam1_e = [np.std(100*gams[i, ::2, :], axis = 0)/2 for i in s_] +tau1_e = [np.std(taus[i, ::2, :], axis = 0)/2 for i in s_] +Gp1_e = [np.std(Gps[i, ::2, :], axis = 0)/2 for i in s_] +Gpp1_e = [np.std(Gpps[i, ::2, :], axis = 0)/2 for i in s_] +GpM1_e = [np.std(GpMs[i, ::2, :], axis = 0)/2 for i in s_] +GpL1_e = [np.std(GpLs[i, ::2, :], axis = 0)/2 for i in s_] +sig1_e = [np.std(np.abs(sigs[i, ::2, :]), axis = 0)/2 for i in s_] +S1_e = [np.std(Ss[i, ::2, :], axis = 0)/2 for i in s_] +tandel1_e = [np.std(tandels[i, ::2, :], axis = 0)/2 for i in s_] +WM1_e = [np.std(WMs[i, ::2, :], axis = 0)/2 for i in s_] +WL1_e = [np.std(WLs[i, ::2, :], axis = 0)/2 for i in s_] +# calculate second round standard errors +gam2_e = [np.std(100*gams[i, 1::2, :], axis = 0)/2 for i in s_] +tau2_e = [np.std(taus[i, 1::2, :], axis = 0)/2 for i in s_] +Gp2_e = [np.std(Gps[i, 1::2, :], axis = 0)/2 for i in s_] +Gpp2_e = [np.std(Gpps[i, 1::2, :], axis = 0)/2 for i in s_] +GpM2_e = [np.std(GpMs[i, 1::2, :], axis = 0)/2 for i in s_] +GpL2_e = [np.std(GpLs[i, 1::2, :], axis = 0)/2 for i in s_] +sig2_e = [np.std(np.abs(sigs[i, 1::2, :]), axis = 0)/2 for i in s_] +S2_e = [np.std(Ss[i, 1::2, :], axis = 0)/2 for i in s_] +tandel2_e = [np.std(tandels[i, 1::2, :], axis = 0)/2 for i in s_] +WM2_e = [np.std(WMs[i, 1::2, :], axis = 0)/2 for i in s_] +WL2_e = [np.std(WLs[i, 1::2, :], axis = 0)/2 for i in s_] + +#### plotting ################################################################ + +# set default font and activate Latex +mpl.rc('font', family = 'Courier New') +mpl.rc('text', usetex = True) +# colors +spixclrs = [cm.cool(x) for x in np.linspace(0, 1, 6)] +clrs = [spixclrs[5],spixclrs[4],spixclrs[2]] +# labels +spp = ('A. polycapella', 'Callyspongia sp.', 'C. celata') +spp = [r'\textit{%s}' % spp[i] for i in [0,1,2]] # italicize species names + +# GpM and GpL vs. strain amplitude figures and axes +plt0 = [plt.subplots(nrows = 1, ncols = 1, figsize = (12, 10)) for i in s_] +fig0 = [plt0[i][0] for i in s_] +ax0 = [plt0[i][1] for i in s_] +[ax0[j].errorbar(gam1[j], GpM1[j], yerr = GpM1_e[j], fmt = 'v', ms = 24, + mew = 3, mfc = clrs[j], mec = 'black', ecolor = 'dimgray', + capsize = 6, label = '$G^{\prime}_{M}$ 1st round') + for j in s_] +[ax0[j].plot([gam_b1[j],gam_b1[j],gam_b1[j]],[100,10000,100000000], ls = '-', + lw = 4, c = clrs[j], + label = '$\gamma_{a}=$ %.2f' % gam_b1[j] +'\%') for j in s_] +[ax0[j].plot([gam_a1[j],gam_a1[j],gam_a1[j]],[100,10000,100000000], ls = '--', + lw = 4, c = clrs[j], + label = '$\gamma_{b}=$ %.2f' % gam_a1[j] +'\%') for j in s_] +[ax0[j].plot([gam_c2[j],gam_c2[j],gam_c2[j]],[100,10000,100000000], ls = ':', + lw = 4, c = clrs[j], label = '$\gamma_{c}=$ %.2f'%gam_c2[j]+'\%') + for j in s_] +[ax0[j].errorbar(gam1[j], GpL1[j], yerr = GpL1_e[j], fmt = '^', ms = 24, + mew = 3, mfc = clrs[j], mec = 'black', ecolor = 'dimgray', + capsize = 6, label = '$G^{\prime}_{L}$ 1st round') + for j in s_] +[ax0[j].errorbar(gam2[j], GpM2[j], yerr = GpM2_e[j], fmt = 'v', ms = 24, + mew = 3, mfc = 'gainsboro', mec = clrs[j], ecolor = 'dimgray', + capsize = 6, label = '$G^{\prime}_{M}$ 2nd round') + for j in s_] +[ax0[j].errorbar(gam2[j], GpL2[j], yerr = GpL2_e[j], fmt = '^', ms = 24, + mew = 3, mfc = 'gainsboro', mec = clrs[j], ecolor = 'dimgray', + capsize = 6, label = '$G^{\prime}_{L}$ 2nd round') + for j in s_] +[ax0[j].set_xlabel('$\gamma_{0}$ (\%)', fontsize = 68) for j in s_] +[ax0[j].set_ylabel('$G^{\prime}_{X}$ (Pa)', fontsize = 68, labelpad = -10) + for j in s_] +[ax0[j].set_xscale('log') for j in s_] +[ax0[j].set_yscale('log') for j in s_] +[ax0[j].set_xlim([0.015, 25]) for j in s_] +[ax0[j].set_ylim([3.5*10**4, 2.5*10**6]) for j in s_] +[ax0[j].tick_params(axis = 'both', which = 'both', labelsize = 58) for j in s_] +hndls0, lbls0 = map(list,zip(*[ax0[j].get_legend_handles_labels() + for j in s_])) +[ax0[j].legend(hndls0[j], lbls0[j], loc = 'best', fancybox = True, + shadow = True, fontsize = 28) for j in s_] +[fig0[j].savefig('plots/' + s[j] + '_GpMGpLvsgam.svg', bbox_inches = 'tight', + dpi = 1200) for j in s_] + +fig1, ax1 = plt.subplots(figsize = (12,10)) +[ax1.errorbar(gam2[j], S2[j], yerr = S2_e[j], fmt = 's', ms = 20, mew = 3, + mfc = 'gainsboro', mec = clrs[j], ecolor = 'dimgray', + capsize = 6) for j in s_] +[ax1.errorbar(gam1[j], S1[j], yerr = S1_e[j], fmt = 's', ms = 20, mew = 3, + mfc = clrs[j], mec = 'black', ecolor = 'dimgray', capsize = 6, + label = spp[j]) for j in s_] +ax1.set_xlabel('$\gamma_{0}$ (\%)', fontsize = 68) +ax1.set_ylabel('$S$', fontsize = 68, rotation = 0, labelpad = 50) +ax1.set_xscale('log') +ax1.set_xlim([0.015, 25]) +ax1.set_ylim([-0.03, 0.71]) +ax1.tick_params(axis = 'both', which = 'major', labelsize = 58) +hndls1, lbls1 = ax1.get_legend_handles_labels() +ax1.legend(hndls1, lbls1, loc = 'upper left', fancybox = True, shadow = True, + fontsize = 28) +fig1.savefig('plots/Svsgam.svg', bbox_inches = 'tight', dpi = 1200) + +fig2, ax2 = plt.subplots(figsize = (12,10)) +[ax2.errorbar((gam2[j][:-1]+gam2[j][1:])/2, WL2[j], yerr = WL2_e[j], fmt = '^', + ms = 20, mew = 3, mfc = 'gainsboro', mec = clrs[j], + ecolor = 'dimgray', capsize = 6) for j in s_] +[ax2.errorbar((gam1[j][:-1]+gam1[j][1:])/2, WL1[j], yerr = WL1_e[j], fmt = '^', + ms = 20, mew = 3, mfc = clrs[j], mec = 'black', + ecolor = 'dimgray', capsize = 6, label = spp[j]) for j in s_] +[ax2.errorbar((gam2[j][:-1]+gam2[j][1:])/2, WM2[j], yerr = WM2_e[j], fmt = 'v', + ms = 20, mew = 3, mfc = 'gainsboro', mec = clrs[j], + ecolor = 'dimgray', capsize = 6) for j in s_] +[ax2.errorbar((gam1[j][:-1]+gam1[j][1:])/2, WM1[j], yerr = WM1_e[j], fmt = 'v', + ms = 20, mew = 3, mfc = clrs[j], mec = 'black', + ecolor = 'dimgray', capsize = 6, label = spp[j]) for j in s_] +ax2.plot([0.02,0.2,2,20],[0,0,0,0], lw = 3, c = 'silver', ls = '--') +ax2.set_xlabel('$\gamma_{0}$ (\%)', fontsize = 68) +ax2.set_ylabel('$W_{X}$', fontsize = 68) +ax2.set_xscale('log') +ax2.set_xlim([0.025, 19]) +ax2.set_ylim([-295, 29.5]) +ax2.tick_params(axis = 'both', which = 'major', labelsize = 58) +axins2 = inset_axes(ax2, width = '50%', height = '50%', loc = 4) +[axins2.errorbar((gam2[j][:-1]+gam2[j][1:])/2, WL2[j], yerr = WL2_e[j], + fmt = '^', ms = 20, mew = 3, mfc = 'gainsboro', mec = clrs[j], + ecolor = 'dimgray', capsize = 6) for j in s_] +[axins2.errorbar((gam1[j][:-1]+gam1[j][1:])/2, WL1[j], yerr = WL1_e[j], + fmt = '^', ms = 20, mew = 3, mfc = clrs[j], mec = 'black', + ecolor = 'dimgray', capsize = 6, label = spp[j]) for j in s_] +[axins2.errorbar((gam2[j][:-1]+gam2[j][1:])/2, WM2[j], yerr = WM2_e[j], + fmt = 'v', ms = 20, mew = 3, mfc = 'gainsboro', mec = clrs[j], + ecolor = 'dimgray', capsize = 6) for j in s_] +[axins2.errorbar((gam1[j][:-1]+gam1[j][1:])/2, WM1[j], yerr = WM1_e[j], + fmt = 'v', ms = 20, mew = 3, mfc = clrs[j], mec = 'black', + ecolor = 'dimgray', capsize = 6, label = spp[j]) for j in s_] +axins2.plot([0.02,0.2,2,20],[0,0,0,0], lw = 3, c = 'silver', ls = '--') +mark_inset(ax2, axins2, loc1 = 2, loc2 = 1, fc = 'none', ec = '0') +axins2.set_xlim(3.2, 16) +axins2.set_ylim(-6.4, 6.4) +axins2.xaxis.set_ticks_position('top') +axins2.tick_params(axis = 'both', which = 'both', labelsize = 38) +fig2.savefig('plots/Wvsgam.svg', bbox_inches = 'tight', dpi = 1200) + +fig3, ax3 = plt.subplots(figsize = (12,10)) +[ax3.errorbar(gam2[j], sig2[j]/1000, xerr = gam2_e[j], yerr = sig2_e[j]/1000, + fmt = 's', ms = 20, mew = 3, mfc = 'gainsboro', mec = clrs[j], + ecolor = 'dimgray', capsize = 6) for j in s_] +[ax3.errorbar(gam1[j], sig1[j]/1000, xerr = gam1_e[j], yerr = sig1_e[j]/1000, + fmt = 's', ms = 20, mew = 3, mfc = clrs[j], mec = 'black', + ecolor = 'dimgray', capsize = 6, label = spp[j]) for j in s_] +ax3.plot([0.01,0.1,1,10,100],[0,0,0,0,0], lw = 3, c = 'silver', ls = '--') +ax3.set_xscale('log') +ax3.set_xlim([0.015, 25]) +ax3.set_ylim([-16.5, 6.5]) +ax3.set_yticks([-15, -10, -5, 0, 5]) +ax3.set_xlabel('$\gamma_{0}$ (\%)', fontsize = 68) +ax3.set_ylabel(r'$\sigma_{zz}$ (kPa)', fontsize = 68) +ax3.tick_params(axis = 'both', which = 'major', labelsize = 58) +plt.savefig('plots/normvsgam.svg', bbox_inches = 'tight', dpi = 1200) + +fig4, ax4 = plt.subplots(figsize = (12,10)) +[ax4.errorbar(gam2[j], tandel2[j], xerr = gam2_e[j], yerr = tandel2_e[j], + fmt = 's', ms = 20, mew = 3, mfc = 'gainsboro', mec = clrs[j], + ecolor = 'dimgray', capsize = 6) for j in s_] +[ax4.errorbar(gam1[j], tandel1[j], xerr = gam1_e[j], yerr = tandel1_e[j], + fmt = 's', ms = 20, mew = 3, mfc = clrs[j], mec = 'black', + ecolor = 'dimgray', capsize = 6, label = spp[j]) for j in s_] +ax4.set_xlabel('$\gamma_{0}$ (\%)', fontsize = 68) +ax4.set_ylabel(r'$\tan\delta$', fontsize = 68) +ax4.set_xscale('log') +ax4.set_xlim([0.015, 25]) +ax4.set_ylim([0.03, 0.43]) +ax4.tick_params(axis = 'both', which = 'major', labelsize = 58) +plt.savefig('plots/tandelvsgam.svg', bbox_inches = 'tight', dpi = 1200) \ No newline at end of file diff --git a/uniaxialstrainsummary.py b/uniaxialstrainsummary.py new file mode 100644 index 0000000..22f7bfe --- /dev/null +++ b/uniaxialstrainsummary.py @@ -0,0 +1,434 @@ +""" +@author: EAK +""" + +from mpl_toolkits.axes_grid1.inset_locator import inset_axes, mark_inset +from matplotlib import cm +import numpy as np +import matplotlib.pyplot as plt +import matplotlib as mpl +import pandas as pd +import os + +#### Data Read-In ############################################################ + +dir = '/Users/Emile/Documents/Graduate/AntonPaarData/Porifera/summary/'+\ + 'uniaxial data' +os.chdir(dir) + +fs = ['Axinella','Callyspongia','Cinachyrella','Cliona', + 'Tectitethya','Tethya','Aplysina','Igernella'] # sponge files +fs_ = np.arange(0, len(fs), 1) # array them +dfs = [(pd.read_excel(fs[i] + '.xlsx', sheet_name = j)).values for i in fs_ + for j in [0,1]] # dataframes +dfs_ = np.arange(0, len(dfs), 1) # array them +# average stress-strain-shear modulus curves and uncertainties +eps = [100*dfs[i][:,0].astype('float64') for i in dfs_] # uniaxial strain, % +sig = [dfs[i][:,1].astype('float64') for i in dfs_] # uniaxial stress, Pa +Gp = [dfs[i][:,2].astype('float64') for i in dfs_] # G', Pa +Gpn = [dfs[i][:,3].astype('float64') for i in dfs_] # normalized G' +eps_e = [100*dfs[i][:,4].astype('float64') for i in dfs_] +sig_e = [dfs[i][:,5].astype('float64') for i in dfs_] +Gp_e = [dfs[i][:,6].astype('float64') for i in dfs_] +# averaged moduli from each run +G0 = [dfs[i][0,8].astype('float64') for i in dfs_] # shear modulus +G0_e = [dfs[i][0,9].astype('float64') for i in dfs_] +Ec = [dfs[i][0,10].astype('float64') for i in dfs_] # compression modulus +Ec_e = [dfs[i][0,11].astype('float64') for i in dfs_] +Es = [dfs[i][0,12].astype('float64') for i in dfs_] # extension modulus +Es_e = [dfs[i][0,13].astype('float64') for i in dfs_] +E0 = [dfs[i][0,14].astype('float64') for i in dfs_] # zero strain modulus +E0_e = [dfs[i][0,15].astype('float64') for i in dfs_] + +# other animal tissue and synthetic sponge data +dfo = (pd.read_excel('mammalcompressstiff.xlsx')).values +fo = np.arange(0, np.int64(np.size(dfo)/24), 1) +epso = [dfo[:,5*i+1].astype('float64') for i in fo] # uniaxial strain, % +sigo = [dfo[:,5*i+2].astype('float64') for i in fo] # uniaxial stress, Pa +Gpo = [dfo[:,5*i+3].astype('float64') for i in fo] # G', Pa +Eo = [dfo[0,5*i+4].astype('float64') for i in fo] # E, Pa +Eo_e = [dfo[1,5*i+4].astype('float64') for i in fo] + +#### calculations ############################################################ + +# compression stiffening stress slope: + +# for others +cso = [np.polyfit(-sigo[i][2:], Gpo[i][2:], 1, cov = True) for i in fo] + +# indices to take fits at compression points +lsc = [0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 0, 0, 3, 0, 0] +lfc = [3, 5, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7] +# for sponges +cs = [np.polyfit(-sig[i][lsc[i]:lfc[i]], Gp[i][lsc[i]:lfc[i]], 1, cov = True) + for i in dfs_] + +# if the material follows classical Birch compression stiffening +nu = [(9-2*cs[i][0][0])/(2*cs[i][0][0]+12) for i in dfs_] # Poisson's ratio +nuo = [(9-2*cso[i][0])/(2*cso[i][0]+12) for i in fo] + +EG_birch = [2*(1+nu[i]) for i in dfs_] + +EG = [E0[i]/G0[i] for i in dfs_] # ratio of E to G at small uniaxial strain +EG_e = [np.sqrt(E0_e[j]**2/G0[j]**2 + G0_e[j]**2/G0[j]**4) for j in dfs_] + +EGo = [Eo[i]/Gpo[i][0] for i in fo] +EGo_e = [np.sqrt(Eo_e[j]**2/Gpo[j][0]**2) for j in fo] + +#### Plotting ################################################################ + +# set default font and activate LaTeX rendering +mpl.rc('font', family = 'Courier New') +mpl.rc('text', usetex = True) +# living sponge colors, markers, and labels +spxclrs = [cm.cool(x) for x in np.linspace(0, 1, 6)] +nospxclrs = [cm.spring(x) for x in np.linspace(0.6, 0.89, 2)] +clrs = [spxclrs[5],spxclrs[5],spxclrs[4],spxclrs[4],spxclrs[3],spxclrs[3], + spxclrs[2],spxclrs[2],spxclrs[1],spxclrs[1],spxclrs[0],spxclrs[0], + nospxclrs[0],nospxclrs[0],nospxclrs[1],nospxclrs[1]] +mrkrs = ['s','s','s','s','s','s','s','s','s','s','s','s','o','o','o','o'] +spp = ['A. polycapella','Callyspongia sp.','C. apion', + 'C. celata','T. keyensis','T. aurantium', + 'A. fulva','I. notabilis'] +spp = [r'\textit{%s}' % spp[i] for i in fs_] # italicize +olbls = ['brain', 'liver', 'adipose', 'synthetic'] +oclrs = [cm.Reds(x) for x in np.linspace(0.76, 1, 3)] +oclrs.insert(len(oclrs), 'xkcd:dried blood') +omrkrs = ['p', 'H', '8', '*'] + +# uniaxial stress vs. uniaxial strain figures and axes +# plts0 = [plt.subplots(nrows = 1, ncols = 2, figsize = (12, 10)) for i in fs_] +# figs0 = [plts0[i][0] for i in fs_] +# axes0 = [plts0[i][1] for i in fs_] +# # compression for second orientation +# [axes0[i][0].errorbar(eps[2*i+1][:7], sig[2*i+1][:7], xerr = eps_e[2*i+1][:7], +# yerr = sig_e[2*i+1][:7], ms = 24, fmt = mrkrs[2*i], +# mfc = 'snow', mec = clrs[2*i], capsize = 6, +# ecolor = 'dimgray', mew = 3) for i in fs_] +# [axes0[i][0].plot(eps[2*i+1][:6], Ec[2*i+1]*eps[2*i+1][:6]/100, c = clrs[2*i], +# lw = 3, ls = '-') for i in fs_] +# [axes0[i][0].plot(eps[2*i+1][5:9], E0[2*i+1]*eps[2*i+1][5:9]/100, +# c = clrs[2*i], lw = 3, ls = '--') for i in fs_] +# # compression for first orientation +# [axes0[i][0].errorbar(eps[2*i][:7], sig[2*i][:7], xerr = eps_e[2*i][:7], +# yerr = sig_e[2*i][:7], ms = 24, fmt = mrkrs[2*i], +# mfc = clrs[2*i], mec = 'black', capsize = 6, mew = 3, +# ecolor = 'dimgray') for i in fs_] +# [axes0[i][0].plot(eps[2*i][:6], Ec[2*i]*eps[2*i][:6]/100, c = clrs[2*i], +# lw = 3, ls = ':') for i in fs_] +# [axes0[i][0].plot(eps[2*i][5:9], E0[2*i]*eps[2*i][5:9]/100, c = clrs[2*i], +# lw = 3, ls = '-.') for i in fs_] +# # stretch for second orientation +# [axes0[i][1].errorbar(eps[2*i+1][7:], sig[2*i+1][7:], +# xerr = eps_e[2*i+1][7:], yerr = sig_e[2*i+1][7:], +# ms = 24, fmt = mrkrs[2*i], mfc = 'snow', mec = clrs[2*i], +# capsize = 6, ecolor = 'dimgray', mew = 3) for i in fs_] +# [axes0[i][1].plot(eps[2*i+1][8:], Es[2*i+1]*eps[2*i+1][8:]/100, c = clrs[2*i], +# lw = 3, ls = '-') for i in fs_] +# [axes0[i][1].plot(eps[2*i+1][5:9], E0[2*i+1]*eps[2*i+1][5:9]/100, +# c = clrs[2*i], lw = 3, ls = '--') for i in fs_] +# # stretch for first orientation +# [axes0[i][1].errorbar(eps[2*i][7:], sig[2*i][7:], xerr = eps_e[2*i][7:], +# yerr = sig_e[2*i][7:], ms = 24, fmt = mrkrs[2*i], +# mfc = clrs[2*i], mec = 'black', capsize = 6, mew = 3, +# ecolor = 'dimgray') for i in fs_] +# [axes0[i][1].plot(eps[2*i][8:], Es[2*i]*eps[2*i][8:]/100, c = clrs[2*i], +# lw = 3, ls = ':') for i in fs_] +# [axes0[i][1].plot(eps[2*i][5:9], E0[2*i]*eps[2*i][5:9]/100, c = clrs[2*i], +# lw = 3, ls = '-.') for i in fs_] +# # aesthetics +# [axes0[i][0].set_xlim(-13.1, 0) for i in fs_] +# [axes0[i][0].set_xticks([-10,-5,0]) for i in fs_] +# [axes0[i][1].set_xlim(0, 13.1) for i in fs_] +# [axes0[i][1].set_xticks([5,10]) for i in fs_] +# max0 = [np.max([np.abs(sig[2*i][:]),np.abs(sig[2*i+1][:])]) for i in fs_] +# [axes0[i][0].set_ylim(-max0[i]-0.26*max0[i], 0) for i in fs_] +# [axes0[i][1].set_ylim(0.001, max0[i]+0.26*max0[i]) for i in fs_] +# [axes0[i][1].set_xlabel('$\epsilon$ (\%)', fontsize = 72, labelpad = -10) +# for i in fs_] +# [axes0[i][1].set_ylabel('$\sigma_{zz}$ (Pa)', fontsize = 72) for i in fs_] +# [axes0[i][1].yaxis.set_ticks_position('right') for i in fs_] +# [axes0[i][j].yaxis.get_major_formatter().set_powerlimits((3, 3)) +# for i in fs_ for j in [0,1]] +# [axes0[i][j].yaxis.offsetText.set_fontsize(58) for i in fs_ for j in [0,1]] +# [axes0[i][1].yaxis.set_offset_position('right') for i in fs_] +# [axes0[i][j].tick_params(axis = 'both', which = 'major', labelsize = 58) +# for i in fs_ for j in [0,1]] +# [figs0[i].subplots_adjust(wspace = 0.001) for i in fs_] +# [figs0[i].savefig('plots/uniaxialstressvsstrain%s.svg' % i, +# bbox_inches = 'tight', dpi = 1200) for i in fs_] + +# shear modulus vs. uniaxial strain figures and axes +# plts1 = [plt.subplots(nrows = 1, ncols = 2, figsize = (12, 10)) for i in fs_] +# figs1 = [plts1[i][0] for i in fs_] +# axes1 = [plts1[i][1] for i in fs_] +# # compression for second orientation +# [axes1[i][0].errorbar(eps[2*i+1][:7], Gp[2*i+1][:7], xerr = eps_e[2*i+1][:7], +# yerr = Gp_e[2*i+1][:7], ms = 24, fmt = mrkrs[2*i], +# mfc = 'snow', mec = clrs[2*i], capsize = 6, +# ecolor = 'dimgray', mew = 3) for i in fs_] +# [axes1[i][0].plot(eps[2*i+1][:8], bc[2*i+1]+mc[2*i+1]*eps[2*i+1][:8]/100, +# c = clrs[2*i], lw = 3, ls = '-') for i in fs_] +# # compression for first orientation +# [axes1[i][0].errorbar(eps[2*i][:7], Gp[2*i][:7], xerr = eps_e[2*i][:7], +# yerr = Gp_e[2*i][:7], ms = 24, fmt = mrkrs[2*i], +# mfc = clrs[2*i], mec = 'black', capsize = 6, mew = 3, +# ecolor = 'dimgray') for i in fs_] +# [axes1[i][0].plot(eps[2*i][:8], bc[2*i]+mc[2*i]*eps[2*i][:8]/100, +# c = clrs[2*i], lw = 3, ls = ':') for i in fs_] +# # stretch for second orientation +# [axes1[i][1].errorbar(eps[2*i+1][7:], Gp[2*i+1][7:], xerr = eps_e[2*i+1][7:], +# yerr = Gp_e[2*i+1][7:], ms = 24, fmt = mrkrs[2*i], +# mfc = 'snow', mec = clrs[2*i], capsize = 6, +# ecolor = 'dimgray', mew = 3) for i in fs_] +# [axes1[i][1].plot(eps[2*i+1][7:], be[2*i+1]+me[2*i+1]*eps[2*i+1][7:]/100, +# c = clrs[2*i], lw = 3, ls = '-') for i in fs_] +# # stretch for first orientation +# [axes1[i][1].errorbar(eps[2*i][7:], Gp[2*i][7:], xerr = eps_e[2*i][7:], +# yerr = Gp_e[2*i][7:], ms = 24, fmt = mrkrs[2*i], +# mfc = clrs[2*i], mec = 'black', capsize = 6, mew = 3, +# ecolor = 'dimgray') for i in fs_] +# [axes1[i][1].plot(eps[2*i][7:], be[2*i]+me[2*i]*eps[2*i][7:]/100, +# c = clrs[2*i], lw = 3, ls = ':') for i in fs_] +# # aesthetics +# [axes1[i][0].set_xlim(-13.1, -0.131) for i in fs_] +# [axes1[i][1].set_xlim(0.131, 13.1) for i in fs_] +# min1 = [np.min([axes1[i][0].get_ylim(), axes1[i][1].get_ylim()]) for i in fs_] +# max1 = [np.max([axes1[i][0].get_ylim(), axes1[i][1].get_ylim()]) for i in fs_] +# [axes1[i][j].set_ylim(min1[i]-0.001*min1[i], max1[i]+0.001*max1[i]) +# for i in fs_ for j in [0,1]] +# [axes1[i][1].set_xlabel('$\epsilon$ (\%)', fontsize = 72) for i in fs_] +# [axes1[i][1].xaxis.set_label_coords(-0.1, -0.02) for i in fs_] +# [axes1[i][0].set_yticks([]) for i in fs_] +# [axes1[i][0].set_ylabel('$G^{\prime}$ (Pa)', fontsize = 72) for i in fs_] +# [axes1[i][j].tick_params(axis = 'both', which = 'major', labelsize = 58) +# for i in fs_ for j in [0,1]] +# [axes1[i][j].yaxis.get_major_formatter().set_powerlimits((6, 6)) +# for i in fs_ for j in [0,1]] +# [axes1[i][j].yaxis.offsetText.set_fontsize(58) for i in fs_ for j in [0,1]] +# [figs1[i].subplots_adjust(wspace = 0.27) for i in fs_] +# [figs1[i].savefig('plots/Gpvsstrain%s.svg' % i, bbox_inches = 'tight', +# dpi = 1200) for i in fs_] + +# E bar plot +# fig2, ax2 = plt.subplots(nrows = 1, ncols = 2, figsize = (18, 18)) +# [ax2[0].barh(fs_[i]+1.25*i+1, Ec[2*i], 1, xerr = Ec_e[2*i], color = clrs[2*i], +# lw = 3, capsize = 6, ecolor = 'dimgray') for i in fs_] +# [ax2[0].barh(fs_[i]+1.25*i, Ec[2*i+1], 1, xerr = Ec_e[2*i+1], color = 'snow', +# edgecolor = clrs[2*i], lw = 6, capsize = 6, ecolor = 'dimgray') +# for i in fs_] +# [ax2[1].barh(fs_[i]+1.25*i+1, Es[2*i], 1, xerr = Es_e[2*i], color = clrs[2*i], +# lw = 3, capsize = 6, ecolor = 'dimgray') for i in fs_] +# [ax2[1].barh(fs_[i]+1.25*i, Es[2*i+1], 1, xerr = Es_e[2*i+1], +# color = 'snow', edgecolor = clrs[2*i], lw = 6, +# capsize = 6, ecolor = 'dimgray') for i in fs_] +# [ax2[i].set_yticks([]) for i in [0,1]] +# [ax2[i].tick_params(axis = 'both', which = 'major', labelsize = 72) +# for i in [0,1]] +# [ax2[i].set_xlim(0.001, 1540000) for i in [0,1]] +# [ax2[i].set_ylim(-0.75, 17.5) for i in [0,1]] +# ax2[0].set_xlabel('$E_{c}$ (Pa)', fontsize = 72) +# ax2[1].set_xlabel('$E_{s}$ (Pa)', fontsize = 72) +# [ax2[i].xaxis.offsetText.set_fontsize(62) for i in [0,1]] +# ax2[0].invert_xaxis() +# [fig2.subplots_adjust(wspace = 0.04) for i in fs_] +# fig2.savefig('plots/Ebarplot.svg', bbox_inches = 'tight', dpi = 1200) + +# EG ratio barplot +# fig3, ax3 = plt.subplots(nrows = 1, ncols = 1, figsize = (18, 18)) +# ax3.bar(0, EGo[2], 3, yerr = EGo_e[2], color = oclrs[2], capsize = 6, +# ecolor = 'dimgray') +# ax3.bar(5, EG[12], 3, yerr = EG_e[12], color = clrs[12], capsize = 6, +# ecolor = 'dimgray', lw = 3) +# ax3.bar(8, EG[13], 3, yerr = EG_e[13], color = 'snow', edgecolor = clrs[12], +# capsize = 6, ecolor = 'dimgray', lw = 6) +# ax3.bar(13, EG[0], 3, yerr = EG_e[0], color = clrs[0], capsize = 6, +# ecolor = 'dimgray', lw = 3) +# ax3.bar(16, EG[1], 3, yerr = EG_e[1], color = 'snow', edgecolor = clrs[0], +# capsize = 6, ecolor = 'dimgray', lw = 6) +# ax3.bar(21, EGo[0], 3, yerr = EGo_e[0], color = oclrs[0], capsize = 6, +# ecolor = 'dimgray') +# ax3.bar(26, EGo[1], 3, yerr = EGo_e[1], color = oclrs[1], capsize = 6, +# ecolor = 'dimgray') +# ax3.bar(31, EG[8], 3, yerr = EG_e[8], color = clrs[8], capsize = 6, +# ecolor = 'dimgray', lw = 3) +# ax3.bar(34, EG[9], 3, yerr = EG_e[9], color = 'snow', edgecolor = clrs[8], +# capsize = 6, ecolor = 'dimgray', lw = 6) +# ax3.bar(39, EG[14], 3, yerr = EG_e[14], color = clrs[14], capsize = 6, +# ecolor = 'dimgray', lw = 3) +# ax3.bar(42, EG[15], 3, yerr = EG_e[15], color = 'snow', edgecolor = clrs[14], +# capsize = 6, ecolor = 'dimgray', lw = 6) +# ax3.bar(47, EG[6], 3, yerr = EG_e[6], color = clrs[6], capsize = 6, +# ecolor = 'dimgray', lw = 3) +# ax3.bar(50, EG[7], 3, yerr = EG_e[7], color = 'snow', edgecolor = clrs[6], +# capsize = 6, ecolor = 'dimgray', lw = 6) +# ax3.bar(55, EG[4], 3, yerr = EG_e[4], color = clrs[4], capsize = 6, +# ecolor = 'dimgray', lw = 3) +# ax3.bar(58, EG[5], 3, yerr = EG_e[5], color = 'snow', edgecolor = clrs[5], +# capsize = 6, ecolor = 'dimgray', lw = 6) +# ax3.bar(63, EG[10], 3, yerr = EG_e[10], color = clrs[10], capsize = 6, +# ecolor = 'dimgray', lw = 3) +# ax3.bar(66, EG[11], 3, yerr = EG_e[11], color = 'snow', edgecolor = clrs[10], +# capsize = 6, ecolor = 'dimgray', lw = 6) +# ax3.bar(71, EG[2], 3, yerr = EG_e[2], color = clrs[2], capsize = 6, +# ecolor = 'dimgray', lw = 3) +# ax3.bar(74, EG[3], 3, yerr = EG_e[3], color = 'snow', edgecolor = clrs[2], +# capsize = 6, ecolor = 'dimgray', lw = 6) +# ax3.bar(79, EGo[3], 3, yerr = EGo_e[3], color = oclrs[3], capsize = 6, +# ecolor = 'dimgray') +# ax3.plot(np.arange(-3,100,2), 52*[1], ls = ':', lw = 6, c = 'silver') +# ax3.plot(np.arange(-3,100,2), 52*[2], ls = '-.', lw = 6, c = 'silver') +# ax3.plot(np.arange(-3,100,2), 52*[3], ls = '--', lw = 6, c = 'silver') +# ax3.set_xticks([0, 6.5, 14.5, 21, 26, 32.5, 40.5, 48.5, 56.5, 64.5, 72.5, 79]) +# ax3.set_xticklabels(['adipose', r'\textit{A. fulva}', +# r'\textit{A. polycapella}', 'brain', 'liver', +# r'\textit{T. keyensis}',r'\textit{I. notabilis}', +# r'\textit{C. celata}',r'\textit{C. apion}', +# r'\textit{T. aurantium}',r'\textit{Callyspongia sp.}', +# 'synthetic'], fontdict = {'fontsize': 42}, rotation = 90) +# ax3.set_xlim(-3, 82) +# ax3.set_ylim(0.004, 4) +# ax3.set_ylabel('$E_{0}/G^{\prime}_{0}$', fontsize = 72, labelpad = 20) +# ax3.tick_params(axis = 'y', which = 'major', labelsize = 72) +# fig3.savefig('plots/EGbarplot.svg', bbox_inches = 'tight', dpi = 1200) + +# compression stiffening +fig4, axs4 = plt.subplots(nrows = 1, ncols = 1, figsize = (18, 18)) +# sponges +[axs4.errorbar(sig[2*j+1][:7], Gp[2*j+1][:7], xerr = sig_e[2*j+1][:7], + yerr = Gp_e[2*j+1][:7], ms = 30, fmt = mrkrs[2*j], mfc = 'snow', + mec = clrs[2*j], capsize = 6, ecolor = 'dimgray', mew = 4) + for j in fs_] +[axs4.errorbar(sig[2*j][:7], Gp[2*j][:7], xerr = sig_e[2*j][:7], + yerr = Gp_e[2*j][:7], ms = 30, fmt = mrkrs[2*j], + mfc = clrs[2*j], mec = 'black', capsize = 6, label = spp[j], + ecolor = 'dimgray', mew = 4) for j in fs_] +# axs4.plot(sig[7][lsc[7]:lfc[7]], +# -cs[7][0][0]*sig[7][lsc[7]:lfc[7]]+cs[7][0][1], +# c = clrs[6], lw = 3, ls = '-')#, label = '$m=%.0f$' % cs[7][0][0]) +# axs4.plot(sig[6][lsc[6]:lfc[6]], +# -cs[6][0][0]*sig[6][lsc[6]:lfc[6]]+cs[6][0][1], +# c = clrs[6], lw = 3, ls = ':')#, label = '$m=%.0f$' % cs[6][0][0]) +# others +[axs4.errorbar(sigo[j][:], Gpo[j][:], ms = 30, fmt = omrkrs[j], mfc = oclrs[j], + mec = 'black', mew = 4, label = olbls[j]) for j in fo] +axs4.set_xlabel('$\sigma_{zz}$ (Pa)', fontsize = 72, loc = 'left') +axs4.set_ylabel('$G^{\prime}$ (Pa)', fontsize = 72, loc = 'bottom') +axs4.tick_params(axis = 'both', which = 'major', labelsize = 72) +axs4.set_xlim([-200000, -100]) +axs4.set_ylim([250, 12500000]) +axs4.set_xscale('symlog') +axs4.set_yscale('log') +axs4.set_yticks([1000, 10000, 100000, 1000000, 10000000]) +axs4.get_yaxis().set_major_formatter(mpl.ticker.LogFormatterSciNotation()) +# axs4.set_ylim([1.25*10**2, 1.25*10**7]) +# axins41 = axs4.inset_axes([1.125, 0.75, 0.4, 0.4]) +# [axins41.errorbar(sig[2*j+1][:7], Gp[2*j+1][:7], xerr = sig_e[2*j+1][:7], +# yerr = Gp_e[2*j+1][:7], ms = 30, fmt = mrkrs[2*j], +# mfc = 'snow', mec = clrs[2*j], capsize = 6, +# ecolor = 'dimgray', mew = 4) for j in fs_] +# [axins41.errorbar(sig[2*j][:7], Gp[2*j][:7], xerr = sig_e[2*j][:7], +# yerr = Gp_e[2*j][:7], ms = 30, fmt = mrkrs[2*j], +# mfc = clrs[2*j], mec = 'black', capsize = 6, +# ecolor = 'dimgray', mew = 4) for j in fs_] +# axins41.plot(sig[7][lsc[7]:lfc[7]], +# -cs[7][0][0]*sig[7][lsc[7]:lfc[7]]+cs[7][0][1], +# c = clrs[6], lw = 3, ls = '-', label = '$m=%.1f$' +# % cs[7][0][0]) +# axins41.plot(sig[6][lsc[6]:lfc[6]], +# -cs[6][0][0]*sig[6][lsc[6]:lfc[6]]+cs[6][0][1], +# c = clrs[6], lw = 3, ls = ':', label = '$m=%.0f$' +# % cs[6][0][0]) +# mark_inset(axs4, axins41, loc1 = 2, loc2 = 3, fc = 'none', ec = '0') +# axins41.set_xlim(-75000, -75) +# axins41.set_ylim(400000, 3000000) +# axins41.xaxis.offsetText.set_fontsize(42) +# axins41.yaxis.offsetText.set_fontsize(42) +# axins41.xaxis.get_major_formatter().set_powerlimits((3, 3)) +# axins41.yaxis.get_major_formatter().set_powerlimits((6, 6)) +# axins41.tick_params(axis = 'both', which = 'both', labelsize = 52) + +# axins42 = axs4.inset_axes([1.125, 0.25, 0.4, 0.4]) +# [axins42.errorbar(sig[2*j+1][:7], Gp[2*j+1][:7], xerr = sig_e[2*j+1][:7], +# yerr = Gp_e[2*j+1][:7], ms = 30, fmt = mrkrs[2*j], +# mfc = 'snow', mec = clrs[2*j], capsize = 6, +# ecolor = 'dimgray', mew = 4) for j in fs_] +# [axins42.errorbar(sig[2*j][:7], Gp[2*j][:7], xerr = sig_e[2*j][:7], +# yerr = Gp_e[2*j][:7], ms = 30, fmt = mrkrs[2*j], +# mfc = clrs[2*j], mec = 'black', capsize = 6, +# ecolor = 'dimgray', mew = 4) for j in fs_] +# [axins42.errorbar(sigo[j][:], Gpo[j][:], ms = 30, fmt = omrkrs[j], +# mfc = oclrs[j], mec = 'black', mew = 4, label = olbls[j]) +# for j in fo] +# mark_inset(axs4, axins42, loc1 = 2, loc2 = 3, fc = 'none', ec = '0') +# axins42.set_xlim(-15000, -15) +# axins42.set_ylim(43000, 860000) +# axins42.set_yticks([200000, 400000, 600000, 800000]) +# axins42.xaxis.offsetText.set_fontsize(42) +# axins42.yaxis.offsetText.set_fontsize(42) +# axins42.xaxis.get_major_formatter().set_powerlimits((3, 3)) +# axins42.yaxis.get_major_formatter().set_powerlimits((6, 6)) +# axins42.tick_params(axis = 'both', which = 'both', labelsize = 52) + +# axins43 = axs4.inset_axes([1.125, -0.25, 0.4, 0.4]) +# [axins43.errorbar(sigo[j][:], Gpo[j][:], ms = 30, fmt = omrkrs[j], +# mfc = oclrs[j], mec = 'black', mew = 4) for j in fo] +# [axins43.plot(sigo[2][:], -cso[i][0][0]*sigo[2][:]+cso[i][0][1], c = oclrs[i], +# lw = 3, ls = '--', label = '$m=%.2f$' % cso[i][0][0]) +# for i in fo[:-1]] +# mark_inset(axs4, axins43, loc1 = 2, loc2 = 3, fc = 'none', ec = '0') +# axins43.set_xlim(-2500, 0.025) +# axins43.set_xticks([-2000, -1000, 0]) +# axins43.set_ylim(0.025, 2500) +# axins43.set_yticks([1000, 2000]) +# axins43.xaxis.offsetText.set_fontsize(42) +# axins43.yaxis.offsetText.set_fontsize(42) +# axins43.xaxis.get_major_formatter().set_powerlimits((3, 3)) +# axins43.yaxis.get_major_formatter().set_powerlimits((6, 6)) +# axins43.tick_params(axis = 'both', which = 'both', labelsize = 52) +# hndls43, lbls43 = axins43.get_legend_handles_labels() # create legend +# axins43.legend(hndls43, lbls43, loc = 'upper right', fancybox = True, +# shadow = True, fontsize = 38) +# legend +# hndls, lbls = axs4.get_legend_handles_labels() # create legend +# axs4.legend(hndls, lbls, loc = 'upper left', fancybox = True, shadow = True, +# fontsize = 42) +fig4.savefig('plots/compressstiff.svg', bbox_inches = 'tight', dpi = 1200) + +# shear modulus vs. uniaxial stress figures and axes +# plts5 = [plt.subplots(nrows = 1, ncols = 2, figsize = (12, 10)) for i in fs_] +# figs5 = [plts5[i][0] for i in fs_] +# axes5 = [plts5[i][1] for i in fs_] +# # compression for second orientation +# [axes5[i][0].errorbar(sig[2*i+1][:7], Gp[2*i+1][:7], xerr = sig_e[2*i+1][:7], +# yerr = Gp_e[2*i+1][:7], ms = 24, fmt = mrkrs[2*i], +# mfc = 'snow', mec = clrs[2*i], capsize = 6, +# ecolor = 'dimgray', mew = 3) for i in fs_] +# # compression for first orientation +# [axes5[i][0].errorbar(sig[2*i][:7], Gp[2*i][:7], xerr = sig_e[2*i][:7], +# yerr = Gp_e[2*i][:7], ms = 24, fmt = mrkrs[2*i], +# mfc = clrs[2*i], mec = 'black', capsize = 6, mew = 3, +# ecolor = 'dimgray') for i in fs_] +# # stretch for second orientation +# [axes5[i][1].errorbar(sig[2*i+1][7:], Gp[2*i+1][7:], xerr = sig_e[2*i+1][7:], +# yerr = Gp_e[2*i+1][7:], ms = 24, fmt = mrkrs[2*i], +# mfc = 'snow', mec = clrs[2*i], capsize = 6, +# ecolor = 'dimgray', mew = 3) for i in fs_] +# # stretch for first orientation +# [axes5[i][1].errorbar(sig[2*i][7:], Gp[2*i][7:], xerr = sig_e[2*i][7:], +# yerr = Gp_e[2*i][7:], ms = 24, fmt = mrkrs[2*i], +# mfc = clrs[2*i], mec = 'black', capsize = 6, mew = 3, +# ecolor = 'dimgray') for i in fs_] +# # aesthetics +# [axes5[i][j].yaxis.get_major_formatter().set_powerlimits((6, 6)) +# for i in fs_ for j in [0,1]] +# [axes5[i][j].yaxis.offsetText.set_fontsize(58) for i in fs_ for j in [0,1]] +# [axes5[i][1].set_xlabel('$\sigma_{zz}$ (Pa)', fontsize = 72) for i in fs_] +# [axes5[i][1].xaxis.set_label_coords(-0.1, -0.04) for i in fs_] +# [axes5[i][1].set_ylabel('$G^{\prime}$', fontsize = 72) for i in fs_] +# [axes5[i][1].yaxis.set_ticks_position('right') for i in fs_] +# [axes5[i][j].tick_params(axis = 'both', which = 'major', labelsize = 58) +# for i in fs_ for j in [0,1]] +# [figs5[i].subplots_adjust(wspace = 0.3) for i in fs_] +# [figs5[i].savefig('plots/Gpvsstress%s.svg' % i, bbox_inches = 'tight', +# dpi = 1200) for i in fs_] \ No newline at end of file