artiq/artiq/examples/artiq_ipython_notebook.ipynb

371 lines
24 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Populating the interactive namespace from numpy and matplotlib\n"
]
}
],
"source": [
"%pylab inline\n",
"\n",
"import os\n",
"import logging\n",
"import time\n",
"import asyncio\n",
"import datetime\n",
"import glob\n",
"from pprint import pprint\n",
"\n",
"import numpy as np\n",
"np.set_printoptions(precision=3)\n",
"import matplotlib.pyplot as plt\n",
"import seaborn\n",
"seaborn.set_style(\"whitegrid\")\n",
"import pandas as pd\n",
"import h5py\n",
"\n",
"from artiq.protocols.pc_rpc import (Client, AsyncioClient,\n",
" BestEffortClient, AutoTarget)\n",
"from artiq.master.databases import DeviceDB\n",
"from artiq.master.worker_db import DeviceManager"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# let's assume artiq_master and artiq_ctlmgr are already running\n",
"# then move to a location where we have our artiq setup\n",
"os.chdir(os.path.expanduser(\"~/work/nist/artiq/run\"))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# we can directly use the artiq controller infrastructure\n",
"# and access any artiq device\n",
"\n",
"# we can have artiq prepare that connection for us:\n",
"ddb = DeviceDB(\"device_db.pyon\")\n",
"devmgr = DeviceManager(ddb)\n",
"lda = devmgr.get(\"lda\")\n",
"lda.set_attenuation(42)\n",
"assert lda.get_attenuation() == 42\n",
"\n",
"# ... or we can wire it up ourselves if you know where it is\n",
"assert ddb.get(\"lda\")[\"host\"] == \"::1\"\n",
"assert ddb.get(\"lda\")[\"port\"] == 3253\n",
"\n",
"# there are different Client types tailored to different use cases:\n",
"\n",
"# synchronous\n",
"lda = Client(\"::1\", 3253)\n",
"assert lda.get_attenuation() == 42\n",
"\n",
"# asyncio\n",
"lda = AsyncioClient()\n",
"async def test_lda():\n",
" await lda.connect_rpc(\"::1\", 3253, AutoTarget)\n",
" return await lda.get_attenuation()\n",
"assert asyncio.get_event_loop().run_until_complete(test_lda()) == 42\n",
"\n",
"# best effort\n",
"lda = BestEffortClient(\"::1\", 3253, AutoTarget)\n",
"assert lda.get_attenuation() == 42"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"current schedule\n",
"{}\n",
"experiments:\n",
"['ex/',\n",
" 'test_analyzer.py',\n",
" 'notebook_test.py',\n",
" 'speed_benchmark.py',\n",
" 'histograms.py',\n",
" 'arguments_demo.py',\n",
" '.git/',\n",
" '__pycache__/',\n",
" 'flopping_f_simulation.py',\n",
" 'test_crash.py',\n",
" 'run_forever.py',\n",
" 'transport.py',\n",
" 'pdq2_simple.py']\n"
]
}
],
"source": [
"# let's connect to the master\n",
"\n",
"schedule, exps, datasets = [\n",
" Client(\"::1\", 3251, \"master_\" + i) for i in\n",
" \"schedule experiment_db dataset_db\".split()]\n",
"\n",
"print(\"current schedule\")\n",
"pprint(schedule.get_status())\n",
"print(\"experiments:\")\n",
"pprint(exps.list_directory(\"repository\"))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"current schedule\n",
"{4722: {'due_date': None,\n",
" 'expid': {'arguments': {'F0': 1500, 'noise_amplitude': 0.3},\n",
" 'class_name': 'FloppingF',\n",
" 'file': 'repository/flopping_f_simulation.py',\n",
" 'log_level': 30},\n",
" 'flush': False,\n",
" 'pipeline': 'main',\n",
" 'priority': 0,\n",
" 'repo_msg': None,\n",
" 'status': 'preparing'}}\n"
]
}
],
"source": [
"# we can submit experiments to be run\n",
"\n",
"expid = dict(\n",
" file=\"repository/flopping_f_simulation.py\",\n",
" class_name=\"FloppingF\",\n",
" log_level=logging.WARNING,\n",
" arguments=dict(\n",
" F0=1500,\n",
" noise_amplitude=.3,\n",
" ),\n",
")\n",
"if not schedule.get_status():\n",
" rid = schedule.submit(pipeline_name=\"main\", expid=expid,\n",
" priority=0, due_date=None, flush=False)\n",
"print(\"current schedule\")\n",
"pprint(schedule.get_status())"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# wait for experiment to finish\n",
"# this can be written nicer by subscribing and reacting to scheduler changes\n",
"while rid in schedule.get_status():\n",
" time.sleep(.1)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"flopping_f: 1499.944285221012\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAECCAYAAAAFL5eMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xt4VOWBP/DvOXOfTC4ECJckJCFcE4FKEsyqIKuywtbd\nLRZXYWVlpf1x2fpYeFCUi6GR1a3bZ+tPH9tKf219DF2wVfyt9de1NdIahSgwBeRiuIdLICGEXOY+\nZ+ac3x9JJkRCZpLMBOad7+d5eB4yM+ecN2/OfOed97znfSVN0zQQEZFQ5JtdACIiij6GOxGRgBju\nREQCYrgTEQmI4U5EJCCGOxGRgPThXhAIBLB27VrU1dVBr9fjhRdegNfrxbJly5CbmwsAWLhwIebN\nmxfrshIRUYSkcOPcP/74Y3zwwQf48Y9/jN27d2P79u2YOXMmXC4XlixZMkjFJCKivgjbcs/NzUUw\nGISmaXA4HDAYDDhy5AjOnDmDyspK5OTkYP369bBarYNRXiIiikDYlnt9fT1WrlwJl8uFlpYWvPHG\nGzhz5gwmTpyIgoIC/OxnP0NrayvWrl07WGUmIqIwwl5QffPNNzFz5kz84Q9/wPvvv4+1a9di1qxZ\nKCgoAADMmTMHNTU1MS8oERFFLmy3TGpqKvT69pclJydDURQsX74cGzduxNSpU1FdXY3CwsJe92G3\n26NTWiKiBFN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qba2trwk5/8BK+//jokScL69euxefPm0Lw8c+fOvdnFvGnWrl2LjRs3JlxdzJ49G/v27cOC\nBQtCI8oyMzO7zdeUKHXx+OOPY926dfinf/onBAIBrFmzBoWFhQlZF516el9IkoTFixdj0aJF0DQN\nq1evhtFo7HU/nFuGiEhAidUBTkSUIBjuREQCYrgTEQmI4U5EJCCGOxGRgBjuREQCYrgTEQmI4U5E\nJKD/D7Ip5VrpmcohAAAAAElFTkSuQmCC\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7fc5187c8668>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# now that the experiment has completed, we can get the\n",
"# current value of the (live) dataset and plot it\n",
"# had we done this earlier, the dataset would have been incomplete\n",
"fig, ax = plt.subplots()\n",
"d = datasets.get(\"flopping_f_brightness\")\n",
"ax.plot(d)\n",
"print(\"flopping_f:\", datasets.get(\"flopping_freq\"))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# this is how you would clear all pipelines\n",
"for i in schedule.get_status():\n",
" schedule.delete(i)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"available datasets ['artiq_version', 'flopping_f_brightness']\n"
]
}
],
"source": [
"# we can easily find and use the data that was saved as part\n",
"# of the experiment\n",
"\n",
"t = datetime.datetime.now()\n",
"f = os.path.join(\n",
" \"results\", t.strftime(\"%Y-%m-%d\"), #t.strftime(\"%H-%M\"),\n",
" \"*\", \"{:09d}-FloppingF.h5\".format(rid))\n",
"\n",
"# we would usually like to use pandas but our data does not have\n",
"# the metadata pandas want\n",
"#d = pd.HDFStore(glob.glob(f)[0])\n",
"\n",
"with h5py.File(glob.glob(f)[0]) as f:\n",
" print(\"available datasets\", list(f))\n",
" assert np.allclose(f[\"datasets/flopping_f_brightness\"], d)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting repository/notebook_test.py\n"
]
}
],
"source": [
"%%writefile repository/notebook_test.py\n",
"\n",
"# we can also write experiments in the notebook and submit them\n",
"# we don't have submit-by-content yet (and there would be questions\n",
"# about other modules that would need to be imported) so we just export\n",
"# this cell and submit it by filename\n",
"\n",
"from artiq.experiment import *\n",
"\n",
"class Hello(EnvExperiment):\n",
" def build(self):\n",
" pass\n",
" \n",
" def run(self):\n",
" print(\"Hello world!\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4724\n"
]
}
],
"source": [
"expid = dict(\n",
" file=\"repository/notebook_test.py\",\n",
" class_name=\"Hello\",\n",
" log_level=logging.WARNING,\n",
" arguments=dict(),\n",
")\n",
"rid = schedule.submit(pipeline_name=\"misc\", expid=expid,\n",
" priority=1, due_date=None, flush=False)\n",
"print(rid)\n",
"# on the master you should see the message."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}