def _plot_2D(self, t, comp, state, vmax): x = self.axial_coordinates y = self.particle_coordinates if not self.time[0] <= t <= self.time[-1]: raise ValueError("Time exceeds bounds.") t_i = np.where(t <= self.time)[0][0] c_i = comp * self.n_bound + state v = self.solution[t_i, :, :, c_i].transpose() if vmax is None: vmax = v.max() fig, ax = plotting.setup_figure() mesh = ax.pcolormesh(x, y, v, shading='gouraud', vmin=0, vmax=vmax) plotting.add_text(ax, f'time = {t:.2f} s') layout = plotting.Layout() layout.title = f'Solid phase concentration, comp={comp}, state={state}' layout.x_label = '$z~/~m$' layout.y_label = '$r~/~m$' layout.labels = self.component_system.labels[c_i] plotting.set_layout(fig, ax, layout) fig.colorbar(mesh) return fig, ax, mesh
def plot(self, start=0, end=None, overlay=None): """Plots the whole time_signal for each component. Parameters ---------- start : float start time for plotting end : float end time for plotting See also -------- CADETProcess.plot """ x = self.time / 60 y = self.solution / 1000 ymax = np.max(y) fig, ax = plotting.setup_figure() ax.plot(x, y) if overlay is not None: ymax = 1.1 * np.max(overlay) plotting.add_overlay(ax, overlay) layout = plotting.Layout() layout.x_label = '$time~/~min$' layout.y_label = '$V~/~L$' layout.xlim = (start, end) layout.ylim = (0, ymax) plotting.set_layout(fig, ax, layout) return ax
def plot_purity(self, start=0, end=None): """Plots the local purity for each component of the concentration profile. Parameters ---------- start : float start time for plotting end : float ent time for plotting See also -------- plotlib plot """ x = self.time / 60 y = self.local_purity * 100 fig, ax = plotting.setup_figure() ax.plot(x,y) layout = plotting.Layout() layout.x_label = '$time~/~min$' layout.y_label = '$c~/~mol \cdot L^{-1}$' layout.xlim = (start, end) layout.ylim = (0, 1.1*np.max(y)) plotting.set_layout(fig, ax, layout) return ax
def plot(self, start=0, end=None): """Plots the whole time_signal for each component. Parameters ---------- start : float start time for plotting end : float end time for plotting See also -------- plotlib plot_purity """ x = self.time / 60 y = self.signal fig, ax = plotting.setup_figure() ax.plot(x,y) layout = plotting.Layout() layout.x_label = '$time~/~min$' layout.y_label = '$c~/~mol \cdot L^{-1}$' layout.xlim = (start, end) layout.ylim = (0, 1.1*np.max(y)) plotting.set_layout(fig, ax, layout) return ax
def plot(self, start=0, end=None, ymax=None, ax=None, layout=None, only_plot_total_concentrations=False, alpha=1, hide_labels=False, secondary_axis=None, secondary_layout=None, show_legend=True): """Plots the whole time_signal for each component. Parameters ---------- start : float start time for plotting end : float end time for plotting See also -------- plotlib plot_purity """ if ymax is None: ymax = self.solution.max() layout = plotting.Layout() layout.x_label = '$time~/~min$' layout.y_label = '$c~/~mM$' layout.xlim = (start, end) layout.ylim = (0, ymax) ax, fig = plot_solution_1D( self, ax=None, layout=layout, only_plot_total_concentrations=only_plot_total_concentrations, alpha=alpha, hide_labels=hide_labels, secondary_axis=secondary_axis, secondary_layout=secondary_layout, show_legend=show_legend, ) return ax, fig
def plot_events(self): """Plot parameter state as function of time. """ time = np.linspace(0, self.cycle_time, 1001) for parameter, tl in self.parameter_timelines.items(): y = tl.value(time) fig, ax = plotting.setup_figure() layout = plotting.Layout() layout.title = str(parameter) layout.x_label = '$time~/~min$' layout.y_label = '$state$' ax.plot(time / 60, y) plotting.set_layout(fig, ax, layout)
def plot(self): """Plot section state over time. """ start = self.sections[0].start end = self.sections[-1].end time = np.linspace(start, end, 1001) / 60 y = self.value(time) fig, ax = plotting.setup_figure() ax.plot(time, y) layout = plotting.Layout() layout.x_label = '$time~/~min$' layout.y_label = '$state$' layout.xlim = (start / 60, end / 60) layout.ylim = (0, 1.1 * np.max(y)) plotting.set_layout(fig, ax, layout) return ax
def plot_at_location(self, z, overlay=None, ymax=None): """Plot bulk solution over time at given location. Parameters ---------- z : float space for plotting See also -------- plot_at_time CADETProcess.plotting """ x = self.time if not self.axial_coordinates[0] <= z <= self.axial_coordinates[-1]: raise ValueError("Axial coordinate exceets boundaries.") z_i = np.where(z <= self.axial_coordinates)[0][0] y = self.solution[:, z_i] if ymax is None: ymax = 1.1 * np.max(y) fig, ax = plotting.setup_figure() ax.plot(x, y) plotting.add_text(ax, f'z = {z:.2f} m') if overlay is not None: ymax = np.max(overlay) plotting.add_overlay(ax, overlay) layout = plotting.Layout() layout.x_label = '$time~/~min$' layout.y_label = '$c~/~mM$' layout.ylim = (0, ymax) plotting.set_layout(fig, ax, layout) return ax
def plot_at_time(self, t, overlay=None, ymax=None): """Plot bulk solution over space at given time. Parameters ---------- t : float time for plotting See also -------- plot_at_location CADETProcess.plotting """ x = self.axial_coordinates if not self.time[0] <= t <= self.time[-1]: raise ValueError("Time exceeds bounds.") t_i = np.where(t <= self.time)[0][0] y = self.solution[t_i, :] if ymax is None: ymax = 1.1 * np.max(y) fig, ax = plotting.setup_figure() ax.plot(x, y) plotting.add_text(ax, f'time = {t:.2f} s') if overlay is not None: ymax = np.max(overlay) plotting.add_overlay(ax, overlay) layout = plotting.Layout() layout.x_label = '$z~/~m$' layout.y_label = '$c~/~mM$' layout.ylim = (0, ymax) plotting.set_layout(fig, ax, layout) return ax
def _plot_1D(self, t, ymax): x = self.axial_coordinates if not self.time[0] <= t <= self.time[-1]: raise ValueError("Time exceeds bounds.") t_i = np.where(t <= self.time)[0][0] y = self.solution[t_i, :] if ymax is None: ymax = 1.1 * np.max(y) fig, ax = plotting.setup_figure() ax.plot(x, y) plotting.add_text(ax, f'time = {t:.2f} s') layout = plotting.Layout() layout.x_label = '$z~/~m$' layout.y_label = '$c~/~mM$' layout.ylim = (0, ymax) plotting.set_layout(fig, ax, layout) return fig, ax