src.phaseshifter

Created on Wed Apr 24 11:52:30 2024

@author: jsatuit

Classes

PhaseShifter

Simulates behaviour of phase shifter

Module Contents

class src.phaseshifter.PhaseShifter

Simulates behaviour of phase shifter

_phase_shifts = []
_phases = []
set_phase(time, phase)

Set phase shifter to certain phase

Parameters:
  • time (float) – Time of phase shift

  • phase (float) – Phase to set to.

restart()

Restarts phase shifter.

Means that all saved content is deleted. Use this when data is copied, for example at ethe end of a subcycle.

PHA0(time, line=0)

Set phase shifter to 0 degree.

Parameters:
  • time (float) – Time of phase shift

  • line (int) – Line of command in tlan file. Not in use

PHA180(time, line=0)

Set phase shifter to 180 degree.

Parameters:
  • time (float) – Time of phase shift

  • line (int) – Line of command in tlan file. Not in use

property phase_shifts

List of TimedEvents contaning the phase shifts

phase_shifts_within(interval, tx_intervals=None)

List of TimedEvents contaning the phase shifts within interval.

The last phase shift before the interval is also returned.

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 (TimeIntervalList or None, optional) – transmit intervals. If wanted to estimate baud lengths, these must be given, defaults to None

Returns:

A list of the phase shifts within the interval. If tx_intervals is given, also a list of baud lengths is returned.

Return type:

EventList[, list[float]]

estimate_baud_length(interval)

Estimate baud length within transmit interval.

Baud length is estimated by finding the greatest common divisor of the time between the phase shifts in the transmit pulse.

WARNING: This is NOT a perfect function and will fail in cases where the pulse has phases like ++++ or ++–. but still works for cases like +++–.

In many KST experiments (f.e. beata, manda), the first baud is not used or the code is long enough such that this function works for all pulses.

Parameters:

interval (TimeInterval) – transmit interval

Returns:

baud length

Return type:

float

as_line(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, …]

(Not used at current)

Parameters:

interval (TimeInterval) – nInterval the phase shifts should be within

Returns:

lists of coordinates

Return type:

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