Ejemplo n.º 1
0
    denom = sys.argv[5]


scan = {}
scan['\\gamma_s'] = gamma
scan['k_{24}'] = k24
scan['\\Lambda'] = Lambda
scan['\\omega'] = omega


loadsuf=["K_{33}","k_{24}","\\Lambda","\\omega","\\gamma_s"]


psistuff = PsiData(scan=scan,loadsuf=loadsuf,savesuf=loadsuf)

rs = psistuff.r()/8.0*1000
psis = psistuff.psi()

observablestuff = ObservableData(scan=scan,loadsuf=loadsuf,savesuf=loadsuf)

print(observablestuff.surfacetwist())

R = observablestuff.R()/8.0*1000


fig = plt.figure()
width  = 3.487
height = width
fig.set_size_inches(2*width,height)

ax1 = fig.add_subplot(1,2,1)
                            ysfwd[i][i_Lambda],
                            color=colors[js],
                            marker=mtypes[0],
                            markeredgewidth=0.5,
                            markeredgecolor="w")

    ax[observable].set_xlabel(r"$\Lambda$", fontsize=10)

    for ms, Lambda in enumerate(Lambdalist):

        scan['\\Lambda'] = Lambda
        psistuff = PsiData(scan=scan,
                           loadsuf=psi_loadsuf,
                           savesuf=psi_loadsuf,
                           name=f"psivsr")
        ax["psi(r)"].plot(psistuff.r() / psistuff.r()[-1],
                          psistuff.psi(),
                          linestyle=ltypes[0],
                          label=rf"$\Lambda={Lambda}$",
                          color=colors[js],
                          lw=3)

        ax["psi(r)"].plot(1.0,
                          psistuff.psi()[-1],
                          marker=mtypes[ms],
                          color=colors[js],
                          markeredgewidth=0.5,
                          markeredgecolor="w")

        if Lambda == '27':
Ejemplo n.º 3
0
for i,gamma in enumerate(gammas):

    scan = {}
    scan['\\gamma_s'] = gamma
    scan['k_{24}'] = k24
    scan['\\Lambda'] = Lambda
    scan['\\omega'] = omega





    psistuff = PsiData(scan=scan,loadsuf=loadsuf,savesuf=savesuf,name=f"psivsr",
                       sfile_format="pdf")

    rs = psistuff.r()
    psis = psistuff.psi()

    ax1.plot(rs/rs[-1],psis,markertypes[i],label=rf'$\gamma={gamma}$',lw=2)

ax1.set_xlabel(r'$r/R$',fontsize=10)
ax1.set_ylabel(r'$\psi(r)$',fontsize=10)
ax1.set_xlim(left=0)
ax1.set_ylim(bottom=0)
ax1.legend(frameon=False,fontsize=10)


fig.subplots_adjust(left=0.2,bottom=0.2)

fig.savefig(psistuff.psivsr_sname())
    hermitedata = PsiData(scan=scan,
                          loadsuf=loadsuf,
                          savesuf=loadsuf,
                          name="hermite-psivsr")

    fig = plt.figure()
    fig.set_size_inches(width, 3 * height)

    ax1 = fig.add_subplot(3, 1, 1)

    ax2 = fig.add_subplot(3, 1, 2)

    ax3 = fig.add_subplot(3, 1, 3)

    ax1.plot(psidata.r(), psidata.psi(), '.', label='actual')
    ax1.plot(hermitedata.r(), hermitedata.psi(), '-', label='fit')
    ax1.set_ylabel(r'$\psi(r)$')

    ax2.plot(psidata.r(), psidata.psiprime(), '.', label='actual')
    ax2.plot(hermitedata.r(), hermitedata.psiprime(), '-', label='fit')
    ax2.set_ylabel(r'$\frac{d\psi}{dr}$')

    ax3.plot(psidata.r(), psidata.rf_fibril(), '.', label='actual')
    ax3.plot(hermitedata.r(), hermitedata.rf_fibril(), '-', label='fit')
    ax3.legend(frameon=False)
    ax3.set_ylabel(r'$r\times f_{\mathrm{fibril}}(r)$')
    ax3.set_xlabel(r'$r$')

    fig.subplots_adjust(left=0.2)
Ejemplo n.º 5
0
scan = {}
scan['\\gamma_s'] = gamma
scan['k_{24}'] = k24
scan['\\Lambda'] = Lambda
scan['\\omega'] = omega


R_units = 1000.0/10.0  # units of nano meters, with q = 10 (um)^{-1}

loadsuf=["K_{33}","k_{24}","\\Lambda","\\omega","\\gamma_s"]


psistuff = PsiData(scan=scan,loadsuf=loadsuf,savesuf=loadsuf,
                   name=f"psivsr{type}")

rs = psistuff.r()*R_units
psis = psistuff.psi()*180/np.pi

observablestuff = ObservableData(scan=scan,loadsuf=loadsuf,savesuf=loadsuf,
                                 name=f"observables{type}")

print(observablestuff.surfacetwist())

R = observablestuff.R()*R_units


fig = plt.figure()
width  = 4
height = width
fig.set_size_inches(2*width,height)
        print("bad calculation at Lambda = ", Lambda)

    for i, u in enumerate(strains):

        if i == 0:

            strain = None

        else:

            strain = str(u)

        psi = PsiData(scan=scan,
                      loadsuf=loadsuf,
                      savesuf=savesuf,
                      strain=strain)

        ax.plot(psi.r(),
                psi.psi(),
                '-',
                color=colors[i],
                label=rf"$\epsilon={u:.3}$")

    ax.set_xlabel(r"$r$")
    ax.set_ylabel(r"$\psi(r)$")
    ax.legend(frameon=False)
    fig.subplots_adjust(left=0.2, right=0.8, bottom=0.1, top=0.95, hspace=0.05)
    fig.savefig(obsfwd.observable_sname("psivsr-vsstrain", plot_format="pdf"))

    plt.show()
Ejemplo n.º 7
0
            if j == 0:

                strain = None

            else:

                strain = str(u)

            psi = PsiData(scan=scan,
                          loadsuf=loadsuf,
                          savesuf=savesuf,
                          strain=strain,
                          name=names_for[type])

            ax[j].plot(psi.r() / q * 1000,
                       psi.psi(),
                       '-',
                       color=colors[i],
                       label=rf"$\tilde{{\sigma}}=\num{{{stresses[j]:.2e}}}$")

    for i, stress in enumerate(stresses):

        ax[i].legend(frameon=False)
        ax[i].set_ylabel(r'$\psi(\tilde{r})$' + ' (' + r'$\si{\radian}$' + ')')
        if (i == 3):
            ax[i].set_xlabel(r'$\tilde{r}$' + ' (' + r'$\si{\nano\meter}$' +
                             ')')
        else:
            plt.setp(ax[i].get_xticklabels(), visible=False)
Ejemplo n.º 8
0
class FibrilStrain(ReadParams):

    def __init__(self,scan_dir="",scan={},
                 loadsuf=["K_{33}","k_{24}","\\Lambda",
                          "\\omega","\\gamma_s"],
                 savesuf=["K_{33}","k_{24}","\\Lambda",
                          "\\omega","\\gamma_s"],
                 sfile_format="pdf",obsname = "observables",
                 datfile="data/input.dat",psiname = "psivsr",
                 psiloadfilepath="data",obsloadfilepath="data",
                 psisavefilepath="results",obssavefilepath="results"):
        
        ReadParams.__init__(self,datfile=datfile,
                            scan=scan,loadsuf=loadsuf,savesuf=savesuf)

        self.obsdata = ObservableData(scan=scan,loadsuf=loadsuf,savesuf=savesuf,
                                      datfile=datfile,loadfilepath=obsloadfilepath,
                                      savefilepath=obssavefilepath,
                                      scan_dir=scan_dir,name=obsname)

        self.psidata = PsiData(scan=scan,loadsuf=loadsuf,savesuf=savesuf,
                                datfile=datfile,loadfilepath=psiloadfilepath,
                                savefilepath=obssavefilepath,
                                scan_dir = scan_dir,name=psiname)

        self.scan_dir=scan_dir
        self.sfile_format=sfile_format
        self.i_R_c = self.find_R_c_index()
        return

    def find_R_c_index(self):

        i = np.argmin(np.abs(self.psidata.r()-self.obsdata.R_c()))


        return i

    def mesh_polar(self,num_azm=50,grid_skip=1):

        azm = np.linspace(0,2*np.pi,num=num_azm)

        rs,thetas = np.meshgrid(self.psidata.r()[::grid_skip],
                                azm)

        return rs,thetas

    def strain_1d(self,denom='d(r)'):

        preferred_dband = np.cos(self.psidata.psi()[self.i_R_c:])

        true_dband = 2*np.pi/self.obsdata.eta()


        if denom=='d(r)':
            dn = preferred_dband
        elif denom=='d':
            dn = true_dband
        else:
            raise ValueError(f'setting denominator of the strain equation to '
                             '"{denom}" is not valid, it must either be "d(r)" '
                             '(the default value) or "d".')

        dums = np.full(self.i_R_c,np.nan)

        s0s = (true_dband-preferred_dband)/dn

        return np.concatenate((dums,s0s)) 

    def strain_polar(self,r_mesh,denom='d(r)',grid_skip=1):

        return np.tile(self.strain_1d(denom=denom)[::grid_skip],
                       (r_mesh.shape[0],1))


    def strain_sname(self,descriptor="polar"):

        suffix = self.write_suffix(suffix_type="save")

        if self.scan_dir != "":
            sname = f"results/_{descriptor}_strain_{self.scan_dir}_{suffix}.{self.sfile_format}"
        else:
            sname = f"results/_{descriptor}_strain_{suffix}.{self.sfile_format}"

        return sname