Esempio n. 1
0
def render_frame(i, times, dmat2, X1, X2, num_digits, dpi):
    unit_system = units.get_default_unit_system()
    fig, ax = plt.subplots()
    ax.set_title("$t=" + str(times[i]) + "$")
    ax.set_xlabel(unit_system.get_length_unit().format_label("x_1"))
    ax.set_ylabel(unit_system.get_length_unit().format_label("x_2"))
    ax.pcolormesh(X1, X2, dmat2[i])
    fig.savefig(("{:0" + str(num_digits) + "d}.png").format(i), dpi=dpi)
    plot.close_figure(fig)
    LOGGER.info("rendered image %d", i)
Esempio n. 2
0
    def action_plot(targets):
        fig, axes = plot_func()

        for axis in axes:
            plotting_args.apply(axis)
            for decorator_func in decorator_funcs:
                decorator_func(fig, axis)

        for target in targets:
            plot.save(fig, target)

        plot.close_figure(fig)
Esempio n. 3
0
        def action_plot(index, path, parameters, targets):
            fig, axes = plot_func(index, path, parameters)

            for axis in axes:
                plotting_args.apply(axis, fig)
                for decorator_func in decorator_funcs:
                    decorator_func(fig, axis, index, path, parameters)

            for target in targets:
                path = Path(target).parent
                if not path.exists:
                    path.mkdir(parents=True)
                plot.save(fig, target)

            plot.close_figure(fig)
Esempio n. 4
0
def plot_energy(
    index: int,
    path: Path,
    parameters: Parameters,
    file_path: Path,
    extension: str = ".pdf",
    modfunc: Callable[[Figure, Axes, Parameters], None] = None,
):
    total_path = path / file_path
    try:
        fig, ax = plot.create_subplots(1, 1)
        time, _, energy, _ = inout.read_output(total_path)
        plot.plot_energy(ax, time, energy)
        system = units.get_default_unit_system()
        ax.set_xlabel(system.get_time_unit().format_label("t"))
        ax.set_ylabel(system.get_energy_unit().format_label("E"))
        if modfunc:
            modfunc(fig, ax, parameters)
        plot.save(fig, str(index) + extension)
        plot.close_figure(fig)
    except FileNotFoundError:
        LOGGER.warning("file does not exist: %s", total_path)
Esempio n. 5
0
def plot_natpop(
    index: int,
    path: Path,
    parameters: Parameters,
    file_path: Path,
    dof: int = 1,
    node: int = 1,
    extension: str = ".pdf",
):
    total_path = path / file_path
    try:
        fig, ax = plot.create_subplots(1, 1)
        plot.plot_natpop(ax, *inout.read_natpop(total_path, dof=dof, node=node))
        system = units.get_default_unit_system()
        ax.set_xlabel(system.get_time_unit().format_label("t"))
        ax.set_ylabel(r"$\lambda_i(t)$")
        for func in MODFUNCS:
            func(fig, ax, parameters)
        plot.save(fig, str(index) + extension)
        plot.close_figure(fig)
    except FileNotFoundError:
        LOGGER.warning("file does not exist: %s", total_path)
Esempio n. 6
0
def plot_expval(
    index: int,
    path: Path,
    parameters: Parameters,
    file_path: Path,
    extension: str = ".pdf",
    modfunc: Callable[[Figure, Axes, Parameters], None] = None,
):
    total_path = path / file_path
    try:
        fig, ax = plot.create_subplots(1, 1)
        plot.plot_expval(ax, *inout.expval.read_expval(total_path))
        ax.set_title(r"$\rho_1(x,t)$")
        system = units.get_default_unit_system()
        ax.set_xlabel(system.get_time_unit().format_label("t"))
        ax.set_xlabel(system.get_length_unit().format_label("x"))
        if modfunc:
            modfunc(fig, ax, parameters)
        plot.save(fig, str(index) + extension)
        plot.close_figure(fig)
    except FileNotFoundError:
        LOGGER.warning("file does not exist: %s", total_path)
Esempio n. 7
0
def plot_natpop(
    index: int,
    path: Path,
    parameters: Parameters,
    file_path: Path,
    dof: int = 1,
    node: int = 1,
    extension: str = ".pdf",
    modfunc: Callable[[Figure, Axes, Parameters], None] = None,
):
    total_path = path / file_path
    try:
        fig, ax = plot.create_subplots(1, 1)
        plot.plot_depletion(ax, *inout.read_natpop(total_path, dof=dof, node=node))
        system = units.get_default_unit_system()
        ax.set_xlabel(system.get_time_unit().format_label("t"))
        if modfunc:
            modfunc(fig, ax, parameters)
        plot.save(fig, str(index) + extension)
        plot.close_figure(fig)
    except FileNotFoundError:
        LOGGER.warning("file does not exist: %s", total_path)