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_from_sc: ndarray[Any, dtype[_ScalarType_co]], c_diss: ndarray[Any, dtype[_ScalarType_co]], n_diss_from_sc: 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_from_sc (np.ndarray, shape (n_size_classes, n_timesteps)) – Mass concentrations of dissolved organics lost from each size class, not including initial dissolved concentrations specified by initial_concs_diss parameter
c_diss (np.ndarray, shape (n_timesteps)) – Total mass concentrations of dissolved organics, including initial concentrations
n_diss_from_sc (np.ndarray, shape (n_size_classes, n_timesteps)) – Particle number concentrations lost from size classes due to dissolution, not including initial dissolved concentrations specified by initial_concs_diss parameter
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, log_yaxis=False, units=None, cmap='viridis', show_legend=True, size_classes_to_plot=None)[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
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.
- Returns
Matplotlib figure and axes objects for the plot
- Return type
(matplotlib.figure.Figure, matplotlib.axes.Axes)