Hyperfine orientations

[1]:
import nexus as nx
import numpy as np
import matplotlib.pyplot as plt
[2]:
r2d = 180.0 / np.pi

d2r = np.pi / 180.0

Moessbauer soure

[3]:
iron = nx.Material.Template(nx.lib.material.Fe)

layer_Fe = nx.Layer(id = "Fe layer",
                    material = iron,
                    thickness = 3000)

site = nx.Hyperfine(magnetic_field = 33,
                    magnetic_theta = 0,
                    magnetic_phi = 0,
                    isotropic = False)

iron.hyperfine_sites = [site]

sample = nx.Sample(layers = [layer_Fe])

beam = nx.Beam()
beam.Unpolarized()

exp = nx.Experiment(beam = beam,
                    objects = [sample],
                    isotope = nx.lib.moessbauer.Fe57)

velocities = np.linspace(-10, 10, 512)

moessbauer_spectrum = nx.MoessbauerSpectrum(experiment = exp,
                                            velocity = velocities)

magnetic

[4]:
# Moessbauer spectra magnetic (unpolarized gamma ray)

fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, sharex=True, sharey=True, figsize=(12, 12))

ratio = 2/3

ax1.set_box_aspect(ratio)
ax2.set_box_aspect(ratio)
ax3.set_box_aspect(ratio)
ax4.set_box_aspect(ratio)

plt.subplots_adjust(wspace=0, hspace=0)

props = dict(boxstyle="round", facecolor="wheat", alpha = 0.1)
fontsize = 10


# mag isotropic
site.isotropic = True

ax1.text(0.05, 0.05, "isotropic", fontsize = fontsize, transform=ax1.transAxes, ha="left", va="bottom", bbox=props)
ax1.plot(velocities, moessbauer_spectrum())


# mag along k direction
site.isotropic = False
site.magnetic_theta = 0
site.magnetic_phi = 0

ax2.text(0.05, 0.05, r"$\theta=0$"+"\n"+r"$\phi=0$", fontsize = fontsize, transform=ax2.transAxes, ha="left", va="bottom", bbox=props)
ax2.plot(velocities, moessbauer_spectrum())


# mag along sigma direction
site.magnetic_theta = 90
site.magnetic_phi = 0

ax3.text(0.05, 0.05, r"$\theta=90$"+"\n"+r"$\phi=0$", fontsize = fontsize, transform=ax3.transAxes, ha="left", va="bottom", bbox=props)
ax3.plot(velocities, moessbauer_spectrum())


# mag along pi direction
site.magnetic_theta = 90
site.magnetic_phi = 90

ax4.text(0.05, 0.05, r"$\theta=90$"+"\n"+r"$\phi=90$", fontsize = fontsize, transform=ax4.transAxes, ha="left", va="bottom", bbox=props)
ax4.plot(velocities, moessbauer_spectrum())

ax4.set_xlabel('velocity (mm/s)')

plt.savefig("Moessbauer_magnetic.png")

plt.show()
_images/nb_hyperfine_orientations_6_0.png

quadrupole

[5]:
# Moessbauer spectra efg (unpolarized gamma ray)

site.magnetic_field = 0
site.quadrupole = 4

fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, sharex=True, sharey=True, figsize=(12, 12))

ratio = 2/3

ax1.set_box_aspect(ratio)
ax2.set_box_aspect(ratio)
ax3.set_box_aspect(ratio)
ax4.set_box_aspect(ratio)

plt.subplots_adjust(wspace=0, hspace=0)

props = dict(boxstyle="round", facecolor="wheat", alpha = 0.1)
fontsize = 10


# efg isotropic
site.isotropic = True

ax1.text(0.05, 0.05, "isotropic",
         fontsize = fontsize, transform=ax1.transAxes, ha="left", va="bottom", bbox=props)
ax1.plot(velocities, moessbauer_spectrum())

site.isotropic = False

# efg along k direction
site.quadrupole_alpha = 0
site.quadrupole_beta = 0
site.quadrupole_gamma = 0

ax2.text(0.05, 0.05, r"$\alpha=0$"+"\n"+r"$\beta=0$"+"\n"+r"$\gamma=0$",
         fontsize = fontsize, transform=ax2.transAxes, ha="left", va="bottom", bbox=props)
ax2.plot(velocities, moessbauer_spectrum())


# efg along sigma direction
site.quadrupole_alpha = 0
site.quadrupole_beta = -90
site.quadrupole_gamma = 0

ax3.text(0.05, 0.05, r"$\alpha=0$"+"\n"+r"$\beta=-90$"+"\n"+r"$\gamma=0$",
         fontsize = fontsize, transform=ax3.transAxes, ha="left", va="bottom", bbox=props)
ax3.plot(velocities, moessbauer_spectrum())


# efg along pi direction
site.quadrupole_alpha = 0
site.quadrupole_beta = 90
site.quadrupole_gamma = 90

ax4.text(0.05, 0.05, r"$\alpha=0$"+"\n"+r"$\beta=90$"+"\n"+r"$\gamma=90$",
         fontsize = fontsize, transform=ax4.transAxes, ha="left", va="bottom", bbox=props)
ax4.plot(velocities, moessbauer_spectrum())


ax4.set_xlabel('velocity (mm/s)')

plt.savefig("Moessbauer_quadrupole.png")

plt.show()
_images/nb_hyperfine_orientations_8_0.png

Synchrotron

[6]:
beam.LinearSigma()

time_spectrum = nx.TimeSpectrum(exp,
                                time_length = 200,
                                time_step = 0.2)

magnetic

[7]:
site.isotropic = True
site.quadrupole = 0
site.magnetic_field = 33
[8]:
fig, ((ax11, ax12), (ax21, ax22), (ax31, ax32), (ax41, ax42)) = plt.subplots(4, 2, figsize=(12, 12), sharey='col', sharex='col')

ratio = 2/3

ax11.set_box_aspect(ratio)
ax12.set_box_aspect(ratio)
ax21.set_box_aspect(ratio)
ax22.set_box_aspect(ratio)
ax31.set_box_aspect(ratio)
ax32.set_box_aspect(ratio)
ax41.set_box_aspect(ratio)
ax42.set_box_aspect(ratio)

plt.subplots_adjust(wspace=0, hspace=0)

props = dict(boxstyle="round", facecolor="wheat", alpha = 0.1)
fontsize = 10

# 3D isotropic
ax11.text(0.05, 0.05, "isotropic", fontsize = fontsize, transform=ax11.transAxes, ha="left", va="bottom", bbox=props)
ax11.plot(velocities, moessbauer_spectrum())
ax12.semilogy(*time_spectrum())

site.isotropic = False

# mag along k direction
site.magnetic_theta = 0
site.magnetic_phi = 0

ax21.text(0.05, 0.05, r"$\theta=0$"+"\n"+r"$\phi=0$", fontsize = fontsize, transform=ax21.transAxes, ha="left", va="bottom", bbox=props)
ax21.plot(velocities, moessbauer_spectrum())
ax22.semilogy(*time_spectrum())

# mag along sigma direction
site.magnetic_theta = 90
site.magnetic_phi = 0

ax31.text(0.05, 0.05, r"$\theta=90$"+"\n"+r"$\phi=0$", fontsize = fontsize, transform=ax31.transAxes, ha="left", va="bottom", bbox=props)
ax31.plot(velocities, moessbauer_spectrum())
ax32.semilogy(*time_spectrum())

# mag along pi direction
site.magnetic_theta = 90
site.magnetic_phi = 90

ax41.text(0.05, 0.05, r"$\theta=90$"+"\n"+r"$\phi=90$", fontsize = fontsize, transform=ax41.transAxes, ha="left", va="bottom", bbox=props)
ax41.plot(velocities, moessbauer_spectrum())
ax42.semilogy(*time_spectrum())

ax41.set_xlabel('velocity (mm/s)')
ax42.set_xlabel('time (ns)')

plt.savefig("NRS_magnetic.png")

plt.show()
_images/nb_hyperfine_orientations_13_0.png

quadrupole

[9]:
site.quadrupole = 4
site.magnetic_field = 0
[10]:
fig, ((ax11, ax12), (ax21, ax22), (ax31, ax32), (ax41, ax42), (ax51, ax52)) = plt.subplots(5, 2, figsize=(12, 12), sharey='col', sharex='col')

ratio = 2/3

ax11.set_box_aspect(ratio)
ax12.set_box_aspect(ratio)
ax21.set_box_aspect(ratio)
ax22.set_box_aspect(ratio)
ax31.set_box_aspect(ratio)
ax32.set_box_aspect(ratio)
ax41.set_box_aspect(ratio)
ax42.set_box_aspect(ratio)
ax51.set_box_aspect(ratio)
ax52.set_box_aspect(ratio)

plt.subplots_adjust(wspace=0, hspace=0)

props = dict(boxstyle="round", facecolor="wheat", alpha = 0.1)
fontsize = 10

# efg isotropic
site.isotropic = True

ax11.text(0.05, 0.05, "isotropic", fontsize = fontsize, transform=ax11.transAxes, ha="left", va="bottom", bbox=props)
ax11.plot(velocities, moessbauer_spectrum())
ax12.semilogy(*time_spectrum())

site.isotropic = False

# efg along k direction
site.quadrupole_alpha = 0
site.quadrupole_beta = 0
site.quadrupole_gamma = 0
#print(nx.euler.AnglesToVectors(site.quadrupole_alpha.value,site.quadrupole_beta.value,site.quadrupole_gamma.value))

ax21.text(0.05, 0.05, r"$\alpha=0$"+"\n"+r"$\beta=0$"+"\n"+r"$\gamma=0$", fontsize = fontsize, transform=ax21.transAxes, ha="left", va="bottom", bbox=props)
ax21.plot(velocities, moessbauer_spectrum())
ax22.semilogy(*time_spectrum())


# efg along sigma direction
a, b, g = nx.euler.VectorsToAngles([1,0,0])
print(a,b,g)
print(nx.euler.AnglesToVectors(a, b, g))
site.quadrupole_alpha = a * r2d
site.quadrupole_beta = b * r2d
site.quadrupole_gamma = g * r2d


ax31.text(0.05, 0.05, r"$\alpha=0$"+"\n"+r"$\beta=-90$"+"\n"+r"$\gamma=0$", fontsize = fontsize, transform=ax31.transAxes, ha="left", va="bottom", bbox=props)
ax31.plot(velocities, moessbauer_spectrum())
ax32.semilogy(*time_spectrum())


# efg along pi direction
a, b, g = nx.euler.VectorsToAngles([0,1,0])
print(a,b,g)
print(nx.euler.AnglesToVectors(a, b, g))
site.quadrupole_alpha = a * r2d
site.quadrupole_beta = b * r2d
site.quadrupole_gamma = g * r2d

ax41.text(0.05, 0.05, r"$\alpha=0$"+"\n"+r"$\beta=90$"+"\n"+r"$\gamma=90$", fontsize = fontsize, transform=ax41.transAxes, ha="left", va="bottom", bbox=props)
ax41.plot(velocities, moessbauer_spectrum())
ax42.semilogy(*time_spectrum())


# efg along sigma-pi 45
a, b, g = nx.euler.VectorsToAngles([1,1,0])
print(a,b,g)
print(nx.euler.AnglesToVectors(a, b, g))
site.quadrupole_alpha = a * r2d
site.quadrupole_beta = b * r2d
site.quadrupole_gamma = g * r2d

ax51.text(0.05, 0.05, r"$\alpha=0$"+"\n"+r"$\beta=90$"+"\n"+r"$\gamma=135$", fontsize = fontsize, transform=ax51.transAxes, ha="left", va="bottom", bbox=props)
ax51.plot(velocities, moessbauer_spectrum())
ax52.semilogy(*time_spectrum())


ax51.set_xlabel('velocity (mm/s)')
ax52.set_xlabel('time (ns)')

plt.savefig("NRS_quadrupole.png")

plt.show()
0.0 -1.5707963267948966 0.0
(array([ 6.123234e-17, -0.000000e+00, -1.000000e+00]), array([ 0.,  1., -0.]), array([ 1.000000e+00, -0.000000e+00,  6.123234e-17]))
0.0 1.5707963267948966 1.5707963267948966
(array([ 3.74939946e-33, -6.12323400e-17,  1.00000000e+00]), array([1.000000e+00, 6.123234e-17, 0.000000e+00]), array([-6.123234e-17,  1.000000e+00,  6.123234e-17]))
0.0 1.5707963267948966 2.356194490192345
(array([-4.32978028e-17, -4.32978028e-17,  1.00000000e+00]), array([ 0.70710678, -0.70710678,  0.        ]), array([7.07106781e-01, 7.07106781e-01, 6.12323400e-17]))
_images/nb_hyperfine_orientations_16_1.png
[ ]: