.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/three_cnots.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_three_cnots.py: Three Logical CNOTs =================== This example demonstrates a computation involving three logical CNOT operations. .. GENERATED FROM PYTHON SOURCE LINES 6-24 .. code-block:: Python #!/usr/bin/env python # coding: utf-8 # # Three CNOTs # # This notebook shows the construction and simulation results of three logical CNOT gates between three logical qubits with lattice surgery [[Horsman et al. (2012)]]. # noqa: E501 # ## Construction # # The three CNOT gates are applied in the following order: # #
# circuit_diagram #
# # `tqec` provides builtin functions in `tqec.gallery.three_cnots` to construct three logical CNOT gates compressed in spacetime. # noqa: E501 .. GENERATED FROM PYTHON SOURCE LINES 25-29 .. code-block:: Python from tqec.gallery import three_cnots graph = three_cnots() .. GENERATED FROM PYTHON SOURCE LINES 30-44 .. code-block:: Python graph.view_as_html() # The three logical CNOTs have six independent stabilizer flow generators: # * `XXX -> XII` # * `XXI -> XIX` # * `XII -> XXI` # * `ZII -> ZII` # * `IZI -> ZZI` # * `IZZ -> IIZ` # # Here we show the correlation surfaces for the generators. .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 45-54 .. code-block:: Python correlation_surfaces = graph.find_correlation_surfaces() stab_to_surface = {s.external_stabilizer_on_graph(graph): s for s in correlation_surfaces} print(stab_to_surface.keys()) # ### `XXX -> XII` .. rst-class:: sphx-glr-script-out .. code-block:: none dict_keys(['XXXXII', 'XXIXIX', 'XIIXXI', 'ZIIZII', 'IZIZZI', 'IZZIIZ']) .. GENERATED FROM PYTHON SOURCE LINES 58-67 .. code-block:: Python graph.view_as_html( pop_faces_at_directions=("-Y",), show_correlation_surface=stab_to_surface["XXXXII"], ) # ### `XXI -> XIX` .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 71-80 .. code-block:: Python graph.view_as_html( pop_faces_at_directions=("-Y",), show_correlation_surface=stab_to_surface["XXIXIX"], ) # ### `XII -> XXI` .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 84-93 .. code-block:: Python graph.view_as_html( pop_faces_at_directions=("-Y",), show_correlation_surface=stab_to_surface["XIIXXI"], ) # ### `ZII -> ZII` .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 97-106 .. code-block:: Python graph.view_as_html( pop_faces_at_directions=("+Z",), show_correlation_surface=stab_to_surface["ZIIZII"], ) # ### `IZI -> ZZI` .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 110-119 .. code-block:: Python graph.view_as_html( pop_faces_at_directions=("-Y",), show_correlation_surface=stab_to_surface["IZIZZI"], ) # ### `IZZ -> IIZ` .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 123-134 .. code-block:: Python graph.view_as_html( pop_faces_at_directions=("-Y",), show_correlation_surface=stab_to_surface["IZZIIZ"], ) # ## Example Circuit # # Here we show an example circuit of three logical CNOTs with $d=3$ surface code that is initialized and measured in the $X$ basis. You can download the circuit :download:`here <../media/gallery/three_cnots/circuit.stim>` or view it in `Crumble `_0;Q(-7,1)1;Q(-7,3)2;Q(-6,0)3;Q(-6,2)4;Q(-6,4)5;Q(-5,1)6;Q(-5,3)7;Q(-5,5)8;Q(-4,2)9;Q(-4,4)10;Q(-4,6)11;Q(-3,1)12;Q(-3,3)13;Q(-3,5)14;Q(-2,0)15;Q(-2,2)16;Q(-2,4)17;Q(-1,1)18;Q(-1,3)19;Q(-1,5)20;Q(0,-6)21;Q(0,-2)22;Q(0,2)23;Q(0,4)24;Q(0,6)25;Q(0,10)26;Q(1,-7)27;Q(1,-5)28;Q(1,-3)29;Q(1,-1)30;Q(1,1)31;Q(1,3)32;Q(1,5)33;Q(1,7)34;Q(1,9)35;Q(1,11)36;Q(2,-8)37;Q(2,-6)38;Q(2,-4)39;Q(2,-2)40;Q(2,0)41;Q(2,2)42;Q(2,4)43;Q(2,6)44;Q(2,8)45;Q(2,10)46;Q(2,12)47;Q(3,-7)48;Q(3,-5)49;Q(3,-3)50;Q(3,-1)51;Q(3,1)52;Q(3,3)53;Q(3,5)54;Q(3,7)55;Q(3,9)56;Q(3,11)57;Q(3,13)58;Q(4,-6)59;Q(4,-4)60;Q(4,-2)61;Q(4,0)62;Q(4,2)63;Q(4,4)64;Q(4,6)65;Q(4,8)66;Q(4,10)67;Q(4,12)68;Q(4,14)69;Q(5,-5)70;Q(5,-3)71;Q(5,-1)72;Q(5,1)73;Q(5,3)74;Q(5,5)75;Q(5,7)76;Q(5,9)77;Q(5,11)78;Q(5,13)79;Q(6,-4)80;Q(6,0)81;Q(6,2)82;Q(6,4)83;Q(6,8)84;Q(6,10)85;Q(6,12)86;Q(7,1)87;Q(7,3)88;Q(7,5)89;Q(7,9)90;Q(7,11)91;Q(7,13)92;Q(8,2)93;Q(8,4)94;Q(8,6)95;Q(8,8)96;Q(8,10)97;Q(8,12)98;Q(8,14)99;Q(9,1)100;Q(9,3)101;Q(9,5)102;Q(9,7)103;Q(9,9)104;Q(9,11)105;Q(9,13)106;Q(10,0)107;Q(10,2)108;Q(10,4)109;Q(10,6)110;Q(10,8)111;Q(10,10)112;Q(10,12)113;Q(11,1)114;Q(11,3)115;Q(11,5)116;Q(11,7)117;Q(11,9)118;Q(11,11)119;Q(11,13)120;Q(12,2)121;Q(12,4)122;Q(12,6)123;Q(12,8)124;Q(12,10)125;Q(12,12)126;Q(12,14)127;Q(13,1)128;Q(13,3)129;Q(13,5)130;Q(13,7)131;Q(13,9)132;Q(13,11)133;Q(13,13)134;Q(14,2)135;Q(14,6)136;Q(14,8)137;Q(14,10)138;Q(14,12)139;Q(15,9)140;Q(15,11)141;Q(15,13)142;Q(16,10)143;Q(16,12)144;Q(16,14)145;Q(17,9)146;Q(17,11)147;Q(17,13)148;Q(18,8)149;Q(18,10)150;Q(18,12)151;Q(19,9)152;Q(19,11)153;Q(19,13)154;Q(20,10)155;Q(20,12)156;Q(20,14)157;Q(21,11)158;Q(21,13)159;Q(22,12)160;RX_94_98_100_101_102_104_105_106_107_108_109_111_112_113_114_115_116_118_119_120_121_122_123_125_126_127_128_129_130_132_133_134_135_138;TICK;CX_109_101_113_105_121_114_123_116_125_118_127_120;CZ_108_100_112_104_122_115_126_119_135_128_138_132;TICK;CX_109_115_113_119_121_128_123_130_125_132_127_134;CZ_94_101_98_105;TICK;CX_107_100_109_102_111_104_113_106_121_115_125_119;CZ_108_101_112_105_122_116_126_120_135_129_138_133;TICK;CZ_108_114_112_118_122_129_126_133;TICK;CX_107_114_109_116_111_118_113_120_121_129_125_133;CZ_94_102_98_106_108_115_112_119_122_130_126_134;TICK;MX_94_98_107_108_109_111_112_113_121_122_123_125_126_127_135_138;DT(10,0,0)rec[-14];DT(10,4,0)rec[-12];DT(10,8,0)rec[-11];DT(10,12,0)rec[-9];DT(12,2,0)rec[-8];DT(12,6,0)rec[-6];DT(12,10,0)rec[-5];DT(12,14,0)rec[-3];TICK;RX_94_98_107_108_109_111_112_113_121_122_123_125_126_127_135_138;TICK;CX_109_101_113_105_121_114_123_116_125_118_127_120;CZ_108_100_112_104_122_115_126_119_135_128_138_132;TICK;CX_109_115_113_119_121_128_123_130_125_132_127_134;CZ_94_101_98_105;TICK;CX_107_100_109_102_111_104_113_106_121_115_125_119;CZ_108_101_112_105_122_116_126_120_135_129_138_133;TICK;CZ_108_114_112_118_122_129_126_133;TICK;CX_107_114_109_116_111_118_113_120_121_129_125_133;CZ_94_102_98_106_108_115_112_119_122_130_126_134;TICK;MX_94_98_107_108_109_111_112_113_121_122_123_125_126_127_135_138;DT(8,4,1)rec[-16]_rec[-32];DT(8,12,1)rec[-15]_rec[-31];DT(10,0,1)rec[-14]_rec[-30];DT(10,2,1)rec[-13]_rec[-29];DT(10,4,1)rec[-12]_rec[-28];DT(10,8,1)rec[-11]_rec[-27];DT(10,10,1)rec[-10]_rec[-26];DT(10,12,1)rec[-9]_rec[-25];DT(12,2,1)rec[-8]_rec[-24];DT(12,4,1)rec[-7]_rec[-23];DT(12,6,1)rec[-6]_rec[-22];DT(12,10,1)rec[-5]_rec[-21];DT(12,12,1)rec[-4]_rec[-20];DT(12,14,1)rec[-3]_rec[-19];DT(14,2,1)rec[-2]_rec[-18];DT(14,10,1)rec[-1]_rec[-17];TICK;RX_94_98_107_108_109_111_112_113_121_122_123_125_126_127_135_138;TICK;CX_109_101_113_105_121_114_123_116_125_118_127_120;CZ_108_100_112_104_122_115_126_119_135_128_138_132;TICK;CX_109_115_113_119_121_128_123_130_125_132_127_134;CZ_94_101_98_105;TICK;CX_107_100_109_102_111_104_113_106_121_115_125_119;CZ_108_101_112_105_122_116_126_120_135_129_138_133;TICK;CZ_108_114_112_118_122_129_126_133;TICK;CX_107_114_109_116_111_118_113_120_121_129_125_133;CZ_94_102_98_106_108_115_112_119_122_130_126_134;TICK;MX_94_98_107_108_109_111_112_113_121_122_123_125_126_127_135_138;DT(8,4,2)rec[-16]_rec[-32];DT(8,12,2)rec[-15]_rec[-31];DT(10,0,2)rec[-14]_rec[-30];DT(10,2,2)rec[-13]_rec[-29];DT(10,4,2)rec[-12]_rec[-28];DT(10,8,2)rec[-11]_rec[-27];DT(10,10,2)rec[-10]_rec[-26];DT(10,12,2)rec[-9]_rec[-25];DT(12,2,2)rec[-8]_rec[-24];DT(12,4,2)rec[-7]_rec[-23];DT(12,6,2)rec[-6]_rec[-22];DT(12,10,2)rec[-5]_rec[-21];DT(12,12,2)rec[-4]_rec[-20];DT(12,14,2)rec[-3]_rec[-19];DT(14,2,2)rec[-2]_rec[-18];DT(14,10,2)rec[-1]_rec[-17];TICK;R_1_2_6_7_8_12_13_14_18_19_20_27_28_29_30_31_32_33_34_35_36_48_49_50_51_52_53_54_55_56_57_58_70_71_72_73_74_75_76_77_78_79_87_88_89_90_91_92_140_141_142_146_147_148_152_153_154_158_159;RX_0_3_4_5_9_10_11_15_16_17_21_22_23_24_25_26_37_38_39_40_41_42_43_44_45_46_47_59_60_61_62_63_64_65_66_67_68_69_80_81_82_83_84_85_86_93_94_95_97_98_99_107_108_109_111_112_113_121_122_123_125_126_127_135_137_138_139_143_144_145_149_150_151_155_156_157_160;TICK;CX_5_2_9_6_11_8_17_13_23_18_25_20_39_28_41_30_43_32_45_34_47_36_59_48_61_50_63_52_65_54_67_56_69_58_80_70_81_72_83_74_84_76_86_78_93_87_95_89_97_90_99_92_109_101_113_105_121_114_123_116_125_118_127_120_139_133_143_140_145_142_151_147_155_152_157_154_160_158;CZ_4_1_10_7_16_12_24_19_38_27_40_29_42_31_44_33_46_35_60_49_62_51_64_53_66_55_68_57_82_73_85_77_94_88_98_91_108_100_112_104_122_115_126_119_135_128_138_132_144_141_150_146_156_153;TICK;CX_0_1_5_7_9_12_11_14_17_19_21_27_22_29_23_31_25_33_26_35_47_57_69_79_83_88_86_91_93_100_95_102_97_104_99_106_109_115_113_119_121_128_123_130_125_132_127_134_139_141_143_146_145_148_151_153_157_159;CZ_40_50_42_52_44_54_46_56_60_70_62_72_64_74_66_76;TICK;CX_3_1_9_7_15_12_17_14_23_19_37_27_39_29_41_31_43_33_45_35_59_49_61_51_63_53_65_55_67_57_80_71_81_73_83_75_84_77_86_79_93_88_97_91_107_100_109_102_111_104_113_106_121_115_125_119_137_132_139_134_143_141_149_146_151_148_155_153_160_159;CZ_4_2_10_8_16_13_24_20_38_28_40_30_42_32_44_34_46_36_60_50_62_52_64_54_66_56_68_58_82_74_85_78_94_89_98_92_108_101_112_105_122_116_126_120_135_129_138_133_144_142_150_147_156_154;TICK;CX_39_49_41_51_43_53_45_55_61_71_63_73_65_75_67_77;CZ_4_6_10_13_16_18_24_32_38_48_68_78_82_87_85_90_94_101_98_105_108_114_112_118_122_129_126_133_138_140_144_147_150_152_156_158;TICK;CX_0_2_3_6_5_8_9_13_15_18_17_20_21_28_22_30_23_32_25_34_26_36_37_48_39_50_41_52_43_54_45_56_47_58_59_70_61_72_63_74_65_76_67_78_81_87_83_89_84_90_86_92_93_101_97_105_107_114_109_116_111_118_113_120_121_129_125_133_137_140_139_142_143_147_149_152_151_154_155_158;CZ_4_7_10_14_16_19_24_33_38_49_40_51_42_53_44_55_46_57_60_71_62_73_64_75_66_77_68_79_82_88_85_91_94_102_98_106_108_115_112_119_122_130_126_134_138_141_144_148_150_153_156_159;TICK;MX_0_3_4_5_9_10_11_15_16_17_21_22_23_24_25_26_37_38_39_40_41_42_43_44_45_46_47_59_60_61_62_63_64_65_66_67_68_69_80_81_82_83_84_85_86_93_94_95_97_98_99_107_108_109_111_112_113_121_122_123_125_126_127_135_137_138_139_143_144_145_149_150_151_155_156_157_160;DT(-6,2,3)rec[-75];DT(-4,4,3)rec[-72];DT(-2,2,3)rec[-69];DT(0,4,3)rec[-64];DT(2,-6,3)rec[-60];DT(2,-2,3)rec[-58];DT(2,2,3)rec[-56];DT(2,6,3)rec[-54];DT(2,10,3)rec[-52];DT(4,-4,3)rec[-49];DT(4,0,3)rec[-47];DT(4,4,3)rec[-45];DT(4,8,3)rec[-43];DT(4,12,3)rec[-41];DT(6,2,3)rec[-37];DT(6,10,3)rec[-34];DT(8,4,3)rec[-31]_rec[-93];DT(8,12,3)rec[-28]_rec[-92];DT(10,0,3)rec[-26]_rec[-91];DT(10,2,3)rec[-25]_rec[-90];DT(10,4,3)rec[-24]_rec[-89];DT(10,8,3)rec[-23]_rec[-88];DT(10,10,3)rec[-22]_rec[-87];DT(10,12,3)rec[-21]_rec[-86];DT(12,2,3)rec[-20]_rec[-85];DT(12,4,3)rec[-19]_rec[-84];DT(12,6,3)rec[-18]_rec[-83];DT(12,10,3)rec[-17]_rec[-82];DT(12,12,3)rec[-16]_rec[-81];DT(12,14,3)rec[-15]_rec[-80];DT(14,2,3)rec[-14]_rec[-79];DT(14,10,3)rec[-12]_rec[-78];DT(16,12,3)rec[-9];DT(18,10,3)rec[-6];DT(20,12,3)rec[-3];OI(0)rec[-1]_rec[-2]_rec[-4]_rec[-5]_rec[-7]_rec[-8]_rec[-10]_rec[-11]_rec[-13]_rec[-15]_rec[-17]_rec[-21]_rec[-23]_rec[-24]_rec[-26]_rec[-27]_rec[-29]_rec[-30]_rec[-32]_rec[-33]_rec[-35]_rec[-36]_rec[-38]_rec[-39]_rec[-40]_rec[-42]_rec[-44]_rec[-46]_rec[-48]_rec[-50]_rec[-51]_rec[-53]_rec[-55]_rec[-57]_rec[-59]_rec[-61]_rec[-62]_rec[-63]_rec[-65]_rec[-66]_rec[-67]_rec[-68]_rec[-70]_rec[-71]_rec[-73]_rec[-74]_rec[-76]_rec[-77];OI(2)rec[-1]_rec[-2]_rec[-4]_rec[-5]_rec[-7]_rec[-8]_rec[-10]_rec[-11]_rec[-13]_rec[-15]_rec[-17];TICK;RX_0_3_4_5_9_10_11_15_16_17_21_22_23_24_25_26_37_38_39_40_41_42_43_44_45_46_47_59_60_61_62_63_64_65_66_67_68_69_80_81_82_83_84_85_86_93_94_95_97_98_99_107_108_109_111_112_113_121_122_123_125_126_127_135_137_138_139_143_144_145_149_150_151_155_156_157_160;TICK;CX_5_2_9_6_11_8_17_13_23_18_25_20_39_28_41_30_43_32_45_34_47_36_59_48_61_50_63_52_65_54_67_56_69_58_80_70_81_72_83_74_84_76_86_78_93_87_95_89_97_90_99_92_109_101_113_105_121_114_123_116_125_118_127_120_139_133_143_140_145_142_151_147_155_152_157_154_160_158;CZ_4_1_10_7_16_12_24_19_38_27_40_29_42_31_44_33_46_35_60_49_62_51_64_53_66_55_68_57_82_73_85_77_94_88_98_91_108_100_112_104_122_115_126_119_135_128_138_132_144_141_150_146_156_153;TICK;CX_0_1_5_7_9_12_11_14_17_19_21_27_22_29_23_31_25_33_26_35_47_57_69_79_83_88_86_91_93_100_95_102_97_104_99_106_109_115_113_119_121_128_123_130_125_132_127_134_139_141_143_146_145_148_151_153_157_159;CZ_40_50_42_52_44_54_46_56_60_70_62_72_64_74_66_76;TICK;CX_3_1_9_7_15_12_17_14_23_19_37_27_39_29_41_31_43_33_45_35_59_49_61_51_63_53_65_55_67_57_80_71_81_73_83_75_84_77_86_79_93_88_97_91_107_100_109_102_111_104_113_106_121_115_125_119_137_132_139_134_143_141_149_146_151_148_155_153_160_159;CZ_4_2_10_8_16_13_24_20_38_28_40_30_42_32_44_34_46_36_60_50_62_52_64_54_66_56_68_58_82_74_85_78_94_89_98_92_108_101_112_105_122_116_126_120_135_129_138_133_144_142_150_147_156_154;TICK;CX_39_49_41_51_43_53_45_55_61_71_63_73_65_75_67_77;CZ_4_6_10_13_16_18_24_32_38_48_68_78_82_87_85_90_94_101_98_105_108_114_112_118_122_129_126_133_138_140_144_147_150_152_156_158;TICK;CX_0_2_3_6_5_8_9_13_15_18_17_20_21_28_22_30_23_32_25_34_26_36_37_48_39_50_41_52_43_54_45_56_47_58_59_70_61_72_63_74_65_76_67_78_81_87_83_89_84_90_86_92_93_101_97_105_107_114_109_116_111_118_113_120_121_129_125_133_137_140_139_142_143_147_149_152_151_154_155_158;CZ_4_7_10_14_16_19_24_33_38_49_40_51_42_53_44_55_46_57_60_71_62_73_64_75_66_77_68_79_82_88_85_91_94_102_98_106_108_115_112_119_122_130_126_134_138_141_144_148_150_153_156_159;TICK;MX_0_3_4_5_9_10_11_15_16_17_21_22_23_24_25_26_37_38_39_40_41_42_43_44_45_46_47_59_60_61_62_63_64_65_66_67_68_69_80_81_82_83_84_85_86_93_94_95_97_98_99_107_108_109_111_112_113_121_122_123_125_126_127_135_137_138_139_143_144_145_149_150_151_155_156_157_160;DT(-8,2,4)rec[-77]_rec[-154];DT(-6,0,4)rec[-76]_rec[-153];DT(-6,2,4)rec[-75]_rec[-152];DT(-6,4,4)rec[-74]_rec[-151];DT(-4,2,4)rec[-73]_rec[-150];DT(-4,4,4)rec[-72]_rec[-149];DT(-4,6,4)rec[-71]_rec[-148];DT(-2,0,4)rec[-70]_rec[-147];DT(-2,2,4)rec[-69]_rec[-146];DT(-2,4,4)rec[-68]_rec[-145];DT(0,-6,4)rec[-67]_rec[-144];DT(0,-2,4)rec[-66]_rec[-143];DT(0,2,4)rec[-65]_rec[-142];DT(0,4,4)rec[-64]_rec[-141];DT(0,6,4)rec[-63]_rec[-140];DT(0,10,4)rec[-62]_rec[-139];DT(2,-8,4)rec[-61]_rec[-138];DT(2,-6,4)rec[-60]_rec[-137];DT(2,-4,4)rec[-59]_rec[-136];DT(2,-2,4)rec[-58]_rec[-135];DT(2,0,4)rec[-57]_rec[-134];DT(2,2,4)rec[-56]_rec[-133];DT(2,4,4)rec[-55]_rec[-132];DT(2,6,4)rec[-54]_rec[-131];DT(2,8,4)rec[-53]_rec[-130];DT(2,10,4)rec[-52]_rec[-129];DT(2,12,4)rec[-51]_rec[-128];DT(4,-6,4)rec[-50]_rec[-127];DT(4,-4,4)rec[-49]_rec[-126];DT(4,-2,4)rec[-48]_rec[-125];DT(4,0,4)rec[-47]_rec[-124];DT(4,2,4)rec[-46]_rec[-123];DT(4,4,4)rec[-45]_rec[-122];DT(4,6,4)rec[-44]_rec[-121];DT(4,8,4)rec[-43]_rec[-120];DT(4,10,4)rec[-42]_rec[-119];DT(4,12,4)rec[-41]_rec[-118];DT(4,14,4)rec[-40]_rec[-117];DT(6,-4,4)rec[-39]_rec[-116];DT(6,0,4)rec[-38]_rec[-115];DT(6,2,4)rec[-37]_rec[-114];DT(6,4,4)rec[-36]_rec[-113];DT(6,8,4)rec[-35]_rec[-112];DT(6,10,4)rec[-34]_rec[-111];DT(6,12,4)rec[-33]_rec[-110];DT(8,2,4)rec[-32]_rec[-109];DT(8,4,4)rec[-31]_rec[-108];DT(8,6,4)rec[-30]_rec[-107];DT(8,10,4)rec[-29]_rec[-106];DT(8,12,4)rec[-28]_rec[-105];DT(8,14,4)rec[-27]_rec[-104];DT(10,0,4)rec[-26]_rec[-103];DT(10,2,4)rec[-25]_rec[-102];DT(10,4,4)rec[-24]_rec[-101];DT(10,8,4)rec[-23]_rec[-100];DT(10,10,4)rec[-22]_rec[-99];DT(10,12,4)rec[-21]_rec[-98];DT(12,2,4)rec[-20]_rec[-97];DT(12,4,4)rec[-19]_rec[-96];DT(12,6,4)rec[-18]_rec[-95];DT(12,10,4)rec[-17]_rec[-94];DT(12,12,4)rec[-16]_rec[-93];DT(12,14,4)rec[-15]_rec[-92];DT(14,2,4)rec[-14]_rec[-91];DT(14,8,4)rec[-13]_rec[-90];DT(14,10,4)rec[-12]_rec[-89];DT(14,12,4)rec[-11]_rec[-88];DT(16,10,4)rec[-10]_rec[-87];DT(16,12,4)rec[-9]_rec[-86];DT(16,14,4)rec[-8]_rec[-85];DT(18,8,4)rec[-7]_rec[-84];DT(18,10,4)rec[-6]_rec[-83];DT(18,12,4)rec[-5]_rec[-82];DT(20,10,4)rec[-4]_rec[-81];DT(20,12,4)rec[-3]_rec[-80];DT(20,14,4)rec[-2]_rec[-79];DT(22,12,4)rec[-1]_rec[-78];TICK;RX_0_3_4_5_9_10_11_15_16_17_21_22_23_24_25_26_37_38_39_40_41_42_43_44_45_46_47_59_60_61_62_63_64_65_66_67_68_69_80_81_82_83_84_85_86_93_94_95_97_98_99_107_108_109_111_112_113_121_122_123_125_126_127_135_137_138_139_143_144_145_149_150_151_155_156_157_160;TICK;CX_5_2_9_6_11_8_17_13_23_18_25_20_39_28_41_30_43_32_45_34_47_36_59_48_61_50_63_52_65_54_67_56_69_58_80_70_81_72_83_74_84_76_86_78_93_87_95_89_97_90_99_92_109_101_113_105_121_114_123_116_125_118_127_120_139_133_143_140_145_142_151_147_155_152_157_154_160_158;CZ_4_1_10_7_16_12_24_19_38_27_40_29_42_31_44_33_46_35_60_49_62_51_64_53_66_55_68_57_82_73_85_77_94_88_98_91_108_100_112_104_122_115_126_119_135_128_138_132_144_141_150_146_156_153;TICK;CX_0_1_5_7_9_12_11_14_17_19_21_27_22_29_23_31_25_33_26_35_47_57_69_79_83_88_86_91_93_100_95_102_97_104_99_106_109_115_113_119_121_128_123_130_125_132_127_134_139_141_143_146_145_148_151_153_157_159;CZ_40_50_42_52_44_54_46_56_60_70_62_72_64_74_66_76;TICK;CX_3_1_9_7_15_12_17_14_23_19_37_27_39_29_41_31_43_33_45_35_59_49_61_51_63_53_65_55_67_57_80_71_81_73_83_75_84_77_86_79_93_88_97_91_107_100_109_102_111_104_113_106_121_115_125_119_137_132_139_134_143_141_149_146_151_148_155_153_160_159;CZ_4_2_10_8_16_13_24_20_38_28_40_30_42_32_44_34_46_36_60_50_62_52_64_54_66_56_68_58_82_74_85_78_94_89_98_92_108_101_112_105_122_116_126_120_135_129_138_133_144_142_150_147_156_154;TICK;CX_39_49_41_51_43_53_45_55_61_71_63_73_65_75_67_77;CZ_4_6_10_13_16_18_24_32_38_48_68_78_82_87_85_90_94_101_98_105_108_114_112_118_122_129_126_133_138_140_144_147_150_152_156_158;TICK;CX_0_2_3_6_5_8_9_13_15_18_17_20_21_28_22_30_23_32_25_34_26_36_37_48_39_50_41_52_43_54_45_56_47_58_59_70_61_72_63_74_65_76_67_78_81_87_83_89_84_90_86_92_93_101_97_105_107_114_109_116_111_118_113_120_121_129_125_133_137_140_139_142_143_147_149_152_151_154_155_158;CZ_4_7_10_14_16_19_24_33_38_49_40_51_42_53_44_55_46_57_60_71_62_73_64_75_66_77_68_79_82_88_85_91_94_102_98_106_108_115_112_119_122_130_126_134_138_141_144_148_150_153_156_159;TICK;M_1_2_6_7_8_12_13_14_18_19_20_27_28_29_30_31_32_33_34_35_36_48_49_50_51_52_53_54_55_56_57_58_70_71_72_73_74_75_76_77_78_79_87_88_89_90_91_92_140_141_142_146_147_148_152_153_154_158_159;MX_0_3_4_5_9_10_11_15_16_17_21_22_23_24_25_26_37_38_39_40_41_42_43_44_45_46_47_59_60_61_62_63_64_65_66_67_68_69_80_81_82_83_84_85_86_93_94_95_97_98_99_107_108_109_111_112_113_121_122_123_125_126_127_135_137_138_139_143_144_145_149_150_151_155_156_157_160;DT(-8,2,5)rec[-77]_rec[-213];DT(-6,0,5)rec[-76]_rec[-212];DT(-6,2,5)rec[-75]_rec[-133]_rec[-134]_rec[-135]_rec[-136];DT(-6,2,6)rec[-75]_rec[-211];DT(-6,4,5)rec[-74]_rec[-210];DT(-4,2,5)rec[-73]_rec[-209];DT(-3,3,5)rec[-72]_rec[-129]_rec[-130]_rec[-132]_rec[-133];DT(-4,4,5)rec[-72]_rec[-208];DT(-4,6,5)rec[-71]_rec[-207];DT(-2,0,5)rec[-70]_rec[-206];DT(-2,2,5)rec[-69]_rec[-127]_rec[-128]_rec[-130]_rec[-131];DT(-2,2,6)rec[-69]_rec[-205];DT(-2,4,5)rec[-68]_rec[-204];DT(0,-6,5)rec[-67]_rec[-203];DT(0,-2,5)rec[-66]_rec[-202];DT(0,2,5)rec[-65]_rec[-201];DT(-1,5,5)rec[-64]_rec[-119]_rec[-120]_rec[-126]_rec[-127];DT(0,4,5)rec[-64]_rec[-200];DT(0,6,5)rec[-63]_rec[-199];DT(0,10,5)rec[-62]_rec[-198];DT(2,-8,5)rec[-61]_rec[-197];DT(1,-5,5)rec[-60]_rec[-114]_rec[-115]_rec[-124]_rec[-125];DT(2,-6,5)rec[-60]_rec[-196];DT(2,-4,5)rec[-59]_rec[-195];DT(3,-1,5)rec[-58]_rec[-112]_rec[-113]_rec[-122]_rec[-123];DT(2,-2,5)rec[-58]_rec[-194];DT(2,0,5)rec[-57]_rec[-193];DT(2,2,5)rec[-56]_rec[-110]_rec[-111]_rec[-120]_rec[-121];DT(2,2,6)rec[-56]_rec[-192];DT(2,4,5)rec[-55]_rec[-191];DT(3,5,5)rec[-54]_rec[-108]_rec[-109]_rec[-118]_rec[-119];DT(2,6,5)rec[-54]_rec[-190];DT(2,8,5)rec[-53]_rec[-189];DT(1,11,5)rec[-52]_rec[-106]_rec[-107]_rec[-116]_rec[-117];DT(2,10,5)rec[-52]_rec[-188];DT(2,12,5)rec[-51]_rec[-187];DT(4,-6,5)rec[-50]_rec[-186];DT(5,-5,5)rec[-49]_rec[-103]_rec[-104]_rec[-113]_rec[-114];DT(4,-4,5)rec[-49]_rec[-185];DT(4,-2,5)rec[-48]_rec[-184];DT(4,0,5)rec[-47]_rec[-101]_rec[-102]_rec[-111]_rec[-112];DT(4,0,6)rec[-47]_rec[-183];DT(4,2,5)rec[-46]_rec[-182];DT(4,4,5)rec[-45]_rec[-99]_rec[-100]_rec[-109]_rec[-110];DT(4,4,6)rec[-45]_rec[-181];DT(4,6,5)rec[-44]_rec[-180];DT(5,7,5)rec[-43]_rec[-97]_rec[-98]_rec[-107]_rec[-108];DT(4,8,5)rec[-43]_rec[-179];DT(4,10,5)rec[-42]_rec[-178];DT(4,12,5)rec[-41]_rec[-95]_rec[-96]_rec[-105]_rec[-106];DT(4,12,6)rec[-41]_rec[-177];DT(4,14,5)rec[-40]_rec[-176];DT(6,-4,5)rec[-39]_rec[-175];DT(6,0,5)rec[-38]_rec[-174];DT(5,3,5)rec[-37]_rec[-93]_rec[-94]_rec[-100]_rec[-101];DT(6,2,5)rec[-37]_rec[-173];DT(6,4,5)rec[-36]_rec[-172];DT(6,8,5)rec[-35]_rec[-171];DT(5,11,5)rec[-34]_rec[-90]_rec[-91]_rec[-96]_rec[-97];DT(6,10,5)rec[-34]_rec[-170];DT(6,12,5)rec[-33]_rec[-169];DT(8,2,5)rec[-32]_rec[-168];DT(8,4,5)rec[-31]_rec[-167];DT(8,6,5)rec[-30]_rec[-166];DT(8,10,5)rec[-29]_rec[-165];DT(8,12,5)rec[-28]_rec[-164];DT(8,14,5)rec[-27]_rec[-163];DT(10,0,5)rec[-26]_rec[-162];DT(10,2,5)rec[-25]_rec[-161];DT(10,4,5)rec[-24]_rec[-160];DT(10,8,5)rec[-23]_rec[-159];DT(10,10,5)rec[-22]_rec[-158];DT(10,12,5)rec[-21]_rec[-157];DT(12,2,5)rec[-20]_rec[-156];DT(12,4,5)rec[-19]_rec[-155];DT(12,6,5)rec[-18]_rec[-154];DT(12,10,5)rec[-17]_rec[-153];DT(12,12,5)rec[-16]_rec[-152];DT(12,14,5)rec[-15]_rec[-151];DT(14,2,5)rec[-14]_rec[-150];DT(14,8,5)rec[-13]_rec[-149];DT(14,10,5)rec[-12]_rec[-148];DT(14,12,5)rec[-11]_rec[-147];DT(16,10,5)rec[-10]_rec[-146];DT(15,11,5)rec[-9]_rec[-83]_rec[-84]_rec[-86]_rec[-87];DT(16,12,5)rec[-9]_rec[-145];DT(16,14,5)rec[-8]_rec[-144];DT(18,8,5)rec[-7]_rec[-143];DT(17,9,5)rec[-6]_rec[-81]_rec[-82]_rec[-84]_rec[-85];DT(18,10,5)rec[-6]_rec[-142];DT(18,12,5)rec[-5]_rec[-141];DT(20,10,5)rec[-4]_rec[-140];DT(19,11,5)rec[-3]_rec[-78]_rec[-79]_rec[-80]_rec[-81];DT(20,12,5)rec[-3]_rec[-139];DT(20,14,5)rec[-2]_rec[-138];DT(22,12,5)rec[-1]_rec[-137];TICK;RX_94_96_98_103_107_108_109_110_111_112_113_117_121_122_123_124_125_126_127_131_135_136_138;TICK;CX_109_101_111_103_113_105_121_114_123_116_125_118_127_120;CZ_108_100_110_102_112_104_122_115_124_117_126_119_135_128_136_130_138_132;TICK;CX_109_115_111_117_113_119_121_128_123_130_125_132_127_134;CZ_94_101_96_103_98_105;TICK;CX_107_100_109_102_111_104_113_106_121_115_123_117_125_119;CZ_108_101_110_103_112_105_122_116_124_118_126_120_135_129_136_131_138_133;TICK;CZ_108_114_110_116_112_118_122_129_124_131_126_133;TICK;CX_107_114_109_116_111_118_113_120_121_129_123_131_125_133;CZ_94_102_96_104_98_106_108_115_110_117_112_119_122_130_124_132_126_134;TICK;MX_94_96_98_107_108_109_110_111_112_113_121_122_123_124_125_126_127_135_136_138;DT(7,5,7)rec[-20]_rec[-51]_rec[-112]_rec[-113];DT(7,13,7)rec[-18]_rec[-48]_rec[-109]_rec[-110];DT(10,0,7)rec[-17]_rec[-46];DT(10,2,7)rec[-16]_rec[-45];DT(10,4,7)rec[-15]_rec[-44];DT(10,8,7)rec[-13]_rec[-43];DT(10,10,7)rec[-12]_rec[-42];DT(10,12,7)rec[-11]_rec[-41];DT(12,2,7)rec[-10]_rec[-40];DT(12,4,7)rec[-9]_rec[-39];DT(12,6,7)rec[-8]_rec[-38];DT(12,10,7)rec[-6]_rec[-37];DT(12,12,7)rec[-5]_rec[-36];DT(12,14,7)rec[-4]_rec[-35];DT(14,2,7)rec[-3]_rec[-34];DT(14,10,7)rec[-1]_rec[-32]_rec[-107]_rec[-108];TICK;RX_94_96_98_107_108_109_110_111_112_113_121_122_123_124_125_126_127_135_136_138;TICK;CX_109_101_111_103_113_105_121_114_123_116_125_118_127_120;CZ_108_100_110_102_112_104_122_115_124_117_126_119_135_128_136_130_138_132;TICK;CX_109_115_111_117_113_119_121_128_123_130_125_132_127_134;CZ_94_101_96_103_98_105;TICK;CX_107_100_109_102_111_104_113_106_121_115_123_117_125_119;CZ_108_101_110_103_112_105_122_116_124_118_126_120_135_129_136_131_138_133;TICK;CZ_108_114_110_116_112_118_122_129_124_131_126_133;TICK;CX_107_114_109_116_111_118_113_120_121_129_123_131_125_133;CZ_94_102_96_104_98_106_108_115_110_117_112_119_122_130_124_132_126_134;TICK;MX_94_96_98_107_108_109_110_111_112_113_121_122_123_124_125_126_127_135_136_138;DT(8,4,8)rec[-20]_rec[-40];DT(8,8,8)rec[-19]_rec[-39];DT(8,12,8)rec[-18]_rec[-38];DT(10,0,8)rec[-17]_rec[-37];DT(10,2,8)rec[-16]_rec[-36];DT(10,4,8)rec[-15]_rec[-35];DT(10,6,8)rec[-14]_rec[-34];DT(10,8,8)rec[-13]_rec[-33];DT(10,10,8)rec[-12]_rec[-32];DT(10,12,8)rec[-11]_rec[-31];DT(12,2,8)rec[-10]_rec[-30];DT(12,4,8)rec[-9]_rec[-29];DT(12,6,8)rec[-8]_rec[-28];DT(12,8,8)rec[-7]_rec[-27];DT(12,10,8)rec[-6]_rec[-26];DT(12,12,8)rec[-5]_rec[-25];DT(12,14,8)rec[-4]_rec[-24];DT(14,2,8)rec[-3]_rec[-23];DT(14,6,8)rec[-2]_rec[-22];DT(14,10,8)rec[-1]_rec[-21];TICK;RX_94_96_98_107_108_109_110_111_112_113_121_122_123_124_125_126_127_135_136_138;TICK;CX_109_101_111_103_113_105_121_114_123_116_125_118_127_120;CZ_108_100_110_102_112_104_122_115_124_117_126_119_135_128_136_130_138_132;TICK;CX_109_115_111_117_113_119_121_128_123_130_125_132_127_134;CZ_94_101_96_103_98_105;TICK;CX_107_100_109_102_111_104_113_106_121_115_123_117_125_119;CZ_108_101_110_103_112_105_122_116_124_118_126_120_135_129_136_131_138_133;TICK;CZ_108_114_110_116_112_118_122_129_124_131_126_133;TICK;CX_107_114_109_116_111_118_113_120_121_129_123_131_125_133;CZ_94_102_96_104_98_106_108_115_110_117_112_119_122_130_124_132_126_134;TICK;MX_94_96_98_103_104_105_106_107_108_109_110_111_112_113_117_118_119_120_121_122_123_124_125_126_127_131_132_133_134_135_136_138;DT(8,4,9)rec[-32]_rec[-52];DT(8,8,9)rec[-31]_rec[-51];DT(8,12,9)rec[-30]_rec[-50];DT(10,0,9)rec[-25]_rec[-49];DT(10,2,9)rec[-24]_rec[-48];DT(10,4,9)rec[-23]_rec[-47];DT(10,6,9)rec[-22]_rec[-46];DT(10,8,9)rec[-21]_rec[-45];DT(10,10,9)rec[-20]_rec[-44];DT(10,12,9)rec[-19]_rec[-43];DT(11,7,9)rec[-17]_rec[-18]_rec[-21]_rec[-28]_rec[-29];DT(11,13,9)rec[-15]_rec[-16]_rec[-19]_rec[-26]_rec[-27];DT(12,2,9)rec[-14]_rec[-42];DT(12,4,9)rec[-13]_rec[-41];DT(12,6,9)rec[-12]_rec[-40];DT(12,8,9)rec[-11]_rec[-39];DT(12,10,9)rec[-10]_rec[-38];DT(12,12,9)rec[-9]_rec[-37];DT(12,14,9)rec[-8]_rec[-36];DT(13,9,9)rec[-5]_rec[-6]_rec[-10]_rec[-16]_rec[-17];DT(13,13,9)rec[-4]_rec[-8]_rec[-15];DT(14,2,9)rec[-3]_rec[-35];DT(14,6,9)rec[-2]_rec[-34];DT(14,10,9)rec[-1]_rec[-33];TICK;RX_94_107_108_109_121_122_123_135;TICK;CX_109_101_121_114_123_116;CZ_108_100_122_115_135_128;TICK;CX_109_115_121_128_123_130;CZ_94_101;TICK;CX_107_100_109_102_121_115;CZ_108_101_122_116_135_129;TICK;CZ_108_114_122_129;TICK;CX_107_114_109_116_121_129;CZ_94_102_108_115_122_130;TICK;MX_94_107_108_109_121_122_123_135;DT(8,4,10)rec[-8]_rec[-40];DT(10,0,10)rec[-7]_rec[-33];DT(10,2,10)rec[-6]_rec[-32];DT(10,4,10)rec[-5]_rec[-31];DT(12,2,10)rec[-4]_rec[-22];DT(12,4,10)rec[-3]_rec[-21];DT(12,6,10)rec[-2]_rec[-15]_rec[-20]_rec[-26];DT(14,2,10)rec[-1]_rec[-11];TICK;RX_94_107_108_109_121_122_123_135;TICK;CX_109_101_121_114_123_116;CZ_108_100_122_115_135_128;TICK;CX_109_115_121_128_123_130;CZ_94_101;TICK;CX_107_100_109_102_121_115;CZ_108_101_122_116_135_129;TICK;CZ_108_114_122_129;TICK;CX_107_114_109_116_121_129;CZ_94_102_108_115_122_130;TICK;MX_94_107_108_109_121_122_123_135;DT(8,4,11)rec[-8]_rec[-16];DT(10,0,11)rec[-7]_rec[-15];DT(10,2,11)rec[-6]_rec[-14];DT(10,4,11)rec[-5]_rec[-13];DT(12,2,11)rec[-4]_rec[-12];DT(12,4,11)rec[-3]_rec[-11];DT(12,6,11)rec[-2]_rec[-10];DT(14,2,11)rec[-1]_rec[-9];TICK;RX_94_107_108_109_121_122_123_135;TICK;CX_109_101_121_114_123_116;CZ_108_100_122_115_135_128;TICK;CX_109_115_121_128_123_130;CZ_94_101;TICK;CX_107_100_109_102_121_115;CZ_108_101_122_116_135_129;TICK;CZ_108_114_122_129;TICK;CX_107_114_109_116_121_129;CZ_94_102_108_115_122_130;TICK;MX_94_100_101_102_107_108_109_114_115_116_121_122_123_128_129_130_135;DT(8,4,12)rec[-17]_rec[-25];DT(10,0,12)rec[-13]_rec[-24];DT(10,2,12)rec[-12]_rec[-23];DT(10,4,12)rec[-11]_rec[-22];DT(11,1,12)rec[-10]_rec[-13]_rec[-16];DT(9,5,12)rec[-8]_rec[-9]_rec[-11]_rec[-14]_rec[-15];DT(12,2,12)rec[-7]_rec[-21];DT(12,4,12)rec[-6]_rec[-20];DT(12,6,12)rec[-5]_rec[-19];DT(13,1,12)rec[-3]_rec[-4]_rec[-7]_rec[-9]_rec[-10];DT(11,5,12)rec[-2]_rec[-5]_rec[-8];DT(14,2,12)rec[-1]_rec[-18];OI(1)rec[-8]_rec[-9]_rec[-10]_rec[-48]_rec[-49]_rec[-50]_rec[-51]_rec[-319]_rec[-320]_rec[-322]_rec[-323]_rec[-325]_rec[-326]_rec[-328]_rec[-329]_rec[-331]_rec[-333]_rec[-335]). # noqa: E501 .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 135-231 .. code-block:: Python from tqec import Basis, NoiseModel, compile_block_graph # noqa: E402 graph = three_cnots(Basis.X) compiled_graph = compile_block_graph(graph) circuit = compiled_graph.generate_stim_circuit( k=1, noise_model=NoiseModel.uniform_depolarizing(p=0.001) ) # ## Simulation # # Here we show the simulation results for all six observables under a # **uniform depolarizing** noise model. # #
Click to show the full code used for the simulation # # ```py # from multiprocessing import cpu_count # from pathlib import Path # # import matplotlib.pyplot as plt # import numpy # import sinter # # from tqec.gallery import three_cnots # from tqec import NoiseModel # from tqec.simulation.plotting.inset import plot_observable_as_inset # from tqec.simulation.simulation import start_simulation_using_sinter # from tqec.utils.enums import Basis # # SAVE_DIR = Path("results") # # # def generate_graphs(support_observable_basis: Basis) -> None: # block_graph = three_cnots(support_observable_basis) # zx_graph = block_graph.to_zx_graph() # # correlation_surfaces = block_graph.find_correlation_surfaces() # # stats = start_simulation_using_sinter( # block_graph, # range(1, 4), # list(numpy.logspace(-4, -1, 10)), # NoiseModel.uniform_depolarizing, # manhattan_radius=2, # observables=correlation_surfaces, # num_workers=cpu_count(), # max_shots=1_000_000, # max_errors=5_000, # decoders=["pymatching"], # print_progress=True, # # note that save_resume_filepath and database_path can help reduce the time taken # # by the simulation after the database and result statistics have been saved to # # the chosen path # save_resume_filepath=Path( # f"../_examples_database/three_cnots_stats_{support_observable_basis.value}.csv" # ), # database_path=Path("../_examples_database/database.pkl"), # ) # # for i, stat in enumerate(stats): # fig, ax = plt.subplots() # sinter.plot_error_rate( # ax=ax, # stats=stat, # x_func=lambda stat: stat.json_metadata["p"], # failure_units_per_shot_func=lambda stat: stat.json_metadata["d"], # group_func=lambda stat: stat.json_metadata["d"], # ) # plot_observable_as_inset(ax, zx_graph, correlation_surfaces[i]) # ax.grid(axis="both") # ax.legend() # ax.loglog() # ax.set_title("Three CNOTs Error Rate") # ax.set_xlabel("Physical Error Rate") # ax.set_ylabel("Logical Error Rate(per round)") # fig.savefig( # SAVE_DIR # / f"three_cnots_result_{support_observable_basis}_observable_{i}.png" # ) # # # def main(): # SAVE_DIR.mkdir(exist_ok=True) # generate_graphs(Basis.Z) # generate_graphs(Basis.X) # # # if __name__ == "__main__": # main() # ``` # #
.. GENERATED FROM PYTHON SOURCE LINES 232-292 .. code-block:: Python from multiprocessing import cpu_count # noqa: E402 from pathlib import Path # noqa: E402 import matplotlib.pyplot as plt # noqa: E402 import numpy # noqa: E402 import sinter # noqa: E402 from tqec import NoiseModel # noqa: E402 from tqec.gallery import three_cnots # noqa: E402 from tqec.simulation.plotting.inset import plot_observable_as_inset # noqa: E402 from tqec.simulation.simulation import start_simulation_using_sinter # noqa: E402 from tqec.utils.enums import Basis # noqa: E402 def generate_graphs(support_observable_basis: Basis) -> None: """Generate the logical error-rate graphs corresponding to the provided basis.""" block_graph = three_cnots(support_observable_basis) zx_graph = block_graph.to_zx_graph() correlation_surfaces = block_graph.find_correlation_surfaces() stats = start_simulation_using_sinter( block_graph, range(1, 4), list(numpy.logspace(-4, -1, 10)), NoiseModel.uniform_depolarizing, manhattan_radius=2, observables=correlation_surfaces, num_workers=cpu_count(), max_shots=1_000_000, max_errors=5_000, decoders=["pymatching"], save_resume_filepath=Path( f"../_examples_database/three_cnots_stats_{support_observable_basis.value}.csv" ), database_path=Path("../_examples_database/database.pkl"), ) for i, stat in enumerate(stats): _, ax = plt.subplots() sinter.plot_error_rate( ax=ax, stats=stat, x_func=lambda stat: stat.json_metadata["p"], failure_units_per_shot_func=lambda stat: stat.json_metadata["d"], group_func=lambda stat: stat.json_metadata["d"], ) plot_observable_as_inset(ax, zx_graph, correlation_surfaces[i]) ax.grid(axis="both") ax.legend() ax.loglog() ax.set_title("Three CNOTs Error Rate") ax.set_xlabel("Physical Error Rate") ax.set_ylabel("Logical Error Rate(per round)") # ### Z Basis .. GENERATED FROM PYTHON SOURCE LINES 293-300 .. code-block:: Python generate_graphs(Basis.Z) # ### X Basis .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/images/sphx_glr_three_cnots_001.png :alt: Three CNOTs Error Rate :srcset: /auto_examples/images/sphx_glr_three_cnots_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_three_cnots_002.png :alt: Three CNOTs Error Rate :srcset: /auto_examples/images/sphx_glr_three_cnots_002.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_three_cnots_003.png :alt: Three CNOTs Error Rate :srcset: /auto_examples/images/sphx_glr_three_cnots_003.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 301-310 .. code-block:: Python generate_graphs(Basis.X) # ## References # # .. footbibliography:: # .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/images/sphx_glr_three_cnots_004.png :alt: Three CNOTs Error Rate :srcset: /auto_examples/images/sphx_glr_three_cnots_004.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_three_cnots_005.png :alt: Three CNOTs Error Rate :srcset: /auto_examples/images/sphx_glr_three_cnots_005.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_three_cnots_006.png :alt: Three CNOTs Error Rate :srcset: /auto_examples/images/sphx_glr_three_cnots_006.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (8 minutes 24.562 seconds) .. _sphx_glr_download_auto_examples_three_cnots.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: three_cnots.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: three_cnots.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: three_cnots.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_