Ejemplo n.º 1
0
def relaxation_plot():
    file = FileOperations('Time_5000_117_from0,04to1,2.txt')
    _, x, y = file.reading()
    x1, x2, y1, y2 = [], [], [], []

    for i in range(len(x)):
        if x[i] < 1:
            x1.append(x[i])
            y1.append(y[i])
        if x[i] > 1:
            x2.append(x[i])
            y2.append(y[i])

    plt.plot(x1, y1, 'r', linewidth=2)
    plt.plot(x2, y2, 'r', linewidth=2)
    plt.plot(x, y, 'ro', markersize=8)
    plt.xlim(0, 1.23)
    plt.ylim(0, 42)

    plt.title('Spin relaxation time dependence on the external magnetic field',
              fontsize=26)
    plt.xlabel('Time between collisions ( 1/Ω )', fontsize=20)
    plt.ylabel('Spin relaxation time ( 1/Ω )', fontsize=20)

    plt.tick_params(axis='both', which='major', labelsize=18)

    plt.savefig(r'image_files\relaxation_plot.png')
    plt.show()
Ejemplo n.º 2
0
def relaxation_log_log_plot():
    file = FileOperations('Time_5000_117_from0,04to1,2.txt')
    _, x, y = file.reading()
    x = [np.log(i) for i in x]
    y = [np.log(i) for i in y]
    for i in range(len(x)):
        print(x[i], y[i])

    x1, x2, y1, y2 = [], [], [], []

    for i in range(len(x)):
        if x[i] < 0:
            x1.append(x[i])
            y1.append(y[i])
        if x[i] > 0:
            x2.append(x[i])
            y2.append(y[i])

    plt.plot(x1, y1, 'r', linewidth=2)
    plt.plot(x2, y2, 'r', linewidth=2)
    plt.plot(x, y, 'ro', markersize=8)
    plt.xlim(-3.3, 0.3)
    plt.ylim(0, 4)

    plt.title('Spin relaxation time dependence on the external magnetic field',
              fontsize=26)
    plt.xlabel('Logarithm of time between collisions', fontsize=20)
    plt.ylabel('Logarithm of spin relaxation time', fontsize=20)

    plt.tick_params(axis='both', which='major', labelsize=18)

    plt.savefig(r'image_files\relaxation_log_log_plot.png')
    plt.show()
Ejemplo n.º 3
0
def external_field_plot():
    file2 = FileOperations('Time_5000_117_from0,04to1,2.txt')

    file = FileOperations('Field_0,1_2000_16_from1,0to16,0.txt')
    _, x1, y1 = file.reading()
    plt.plot(x1, y1, 'y')

    file = FileOperations('Field_0,2_2000_16_from1,0to16,0.txt')
    _, x2, y2 = file.reading()
    plt.plot(x2, y2, 'r')

    file = FileOperations('Field_0,3_2000_16_from1,0to16,0.txt')
    _, x3, y3 = file.reading()
    plt.plot(x3, y3, 'b')

    file = FileOperations('Field_0,4_2000_16_from1,0to16,0.txt')
    _, x4, y4 = file.reading()
    plt.plot(x4, y4, 'g')

    plt.xlim(0, 17)
    plt.ylim(0, 80)

    plt.title('Spin relaxation time dependence on the external magnetic field',
              fontsize=26)
    plt.xlabel('Time between collisions ( 1/ω )', fontsize=20)
    plt.ylabel('Spin relaxation time ( 1/ω )', fontsize=20)

    plt.legend(['0.1', '0.2', '0.3', '0.4'],
               title='ωτ =',
               fontsize=20,
               title_fontsize=20,
               loc='upper left')

    plt.tick_params(axis='both', which='major', labelsize=18)

    plt.plot(x1, y1, 'yo')
    plt.plot(x2, y2, 'ro')
    plt.plot(x3, y3, 'bo')
    plt.plot(x4, y4, 'go')

    plt.savefig(r'image_files\external_fields_plot.png')
    plt.show()
Ejemplo n.º 4
0
def external_field_log_plot():
    file2 = FileOperations('Time_5000_117_from0,04to1,2.txt')

    file = FileOperations('Field_0,1_2000_16_from1,0to16,0.txt')
    _, x1, y1 = file.reading()
    y_0 = file2.searching(0.1)
    x1 = [i**2 for i in x1]
    y1 = [np.log(i / y_0) for i in y1]
    plt.plot(x1, y1, 'y')

    file = FileOperations('Field_0,2_2000_16_from1,0to16,0.txt')
    _, x2, y2 = file.reading()
    y_0 = file2.searching(0.2)
    x2 = [i**2 for i in x2]
    y2 = [np.log(i / y_0) for i in y2]
    plt.plot(x2, y2, 'r')

    file = FileOperations('Field_0,3_2000_16_from1,0to16,0.txt')
    _, x3, y3 = file.reading()
    y_0 = file2.searching(0.3)
    x3 = [i**2 for i in x3]
    y3 = [np.log(i / y_0) for i in y3]
    plt.plot(x3, y3, 'b')

    file = FileOperations('Field_0,4_2000_16_from1,0to16,0.txt')
    _, x4, y4 = file.reading()
    y_0 = file2.searching(0.4)
    x4 = [i**2 for i in x4]
    y4 = [np.log(i / y_0) for i in y4]
    plt.plot(x4, y4, 'g')

    plt.xlim(0, 260)
    plt.ylim(0, 7)

    plt.title('Spin relaxation time dependence on the external magnetic field',
              fontsize=26)
    plt.xlabel('(Ωτ)^2', fontsize=20)
    plt.ylabel('Logarithm of ratio of relaxation times', fontsize=20)

    plt.legend(['0.1', '0.2', '0.3', '0.4'],
               title='ωτ =',
               fontsize=20,
               title_fontsize=20,
               loc='upper left')

    plt.tick_params(axis='both', which='major', labelsize=18)

    plt.plot(x1, y1, 'yo')
    plt.plot(x2, y2, 'ro')
    plt.plot(x3, y3, 'bo')
    plt.plot(x4, y4, 'go')

    plt.savefig(r'image_files\external_field_log_plot.png')
    plt.show()
Ejemplo n.º 5
0
'''
'''
file = FileOperations('Field_0,3_2000_16_from1,0to16,0.txt')
_, x1, y1 = file.reading()
file = FileOperations('Field_spec200_0,3_2000_16_from1,0to16,0.txt')
_, x2, y2 = file.reading()
file = FileOperations('Field_spec50_0,3_2000_16_from1,0to16,0.txt')
_, x3, y3 = file.reading()
x = [np.log(i) for i in x1]
y1 = [np.log(i) for i in y1]
y2 = [np.log(i) for i in y2]
y3 = [np.log(i) for i in y3]

plt.plot(x1, y1, 'ro')
plt.plot(x2, y2, 'bo')
plt.plot(x3, y3, 'go')


plt.show()
'''

file = FileOperations('Field_0,3_2000_16_from1,0to16,0.txt')
_, x1, y1 = file.reading()
file = FileOperations('2_Field_0,3_2000_17_from0,0to16,0.txt')
_, x2, y2 = file.reading()

plt.plot(x1, y1, 'ro')
plt.plot(x2, y2, 'bo')

plt.show()
Ejemplo n.º 6
0
elif input_type == '1':
    print("Print file name:", end=' ')
    file_name = input()

else:
    # most useful file for few next plots; write anything instead 0 and 1 to call it
    file_name = 'Field_0,2_2000_16_from1,0to16,0.txt'

print("Print 1 for theoretical plot:", end=' ')
theor_existence = input()
if theor_existence == '1':
    theor_existence = '_theor_'
else:
    theor_existence = '_'

file = FileOperations(file_name)
inf, x, y = file.reading()

# creating plot
plt.figure(figsize=(19, 9.5))
default_label_size = 20
default_title_size = 26

y_0 = 0
y_theor = []

if plot_type == 'T':
    y_theor = time_theor()
    plt.title('Spin relaxation time dependence on time between collisions',
              fontsize=default_title_size)
    plt.xlabel('Time between collisions ( 1/Ω )', fontsize=default_label_size)
Ejemplo n.º 7
0
x_data, y_data, z_data = [], [], []

omega_tau = 0.4
outside_omega_value = 20

outside_omega = [0, -outside_omega_value,
                 0]  # spin_position_initial = [0, spin_length, 0]
spin_position_list = spin_precession_modulation(omega_tau,
                                                outside_omega,
                                                frames_number=10000)

inf = str(omega_tau) + ' ' + ' '.join([str(i) for i in outside_omega])

file = FileOperations('Bloch_' +
                      (str(omega_tau) + ' ' + str(outside_omega_value)
                       ).replace('.', ',').replace(' ', '_') + '.txt')
file.writing_bloch(inf, spin_position_list)

if outside_omega_value == 0:
    multiplier = 0
else:
    multiplier = 1.1 / outside_omega_value

ax.quiver(0,
          0,
          0,
          outside_omega[0] * multiplier,
          outside_omega[1] * multiplier,
          outside_omega[2] * multiplier,
          color='g')