Example #1
0
vec_space = 5
x = np.arange(0, len(mz[0]), vec_space)
y = x.copy()
mx_vec = mx[::vec_space, ::vec_space].copy()
my_vec = my[::vec_space, ::vec_space].copy()

plt.close('all')

fig1, ax1 = plt.subplots(figsize=(3, 3))
fig1.set_size_inches(4, 4)
im1 = plt.imshow(mz, cmap='jet')
Q = plt.quiver(x, y, mx_vec, my_vec, units='width', scale=20, width=0.005)
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
ax1.xaxis.set_ticklabels([])
ax1.yaxis.set_ticklabels([])
fp.format_plot(plt, 290, 290, 0, 0, no_axes=True)
pylab.savefig('/Users/alec/UCSB/scan_images/mz_recon_' + str(scannum) + '.png',
              format='png')

fig1, ax1 = plt.subplots()
im1 = plt.imshow(mr, cmap='jet')
Q = plt.quiver(x, y, mx_vec, my_vec, units='width')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 500, 500, 0, 320, no_axes=True)

fig1, ax1 = plt.subplots()
im1 = plt.imshow(phi_seed, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 290, 290, 290, 0, no_axes=True)

# fig1, ax1 = plt.subplots()
Example #2
0
slen = len(domains)
res = scansize / slen
res_difference = 2e-9
thickness = 0.911e-9
Ms = 1.044e6

domains = np.add(np.multiply(2 / 255, domains), -1)
domains1 = np.flipud(np.fliplr(domains))
domains2 = np.flipud(domains)
domains3 = np.flipud(np.fliplr(domains))
domains4 = np.fliplr(domains)
domains5 = np.fliplr(domains)
domains6 = np.flipud(np.fliplr(domains))
domains7 = np.flipud(domains)
domains8 = np.flipud(np.fliplr(domains))

domainstop = np.concatenate((domains1, domains2, domains3), axis=1)
domainsmiddle = np.concatenate((domains4, domains, domains5), axis=1)
domainsbottom = np.concatenate((domains6, domains7, domains8), axis=1)

domains_mirror = np.concatenate((domainstop, domainsmiddle, domainsbottom),
                                axis=0)

plt.close('all')

fig1, ax1 = plt.subplots()
im1 = plt.imshow(domains_mirror, cmap='Greys', interpolation='nearest')
fp.format_plot(plt, 800, 800, 50, 50)

plt.show()
print(t2 - t1)

# BLOCH
dw = 30.0e-9
mz = np.tanh(grid_dist / dw)

#---------------- PLOTS ------------------------------------------
#-----------------------------------------------------------------

plt.close('all')

fig2, ax2 = plt.subplots(figsize=(5, 5))
im2 = plt.imshow(mdata, cmap='gray', interpolation='nearest')
plt.colorbar(im2, fraction=0.046, pad=0.04, use_gridspec=True)
ax2.set_axis_off()
fp.format_plot(plt, 350, 350, 450, 50)

fig3, ax3 = plt.subplots()
plt.plot(theta, theta_grad, 'g.')
plt.plot(theta_int_list, theta_grad_int(theta_int_list), 'r-')
fp.format_plot(plt, 350, 350, 50, 50)

fig3, ax3 = plt.subplots()
plt.plot(phis, r0s, 'g.')
plt.plot(phis_int_list, r0s_int(phis_int_list), 'r-')
fp.format_plot(plt, 350, 350, 50, 450)

fig4, ax4 = plt.subplots()
plt.plot(x0, y0, 'g.')
plt.plot(x0_int, y0_int, 'r-')
fp.format_plot(plt, 350, 350, 450, 450)
Example #4
0
mx = np.max(scandata)
scandata = (scandata - mn) / (mx - mn)
scandataint = ndimage.interpolation.zoom(scandata, 2, order=1)

plt.close('all')
my_dpi = 96
size_inches = size / my_dpi
if save:
    fig = plt.figure(frameon=False)
    fig.set_size_inches(size_inches, size_inches)
    ax = plt.Axes(fig, [0., 0., 1., 1.])
    fig.add_axes(ax)
    pcol = ax.pcolormesh(scandataint,
                         cmap='bone',
                         linewidth=0,
                         edgecolor='none')
    pcol.axes.set_xlim(0, len(scandata[0]))
    pcol.axes.set_ylim(0, len(scandata))
    plt.gca().invert_yaxis()
    ax.set_axis_off()
    fig.savefig(savepath, format=filetype, dpi=my_dpi)
else:
    fig, ax = plt.subplots()
    im = plt.imshow(scandataint, cmap='bone', interpolation='nearest')
    cbar = fig.colorbar(im, ax=ax, fraction=0.046, pad=0.04)
    cbar.set_ticks([0, 1])
    cbar.set_ticklabels([0, 1])
    fp.format_plot(plt, size, size, 0, 50)

plt.show()
                               (delta_total_wall_length_norm * thicknessSI) )

print('domain_wall_energy_density = ' + str(domain_wall_energy_density))

As = (domain_wall_energy_density**2)/(16*KeffSI)
DW_width = domain_wall_energy_density/(4*KeffSI)

print('DW_width (no pi) = ' + str(DW_width))
print('As = ' + str(As))

plt.close('all')

fig, ax = plt.subplots()
im = plt.imshow(demagH, cmap='jet', interpolation='nearest')
plt.colorbar(im, fraction=0.046, pad=0.04)
fp.format_plot(plt, 500, 500, 50, 50)

fig, ax = plt.subplots()
im = plt.imshow(domains, cmap='jet', interpolation='nearest')
plt.colorbar(im, fraction=0.046, pad=0.04)
fp.format_plot(plt, 500, 500, 550, 50)
#
# fig1, ax1 = plt.subplots()
# # im1 = plt.imshow(domains[1:slen-1,1:slen-1], cmap='Greys', interpolation='nearest',alpha=0.5)
#
# for n, contour in enumerate(smoothed_contours):
#     ax1.plot(contour[:, 1], contour[:, 0], linewidth=1)
#
# ax1.axis('image')
# ax1.set_xticks([])
# ax1.set_yticks([])
Example #6
0
                                                        color='black',
                                                        linewidth=1.3,
                                                        linestyle='-',
                                                        label='ARG-1200-TR')
        if sig_flag == 'tex':
            ex_run.ex_type._plot_tex_stress_strain_asc(p,
                                                       xscale=1000.,
                                                       color='black',
                                                       linewidth=1.3,
                                                       linestyle='-',
                                                       label='2D-01-08')

    if sig_flag == 'tex':
        format_plot(p,
                    xlabel='Dehnung [1E-3]',
                    ylabel='Textilspannung [MPa]',
                    xlim=14.,
                    ylim=1400.)
    if sig_flag == 'comp':
        format_plot(p,
                    xlabel='Dehnung [1E-3]',
                    ylabel='Kompositspannung [MPa]',
                    xlim=14.,
                    ylim=25.)

    font.set_size('12')
    p.legend(prop=font)

    if save_fig_to_file:
        # create a report-subfolder with the name of the script (without file extension '.py')
        # and save it in the test-type-subfolders with the name and path as
                  'k', 'k', 'k',
                  ]

    fig = p.figure(facecolor='white')
    fig.set_size_inches(8, 6)
    plot_method_str = '_plot_' + sig_flag + '_stress_strain_asc'

    for i, ex_path in enumerate(path_list):
        ex_run = ExRun(ex_path)
        plot_method = getattr(ex_run.ex_type, plot_method_str)
        plot_method(p, k_rho=k_rho, color=color_list[i], linewidth=1.2, linestyle='-', label=label_list[i], xscale=1000., plot_analytical_stiffness=True, interpolated=True)

    # set limits and labels for axis
    #
    if sig_flag == 'tex':
        format_plot(p, xlabel='strain [1E-3]', ylabel='textile stress [MPa]', xlim=8., ylim=1700.)
    if sig_flag == 'comp':
        format_plot(p, xlabel='strain [1E-3]', ylabel='composite stress [MPa]', xlim=8., ylim=25.)

    # plot grid lines
    #
    axes = p.gca()
    axes.xaxis.grid(True, which='major')
    axes.yaxis.grid(True, which='major')

    # plot legend
    #
    p.legend(prop=font, loc=4, frameon=False)  # (4: lower right) (7: center right)

    # --------------------------------
    # save figure
Example #8
0
phi = np.loadtxt(path + 'phi_c_test.txt', delimiter=',')
phi_seed = np.loadtxt(path + 'phi_seed_c_test.txt', delimiter=',')
phi_seed = phi_seed % (2 * pi)
phi = phi % (2 * pi)
mr = np.sqrt(1 - mz**2)
mx_seed = np.multiply(np.cos(phi_seed), mr)
my_seed = np.multiply(np.sin(phi_seed), mr)
mx = np.multiply(np.cos(phi), mr)
my = np.multiply(np.sin(phi), mr)

plt.close('all')

fig1, ax1 = plt.subplots()
im1 = plt.imshow(mz, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 50, 50)

fig1, ax1 = plt.subplots()
im1 = plt.imshow(mr, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 450, 50)

fig1, ax1 = plt.subplots()
im1 = plt.imshow(phi, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 50, 450)

fig1, ax1 = plt.subplots()
im1 = plt.imshow(phi_seed, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 450, 450)
Example #9
0
    hlist[2 * j + 1] = rpopt[0]
    dwlist[2 * j] = popt[2]
    dwlist[2 * j + 1] = rpopt[2]
    # philist[2*j] = popt[2]
    # philist[2*j+1] = rpopt[2]
    # thetalist[2*j] = popt[2]
    # thetalist[2*j+1] = rpopt[2]
    #    bz0list[2*j] = popt[4]
    #    bz0list[2*j+1] = rpopt[4]

    plt.figure(1)
    csubplot = plt.subplot(gs[(j % 5), int(np.floor(j / 5) * 2)])
    plt.plot(xShort, cal_func(xShort, *guess), 'g-')
    plt.errorbar(xShort, yShort, yerr=yeShort, color='#000000', fmt='.')
    plt.plot(xShort, cal_func(xShort, *popt), 'r-')
    csubplot = plt.subplot(gs[(j % 5), int(np.floor(j / 5) * 2 + 1)])
    plt.plot(xShort, cal_func(xShort, *rguess), 'g-')
    plt.errorbar(xShort, ryShort, yerr=ryeShort, color='#000000', fmt='.')
    plt.plot(xShort, cal_func(xShort, *rpopt), 'r-')

fp.format_plot(plt, 1200, 900, 0, 50, tight=False)
plt.show()

print('h mean = ' + str(np.mean(hlist)) + ' +/- ' + str(np.std(hlist)))
# print('theta mean = '+str(np.mean(thetalist))+' +/- '+str(np.std(thetalist)))
# print('phi mean = '+str(np.mean(philist))+' +/- '+str(np.std(philist)))
print('edge width mean = ' + str(np.mean(dwlist)) + ' +/- ' +
      str(np.std(dwlist)))

#print('bz0 mean = '+str(np.mean(bz0list))+' +/- '+str(np.std(bz0list)))
    bpopt, bpcov = curve_fit(fit_tanh, bxf, bzphi[i], p0=bguesses[i])
    bfits[i] = fit_tanh(xf, *bpopt)
    bwidths[i] = np.abs(bpopt[3])

#---------------- PLOTS ------------------------------------------
#-----------------------------------------------------------------

plt.close('all')

fig1, ax1 = plt.subplots()
fig1.set_size_inches(4, 4)
im1 = plt.imshow(datas0, cmap='gray', interpolation='nearest')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
ax1.xaxis.set_ticklabels([])
ax1.yaxis.set_ticklabels([])
fp.format_plot(plt, 250, 250, 50, 50)
pylab.savefig('/Users/alec/UCSB/scan_images/datas_' + str(scannum) + filespec +
              '.png',
              format='png')

fig1, ax1 = plt.subplots()
fig1.set_size_inches(4, 4)
im1 = plt.imshow(bxdata, cmap='gray', interpolation='nearest')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
ax1.xaxis.set_ticklabels([])
ax1.yaxis.set_ticklabels([])
fp.format_plot(plt, 250, 250, 50, 50)
pylab.savefig('/Users/alec/UCSB/scan_images/bx_' + str(scannum) + filespec +
              '.png',
              format='png')
Example #11
0
ffcut = ffxcut

x0, x1, y0, y1 = cutcrop[0], cutcrop[1], yconstant, yconstant

# ---------------------- PLOTS -------------------------------------------------------
# ------------------------------------------------------------------------------------

plt.close('all')

fig1, ax1 = plt.subplots()
im1 = plt.imshow(ffdata[0], cmap='bone', interpolation='nearest')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
plt.plot([x0, x1], [y0, y1], 'r-')
plt.axis('image')
fp.format_plot(plt, 450, 450, 450, 50)

ploth = 1
plotr = 0
fig1, ax1 = plt.subplots()
plt.plot(blochnv[ploth][0],
         blochnv[ploth][1],
         color='#2D7DD2',
         linewidth=2.0,
         label="Bloch")
plt.plot(nleftnv[ploth][0],
         nleftnv[ploth][1],
         color='#F97304',
         linewidth=2.0,
         label=u'left-handed Néel')
plt.plot(nrightnv[ploth][0],
Example #12
0
        plot_method(p,
                    k_rho=k_rho,
                    color=color_list[i],
                    linewidth=1.2,
                    linestyle='-',
                    label=label_list[i],
                    xscale=1000.,
                    plot_analytical_stiffness=True,
                    interpolated=True)

    # set limits and labels for axis
    #
    if sig_flag == 'tex':
        format_plot(p,
                    xlabel='strain [1E-3]',
                    ylabel='textile stress [MPa]',
                    xlim=8.,
                    ylim=1700.)
    if sig_flag == 'comp':
        format_plot(p,
                    xlabel='strain [1E-3]',
                    ylabel='composite stress [MPa]',
                    xlim=8.,
                    ylim=25.)

    # plot grid lines
    #
    axes = p.gca()
    axes.xaxis.grid(True, which='major')
    axes.yaxis.grid(True, which='major')
            # ## for figure compare pretest with barrelshell (TTb_2cm) only:
#            xarr = np.array([0.3 * eps_u_avg, 1.2 * eps_u_avg])
#            sig_tex_avg = 1077
#            yarr = np.array([sig_tex_avg, sig_tex_avg])
#            p.plot(xarr, yarr, linestyle='--', color='k', linewidth=1.)
#            p.text(0.3 * eps_u_avg, sig_tex_avg * 1.03, r'$\sigma_\mathrm{tex,u}\,=\,%0.0f\,\mathrm{MPa}$' % (sig_tex_avg), fontsize=16)  # , bbox={'facecolor':'white', 'edgecolor':'none'})
#            sig_tex_avg = 1483
#            yarr = np.array([sig_tex_avg, sig_tex_avg])
#            p.plot(xarr, yarr, linestyle='--', color='grey', linewidth=1.)
#            p.text(0.3 * eps_u_avg, sig_tex_avg * 1.03, r'$\sigma_\mathrm{tex,u}\,=\,%0.0f\,\mathrm{MPa}$' % (sig_tex_avg), color='grey', fontsize=16)  # , bbox={'facecolor':'white', 'edgecolor':'none'})
#            p.text(0.10 * eps_u_avg, sig_tex_avg * .04, r'$E_\mathrm{tex}$', color='k', fontsize=16)  # , bbox={'facecolor':'white', 'edgecolor':'none'})

    # format plot
    #
    if sig_flag == 'comp':
        format_plot(p, fontsize=15, xlabel='Dehnung $\epsilon$ [1E-3]', ylabel='Kompositspannung $\sigma_\mathrm{c}$ [MPa]', xlim=xlim, ylim=ylim)
    if sig_flag == 'tex':
        format_plot(p, fontsize=15, xlabel='Dehnung $\epsilon$ [1E-3]', ylabel='Textilspannung $\sigma_\mathrm{tex}$ [MPa]', xlim=xlim, ylim=ylim)
    axes = p.gca()
    axes.xaxis.grid(True, which='major')
    axes.yaxis.grid(True, which='major')

    # plot legend
    #
    if legend_flag:
        font = FontProperties()
        font.set_family('serif')
        font.set_style('normal')
        font.set_size(14)
        font.set_variant('normal')
#        font.set_weight('ultralight')
plt.plot(radcutdiff[2],
         color='#E58A25',
         linewidth=2.0,
         label=u'left-handed Néel')
plt.plot(radcutdiff[3],
         color='#000000',
         linewidth=2.0,
         label=r'$\gamma_h$ = 76.8 degrees')
plt.plot(radcutdiff[4],
         color='#97CC04',
         linewidth=2.0,
         label=u'right-handed Néel')
plt.legend(loc=2, borderaxespad=0., prop={'size': 12})
plt.ylabel('residual')
plt.xlabel(r'radial cut angle ($\times\pi/8$)')
fp.format_plot(plt, 600, 600, 0, 50)
pylab.savefig(savepath + 'residuals.png', format='png')

fig1, ax1 = plt.subplots()
fig1.set_size_inches(6, 6)
ax1.set_axis_off()
im1 = plt.imshow(nleftnv, cmap='bone', interpolation='nearest')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
# fp.format_plot(plt, 450, 450, 0, 50)
pylab.savefig(savepath + 'nv_sim_' + str(filenum) + filespec + '.png',
              format='png',
              dpi=my_dpi)

fig1, ax1 = plt.subplots()
fig1.set_size_inches(8, 8)
ax1.set_axis_off()
Example #15
0
        rpcov = np.zeros((4, 4))
        print('fit fail')

    thetalist[2 * j] = popt[2]
    thetalist[2 * j + 1] = rpopt[2]
    # mstlist[2*j] = popt[3]
    # mstlist[2*j+1] = rpopt[3]
    #    bz0list[2*j] = popt[4]
    #    bz0list[2*j+1] = rpopt[4]
    #
    hlist[2 * j] = popt[0]
    hlist[2 * j + 1] = rpopt[0]
    plt.figure(fig1.number)
    csubplot = plt.subplot(gs[(j % 5), int(np.floor(j / 5) * 2)])
    plt.plot(x, cal_func(x, *guess), 'g-')
    plt.errorbar(x, y, yerr=ye, color='#000000', fmt='.')
    plt.plot(x, cal_func(x, *popt), 'r-')
    # plt.plot(yargmax*dres,ymax,'co')
    csubplot = plt.subplot(gs[(j % 5), int(np.floor(j / 5) * 2 + 1)])
    # plt.plot(x,cal_func(x,*rguess),'g-')
    plt.errorbar(x, ry, yerr=rye, color='#000000', fmt='.')
    plt.plot(x, cal_func(x, *rpopt), 'r-')
fp.format_plot(plt, 1400, 850, 50, 50, tight=False)
plt.show()

# print('Ms*t mean = '+str(np.mean(mstlist))+' +/- '+str(np.std(mstlist)))
print('h mean = ' + str(np.mean(hlist)) + ' +/- ' + str(np.std(hlist)))
print('theta mean = ' + str(np.mean(thetalist)) + ' +/- ' +
      str(np.std(thetalist)))
#print('bz0 mean = '+str(np.mean(bz0list))+' +/- '+str(np.std(bz0list)))
Example #16
0
import numpy as np
import matplotlib.pyplot as plt
import format_plot as fp
import stray_field_calc as sfc

pi = np.pi

path = '/Users/alec/UCSB/cofeb_analysis_data/m_reconstruction/'
mx = np.loadtxt(path + "mbx_test.dat")
my = np.loadtxt(path + "mby_test.dat")
mz = np.loadtxt(path + "mbz_test.dat")

sfc_result = sfc.stray_field_calc(mx, my, mz, 1.0e-3, 4000, 80e-9)

hz = sfc_result[4][2]
hzc = np.loadtxt(path + 'stray_field_test_c.txt', delimiter=',')

plt.close('all')

fig1, ax1 = plt.subplots()
im1 = plt.imshow(hz, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 50, 50)

fig1, ax1 = plt.subplots()
im1 = plt.imshow(hzc, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 50, 50)

plt.show()
Example #17
0
#            sig_tex_avg = 1077
#            yarr = np.array([sig_tex_avg, sig_tex_avg])
#            p.plot(xarr, yarr, linestyle='--', color='k', linewidth=1.)
#            p.text(0.3 * eps_u_avg, sig_tex_avg * 1.03, r'$\sigma_\mathrm{tex,u}\,=\,%0.0f\,\mathrm{MPa}$' % (sig_tex_avg), fontsize=16)  # , bbox={'facecolor':'white', 'edgecolor':'none'})
#            sig_tex_avg = 1483
#            yarr = np.array([sig_tex_avg, sig_tex_avg])
#            p.plot(xarr, yarr, linestyle='--', color='grey', linewidth=1.)
#            p.text(0.3 * eps_u_avg, sig_tex_avg * 1.03, r'$\sigma_\mathrm{tex,u}\,=\,%0.0f\,\mathrm{MPa}$' % (sig_tex_avg), color='grey', fontsize=16)  # , bbox={'facecolor':'white', 'edgecolor':'none'})
#            p.text(0.10 * eps_u_avg, sig_tex_avg * .04, r'$E_\mathrm{tex}$', color='k', fontsize=16)  # , bbox={'facecolor':'white', 'edgecolor':'none'})

# format plot
#
    if sig_flag == 'comp':
        format_plot(p,
                    fontsize=15,
                    xlabel='Dehnung $\epsilon$ [1E-3]',
                    ylabel='Kompositspannung $\sigma_\mathrm{c}$ [MPa]',
                    xlim=xlim,
                    ylim=ylim)
    if sig_flag == 'tex':
        format_plot(p,
                    fontsize=15,
                    xlabel='Dehnung $\epsilon$ [1E-3]',
                    ylabel='Textilspannung $\sigma_\mathrm{tex}$ [MPa]',
                    xlim=xlim,
                    ylim=ylim)
    axes = p.gca()
    axes.xaxis.grid(True, which='major')
    axes.yaxis.grid(True, which='major')

    # plot legend
    #
Example #18
0
    "/Users/alec/UCSB/mathematica/CoFeB-MgO/linecut_simulations/linecut_30_h/neelright_y_"
    + str(heightnm) + "_30._400_10..dat")
hintz = np.loadtxt(
    "/Users/alec/UCSB/mathematica/CoFeB-MgO/linecut_simulations/linecut_30_h/neelright_z_"
    + str(heightnm) + "_30._400_10..dat")
hintx = np.multiply(hintx, (1e-3) * MstSInm)
hinty = np.multiply(hinty, (1e-3) * MstSInm)
hintz = np.multiply(hintz, (1e-3) * MstSInm)

flen = len(hr[0])
ilen = len(hintx)

ires = 10.0
fres = 2500 / flen

ix = np.arange(-ilen * ires / 2, ilen * ires / 2, ires)
fx = np.arange(-flen * fres / 2, flen * fres / 2, fres)

plt.close('all')

fig1, ax1 = plt.subplots()
plt.plot(ix, hintx, 'r-')
plt.plot(fx, hr[0][int(flen / 2), :], 'b-')

fig1, ax1 = plt.subplots()
plt.plot(ix, hintz, 'r-')
plt.plot(fx, hr[2][int(flen / 2), :], 'b-')
fp.format_plot(plt, 650, 400, 0, 450)

plt.show()
Example #19
0
path = '/Users/alec/UCSB/cofeb_analysis_data/m_reconstruction/'
mz = np.loadtxt(path + 'mzdata_test.txt')
phi_seed = np.loadtxt(path + 'phi_seed_test.txt', delimiter=',')
phi = np.loadtxt(path + 'phi_test.txt', delimiter=',')
mr = np.sqrt(1 - mz**2)
mx_seed = np.multiply(np.cos(phi_seed), mr)
my_seed = np.multiply(np.sin(phi_seed), mr)
mx = np.multiply(np.cos(phi), mr)
my = np.multiply(np.sin(phi), mr)

plt.close('all')

fig1, ax1 = plt.subplots()
im1 = plt.imshow(mz, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 50, 50)

fig1, ax1 = plt.subplots()
im1 = plt.imshow(mr, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 450, 50)

fig1, ax1 = plt.subplots()
im1 = plt.imshow(phi, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 50, 450)

fig1, ax1 = plt.subplots()
im1 = plt.imshow(phi_seed, cmap='jet')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 450, 450)
r0s = np.append(r0s, r0s[0])

np.savetxt(path + 'stray_field_sim/' + 'radiusphi_' + filespec + '.txt',
           (angles, r0s),
           delimiter=',')

#---------------- PLOTS ------------------------------------------
#-----------------------------------------------------------------

plt.close('all')

fig1, ax1 = plt.subplots()
im1 = ax1.imshow(wimdatafilter, cmap='gray', interpolation='nearest')
fig1.colorbar(im1, ax=ax1, fraction=0.046, pad=0.04)
fp.format_plot(plt, 400, 400, 50, 50)

fig2, ax2 = plt.subplots(figsize=(5, 5))
im2 = plt.imshow(mdata, cmap='jet', interpolation='nearest')
plt.colorbar(im2, fraction=0.046, pad=0.04, use_gridspec=True)
ax2.set_axis_off()
# for i in range(0,phinum):
#     phi = i*2*pi/phinum
#     x1, y1 = x0+lclen*np.cos(phi), y0+lclen*np.sin(phi)
#     plt.plot([x0, x1], [y0, y1], 'k-')
# plt.axis('image')
fp.format_plot(plt, 350, 350, 450, 50)
pylab.savefig('/Users/alec/UCSB/scan_images/mdata_' + str(scannum) + filespec +
              '.png',
              format='png')
    path = join(simdb.exdata_dir, 'tensile_tests',
                'dog_bone', '2010-03-17_TT-8g-3cm-0-TR')
    # , 'TT-8g-3cm-0-TR-V2.DAT', 'TT-8g-3cm-0-TR-V3.DAT']
    tests = ['TT-8g-3cm-0-TR-V2.DAT']
    for t in tests:
        ex_path = join(path, t)
        ex_run = ExRun(ex_path)
        if sig_flag == 'comp':
            ex_run.ex_type._plot_comp_stress_strain_asc(
                p, xscale=1000., color='black', linewidth=1.3, linestyle='-', label='ARG-1200-TR')
        if sig_flag == 'tex':
            ex_run.ex_type._plot_tex_stress_strain_asc(
                p, xscale=1000., color='black', linewidth=1.3, linestyle='-', label='2D-01-08')

    if sig_flag == 'tex':
        format_plot(
            p, xlabel='Dehnung [1E-3]', ylabel='Textilspannung [MPa]', xlim=14., ylim=1400.)
    if sig_flag == 'comp':
        format_plot(
            p, xlabel='Dehnung [1E-3]', ylabel='Kompositspannung [MPa]', xlim=14., ylim=25.)

    font.set_size('12')
    p.legend(prop=font)

    if save_fig_to_file:
        # create a report-subfolder with the name of the script (without file extension '.py')
        # and save it in the test-type-subfolders with the name and path as
        # ex_type
        test_series_name = os.path.basename(__file__)[:-3]
        subfolder_list = __file__.split(os.path.sep)
        devproc_idx = np.where(np.array(subfolder_list) == 'devproc')[0]
        subfolder_path = subfolder_list[