I'm making a very simple script in which a cavity is pumped by an external source which is alternatingly on and off every 1 ns. I use the following code.
#Pump function which is alternatively on and off every 1 ns
def Pump(t,args):
if(np.mod(floor(t),2)==0):
return 0;
else:
return 1
T=20 # Time range used, in ns
sizeT=10000 #Number of bins in which the time in range is divided. If this is not big enough, you get an error
tlist =np.linspace(0,T,sizeT) #These are the true times
Kappa = 10 #Cavity losses
Na = 15;
psi0 = tensor(basis(Na,0))
a = tensor(destroy(Na))
H1 = a.dag() + a
H = [[H1,Pump]]
c_op_list = []
c_op_list.append(sqrt(Kappa) * a)
output = mesolve(H, psi0, tlist,c_op_list, [],args=[])
N_c = expect(a.dag() * a,output.states)
#%% PLOT
Pumplist = np.zeros(len(tlist))
i=0
for t in tlist:
Pumplist[i] = Pump(t,[])
i=i+1
plt.rc('text', usetex=False)
plt.rc('font', family='arial',size=20)
fig, axes = plt.subplots(1, 1, figsize=(10,6))
ax = plt.subplot(111)
plt.plot(tlist,Pumplist/max(Pumplist), label="Pump")
plt.plot(tlist, N_c/max(N_c), label="Cavity")
ax.legend(loc='upper center', prop={'size':18},bbox_to_anchor=(0.5, -0.3),fancybox=True, shadow=True, ncol=5)
plt.xlabel('Time (ns)')
plt.ylabel('External Pulse')
plt.show()
As you see, it looks like the pump does not do anything to the cavity population for the first 13 ns, and only after that it start behaving correctly. I also tried changing the time T, and this behaviour changes: sometimes it seems that the pump has no influence at all, other times it starts to have an effect earlier than 13ns.
Do you have any idea why I have this behaviour? Can you try reproducing this script on your computer?