# plotting settings
plt.xlabel('$\omega/(2\pi)$ [kHz]')
plt.ylabel('$S_{qq}$ [a.u.]')
if log_plot == True:
    plt.yscale('log')
plt.xlim(plot_range)
if legend == True:
    plt.legend(loc='best')
plt.savefig(filename, bbox_inches='tight')
plt.show()

# calculate photon numbers from area
Delta = np.abs(omega[1]) - np.abs(omega[0])
if calc_1D == True:
    print('***1D spectra***')
    NX_from_area = tools.n_from_area(SXX_plus, SXX_minus, Delta, N[0], 'X')
    NY_from_area = tools.n_from_area(SYY_plus, SYY_minus, Delta, N[1], 'Y')
    NZ_from_area = tools.n_from_area(SZZ_plus, SZZ_minus, Delta, N[2], 'Z')

if consider_3D == True:
    print('\n ***3D spectra (ignore difference)***')
    NX_from_area_3D = tools.n_from_area(SXX_plus_3D, SXX_minus_3D, Delta, N[0],
                                        'X')
    NY_from_area_3D = tools.n_from_area(SYY_plus_3D, SYY_minus_3D, Delta, N[1],
                                        'Y')
    NZ_from_area_3D = tools.n_from_area(SZZ_plus_3D, SZZ_minus_3D, Delta, N[2],
                                        'Z')

# save settings
f = open(filename + '_parameters', 'w')
f.write('T ' + str(param.T) + ' #temperatur [K] \n')
Exemple #2
0
        # Calculate resulting parameters
        param.prepare_calc()
        param.Gamma = param.Gamma * 2  # the calculated gamma is actually gamma/2

        # Calculate spectra
        SXX_plus_3D = tools.spectrum_output(omega, 0, param, True)
        SXX_minus_3D = tools.spectrum_output(-omega, 0, param, True)
        SYY_plus_3D = tools.spectrum_output(omega, 1, param, True)
        SYY_minus_3D = tools.spectrum_output(-omega, 1, param, True)
        SZZ_plus_3D = tools.spectrum_output(omega, 2, param, True)
        SZZ_minus_3D = tools.spectrum_output(-omega, 2, param, True)

        # Calculate n_i
        n_x[i][j] = tools.n_from_area(SXX_plus_3D,
                                      SXX_minus_3D,
                                      Delta_omega,
                                      _N=0,
                                      _name='',
                                      printing=False)[2]
        n_y[i][j] = tools.n_from_area(SYY_plus_3D,
                                      SYY_minus_3D,
                                      Delta_omega,
                                      _N=0,
                                      _name='',
                                      printing=False)[2]
        n_z[i][j] = tools.n_from_area(SZZ_plus_3D,
                                      SZZ_minus_3D,
                                      Delta_omega,
                                      _N=0,
                                      _name='',
                                      printing=False)[2]
    #param.Gamma = param.Gamma*2 # the calculated gamma is actually gamma/2

    # 1D calculations
    SXX_plus = tools.spectrum_output(omega, 0, param, False)
    SXX_minus = tools.spectrum_output(-omega, 0, param, False)
    SYY_plus = tools.spectrum_output(omega, 1, param, False)
    SYY_minus = tools.spectrum_output(-omega, 1, param, False)
    SZZ_plus = tools.spectrum_output(omega, 2, param, False)
    SZZ_minus = tools.spectrum_output(-omega, 2, param, False)

    # calculate photon numbers from area
    Delta = np.abs(omega[1]) - np.abs(omega[0])
    NX_from_area = tools.n_from_area(SXX_plus,
                                     SXX_minus,
                                     Delta,
                                     N[0],
                                     'X',
                                     printing=False)[2]
    NY_from_area = tools.n_from_area(SYY_plus,
                                     SYY_minus,
                                     Delta,
                                     N[1],
                                     'Y',
                                     printing=False)[2]
    NZ_from_area = tools.n_from_area(SZZ_plus,
                                     SZZ_minus,
                                     Delta,
                                     N[2],
                                     'Z',
                                     printing=False)[2]
            #param.print_param()
            param.Gamma = param.Gamma * 2  # the calculated gamma is actually gamma/2

            # Calculate spectra
            SXX_plus_3D = tools.spectrum_output(omega, 0, param, True)
            SXX_minus_3D = tools.spectrum_output(-omega, 0, param, True)
            SYY_plus_3D = tools.spectrum_output(omega, 1, param, True)
            SYY_minus_3D = tools.spectrum_output(-omega, 1, param, True)
            SZZ_plus_3D = tools.spectrum_output(omega, 2, param, True)
            SZZ_minus_3D = tools.spectrum_output(-omega, 2, param, True)

            # Calculate n_i
            n_current[0] = tools.n_from_area(SXX_plus_3D,
                                             SXX_minus_3D,
                                             Delta_omega,
                                             _N=0,
                                             _name='',
                                             printing=False)[2]
            n_current[1] = tools.n_from_area(SYY_plus_3D,
                                             SYY_minus_3D,
                                             Delta_omega,
                                             _N=0,
                                             _name='',
                                             printing=False)[2]
            n_current[2] = tools.n_from_area(SZZ_plus_3D,
                                             SZZ_minus_3D,
                                             Delta_omega,
                                             _N=0,
                                             _name='',
                                             printing=False)[2]