Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notebook unittests #395

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
68 changes: 52 additions & 16 deletions doc/examples/Example-APS2-2Qubit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
"# Example Q8: Realistic Two Qubit Tuneup and Experiments\n",
"This example notebook shows how to use APS2/X6 ecosystem to tune up a pair of qubits.\n",
"\n",
"© Raytheon BBN Technologies 2019"
"© Raytheon BBN Technologies 2021"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you are running this notebook without hardware connected, run the following cell:"
]
},
{
Expand All @@ -16,17 +23,36 @@
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"os.environ['AWG_DIR'] = \"./AWG\"\n",
"import auspex.config as config\n",
"config.auspex_dummy_mode = True"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# set these paths to work with your install and system\n",
"# import os\n",
"# os.environ['AWG_DIR'] = \"./AWG\"\n",
"\n",
"# auspex.config.AWGDir = \"./AWG\"\n",
"# QGL.config.AWGDir = \"./AWG\"\n",
"# auspex.config.KernelDir = \"./Kernels\"\n",
"# QGL.config.KernelDir = \"./Kernels\"\n",
"\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import QGL.config\n",
"import auspex.config\n",
"auspex.config.AWGDir = \"/home/qlab/BBN/AWG\"\n",
"QGL.config.AWGDir = \"/home/qlab/BBN/AWG\"\n",
"auspex.config.KernelDir = \"/home/qlab/BBN/Kernels\"\n",
"QGL.config.KernelDir = \"/home/qlab/BBN/Kernels\"\n",
"\n",
"%matplotlib inline\n",
"\n",
Expand Down Expand Up @@ -186,6 +212,11 @@
"#exp.add_qubit_sweep(q2, \"measure\", \"frequency\", np.linspace(6.38e9, 6.395e9, 51))\n",
"exp.add_qubit_sweep(q1, \"measure\", \"frequency\", np.linspace(6.424e9, 6.432e9, 45))\n",
"#exp.add_qubit_sweep(q1,\"measure\",\"amplitude\",np.linspace(0.2,0.8,10))\n",
"\n",
"# get fake data (Comment out to run something real)\n",
"lengths = np.arange(3e-7, 2.3e-6, 301)\n",
"exp.set_fake_data(dig_1, np.cos(lengths*11e-6/(2*np.pi)))\n",
"\n",
"exp.run_sweeps()"
]
},
Expand Down Expand Up @@ -355,7 +386,7 @@
"source": [
"salo = cl.new_source(\"salo\", \"HolzworthHS9000\", \"HS9004A-381-4\", \n",
" power=10.0, frequency=6.5e9, reference=\"10MHz\")\n",
"specAn = cl.new_spectrum_analzyer('specAn','ASRL/dev/ttyACM0',salo)"
"specAn = cl.new_spectrum_analyzer('specAn','ASRL/dev/ttyACM0',salo)"
]
},
{
Expand Down Expand Up @@ -462,11 +493,11 @@
},
"outputs": [],
"source": [
"pf = RabiWidth(q1, np.arange(20e-9, 0.602e-6, 10e-9))\n",
"pf = RabiWidth(q1, np.arange(40e-9, 0.64e-6, 10e-9))\n",
"exp = QubitExperiment(pf, averages=200)\n",
"plot_pulse_files(pf)\n",
"#exp.add_qubit_sweep(q1, \"control\", \"frequency\", q1src.frequency + np.linspace(-6e6, 6e6, 61))\n",
"exp.run_sweeps()"
"# exp.run_sweeps()"
]
},
{
Expand All @@ -475,12 +506,12 @@
"metadata": {},
"outputs": [],
"source": [
"pf = RabiWidth(q2, np.arange(20e-9, 0.602e-6, 10e-9))\n",
"pf = RabiWidth(q2, np.arange(40e-9, 0.64e-6, 10e-9))\n",
"exp = QubitExperiment(pf, averages=200)\n",
"plot_pulse_files(pf)\n",
"#exp.add_qubit_sweep(q2, \"control\", \"frequency\", q2src.frequency + np.linspace(-2e6, 2e6, 21))\n",
"#exp.add_qubit_sweep(q2, \"measure\", \"frequency\", AM2.frequency + np.linspace(-2e6, 2e6, 11))\n",
"exp.run_sweeps()"
"# exp.run_sweeps()"
]
},
{
Expand All @@ -498,7 +529,7 @@
"source": [
"pf = RabiAmp(q1, np.linspace(-1, 1, 101))\n",
"exp = QubitExperiment(pf, averages=128)\n",
"exp.run_sweeps()"
"# exp.run_sweeps()"
]
},
{
Expand Down Expand Up @@ -531,7 +562,7 @@
"source": [
"pf = RabiAmp(q2, np.linspace(-1, 1, 101))\n",
"exp = QubitExperiment(pf, averages=128)\n",
"exp.run_sweeps()"
"# exp.run_sweeps()"
]
},
{
Expand Down Expand Up @@ -587,9 +618,14 @@
"outputs": [],
"source": [
"qb = q2\n",
"icpts = np.linspace(20e-9, 201.02e-6, 101)\n",
"icpts = np.linspace(40e-9, 201.04e-6, 101)\n",
"pf = InversionRecovery(qb, icpts)\n",
"exp = QubitExperiment(pf, averages=400)\n",
"\n",
"# get fake data (Comment out to run something real)\n",
"lengths = np.arange(4e-8, 201.04e-6, 101)\n",
"exp.set_fake_data(dig_1, np.exp(-lengths*(1/50e-6)))\n",
"\n",
"exp.run_sweeps()"
]
},
Expand Down Expand Up @@ -1211,7 +1247,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.7"
},
"latex_envs": {
"bibliofile": "biblio.bib",
Expand Down
3 changes: 2 additions & 1 deletion doc/examples/Example-Calibrations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"source": [
"cl = ChannelLibrary(\"my_config\")\n",
"pl = PipelineManager()"
"q2 = cl[\"q2\"]"
]
},
{
Expand All @@ -53,7 +54,7 @@
"outputs": [],
"source": [
"spec_an = cl.new_spectrum_analzyer(\"SpecAn\", \"ASRL/dev/ttyACM0::INSTR\", cl[\"spec_an_LO\"])\n",
"cal = MixerCalibration(q2, spec_an, mixer=\"measure\")\n",
"cal = MixerCalibration(q2, spec_an, mixer=\"control\")\n",
"cal.calibrate()"
]
},
Expand Down
Loading