Time dependence - create detuning

[1]:
import nexus as nx
import numpy as np
import matplotlib.pyplot as plt

# define a phase jump function
class PhaseJump(nx.FunctionTime):

    def __init__(self, t0):
        super().__init__("phase jump")
        self.t0 = t0

    def Function(self, time):
        phase = 0
        if time > self.t0:
            phase = np.pi
        return phase

func = PhaseJump(20)

# get the special detuning grid needed for calculations in the energy domain
detuning = func.CreateDetuning(400, 2000)

print(detuning)
[-400.  -399.6 -399.2 ...  398.8  399.2  399.6]