The purpose of this tutorial is to illustrate "germ selection". Germ selection is the process by which a complete set of germ gate sequences is constructed. The defining property which makes a set of gate sequences a "complete germ set" is the amplification of *all* possible gate errors. More precisely, the repetition of a complete set of germs, sandwiched between preparation and measurement fiducial sequences, will yield a sensitivity to *all* gate errors that scales with the number of times each germ is repeated. This completeness is relative to the set of gates under consideration, typically a set of desired or "target" gates.

In this tutorial, we find a complete germ set for the standard $X(\pi/2)$, $Y(\pi/2)$, $I$ gate set.

In [1]:

```
import pygsti
from pygsti.construction import std1Q_XYI as std
```

*coincidentally*. We want to find a set of germs that amplifies slight deviations from the ideal gates as well, and so we find germs for a "noisy" version of the target gates, in which each ideal gate is composed with a random small unitary map.

In [2]:

```
gs_target_noisy = std.gs_target.randomize_with_unitary(0.001, seed=1234)
```

`list_all_gatestrings_without_powers_and_cycles`

function provides a convenient way to list sequences gate sequences that are distinct up to such powers and cycles.

In [3]:

```
germsToTest = pygsti.construction.list_all_gatestrings_without_powers_and_cycles(
std.gs_target.gates.keys(), 3)
```

`optimize_integer_germs_slack`

function thins out an initial list of germs with the goal of finding a smallest complete set. The parameter `fixedSlack`

or `slackFrac`

specifies how much of an increase in the quantity 1.0/smallest-nongauge-jacobian-eigenvalue will be tolerated when excluding a germ sequence from the final set (see the function's documentation for further details). A good value to begin with is `fixedSlack=0.1`

.

In [4]:

```
finalGerms = pygsti.alg.optimize_integer_germs_slack(
gs_target_noisy, germsToTest, initialWeights=None,
fixedSlack=0.1, slackFrac=False, returnAll=False, tol=1e-6, verbosity=4)
```

`pygsti.io.write_gatestring_list`

, but for this tutorial we'll just print them.

In [5]:

```
print "Germs:"
print "\n".join(map(str,finalGerms))
# To save to a file:
# pygsti.io.write_gatestring_list("mygerms.lst",finalGerms,"List of germs from tutorial")
```

In [6]:

```
```