|
| 1 | +""" |
| 2 | +look at the phase fringes ddue to interference with each pulse |
| 3 | +
|
| 4 | +E1 interference (first column) should modulate along y-axis |
| 5 | +E2 interference (second column) should modulate along diagonal |
| 6 | +E2p interference (third column) should modulate along x-axis |
| 7 | +
|
| 8 | +simulated and driven experiments (top and bottom rows, resp.) |
| 9 | +should have the same phase of fringes |
| 10 | +""" |
| 11 | + |
| 12 | + |
| 13 | +import WrightSim as ws |
| 14 | +import WrightTools as wt |
| 15 | +import numpy as np |
| 16 | + |
| 17 | +dt = 50 |
| 18 | +nt = 21 |
| 19 | +wn_to_omega = 2 * np.pi * 3e-5 # cm / s |
| 20 | +w_central = 3000 |
| 21 | +coupling = 0 |
| 22 | + |
| 23 | +ham = ws.hamiltonian.Hamiltonian( |
| 24 | + w_central=w_central * wn_to_omega, |
| 25 | + coupling=coupling * wn_to_omega, |
| 26 | +) |
| 27 | +ham.recorded_elements = [7, 8] |
| 28 | + |
| 29 | +exp = ws.experiment.builtin('trive') |
| 30 | +exp.w1.points = w_central # wn |
| 31 | +exp.w2.points = w_central # wn |
| 32 | +exp.d2.points = np.linspace(-10, 10, nt) # fs |
| 33 | +exp.d1.points = np.linspace(-10, 10, nt) |
| 34 | +exp.s1.points = exp.s2.points = dt # fs |
| 35 | + |
| 36 | +exp.d1.active = exp.d2.active = True |
| 37 | + |
| 38 | +exp.timestep = 1 |
| 39 | +exp.early_buffer = 100. |
| 40 | +exp.late_buffer = 300. |
| 41 | + |
| 42 | + |
| 43 | +def check_phase(): |
| 44 | + # TODO: use assertions to check phase |
| 45 | + ... |
| 46 | + |
| 47 | + |
| 48 | +if __name__ == "__main__": |
| 49 | + scan = exp.run(ham, mp=False, windowed=True) |
| 50 | + |
| 51 | + efields = scan.efields() |
| 52 | + zi0=scan.sig.channels[0][:] |
| 53 | + zi1=scan.sig.channels[1][:] |
| 54 | + sig=zi0+zi1 |
| 55 | + |
| 56 | + driven_sig = 1j * efields.prod(axis=-2) |
| 57 | + |
| 58 | + # plot amplitude |
| 59 | + import matplotlib.pyplot as plt |
| 60 | + plt.close('all') |
| 61 | + fig, gs = wt.artists.create_figure(width='single', nrows=2, cols=[1, 1, 1]) |
| 62 | + for i in range(scan.npulses): |
| 63 | + lo = efields[..., i, :] |
| 64 | + if scan.pm[i] == 1: |
| 65 | + lo = lo.conjugate() |
| 66 | + diff = (lo * sig).imag.sum(axis=-1) |
| 67 | + driven_diff = (lo * driven_sig).imag.sum(axis=-1) |
| 68 | + |
| 69 | + axi = plt.subplot(gs[i]) |
| 70 | + axi.pcolormesh(exp.d2.points, exp.d1.points, -diff, |
| 71 | + vmin=-np.abs(diff).max(), |
| 72 | + vmax=np.abs(diff).max(), |
| 73 | + cmap='signed') |
| 74 | + axi2 = plt.subplot(gs[i+3]) |
| 75 | + axi2.pcolormesh(exp.d2.points, exp.d1.points, driven_diff, |
| 76 | + vmin=-np.abs(driven_diff).max(), |
| 77 | + vmax=np.abs(driven_diff).max(), |
| 78 | + cmap='signed') |
| 79 | + [ax.grid(True) for ax in [axi, axi2]] |
| 80 | + |
| 81 | + plt.show() |
0 commit comments