pycsa.wrappers.diagnostics¶
Diagnostic wrapper module to ease setting up the CSA building blocks
Classes
|
Helper class for evaluation of the CSA on a Delaunay triangulated domain. |
|
Helper class to plot CSA-computed data |
- class pycsa.wrappers.diagnostics.delaunay_metrics(params, tri, writer=None)¶
Helper class for evaluation of the CSA on a Delaunay triangulated domain.
- __init__(params, tri, writer=None)¶
- Parameters:
params (
pycsa.config.params.params) – instance of the user-defined parameter classtri (
scipy.spatial.Delaunay) – instance of the scipy Delaunay triangulation classwriter (
pycsa.core.io.writer, optional) – metric will be written to a HDF5 file if writer object is provided, by default None
- update_quad(idx, uw_ref, uw_fa)¶
Store the computed idealised pseudo-momentum fluxes on a quadrilateral grid, i.e., the reference grid.
- Parameters:
uw_ref (array-like) – 2D array the size of a dense (truncated) spectral space containing the reference idealised pseudo-momentum fluxes
uw_fa (array-like) – 2D array the size of a dense (truncated) spectral space containing the first-approximation’s idealised pseudo-momentum fluxes
- get_rel_err(triangle_pair)¶
Method to get the relative error explicitly before
wrappers.diagnostics.delaunay_metrics.end()is called.
- update_pair(triangle_pair, store_error=True)¶
Update metric computation instance with the data from the newly computed triangle pair
- Parameters:
triangle_pair (list) – a list containing the index pair in
intfor the Delaunay triangles corresponding to a quadrilateral grid cellstore_error (bool, optional) – keep a list of the errors for each triangle pair, by default True. Otherwise, the errors are discarded and only the average error is stored.
- class pycsa.wrappers.diagnostics.diag_plotter(params, nhi, nhj)¶
Helper class to plot CSA-computed data
- __init__(params, nhi, nhj)¶
- Parameters:
params (
pycsa.config.params.params) – instance of the user-defined parameter classnhi (int) – number of harmonics in the first horizontal direction
nhj (int) – number of harmonics in the second horizontal direction
- show(rect_idx, sols, kls=None, v_extent=None, dfft_plot=False, output_fig=True, fs=(14.0, 4.0), ir_args=None, fn=None, phys_lbls=None)¶
Plots the data
- Parameters:
rect_idx (int) – index of the quadrilateral grid cell
sols (tuple) –
- contains the data for plotting:
- (
pycsa.data.cell.topo_cellinstance,computed CSA spectrum,computed idealised pseudo-momentum fluxes,the reconstructed physical data)
solsis the tuple returned bywrappers.interface.first_appx.do()andwrappers.interface.second_appx.do()kls (list, optional) – list of size 2, each element is a vector containing the (k,l)-wavenumbers, by default None. Only required to plot FFT spectra.
v_extent (list, optional) –
[z_min, z_max]the vertical extent of the physical reconstruction, by default Nonedfft_plot (bool, optional) – toggles whether a spectrum is the full FFT spectral space or the dense truncated CSA spectrum, By default False, i.e. plot CSA spectrum.
output_fig (bool, optional) – toggles writing figure output, by default True
fs (tuple, optional) – figure size, by default (14.0,4.0)
ir_args (list, optional) –
- additional user-defined arguments:
- [title of the physical reconstruction panel,title of the power spectrum panel,title of the idealised pseudo-momentum flux panel,vertical extent of the power spectrum,vertical extent of the idealised pseudo-momentum flux spectrum]
By default None
fn (str, optional) – output filename, by default None
phys_lbls (list, optional) – axis labels for the physical plot, by default None