42
42
43
43
def check_phase ():
44
44
# TODO: use assertions to check phase
45
- ...
46
-
47
-
48
- if __name__ == "__main__" :
49
45
scan = exp .run (ham , mp = False , windowed = True )
50
46
51
47
efields = scan .efields ()
@@ -55,26 +51,37 @@ def check_phase():
55
51
56
52
driven_sig = 1j * efields .prod (axis = - 2 )
57
53
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 ])
54
+ diff = []
55
+ driven_diff = []
56
+
62
57
for i in range (scan .npulses ):
63
58
lo = efields [..., i , :]
64
59
if scan .pm [i ] == 1 :
65
60
lo = lo .conjugate ()
66
- diff = (lo * sig ).imag .sum (axis = - 1 )
67
- driven_diff = (lo * driven_sig ).imag .sum (axis = - 1 )
61
+ diff .append ((lo * sig ).imag .sum (axis = - 1 ))
62
+ driven_diff .append ((lo * driven_sig ).imag .sum (axis = - 1 ))
63
+
64
+ return diff , driven_diff
65
+
66
+
67
+ if __name__ == "__main__" :
68
+ diff , driven_diff = check_phase ()
69
+
70
+ # plot amplitude
71
+ import matplotlib .pyplot as plt
72
+ plt .close ('all' )
73
+ fig , gs = wt .artists .create_figure (width = 'single' , nrows = 2 , cols = [1 , 1 , 1 ])
74
+ for i , (di , ddi ) in enumerate (zip (diff , driven_diff )):
68
75
69
76
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 (),
77
+ axi .pcolormesh (exp .d2 .points , exp .d1 .points , - di ,
78
+ vmin = - np .abs (di ).max (),
79
+ vmax = np .abs (di ).max (),
73
80
cmap = 'signed' )
74
81
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 (),
82
+ axi2 .pcolormesh (exp .d2 .points , exp .d1 .points , ddi ,
83
+ vmin = - np .abs (ddi ).max (),
84
+ vmax = np .abs (ddi ).max (),
78
85
cmap = 'signed' )
79
86
[ax .grid (True ) for ax in [axi , axi2 ]]
80
87
0 commit comments