comnum.Trace#

class comnum.Trace#

The frame after every block of one trial ({name: Frame}, in the order of the chain), from comnum.Chain.trace().

plot(kind: str = 'constellation', stages: Iterable[str] | None = None, **kwargs: Any) → Figure#

One panel per stage.

Parameters:
  • kind (str) – a function of comnum.plot (constellation, time, psd, eye).

  • stages (list[str] | None) – the stages (all by default).

  • **kwargs – passed to the function.

Returns:

the figure.

Return type:

matplotlib.figure.Figure

save(path: str | Path) → Path#

Write the samples of every stage to a NumPy .npz file, one namespace per stage, so that no name of a stage collides with another key: stage/<name>/stream0, stage/<name>/stream1… (the polarisations or antennas), stage/<name>/sps (the samples per symbol), and tx_symbols (the transmitted symbols).

Parameters:

path (str | os.PathLike) – the file.

Returns:

the path written.

Return type:

pathlib.Path

Example

>>> import comnum, numpy as np, tempfile, pathlib
>>> from comnum import blocks as B
>>> t = comnum.Chain(tx=B.Source(n_symbols=8)).trace({}, comnum.Rng(1))
>>> with tempfile.TemporaryDirectory() as d:
...     sorted(np.load(t.save(pathlib.Path(d) / "t.npz")).files)
['stage/tx/sps', 'stage/tx/stream0', 'tx_symbols']