src.frequencyshift

Created on Mon Jun 3 14:14:31 2024

Classes

FrequencyList

Sorted dict is a sorted mutable mapping.

Module Contents

class src.frequencyshift.FrequencyList(*args, **kwargs)

Bases: sortedcontainers.SortedDict

Sorted dict is a sorted mutable mapping.

Sorted dict keys are maintained in sorted order. The design of sorted dict is simple: sorted dict inherits from dict to store items and maintains a sorted list of keys.

Sorted dict keys must be hashable and comparable. The hash and total ordering of keys must not change while they are stored in the sorted dict.

Mutable mapping methods:

  • SortedDict.__getitem__() (inherited from dict)

  • SortedDict.__setitem__()

  • SortedDict.__delitem__()

  • SortedDict.__iter__()

  • SortedDict.__len__() (inherited from dict)

Methods for adding items:

  • SortedDict.setdefault()

  • SortedDict.update()

Methods for removing items:

  • SortedDict.clear()

  • SortedDict.pop()

  • SortedDict.popitem()

Methods for looking up items:

  • SortedDict.__contains__() (inherited from dict)

  • SortedDict.get() (inherited from dict)

  • SortedDict.peekitem()

Methods for views:

  • SortedDict.keys()

  • SortedDict.items()

  • SortedDict.values()

Methods for miscellany:

  • SortedDict.copy()

  • SortedDict.fromkeys()

  • SortedDict.__reversed__()

  • SortedDict.__eq__() (inherited from dict)

  • SortedDict.__ne__() (inherited from dict)

  • SortedDict.__repr__()

  • SortedDict._check()

Sorted list methods available (applies to keys):

  • SortedList.bisect_left()

  • SortedList.bisect_right()

  • SortedList.count()

  • SortedList.index()

  • SortedList.irange()

  • SortedList.islice()

  • SortedList._reset()

Additional sorted list methods available, if key-function used:

  • SortedKeyList.bisect_key_left()

  • SortedKeyList.bisect_key_right()

  • SortedKeyList.irange_key()

Sorted dicts may only be compared for equality and inequality.

property frequencies
shifts_within(interval)

List of TimedEvents contaning the frequency shifts within interval.

The frequency used when interval starts is also returned: Not only those shifts that happen after interval starts.

Also returns list of (estimated) baud lengths if transmit intervals are given.

Parameters:
  • interval (TimeInterval) – interval which the phases shifts should be inside of.

  • tx_intervals – transmit intervals. If wanted to estimate baud lengths, these must be given, defaults to None

Returns:

A list of the frequencies that occur within the interval.

Return type:

EventList

as_line(end)

Coordinates of a line connecting the phase shifts within an interval

That is a list of x coordinates and a list of y coordinates which respectively describes the time and phases of the phase shifts.

Example:

180        x----------x     x----   etc.
           |          |     |
0   -x-----x          x-----x
     0     6          17    25

gives [0, 6, 6, 17, 17, 25, 25, …] and [0, 0, 180, 180, 0, 0, 180, …]

Parameters:
  • interval (TimeInterval or tuple[float, float] or float) – Interval the shifts should be within. If only a number is given, this is interpreted as end of the plotting interval.

  • end (float)

Returns:

lists of coordinates

Return type:

tuple[list[float], list[float]]

as_line_within(interval)

Coordinates of a line connecting the phase shifts within an interval

That is a list of x coordinates and a list of y coordinates which respectively describes the time and phases of the phase shifts

Example:

180        x----------x     x----   etc.
           |          |     |
0   -x-----x          x-----x
     0     6          17    25

gives [0, 6, 6, 17, 17, 25, 25, …] and [0, 0, 180, 180, 0, 0, 180, …]

Parameters:

interval (TimeInterval or tuple[float, float] or float) – Interval the shifts should be within. If only a number is given, this is interpreted as end of the plotting interval.

Returns:

lists of coordinates

Return type:

tuple[list[float], list[float]]