FRAGMENT-MNP output#
Provides functionality for processing and visulalising model output data.
- class fragmentmnp.output.FMNPOutput(t: ndarray[Any, dtype[_ScalarType_co]], c: ndarray[Any, dtype[_ScalarType_co]], n: ndarray[Any, dtype[_ScalarType_co]], c_diss: ndarray[Any, dtype[_ScalarType_co]], c_min: ndarray[Any, dtype[_ScalarType_co]], soln, psd, id=None)[source]#
Class that holds output data from the model and provides plotting functionalities.
- Parameters
t (np.ndarray, shape (n_timesteps,)) – Time series over which the model was run
c (np.ndarray, shape (n_size_classes, n_timesteps)) – Mass concentrations for each size class over the time series
n (np.ndarray, shape (n_size_classes, n_timesteps)) – Particle number concentrations for each size class over the time series
c_diss (np.ndarray, shape (n_timesteps)) – Total mass concentrations of dissolved organics, including initial concentrations
c_min (np.ndarray, shape (n_timesteps)) – Total mass concentration of mineralised polymer. c_min is given as a concentration relative to the original medium that the polymer was present in. For example, if the original medium is soil, and the units are kg/m3, then c_min is the mass of mineralised polymer per m3 of the soil, rather than the atmosphere surrounding the soil
soln (Bunch object from scipy.integrate.solve_ivp return) – The solution to the model ODE, passed directly from the scipy.integrate.solve_ivp method
psd (np.ndarray, shape (n_size_classes, )) – Particle size distribution - the average diameters of each of the particle size classes
- plot(type: str = 'mass_conc', plot_dissolution: bool = False, plot_mineralisation: bool = False, log_yaxis=False, units=None, cmap='viridis', show_legend=True, size_classes_to_plot=None, show: bool = False)[source]#
Plot the output data by choosing from a number of pre-defined plot types.
- Parameters
type (str, default='mass_conc') – Tells the function what type of plot to produce. Either particle_number_conc or mass_conc.
plot_dissolution (bool, default=False) – Should dissolution be plotted on a separate y-axis
plot_mineralisation (bool, default=False) – Should mineralised polymer be plotted on a separate y-axis
log_yaxis (bool or str, default=False) – True and “log” plots the y axis on a log scale, “symlog” plots the y axis on a symlog scale (useful if the data contain zeros), and False plots the y axis on a linear scale
units (dict or str, default=None) – Units to be used in axis labels. Must either be “SI” to use SI units, “dim” to use dimensional labels (“mass”, “volume”, etc), or a dictionary containing elements for mass, volume and time. E.g. units={‘mass’: ‘kg’, ‘volume’: ‘m3’, ‘time’: ‘s’, ‘length’: ‘nm’}. Note that these units are used purely for axis labelling and are not used to modify the model output data (which is unit agnostic). If None (the default), no units are added to labels.
cmap (str, default='viridis') – The colormap to use for the plot. Must be one of the colormaps available in matplotlib. Note that these are case-sensitive.
show_legend (bool, default=True) – Should size classes be shown on a legend?
size_classes_to_plot (list of ints, default=None) – Only plot specific size classes by providing a list of size class indices to plot, where 0 is the index of the smallest size class. By default, all size classes are plotted.
show (bool, default=False) – Should
plt.show()
be called in order to trigger the plot to show in non-interactive environments (e.g. running the code as a script)? If False, the plot will not be shown automatically unless you are using an interactive environment, such as a Jupyter notebook.
- Returns
Matplotlib figure and axes objects for the plot
- Return type
(matplotlib.figure.Figure, matplotlib.axes.Axes)