@@ -248,3 +248,79 @@ def plot_avg_density(densities, register, with_labels = True, custom_axes = None
248
248
else :
249
249
return None ,ax
250
250
251
+
252
+
253
+ def plot_task (task ,show_register = False ):
254
+ rabi_times = np .array (task .hamiltonian .amplitude .time_series .times ())/ 1e-6
255
+ rabi_vals = np .array (task .hamiltonian .amplitude .time_series .values ())/ 1e6
256
+
257
+ phase_times = np .array (task .hamiltonian .phase .time_series .times ())/ 1e-6
258
+ phase_vals = np .array (task .hamiltonian .phase .time_series .values ())
259
+
260
+ detuning_times = np .array (task .hamiltonian .detuning .time_series .times ())/ 1e-6
261
+ detuning_vals = np .array (task .hamiltonian .detuning .time_series .values ())/ 1e6
262
+
263
+ pos_filled = np .array ([atom .coordinate for atom in task .register if atom .site_type == SiteType .FILLED ])* 1e6
264
+ pos_empty = np .array ([atom .coordinate for atom in task .register if atom .site_type == SiteType .VACANT ])* 1e6
265
+
266
+ if show_register == False :
267
+ fig = plt .figure (figsize = (8 ,8 ))
268
+ ax = plt .subplot (3 ,1 ,1 )
269
+ plt .plot (rabi_times ,rabi_vals ,"k.-" ,linewidth = 2 )
270
+ plt .fill_between (rabi_times ,rabi_vals ,color = "#C2477F" ,alpha = 0.2 )
271
+ ax .axis ([min (rabi_times ) - 0.05 * max (rabi_times ),max (rabi_times )* 1.05 ,ax .axis ()[2 ],ax .axis ()[3 ]])
272
+ ax .set_yticks (np .linspace (0 ,15 ,4 ))
273
+ plt .ylabel ("$\\ Omega(t)$ (rad/usec)" )
274
+ #xlabel("Time along protocol (sec)")
275
+
276
+ ax = plt .subplot (3 ,1 ,2 )
277
+ plt .plot (detuning_times ,detuning_vals ,"k.-" ,linewidth = 2 )
278
+ plt .fill_between (detuning_times ,detuning_vals ,color = "#55de79" ,alpha = 0.2 )
279
+ plt .axis ([min (detuning_times ) - 0.05 * max (detuning_times ),max (rabi_times )* 1.05 ,ax .axis ()[2 ],ax .axis ()[3 ]])
280
+ plt .ylabel ("$\\ Delta(t)$ (rad/usec)" )
281
+ #xlabel("Time along protocol (sec)")
282
+
283
+ ax = plt .subplot (3 ,1 ,3 )
284
+ for ind in range (len (phase_vals )- 1 ):
285
+ plt .plot ([phase_times [ind ],phase_times [ind + 1 ]] , [phase_vals [ind ], phase_vals [ind ]],'k.-' ,linewidth = 2 )
286
+ ax .axis ([min (phase_times ) - 0.05 * max (phase_times ),max (phase_times )* 1.05 ,ax .axis ()[2 ],ax .axis ()[3 ]])
287
+ plt .ylabel ("$\\ phi(t)$ (rad)" )
288
+ plt .xlabel ("Time along protocol (usec)" )
289
+
290
+ plt .subplots_adjust (left = 0.175 )
291
+ else :
292
+ fig = plt .figure (figsize = (16 ,8 ))
293
+ ax = plt .subplot (3 ,2 ,1 )
294
+ ax .set_yticks (np .linspace (0 ,15 ,4 ))
295
+ plt .plot (rabi_times ,rabi_vals ,"k.-" ,linewidth = 2 )
296
+ plt .fill_between (rabi_times ,rabi_vals ,color = "#C2477F" ,alpha = 0.2 )
297
+ plt .axis ([min (rabi_times ) - 0.05 * max (rabi_times ),max (rabi_times )* 1.05 ,plt .axis ()[2 ],plt .axis ()[3 ]])
298
+ plt .ylabel ("$\\ Omega(t)$ (rad/usec)" )
299
+ #xlabel("Time along protocol (sec)")
300
+
301
+ ax = plt .subplot (3 ,2 ,3 )
302
+ plt .plot (detuning_times ,detuning_vals ,"k.-" ,linewidth = 2 )
303
+ plt .fill_between (detuning_times ,detuning_vals ,color = "#55de79" ,alpha = 0.2 )
304
+ ax .axis ([min (detuning_times ) - 0.05 * max (detuning_times ),max (rabi_times )* 1.05 ,ax .axis ()[2 ],ax .axis ()[3 ]])
305
+ plt .ylabel ("$\\ Delta(t)$ (rad/usec)" )
306
+ #xlabel("Time along protocol (sec)")
307
+
308
+ ax = plt .subplot (3 ,2 ,5 )
309
+ for ind in range (len (phase_vals )- 1 ):
310
+ plt .plot ([phase_times [ind ],phase_times [ind + 1 ]] , [phase_vals [ind ], phase_vals [ind ]],'k.-' ,linewidth = 2 )
311
+ ax .axis ([min (phase_times ) - 0.05 * max (phase_times ),max (phase_times )* 1.05 ,ax .axis ()[2 ],ax .axis ()[3 ]])
312
+ plt .ylabel ("$\\ phi(t)$ (rad)" )
313
+ plt .xlabel ("Time along protocol (usec)" )
314
+
315
+ ax = plt .subplot (1 ,2 ,2 )
316
+ #axis([-1,76,-1,76])
317
+ ax .axis ([- 5 ,80 ,- 5 ,80 ])
318
+
319
+
320
+ if len (pos_filled )> 0 :
321
+ plt .scatter (pos_filled [:,0 ],pos_filled [:,1 ],color = "#6437FF" ,s = 200 )
322
+ if len (pos_empty )> 0 :
323
+ plt .scatter (pos_empty [:,0 ],pos_empty [:,1 ],color = "grey" ,s = 200 )
324
+ ax .set_aspect ("equal" )
325
+
326
+ plt .subplots_adjust (left = 0.175 / 2 )
0 commit comments