Utils
This submodule contains utility functions for the atom_access
package.
In particular, a function for the recursive calculation of ZCW coefficients – recursive_g
.
This submodule contains utility functions
- atom_access.utils.platform_check(func)
Decorator to check platform for color terminal output.
Windows Anaconda prompt will not support colors by default, so colors are disabled for all windows machines, unless the aa_term_color envvar is defined
- atom_access.utils.plot_rays(vecs: ndarray[Any, dtype[_ScalarType_co]], clusters: ndarray[Any, dtype[_ScalarType_co]], n_clust: int, show: bool = True, fig: Figure | None = None, colours: list[str] | None = None) None
Create a plot of unblocked rays for web browser using plotly
- Parameters:
vecs (np.ndarray[float]) – (3,n_unblocked_rays) array containing xyz vectors of unblocked rays
clusters (np.ndarray[int]) – Integers specifying which cluster each ray belongs to
n_clust (int) – Number of clusters
show (bool) – If true, displays figure in browser
fig (go.Figure) – If provided, rays are added to this figure
colours (list[str]) –
List of colours, one per cluster formatted as
[
‘rgb(VAL, VAL, VAL)’,
’rgb(VAL, VAL, VAL)’,
…
]
where VAL is Red, Green, Blue in range(0, 255)
- Returns:
Figure of unblocked rays as points
- Return type:
go.Figure
- atom_access.utils.recursive_g(m: int) int
Recursively calculates numbers g_m required by ZCW algorithm
- Parameters:
m (int) – m index
- Returns:
g_m value for given m
- Return type:
int