示例#1
0
def plot(input_file, z):
    r = load.Results(input_file)

    fig, ax = plt.subplots()
    z, A = r.spectral_field(z)
    I = 0.5 * epsilon_0 * c * abs(A)**2
    I /= I.max()

    omega0 = 2 * pi * c / r.config['laser/wavelength']
    order = r.omega / omega0

    if 'capillary/modes' in r.config:
        modes = r.config['capillary/modes']
        m = ax.imshow(I[::-1],
                      norm=colors.LogNorm(1e-6, 1),
                      aspect='auto',
                      extent=(order.min(), order.max(), -0.5, modes - 0.5))
        ax.set_ylabel('modes')
        ax.set_yticks(numpy.arange(modes))

    else:
        kperp = numpy.hstack((0, r.kperp))
        m = ax.pcolormesh(order, kperp, I, norm=colors.LogNorm(1e-6, 1))
        ax.set_ylabel('kperp [1/m]')

    plt.colorbar(m, ax=ax)
    cmap = cm.get_cmap()
    cmap.set_bad(cmap(0))
    ax.set_xlabel('harmonic order')
    ax.set_title('Spectral intensity [scaled], z = {:1.2f}cm'.format(z * 100))
    fig.tight_layout()

    plt.show()
示例#2
0
def plot(input_file):
    r = load.Results(input_file)
    z, energy = r.energy()
    cm = z * 100
    energy_mJ = energy * 1e3

    fig, ax = plt.subplots()
    ax.plot(cm, energy_mJ)

    ax.set_xlabel('distance [cm]')
    ax.set_ylabel('energy [mJ]')
    fig.tight_layout()

    plt.show()
示例#3
0
def plot(input_file):
    r = load.Results(input_file)
    z, density = r.max_electron_density()
    cm = z * 100

    fig, ax = plt.subplots()
    ax.plot(cm, density)

    ax.set_xlabel('distance [cm]')
    ax.set_ylabel('electron density [1/m^3]')
    ax.set_yscale('log')
    fig.tight_layout()

    plt.show()
示例#4
0
def plot(input_file):
    r = load.Results(input_file)
    z, intensity = r.max_intensity()
    cm = z * 100

    fig, ax = plt.subplots()
    ax.plot(cm, intensity)

    ax.set_xlabel('distance [cm]')
    ax.set_ylabel('intensity [W/m^2]')
    ax.set_yscale('log')

    fig.tight_layout()

    plt.show()
示例#5
0
def plot(input_file, z):
    r = load.Results(input_file)
    fs = r.time * 1e15
    z, E = r.electric_field(z)
    cm = z * 100

    fig, ax = plt.subplots()
    ax.plot(fs, E[0].real)
        
    ax.set_xlim(fs.min(), fs.max())
    ax.set_xlabel('time [fs]')
    ax.set_ylabel('electric field [V/m]')
    ax.set_title('z = {:1.2f}cm'.format(cm))
    fig.tight_layout()
        
    plt.show()
示例#6
0
def plot(input_file, z):
    r = load.Results(input_file)
    z, spec = r.spectrum(z)
    spec /= spec.max()
    cm = z * 100
    nm = r.wavelength * 1e9

    fig, ax = plt.subplots()
    ax.plot(nm, spec)

    ax.set_xlim(nm.min(), nm.max())
    ax.set_ylim(0, 1.1)
    ax.set_xlabel('wavelength [nm]')
    ax.set_ylabel('spectral intensity [scaled]')
    ax.set_title('z = {:1.2f}cm'.format(cm))
    fig.tight_layout()

    plt.show()
示例#7
0
def plot(input_file, z):
    r = load.Results(input_file)
    z, E = r.electric_field(z)
    I = 0.5 * epsilon_0 * c * abs(E)**2
    fs = r.time * 1e15
    mm = r.radius * 1e3
    cm = z * 100

    fig, ax = plt.subplots()
    mesh = ax.pcolormesh(fs, mm, I, cmap='inferno')

    ax.set_xlim(fs.min(), fs.max())
    ax.set_ylim(mm.min(), mm.max())
    ax.set_xlabel('time [fs]')
    ax.set_ylabel('radius [mm]')
    ax.set_title('Intensity [W/m^2], z = {:1.2f}cm'.format(cm))
    plt.colorbar(mesh, ax=ax)
    fig.tight_layout()

    plt.show()
示例#8
0
def plot(input_file, z):
    r = load.Results(input_file)
    z, spec = r.spectrum(z)
    spec /= spec.max()
    cm = z * 100
    nm = r.wavelength * 1e9
    thz = r.omega / (2 * pi) / 1e12

    fig, ax = plt.subplots()
    ax.plot(thz, spec)

    ax.set_xlim(0, thz.max())
    ax.set_yscale('log')
    ax.set_ylim(1e-10, 2)

    ax.set_xlabel('frequency [THz]')
    ax.set_ylabel('spectral intensity [scaled]')
    ax.set_title('z = {:1.2f}cm'.format(cm))
    fig.tight_layout()

    plt.show()
示例#9
0
def plot(input_file, z):
    r = load.Results(input_file)
    z, E = r.electric_field(z)
    cm = z * 100
    fs = r.time * 1e15
    mm = r.radius * 1e3
    mm = numpy.hstack((0, mm))

    fig, ax = plt.subplots()
    v = max(E.real.max(), -E.real.min())
    mesh = ax.pcolormesh(fs, mm, E.real, vmin=-v, vmax=v, cmap='bwr')

    ax.set_xlim(fs.min(), fs.max())
    ax.set_ylim(mm.min(), mm.max())

    ax.set_xlabel('time [fs]')
    ax.set_ylabel('radius [mm]')
    ax.set_title('Electric field [V/m], z = {:1.2f}cm'.format(cm))

    plt.colorbar(mesh, ax=ax)
    fig.tight_layout()

    plt.show()
示例#10
0
def plot(input_file, z):
    r = load.Results(input_file)
    z, rho = r.electron_density(z)
    fs = r.time * 1e15
    mm = r.radius * 1e3
    mm = numpy.hstack((0, mm))
    cm = z * 100

    fig, ax = plt.subplots()
    mesh = ax.pcolormesh(fs,
                         mm,
                         rho,
                         cmap='magma',
                         norm=LogNorm(vmin=rho.max() / 1e6, vmax=rho.max()))

    ax.set_xlim(fs.min(), fs.max())
    ax.set_ylim(mm.min(), mm.max())
    ax.set_xlabel('time [fs]')
    ax.set_ylabel('radius [mm]')
    ax.set_title('Electron density [1/m^3], z = {:1.2f}cm'.format(cm))
    plt.colorbar(mesh, ax=ax)
    fig.tight_layout()

    plt.show()
示例#11
0
import density
import intensity
import onaxis
import spectrum
import log_spectrum
import thz_spectrum
import energy
import max_intensity
import max_density

if len(sys.argv) < 2:
    print("Please provide an input file")
    sys.exit()

input_file = sys.argv[1]
r = load.Results(input_file)

results_files = ['temporal_field', 'spectral_field', 'electron_density']
results_files = [join('results', o) for o in results_files]
funcs = [temporal.plot, spectral.plot, density.plot]

for func, results in zip(funcs, results_files):
    for i, z in enumerate(r.distances):
        func(input_file, z)
        filename = r._make_filename(r.config[results], i).replace('dat', 'png')
        plt.savefig(filename)
        print('Wrote:', filename)
        plt.close('all')

for i, z in enumerate(r.distances):
    intensity.plot(input_file, z)