comnum.pulse_shape#

comnum.pulse_shape(kind, sps, *, n_taps=1025, rolloff=0.1)#

Taps of a transmit pulse at sps samples per symbol, normalised to a unit sum (OptiCommPy pulseShape).

The defaults are those of the pulse_shape block of the specifications (1025 taps, roll-off 0.1). OptiCommPy’s defaults are reached by explicit arguments: pulse_shape("rrc", sps, n_taps=4096, rolloff=0.01) gives its taps (an even length, see below).

Parameters:
  • kind (str) – "rect", "nrz", "rc" (raised cosine), "rrc" (root raised cosine) or "rz" (50 % return to zero, a sinusoidal pulse carver).

  • sps (int) – samples per symbol.

  • n_taps (int) – length of the raised-cosine pulses, on a symmetric grid of n_taps points over ±⌊n_taps/2⌋ samples (ignored by rect and nrz). An even length gives OptiCommPy’s taps, which fall between the sampling instants; an odd length puts them on the sampling instants (OptiCommPy’s odd grid is shifted by about half a sample).

  • rolloff (float) – roll-off of the raised-cosine pulses.

Returns:

the taps (float64), summing to one.

Return type:

numpy.ndarray

Raises:

ValueError – for an invalid parameter (the message names it).

Examples

>>> import comnum
>>> h = comnum.pulse_shape("rrc", 4)
>>> h.size, round(float(h.sum()), 12)
(1025, 1.0)